MCRaichu Posted April 27, 2017 Posted April 27, 2017 Hi everyone, I want to add a model I have made to entities while they are under a potioneffect. Currently I don't know where to start . Has anyone tried this before? Any tips where to start? For better understanding, I want to create a crystallization disease that creates tiny crystals on the infected entity. Thanks in advance, McRaichu Quote It doesn't work, I don't know why. It works, I don't know why.
MCRaichu Posted April 27, 2017 Author Posted April 27, 2017 thanks. that helps alot. Quote It doesn't work, I don't know why. It works, I don't know why.
MCRaichu Posted April 28, 2017 Author Posted April 28, 2017 @SubscribeEvent public void onEvent(RenderLivingEvent.Post<EntityLivingBase> event) { EntityLivingBase entity = event.getEntity(); RenderLivingBase renderer = event.getRenderer(); ModelBase model = renderer.getMainModel(); if(entity instanceof EntityCreeper) { ModelCreeper mr = (ModelCreeper)model; ModelRenderer box = new ModelRenderer(model, 0, 16); box.addBox(0.0F, 0.0F, 0.0F, 10, 2, 10); mr.body.addChild(box); } } I did a small test-code. I love the idea of adding to the model because the added parts move with the entity. But the problem is, I have no idea how to set a different texture for my added parts. is it even possible? Quote It doesn't work, I don't know why. It works, I don't know why.
MCRaichu Posted April 28, 2017 Author Posted April 28, 2017 (edited) 47 minutes ago, diesieben07 said: You have to bind your texture like you normally would. I may have to ask you to get a bit more specific. My understanding was to simply change the model and assign new texture (straight forward). EntityLivingBase entity = event.getEntity(); RenderLivingBase renderer = event.getRenderer(); ModelBase model = renderer.getMainModel(); if(entity instanceof EntityCreeper) { ModelCreeper mr = (ModelCreeper)model; renderer.bindTexture(new ResourceLocation(Gunny.MODID+ ":textures/items/models/vss_item.png")); ModelRenderer box = new ModelRenderer(model, 0, 16); box.addBox(0.0F, -20.0F, 0.0F, 10, 2, 10); mr.body.addChild(box); } Maybe I don't get when the event is called and what the difference of Pre and Post are in this case. Edit: Currently the original creeper-texture is still used. Edited April 28, 2017 by MCRaichu Quote It doesn't work, I don't know why. It works, I don't know why.
MCRaichu Posted April 28, 2017 Author Posted April 28, 2017 No, the creeper (just a placeholder in my example) should render as normal but the addition, here the "box", should render with a texture of my choice. Currently the box renders with the creeper-texture. Quote It doesn't work, I don't know why. It works, I don't know why.
MCRaichu Posted April 28, 2017 Author Posted April 28, 2017 okay. to answer all you questions. 1.: the code i posted is in the onEvent(RenderLivingEvent.Post<EntityLivingBase> event) function as shown in Post 4 2.: As mentioned in the first post, I want to add something to any entity that is under a potioneffect. The code I posted, with creeper and the box I add, is just for testing. 3.: Using the model makes it easier to adjust the position of what i add, but with a global model that's not possible. Quote It doesn't work, I don't know why. It works, I don't know why.
MCRaichu Posted April 28, 2017 Author Posted April 28, 2017 6 minutes ago, diesieben07 said: You must add it once at startup from your client proxy, Wouldn't that require that I know all models when my mod is loaded? That would make it incompatible with other mods (their entities), right? In your experience, what would be your approach to achieve a kind of visual feedback to differentiate between affected entities and unaffected ones. Maybe I should consider a different idea. I just don't like the particle effects of the potions, I wanted something more solid/bigger. Quote It doesn't work, I don't know why. It works, I don't know why.
MCRaichu Posted April 28, 2017 Author Posted April 28, 2017 Looping over all Renderes in PostInit makes sence. I don't have time until sunday to give it a try. May have more question on monday meaning I may bother you again . Thanks again. Quote It doesn't work, I don't know why. It works, I don't know why.
Recommended Posts
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.