Posted July 25, 201213 yr Hello I just saw that Forge has a hook in EffectRenderer.addEffect(EntityFX,Object) but there seams to be no ability to get a own texture into EffectRenderer.addEffect(EntityFX) with Forge. This would be very useful for easily adding custom particles. I don't know if there was this request before, but this part would have to be recoded a little bit. My mod needs to bypass this atm by changing an if-statement in minecraft. But I would like my mod to be fully Forge-compatible, so it would be very nice, if you could add this. P.S. I know, it is possible to do this in another way, but that is very complicated. not as nice as just letting the custom particle implement ITextureProvider Thank you Tobias
July 25, 201213 yr Channeling LexManos here: If you can do something the hard way, do it the hard way. Don't ask for the easy way. Done channeling. But really, that would be nice to have. So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.
July 25, 201213 yr You should be able to bind whatever texture you want in your renderer. Disclaimer: Not made any particles myself yet.
July 25, 201213 yr Author Thank you for replying so fast. Yes, I could set up a special Renderer for that, but this is really complicated in comparison to Creating a MyParticleFX.java and just letting this implement ITextureProvider and then using: EntitySmilieFX var21 = new EntitySmilieFX(mc.theWorld, playz0r.lastTickPosX,playz0r.lastTickPosY,playz0r.lastTickPosZ, 0.1D, 1.0D, 0.1D,5); mc.effectRenderer.addEffect((EntityFX)var21,var21); but atm this public void addEffect(EntityFX effect, Object effectObject) { if (effectObject == null || !(effect instanceof EntityDiggingFX || effect instanceof EntityBreakingFX)) { addEffect(effect); return; } : : prevents this by calling addEffect(EntityFX) public void addEffect(EntityFX par1EntityFX) { int var2 = par1EntityFX.getFXLayer(); if (this.fxLayers[var2].size() >= 4000) { this.fxLayers[var2].remove(0); } this.fxLayers[var2].add(par1EntityFX); } Here, for some reason, the hashtable for linking a texture-file with the EntityFX is not used. Using custom particles would be a LOT easier with this small change. I think this would not be too hard to change. I'll change this for my mod, so I can use this the easy way. mfg, Tobias
July 25, 201213 yr Author Sorry for double-posting, but found the easiest way for all modders: public void addEffect(EntityFX effect, Object effectObject) { if (effectObject == null || !(effect instanceof EntityDiggingFX || effect instanceof ITextureProvider || effect instanceof EntityBreakingFX)) { addEffect(effect); return; } String texture = "/terrain.png"; if (effect.getFXLayer() == 0) { texture = "/particles.png"; } else if (effect.getFXLayer() == 2) { texture = "/gui/items.png"; } texture = ForgeHooksClient.getTexture(texture, effectObject); ArrayList<EntityFX> set = effectList.get(texture); if (set == null) { set = new ArrayList<EntityFX>(); effectList.put(texture, set); } set.add(effect); } Just a very small change in this if-statement. Would be really cool, if you could implement this in forge! Thank you Tobias
July 25, 201213 yr Suggest it to Lex, but a better suggestion is to make a pull request and submit it on github. The changes for 1.2.5 are likely frozen now so it would probably be accepted in 1.3 soon.
July 26, 201213 yr Author OK, I created a pull-request on github. Hopefully it will be put into the code for 1.3. Thank you all Tobias
July 31, 201213 yr I REALLY want this cause I want my mod to also have EntityFX's more easily and I dont want to edit base classes.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.