• Recently Browsing

    No registered users viewing this page.

  • Posts

    • Hello,   I have a dog entity that can carry food items in its mouth (much like foxes).  I'm trying to make its held item actually render there as it eats, but I'm having a little trouble getting it to actually work properly.  When the dog is standing still it works fine.     However, when the dog moves its head to look at the player, tilting it in a certain way, it goes all askew for a bit until the dog fully stops moving. I've been looking at the fox's head movement in particular, but that class has a lot of variables and functions that still have the default names, which is giving me a hard time tracing what they're used for.  It has a specific parameter to account for Z Axis tilt, but it's hard to figure out what conditions are actually causing it to be used and for what.  My dog entities also have a lot of potential poses, so the more universalized my solution can be, the better.  Right now the code I have is this, which works alright while the dog is perfectly still but when it looks around (particularly when turning its head at an angle to the player), the rendered item does that weird tilting.   @SuppressWarnings("deprecation") @OnlyIn(Dist.CLIENT) public class WCWolfHeldItemLayer extends LayerRenderer<WCWolfEntity, WCWolfModel<WCWolfEntity>> { private final ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer(); public WCWolfHeldItemLayer(IEntityRenderer<WCWolfEntity, WCWolfModel<WCWolfEntity>> wcwolf) { super(wcwolf); } public void render(WCWolfEntity entityIn, float limbSwing, float limbSwingAmount, float partialTick, float ageInTicks, float netHeadYaw, float headPitch, float scale) { ItemStack itemstack = entityIn.getStackInSlot(entityIn.getHeldSlotID()); if (!itemstack.isEmpty()) { GlStateManager.pushMatrix(); float rotMultiplier = (float)Math.PI / 180F; GlStateManager.translatef((this.getEntityModel().getHead().rotationPointX / 16F), (this.getEntityModel().getHead().rotationPointY / 16F), (this.getEntityModel().getHead().rotationPointZ / 16F)); float calcHeadPitch = this.getEntityModel().getHead().rotateAngleX / rotMultiplier; GlStateManager.rotatef(calcHeadPitch, 1.0F, 0.0F, 0.0F); float calcHeadYaw = this.getEntityModel().getHead().rotateAngleY / rotMultiplier; GlStateManager.rotatef(calcHeadYaw, 0.0F, 1.0F, 0.0F); float calcHeadTilt = this.getEntityModel().getHead().rotateAngleZ / rotMultiplier; GlStateManager.rotatef(calcHeadTilt, 0.0F, 0.0F, 1.0F); GlStateManager.translatef(0.0F, 0.1F , -0.3F); GlStateManager.rotatef(-90.0F, 1.0F, 0.0F, 0.0F); GlStateManager.translatef(0.001F, 0.0F, 0.0F ); this.itemRenderer.renderItem(itemstack, entityIn, TransformType.GROUND, false); GlStateManager.popMatrix(); } } public boolean shouldCombineTextures() { return false; } }   Stuff like the Math.PI calculation comes from what I've observed in other entity classes and it seems to be working at least in part?  My current method here attempts to get the tilt value directly from the head itself.  But that's still causing problems.  So I'm wondering if maybe I'm getting the rotation value wrong?  The value used in the model class seems to be handled differently than the rotation value here.  Putting them in one-for-one causes negligible movement on the item while the head moves a lot.  In the model class, the inputs like netHeadYaw and headPitch seem to be divided by that Math.PI / 180F value, whereas in the fox held item class it seemed like those values were inputted directly to the held item.  There's not a visible tilt value though, not that I've found, and I have some custom animations defined within the model class that I need to account for.  That's why I want to get the value directly from the head rotation if possible-- otherwise I'll have to figure out a way of patterning all the checks I do in the model class somehow, and I really don't want to have to have both classes running the same checks for pose and such if I can help it.   Anyone else have an idea of what I could try here?  Thanks.
    • Oh dang, that's become so second-nature to me that I didn't even notice!
    • Well first i downloaded the forge mdk. next i imported the project file into IDEA. next i modified build.gradle and gradle.properties to fit my needs. and everytime i want to make a build and run it i just type "gradlew build" into the IDEA terminal and copy the jar from ./libs to /mods , and i make sure to delete previous jar version inside /mods. anyways i think this could might be useful to you but their is no net.minecraftforge.eventbus. package inside any of my _compileJava_# files
    • 1.12 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
  • Topics

  • Who's Online (See full list)