Jump to content

Recommended Posts

Posted

Hey, I need help trying to render a texture for one model, and another for another model; all under the same class file but with different methods that tell it to switch between the two. So far, I got the main textures to switch but the collar textures doesn't switch and gives a result like this:

width=800 height=413http://i1319.photobucket.com/albums/t661/Nova_Leary/2015-03-28_10.26.51_zpsyol0tc56.png[/img]

 

Instead of this:

width=455 height=479http://i1319.photobucket.com/albums/t661/Nova_Leary/Untitled6_zps1uhu3mxr.png[/img]

 

Basically, I have 2 different versions of this entity (the pictures are its evolved form), it's wild and tamed devolved form are these:

 

Tamed:

width=212 height=136http://vignette1.wikia.nocookie.net/zeroquest/images/8/8b/ZertumRedesign.png/revision/latest/scale-to-width/212?cb=20141026032739[/img]

 

Wild

width=212 height=110http://vignette4.wikia.nocookie.net/zeroquest/images/b/bf/2014-10-28_18.42.46.png/revision/latest/scale-to-width/212?cb=20141029012529[/img]

 

And the two before these two are the evolved forms. What I want is the fix this issue with the collars not switching, here is my code

 

Layers

package common.zeroquest.client.renderer.entity.layers;

import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import common.zeroquest.client.renderer.entity.RenderZertum;
import common.zeroquest.entity.EntityZertum;
import common.zeroquest.lib.Constants;

@SideOnly(Side.CLIENT)
public class LayersZertum implements LayerRenderer
{
    private static final ResourceLocation ZertumDyingTexture = new ResourceLocation(Constants.modid + ":" + "textures/entity/zertum/zertum_dying.png");
    private static final ResourceLocation ZertumCollarTexture = new ResourceLocation(Constants.modid + ":" + "textures/entity/zertum/zertum_collar.png");
    private static final ResourceLocation EvolvedZertumDyingTexture = new ResourceLocation(Constants.modid + ":" + "textures/entity/zertum/evo/zertum_dying.png");
    private static final ResourceLocation EvolvedZertumCollarTexture = new ResourceLocation(Constants.modid + ":" + "textures/entity/zertum/evo/zertum_collar.png");
    //private static final ResourceLocation ZertumSaddleTexture = new ResourceLocation(Constants.modid + ":" + "textures/entity/zertum/zertum_saddle.png");
    private final RenderZertum field_177146_b;
    private static final String __OBFID = "CL_00002405";

    public LayersZertum(RenderZertum p_177145_1_)
    {
        this.field_177146_b = p_177145_1_;
    }

    public void func_177145_a(EntityZertum p_177145_1_, float p_177145_2_, float p_177145_3_, float p_177145_4_, float p_177145_5_, float p_177145_6_, float p_177145_7_, float p_177145_8_)
    {
    	if(!p_177145_1_.hasEvolved()){
    		if (p_177145_1_.isTamed() && !p_177145_1_.isInvisible())
    		{
    			this.field_177146_b.bindTexture(ZertumCollarTexture);
    			EnumDyeColor enumdyecolor = EnumDyeColor.byMetadata(p_177145_1_.getCollarColor().getMetadata());
    			float[] afloat = EntitySheep.func_175513_a(enumdyecolor);
    			GlStateManager.color(afloat[0], afloat[1], afloat[2]);
    			this.field_177146_b.getMainModel().render(p_177145_1_, p_177145_2_, p_177145_3_, p_177145_5_, p_177145_6_, p_177145_7_, p_177145_8_);
    		}
        
    		if(p_177145_1_.isTamed() && p_177145_1_.getHealth() <=10 && !p_177145_1_.isInvisible()){
    			this.field_177146_b.bindTexture(ZertumDyingTexture);
    			GlStateManager.color(1f, 1f, 1f);
    			this.field_177146_b.getMainModel().render(p_177145_1_, p_177145_2_, p_177145_3_, p_177145_5_, p_177145_6_, p_177145_7_, p_177145_8_);
    		}
        
    		/*if (p_177145_1_.isSaddled())
        	{
            	this.field_177146_b.bindTexture(ZertumSaddleTexture);
            	GlStateManager.color(1f, 1f, 1f);
            	this.field_177146_b.getMainModel().render(p_177145_1_, p_177145_2_, p_177145_3_, p_177145_5_, p_177145_6_, p_177145_7_, p_177145_8_);
        	}*/
    	}
    	else if(p_177145_1_.hasEvolved()){
    		if (p_177145_1_.isTamed() && !p_177145_1_.isInvisible())
    		{
    			this.field_177146_b.bindTexture(EvolvedZertumCollarTexture);
    			EnumDyeColor enumdyecolor = EnumDyeColor.byMetadata(p_177145_1_.getCollarColor().getMetadata());
    			float[] afloat = EntitySheep.func_175513_a(enumdyecolor);
    			GlStateManager.color(afloat[0], afloat[1], afloat[2]);
    			this.field_177146_b.getMainModel().render(p_177145_1_, p_177145_2_, p_177145_3_, p_177145_5_, p_177145_6_, p_177145_7_, p_177145_8_);
    		}
        
    		if(p_177145_1_.isTamed() && p_177145_1_.getHealth() <=10 && !p_177145_1_.isInvisible()){
    			this.field_177146_b.bindTexture(EvolvedZertumDyingTexture);
    			GlStateManager.color(1f, 1f, 1f);
    			this.field_177146_b.getMainModel().render(p_177145_1_, p_177145_2_, p_177145_3_, p_177145_5_, p_177145_6_, p_177145_7_, p_177145_8_);
    		}
    	}
    }

    public boolean shouldCombineTextures()
    {
        return true;
    }

    public void doRenderLayer(EntityLivingBase p_177141_1_, float p_177141_2_, float p_177141_3_, float p_177141_4_, float p_177141_5_, float p_177141_6_, float p_177141_7_, float p_177141_8_)
    {
        this.func_177145_a((EntityZertum)p_177141_1_, p_177141_2_, p_177141_3_, p_177141_4_, p_177141_5_, p_177141_6_, p_177141_7_, p_177141_8_);
    }
}

 

Model:

package common.zeroquest.client.renderer.entity.model;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.MathHelper;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import org.lwjgl.opengl.GL11;

import common.zeroquest.entity.EntityZertumEntity;

@SideOnly(Side.CLIENT)
public class ModelZertum extends ModelBase
{
  //fields
    ModelRenderer Nose;
    ModelRenderer Ear2;
    ModelRenderer Ear1;
    ModelRenderer Head;
    ModelRenderer LeftHindLeg1;
    ModelRenderer LeftHindLeg2;
    ModelRenderer LeftHindLeg3;
    ModelRenderer RightHindLeg1;
    ModelRenderer RightHindLeg2;
    ModelRenderer RightHindLeg3;
    ModelRenderer Mane1;
    ModelRenderer RightLeg;
    ModelRenderer LeftLeg;
    ModelRenderer Tail1;
    ModelRenderer Tail2;
    ModelRenderer Tail3;
    ModelRenderer Mane2;
    ModelRenderer Torso;
    ModelRenderer Neck;
    ModelRenderer Pad1;
    ModelRenderer Pad2;
    ModelRenderer Pad3;
    ModelRenderer Pad4;
    ModelRenderer PadPart1;
    ModelRenderer PadPart2;
    ModelRenderer Rope1;
    ModelRenderer Metal1;
    ModelRenderer Rope2;
    ModelRenderer Metal2;
    ModelRenderer Seat1;
    ModelRenderer Seat2;
    
    //EvoModel\\
    ModelRenderer RightEarPart1;
    ModelRenderer RightEarPart2;
    ModelRenderer RightEarPart3;
    ModelRenderer LeftEarPart1;
    ModelRenderer LeftEarPart2;
    ModelRenderer LeftEarPart3;
    ModelRenderer LeftBottomJaw;
    ModelRenderer BottomJawPart1;
    ModelRenderer BottomJawPart2;
    ModelRenderer BottomJawCenter;
    ModelRenderer LeftTopTeeth;
    ModelRenderer LeftTopJaw;
    ModelRenderer LeftBottomTeeth;
    ModelRenderer RightTopTeeth;
    ModelRenderer RightBottomTeeth;
    ModelRenderer TopJawPart1;
    ModelRenderer TopJawPart2;
    ModelRenderer TopJawCenter;
    ModelRenderer RightTopJaw;
    ModelRenderer LeftJawWebPart2;
    ModelRenderer LeftJawWebPart1;
    ModelRenderer RightJawWebPart2;
    ModelRenderer RightJawWebPart1;
    ModelRenderer RightBottomJaw;
    ModelRenderer Throat;
    ModelRenderer UpSection;
    ModelRenderer MidSection;
    ModelRenderer Pelvis;
    ModelRenderer TailPart1;
    ModelRenderer TailPart2;
    ModelRenderer TailPart3;
    ModelRenderer LeftHumerus;
    ModelRenderer LeftRadius;
    ModelRenderer LeftFClawRPart1;
    ModelRenderer LeftFClawRPart2;
    ModelRenderer LeftFClawMPart1;
    ModelRenderer LeftFClawMPart2;
    ModelRenderer LeftFClawLPart2;
    ModelRenderer LeftFClawLPart1;
    ModelRenderer RightHumerus;
    ModelRenderer RightRadius;
    ModelRenderer RightFClawRPart1;
    ModelRenderer RightFClawRPart2;
    ModelRenderer RightFClawMPart1;
    ModelRenderer RightFClawMPart2;
    ModelRenderer RightFClawLPart1;
    ModelRenderer RightFClawLPart2;
    ModelRenderer LeftFemur;
    ModelRenderer LeftTibia;
    ModelRenderer LeftMetatarsus;
    ModelRenderer LeftClawLPart1;
    ModelRenderer LeftClawLPart2;
    ModelRenderer LeftClawRPart1;
    ModelRenderer LeftClawRPart2;
    ModelRenderer LeftClawMPart1;
    ModelRenderer LeftClawMPart2;
    ModelRenderer RightFemur;
    ModelRenderer RightTibia;
    ModelRenderer RightMetatarsus;
    ModelRenderer RightClawRPart1;
    ModelRenderer RightClawRPart2;
    ModelRenderer RightClawMPart1;
    ModelRenderer RightClawMPart2;
    ModelRenderer RightClawLPart1;
    ModelRenderer RightClawLPart2;
    private float rightFemur = -0.2974289F;
    private float leftFemur = -0.2974289F;
    private float rightTibia = 0.8205006F;
    private float leftTibia = 0.8205006F;
    private float rightMetatarus = -0.5205006F;
    private float leftMetatarus = -0.5205006F;
    private float mane2StartingRotation = -0.34653F;
    private float vertebrae = -0.6015813F;
  
  public ModelZertum()
  {
    textureWidth = 128;
    textureHeight = 64;
    
    Nose = new ModelRenderer(this, 25, 27);
    Nose.addBox(-1.5F, 0F, -3F, 3, 3, 4);
    Nose.setRotationPoint(0F, 2.5F, -15F);
    setRotation(Nose, 0F, 0F, 0F);
    Ear2 = new ModelRenderer(this, 40, 28);
    Ear2.addBox(-1F, -3F, 0F, 2, 3, 1);
    Ear2.setRotationPoint(2F, -0.5F, -10.5F);
    setRotation(Ear2, 0F, 0F, 0F);
    Ear1 = new ModelRenderer(this, 40, 28);
    Ear1.addBox(-1F, -3F, 0F, 2, 3, 1);
    Ear1.setRotationPoint(-2F, -0.5F, -10.5F);
    setRotation(Ear1, 0F, 0F, 0F);
    Head = new ModelRenderer(this, 25, 15);
    Head.addBox(-3F, -0.5F, -14F, 6, 6, 5);
    Head.setRotationPoint(-0.5F, 6F, -3F);
    setRotation(Head, 0F, 0F, 0F);
    LeftHindLeg1 = new ModelRenderer(this, 11, 18);
    LeftHindLeg1.addBox(-1F, 0F, -1F, 2, 5, 3);
    LeftHindLeg1.setRotationPoint(1.5F, 13F, 5F);
    setRotation(LeftHindLeg1, -0.2974289F, 0F, 0F);
    LeftHindLeg2 = new ModelRenderer(this, 3, 44);
    LeftHindLeg2.addBox(-1F, 0F, -1F, 2, 4, 2);
    LeftHindLeg2.setRotationPoint(0F, 4.3F, -0.3F);
    setRotation(LeftHindLeg2, leftTibia, 0F, 0F);
    LeftHindLeg3 = new ModelRenderer(this, 0, 51);
    LeftHindLeg3.addBox(-1F, 0F, -1F, 2, 4, 2);
    LeftHindLeg3.setRotationPoint(0F, 3.55F, 0.2F);
    setRotation(LeftHindLeg3, leftMetatarus, 0F, 0F);
    RightHindLeg1 = new ModelRenderer(this, 11, 31);
    RightHindLeg1.addBox(-1F, 0F, -1F, 2, 5, 3);
    RightHindLeg1.setRotationPoint(-2.5F, 13F, 5F);
    setRotation(RightHindLeg1, -0.2974289F, 0F, 0F);
    RightHindLeg2 = new ModelRenderer(this, 3, 44);
    RightHindLeg2.addBox(-1F, 0F, -1F, 2, 4, 2);
    RightHindLeg2.setRotationPoint(0F, 4.3F, -0.3F);
    setRotation(RightHindLeg2, rightTibia, 0F, 0F);
    RightHindLeg3 = new ModelRenderer(this, 9, 51);
    RightHindLeg3.addBox(-1F, 0F, -1F, 2, 4, 2);
    RightHindLeg3.setRotationPoint(0F, 3.55F, 0.2F);
    setRotation(RightHindLeg3, rightMetatarus, 0F, 0F);
      Mane1 = new ModelRenderer(this, 43, 0);
      Mane1.addBox(-3F, -3F, -3F, 6, 6, 7);
      Mane1.setRotationPoint(-0.5F, 14F, -3F);
      setRotation(Mane1, 1.496439F, 0F, 0F);
      Neck = new ModelRenderer(this, 0, 0);
      Neck.addBox(-2.5F, -12F, -4F, 4, 7, 4);
      Neck.setRotationPoint(0.5F, 0F, 0F);
      setRotation(Neck, -0.6015813F, 0F, 0F);
      Mane2 = new ModelRenderer(this, 18, 0);
      Mane2.addBox(-2.5F, -7F, -3.6F, 5, 6, 7);
      Mane2.setRotationPoint(0F, 0F, 0F);
      setRotation(Mane2, -0.34653F, 0F, 0F);
      RightLeg = new ModelRenderer(this, 0, 30);
      RightLeg.addBox(-1F, 0F, -1F, 2, 10, 2);
      RightLeg.setRotationPoint(-3F, 14F, -4F);
      setRotation(RightLeg, 0F, 0F, 0F);
      LeftLeg = new ModelRenderer(this, 0, 16);
      LeftLeg.addBox(-1F, 0F, -1F, 2, 10, 2);
      LeftLeg.setRotationPoint(2F, 14F, -4F);
      setRotation(LeftLeg, 0F, 0F, 0F);
      Tail1 = new ModelRenderer(this, 91, 0);
      Tail1.addBox(-1.5F, 0F, -1F, 4, 8, 4);
      Tail1.setRotationPoint(-1F, 14.3F, 6F);
      setRotation(Tail1, 1.315962F, 0F, 0F);
      Tail2 = new ModelRenderer(this, 110, 0);
      Tail2.addBox(-1.5F, 0F, -1F, 3, 8, 3);
      Tail2.setRotationPoint(0.5F, 6F, 0.5F);
      setRotation(Tail2, -0.041605F, 0F, 0F);
      Tail3 = new ModelRenderer(this, 110, 13);
      Tail3.addBox(-1F, 0F, -1F, 2, 8, 2);
      Tail3.setRotationPoint(0F, 6.5F, 0.5F);
      setRotation(Tail3, 0.001605F, 0F, 0F);
      Torso = new ModelRenderer(this, 69, 0);
      Torso.addBox(-2.5F, -3F, -3F, 5, 9, 5);
      Torso.setRotationPoint(-0.5F, 12.5F, 1F);
      setRotation(Torso, 1.496439F, 0F, 0F);
      
      //Saddle\\
      Pad1 = new ModelRenderer(this, 110, 32);
      Pad1.addBox(-2F, 0F, 0F, 4, 1, 1);
      Pad1.setRotationPoint(-0.5F, 9.3F, -2.5F);
      setRotation(Pad1, -0.0650564F, 0F, 0F);
      Pad2 = new ModelRenderer(this, 110, 35);
      Pad2.addBox(-3F, 0F, 0F, 6, 1, 2);
      Pad2.setRotationPoint(-0.5F, 9.4F, -1.5F);
      setRotation(Pad2, -0.0743572F, 0F, 0F);
      Pad3 = new ModelRenderer(this, 110, 39);
      Pad3.addBox(-2F, 0F, 0F, 5, 1, 4);
      Pad3.setRotationPoint(-1F, 9.5F, 0.2F);
      setRotation(Pad3, -0.0650564F, 0F, 0F);
      Pad4 = new ModelRenderer(this, 110, 48);
      Pad4.addBox(-1.5F, 0F, 0F, 3, 1, 1);
      Pad4.setRotationPoint(-0.5F, 9.8F, 4.1F);
      setRotation(Pad4, -0.0650564F, 0F, 0F);
      PadPart1 = new ModelRenderer(this, 110, 29);
      PadPart1.addBox(-0.5F, 0F, 0F, 1, 1, 1);
      PadPart1.setRotationPoint(1F, 9.23F, -3.5F);
      setRotation(PadPart1, -0.0650564F, 0F, 0F);
      PadPart2 = new ModelRenderer(this, 110, 29);
      PadPart2.addBox(-0.5F, 0F, 0F, 1, 1, 1);
      PadPart2.setRotationPoint(-2F, 9.2F, -3.5F);
      setRotation(PadPart2, -0.0650564F, 0F, 0F);
      Rope1 = new ModelRenderer(this, 105, 32);
      Rope1.addBox(0F, 0F, -0.5F, 1, 4, 1);
      Rope1.setRotationPoint(1.8F, 9.6F, 0F);
      setRotation(Rope1, 0F, 0F, 0F);
      Metal1 = new ModelRenderer(this, 102, 39);
      Metal1.addBox(0F, 0F, -1F, 1, 1, 2);
      Metal1.setRotationPoint(1.8F, 13.6F, 0F);
      setRotation(Metal1, 0F, 0F, 0F);
      Rope2 = new ModelRenderer(this, 105, 32);
      Rope2.addBox(-1F, 0F, -0.5F, 1, 4, 1);
      Rope2.setRotationPoint(-2.8F, 9.6F, 0F);
      setRotation(Rope2, 0F, 0F, 0F);
      Metal2 = new ModelRenderer(this, 102, 39);
      Metal2.addBox(0F, 0F, -1F, 1, 1, 2);
      Metal2.setRotationPoint(-3.8F, 13.6F, 0F);
      setRotation(Metal2, 0F, 0F, 0F);
      Seat1 = new ModelRenderer(this, 100, 45);
      Seat1.addBox(-1F, 0F, 0F, 2, 1, 1);
      Seat1.setRotationPoint(-0.5F, 8.7F, -1.5F);
      setRotation(Seat1, -0.0650484F, 0F, 0F);
      Seat2 = new ModelRenderer(this, 100, 49);
      Seat2.addBox(-2F, 0F, 0F, 4, 1, 1);
      Seat2.setRotationPoint(-0.5F, 9F, 3.2F);
      setRotation(Seat2, -0.0650484F, 0F, 0F);
      Head.addChild(Nose);
      Head.addChild(Ear1);
      Head.addChild(Ear2);
      LeftHindLeg1.addChild(LeftHindLeg2);
      RightHindLeg1.addChild(RightHindLeg2);
      LeftHindLeg2.addChild(LeftHindLeg3);
      RightHindLeg2.addChild(RightHindLeg3);
      Mane1.addChild(Mane2);
      Mane1.addChild(Neck);
      Tail1.addChild(Tail2);
      Tail2.addChild(Tail3);
      
      //EvoModel\\
      //Ears\\
      textureWidth = 256;
      textureHeight = 128;
      RightEarPart1 = new ModelRenderer(this, 18, 60);
      RightEarPart1.addBox(-1F, -1F, -1F, 1, 1, 4);
      RightEarPart1.setRotationPoint(-1.5F, 1.5F, -5F);
      setRotation(RightEarPart1, 0.0346075F, -0.3346075F, 0F);
      RightEarPart2 = new ModelRenderer(this, 15, 66);
      RightEarPart2.addBox(-1F, -1F, 0F, 2, 2, 6);
      RightEarPart2.setRotationPoint(-0.5F, -0.5F, 0F);
      setRotation(RightEarPart2, 0.3346075F, -0.0346075F, 0F);
      RightEarPart3 = new ModelRenderer(this, 16, 75);
      RightEarPart3.addBox(-0.5F, -0.5F, 0F, 1, 1, 6);
      RightEarPart3.setRotationPoint(-0.5F, 0F, 4F);
      setRotation(RightEarPart3, 0.0346075F, 0.4115358F, 0.0743572F);
      LeftEarPart1 = new ModelRenderer(this, 18, 60);
      LeftEarPart1.addBox(-1F, -1F, -1F, 1, 1, 4);
      LeftEarPart1.setRotationPoint(3.5F, 1.5F, -5F);
      setRotation(LeftEarPart1, 0.3346075F, 0.3346145F, 0F);
      LeftEarPart2 = new ModelRenderer(this, 15, 66);
      LeftEarPart2.addBox(-1F, -1F, 0F, 2, 2, 6);
      LeftEarPart2.setRotationPoint(-0.5F, -0.5F, 0F);
      setRotation(LeftEarPart2, 0.0346075F, 0.0346145F, 0F);
      LeftEarPart3 = new ModelRenderer(this, 16, 75);
      LeftEarPart3.addBox(-0.5F, -0.5F, 0F, 1, 1, 6);
      LeftEarPart3.setRotationPoint(0.5F, 0F, 4F);
      setRotation(LeftEarPart3, 0.0346145F, -0.411544F, -0.074351F);
      
      //Top Jaw\\
      TopJawCenter = new ModelRenderer(this, 56, 38);
      TopJawCenter.addBox(-0.5F, 0F, -7.4F, 2, 1, ;
      TopJawCenter.setRotationPoint(0.5F, -5.7F, -8F);
      setRotation(TopJawCenter, 0F, 0F, 0F);
      LeftTopJaw = new ModelRenderer(this, 39, 50);
      LeftTopJaw.addBox(0F, 0F, -9F, 1, 2, 9);
      LeftTopJaw.setRotationPoint(3F, 0F, 0F);
      setRotation(LeftTopJaw, 0F, 0.3346075F, 0F);
      LeftTopTeeth = new ModelRenderer(this, 61, 50);
      LeftTopTeeth.addBox(0.5F, 0F, -9.3F, 0, 1, 5);
      LeftTopTeeth.setRotationPoint(0F, 2F, 0F);
      setRotation(LeftTopTeeth, 0F, -0.0346145F, 0F);
      RightTopJaw = new ModelRenderer(this, 39, 63);
      RightTopJaw.addBox(-1F, 0F, -9F, 1, 2, 9);
      RightTopJaw.setRotationPoint(-2F, 0F, 0F);
      setRotation(RightTopJaw, 0F, -0.3346075F, 0F);
      RightTopTeeth = new ModelRenderer(this, 61, 50);
      RightTopTeeth.addBox(-0.5F, 0F, -9.3F, 0, 1, 5);
      RightTopTeeth.setRotationPoint(0F, 2F, 0F);
      setRotation(RightTopTeeth, 0F, 0.0346075F, 0F);
      TopJawPart1 = new ModelRenderer(this, 38, 40);
      TopJawPart1.addBox(-1F, 0F, -5.7F, 2, 1, 6);
      TopJawPart1.setRotationPoint(-1F, 0F, 0F);
      setRotation(TopJawPart1, 0F, -0.3346075F, 0F);
      TopJawPart2 = new ModelRenderer(this, 38, 40);
      TopJawPart2.addBox(-1F, 0F, -5.7F, 2, 1, 6);
      TopJawPart2.setRotationPoint(2F, 0F, 0F);
      setRotation(TopJawPart2, 0F, 0.3346145F, 0F);
      
      LeftJawWebPart1 = new ModelRenderer(this, 0, 66);
      LeftJawWebPart1.addBox(-1F, 0F, -2.9F, 1, 3, 2);
      LeftJawWebPart1.setRotationPoint(5F, 2F, -19F);
      setRotation(LeftJawWebPart1, 0.4089647F, 0.3346145F, 0F);
      LeftJawWebPart2 = new ModelRenderer(this, 0, 66);
      LeftJawWebPart2.addBox(-1F, -1F, -1.9F, 1, 3, 2);
      LeftJawWebPart2.setRotationPoint(5F, 6F, -19F);
      setRotation(LeftJawWebPart2, -0.2974289F, 0.3346145F, 0F);
      RightJawWebPart1 = new ModelRenderer(this, 0, 66);
      RightJawWebPart1.addBox(-1F, 0F, -2.9F, 1, 3, 2);
      RightJawWebPart1.setRotationPoint(-0.9F, 2F, -19F);
      setRotation(RightJawWebPart1, 0.4089647F, -0.3346075F, 0F);
      RightJawWebPart2 = new ModelRenderer(this, 0, 66);
      RightJawWebPart2.addBox(-1F, -1F, -1.9F, 1, 3, 2);
      RightJawWebPart2.setRotationPoint(-0.9F, 6F, -19F);
      setRotation(RightJawWebPart2, -0.2974289F, -0.3346075F, 0F);
      
      //BottomJaw\\
      BottomJawCenter = new ModelRenderer(this, 0, 109);
      BottomJawCenter.addBox(-0.5F, 0F, -7.2F, 2, 1, ;
      BottomJawCenter.setRotationPoint(0.5F, -0.7F, -8F);
      setRotation(BottomJawCenter, 0.1587144F, 0F, 0F);
      LeftBottomJaw = new ModelRenderer(this, 0, 84);
      LeftBottomJaw.addBox(0F, 0F, -9F, 1, 2, 9);
      LeftBottomJaw.setRotationPoint(3F, -1.1F, 0F);
      setRotation(LeftBottomJaw, 0.1487144F, 0.3346075F, 0F);
      LeftBottomTeeth = new ModelRenderer(this, 21, 93);
      LeftBottomTeeth.addBox(0.5F, 0F, -9.3F, 0, 1, 5);
      LeftBottomTeeth.setRotationPoint(0.5F, -2.2F, 0F);
      setRotation(LeftBottomTeeth, 0.1487144F, 0.0346145F, 0F);
      RightBottomJaw = new ModelRenderer(this, 0, 97);
      RightBottomJaw.addBox(-1F, 0F, -9F, 1, 2, 9);
      RightBottomJaw.setRotationPoint(-2F, -1.1F, 0F);
      setRotation(RightBottomJaw, 0.1487144F, -0.3346075F, 0F);
      RightBottomTeeth = new ModelRenderer(this, 21, 93);
      RightBottomTeeth.addBox(-0.5F, 0F, -9.3F, 0, 1, 5);
      RightBottomTeeth.setRotationPoint(-0.5F, -2.1F, 0F);
      setRotation(RightBottomTeeth, 0.1487144F, -0.0346075F, 0F);
      BottomJawPart1 = new ModelRenderer(this, 21, 84);
      BottomJawPart1.addBox(-1F, 0F, -6.5F, 2, 1, 7);
      BottomJawPart1.setRotationPoint(-1F, 0F, 0F);
      setRotation(BottomJawPart1, 0.1487144F, -0.3346075F, 0F);
      BottomJawPart2 = new ModelRenderer(this, 21, 84);
      BottomJawPart2.addBox(-1F, 0F, -6.5F, 2, 1, 7);
      BottomJawPart2.setRotationPoint(2F, 0F, 0F);
      setRotation(BottomJawPart2, 0.1487144F, 0.3346075F, 0F);
      
      Throat = new ModelRenderer(this, 0, 0);
      Throat.addBox(-2F, -3F, -9F, 6, 5, 6);
      Throat.setRotationPoint(0.5F, 7.7F, -11F);
      Throat.setTextureSize(256, 128);
      Throat.mirror = true;
      setRotation(Throat, -0.2288904F, 0F, 0F);
      UpSection = new ModelRenderer(this, 25, 0);
      UpSection.addBox(-2F, -2.5F, -9F, 7, 7, ;
      UpSection.setRotationPoint(-0.5F, -0.5F, 2F);
      UpSection.setTextureSize(256, 128);
      UpSection.mirror = true;
      setRotation(UpSection, -0.1917118F, 0F, 0F);
      MidSection = new ModelRenderer(this, 56, 0);
      MidSection.addBox(-2F, -2.5F, 0F, 6, 6, 9);
      MidSection.setRotationPoint(0.5F, 7.5F, -8F);
      setRotation(MidSection, -0.0429974F, 0F, 0F);
      Pelvis = new ModelRenderer(this, 87, 0);
      Pelvis.addBox(-2F, -2.5F, 0F, 6, 6, 7);
      Pelvis.setRotationPoint(0F, 0F, 8F);
      setRotation(Pelvis, 0F, 0F, 0F);
      TailPart1 = new ModelRenderer(this, 114, 0);
      TailPart1.addBox(-1F, -1F, 0F, 2, 2, 11);
      TailPart1.setRotationPoint(1.5F, 7F, 6F);
      setRotation(TailPart1, -0.3346075F, 0F, 0F);
      TailPart2 = new ModelRenderer(this, 141, 0);
      TailPart2.addBox(-1F, -1F, 0F, 2, 2, 11);
      TailPart2.setRotationPoint(0F, -0.2F, 10.5F);
      setRotation(TailPart2, -0.3948578F, 0F, 0F);
      TailPart3 = new ModelRenderer(this, 168, 0);
      TailPart3.addBox(-1F, -1F, 0F, 2, 2, 11);
      TailPart3.setRotationPoint(0F, 0F, 10.8F);
      setRotation(TailPart3, 0.2974289F, 0F, 0F);
      LeftHumerus = new ModelRenderer(this, 39, 16);
      LeftHumerus.addBox(0F, 0F, 0F, 3, 10, 4);
      LeftHumerus.setRotationPoint(3F, 4.7F, -12F);
      setRotation(LeftHumerus, 0.3869765F, 0F, 0F);
      LeftRadius = new ModelRenderer(this, 71, 16);
      LeftRadius.addBox(0F, 0F, 0F, 3, 11, 4);
      LeftRadius.setRotationPoint(0F, 8.0F, 0.45F);
      setRotation(LeftRadius, -0.3869765F, 0F, 0F);
      LeftFClawRPart1 = new ModelRenderer(this, 0, 58);
      LeftFClawRPart1.addBox(-0.5F, 0F, -1F, 1, 1, 1);
      LeftFClawRPart1.setRotationPoint(0F, 9.7F, 0F);
      setRotation(LeftFClawRPart1, 0F, 0.5159687F, 0F);
      LeftFClawRPart2 = new ModelRenderer(this, 5, 58);
      LeftFClawRPart2.addBox(-0.5F, -1F, -3.4F, 1, 1, 3);
      LeftFClawRPart2.setRotationPoint(0F, 0F, 0F);
      setRotation(LeftFClawRPart2, 1.16093F, 0.0259717F, 0F);
      LeftFClawMPart1 = new ModelRenderer(this, 0, 58);
      LeftFClawMPart1.addBox(-0.5F, 0F, -1F, 1, 1, 1);
      LeftFClawMPart1.setRotationPoint(1.5F, 9.7F, 0F);
      setRotation(LeftFClawMPart1, 0F, 0F, 0F);
      LeftFClawMPart2 = new ModelRenderer(this, 5, 58);
      LeftFClawMPart2.addBox(-0.5F, -1F, -3.4F, 1, 1, 3);
      LeftFClawMPart2.setRotationPoint(0F, 0F, 0F);
      setRotation(LeftFClawMPart2, 1.16093F, 0F, 0F);
      LeftFClawLPart1 = new ModelRenderer(this, 0, 58);
      LeftFClawLPart1.addBox(-0.5F, 0F, -1F, 1, 1, 1);
      LeftFClawLPart1.setRotationPoint(3F, 9.7F, 0F);
      setRotation(LeftFClawLPart1, 0F, -0.5159717F, 0F);
      LeftFClawLPart2 = new ModelRenderer(this, 5, 58);
      LeftFClawLPart2.addBox(-0.5F, -1F, -3.4F, 1, 1, 3);
      LeftFClawLPart2.setRotationPoint(0F, 0F, 0F);
      setRotation(LeftFClawLPart2, 1.16093F, -0.0059717F, 0F);
      RightHumerus = new ModelRenderer(this, 55, 16);
      RightHumerus.addBox(-3F, 0F, 0F, 3, 10, 4);
      RightHumerus.setRotationPoint(0F, 4.7F, -12F);
      setRotation(RightHumerus, 0.3869765F, 0F, 0F);
      RightRadius = new ModelRenderer(this, 71, 16);
      RightRadius.addBox(-3F, 0F, 0F, 3, 11, 4);
      RightRadius.setRotationPoint(0F, 8.0F, 0.45F);
      setRotation(RightRadius, -0.3869765F, 0F, 0F);
      RightFClawRPart1 = new ModelRenderer(this, 0, 58);
      RightFClawRPart1.addBox(-0.5F, 0F, -1F, 1, 1, 1);
      RightFClawRPart1.setRotationPoint(-3F, 9.7F, 0F);
      setRotation(RightFClawRPart1, 0F, 0.5159687F, 0F);
      RightFClawRPart2 = new ModelRenderer(this, 5, 58);
      RightFClawRPart2.addBox(-0.5F, -1F, -3.4F, 1, 1, 3);
      RightFClawRPart2.setRotationPoint(0F, 0F, 0F);
      setRotation(RightFClawRPart2, 1.16093F, 0.0259717F, 0F);
      RightFClawMPart1 = new ModelRenderer(this, 0, 58);
      RightFClawMPart1.addBox(-0.5F, 0F, -1F, 1, 1, 1);
      RightFClawMPart1.setRotationPoint(-1.5F, 9.7F, 0F);
      setRotation(RightFClawMPart1, 0F, 0F, 0F);
      RightFClawMPart2 = new ModelRenderer(this, 5, 58);
      RightFClawMPart2.addBox(-0.5F, -1F, -3.4F, 1, 1, 3);
      RightFClawMPart2.setRotationPoint(0F, 0F, 0F);
      setRotation(RightFClawMPart2, 1.16093F, 0F, 0F);
      RightFClawLPart1 = new ModelRenderer(this, 0, 58);
      RightFClawLPart1.addBox(-0.5F, 0F, -1F, 1, 1, 1);
      RightFClawLPart1.setRotationPoint(0F, 9.7F, 0F);
      setRotation(RightFClawLPart1, 0F, -0.5159717F, 0F);
      RightFClawLPart2 = new ModelRenderer(this, 5, 58);
      RightFClawLPart2.addBox(-0.5F, -1F, -3.4F, 1, 1, 3);
      RightFClawLPart2.setRotationPoint(0F, 0F, 0F);
      setRotation(RightFClawLPart2, 1.16093F, -0.0059717F, 0F);
      LeftFemur = new ModelRenderer(this, 19, 16);
      LeftFemur.addBox(0F, 0F, 0F, 3, 8, 6);
      LeftFemur.setRotationPoint(3F, 5.7F, 0F);
      setRotation(LeftFemur, 0F, 0F, 0F);
      LeftTibia = new ModelRenderer(this, 0, 31);
      LeftTibia.addBox(0F, 0F, 0F, 3, 3, 9);
      LeftTibia.setRotationPoint(0F, 7.7F, 0F);
      setRotation(LeftTibia, 0F, 0F, 0F);
      LeftMetatarsus = new ModelRenderer(this, 0, 44);
      LeftMetatarsus.addBox(0F, 0F, 0F, 3, 10, 3);
      LeftMetatarsus.setRotationPoint(0F, -0.02F, 8F);
      setRotation(LeftMetatarsus, -0.1289922F, 0F, 0F);
      LeftClawRPart1 = new ModelRenderer(this, 0, 58);
      LeftClawRPart1.addBox(-0.5F, 0F, -1F, 1, 1, 1);
      LeftClawRPart1.setRotationPoint(0F, 9F, 0F);
      setRotation(LeftClawRPart1, 0F, 0.5159687F, 0F);
      LeftClawRPart2 = new ModelRenderer(this, 5, 58);
      LeftClawRPart2.addBox(-0.5F, -1F, -3.4F, 1, 1, 3);
      LeftClawRPart2.setRotationPoint(0F, 0F, 0F);
      setRotation(LeftClawRPart2, 1.16093F, -0.0259717F, 0F);
      LeftClawMPart1 = new ModelRenderer(this, 0, 58);
      LeftClawMPart1.addBox(-0.5F, 0F, -1F, 1, 1, 1);
      LeftClawMPart1.setRotationPoint(1.5F, 9F, 0F);
      setRotation(LeftClawMPart1, 0F, 0F, 0F);
      LeftClawMPart2 = new ModelRenderer(this, 5, 58);
      LeftClawMPart2.addBox(-0.5F, -1F, -3.4F, 1, 1, 3);
      LeftClawMPart2.setRotationPoint(0F, 0F, 0F);
      setRotation(LeftClawMPart2, 1.16093F, 0F, 0F);
      LeftClawLPart1 = new ModelRenderer(this, 0, 58);
      LeftClawLPart1.addBox(-0.5F, 0F, -1F, 1, 1, 1);
      LeftClawLPart1.setRotationPoint(3F, 9F, 0F);
      setRotation(LeftClawLPart1, 0F, -0.5159687F, 0F);
      LeftClawLPart2 = new ModelRenderer(this, 5, 58);
      LeftClawLPart2.addBox(-0.5F, -1F, -3.4F, 1, 1, 3);
      LeftClawLPart2.setRotationPoint(0F, 0F, 0F);
      setRotation(LeftClawLPart2, 1.16093F, 0.0059717F, 0F);
      RightFemur = new ModelRenderer(this, 0, 16);
      RightFemur.addBox(-2F, 0F, 0F, 3, 8, 6);
      RightFemur.setRotationPoint(-1F, 5.7F, 0F);
      setRotation(RightFemur, 0F, 0F, 0F);
      RightTibia = new ModelRenderer(this, 0, 31);
      RightTibia.addBox(-2F, 0F, 0F, 3, 3, 9);
      RightTibia.setRotationPoint(0F, 7.7F, 0F);
      setRotation(RightTibia, 0F, 0F, 0F);
      RightMetatarsus = new ModelRenderer(this, 0, 44);
      RightMetatarsus.addBox(-2F, 0F, 0F, 3, 10, 3);
      RightMetatarsus.setRotationPoint(0F, -0.02F, 8F);
      setRotation(RightMetatarsus, -0.1289922F, 0F, 0F);
      RightClawRPart1 = new ModelRenderer(this, 0, 58);
      RightClawRPart1.addBox(-0.5F, 0F, -1F, 1, 1, 1);
      RightClawRPart1.setRotationPoint(-3F, 9F, 0F);
      setRotation(RightClawRPart1, 0F, 0.5159687F, 0F);
      RightClawRPart2 = new ModelRenderer(this, 5, 58);
      RightClawRPart2.addBox(-0.5F, -1F, -3.4F, 1, 1, 3);
      RightClawRPart2.setRotationPoint(0F, 0F, 0F);
      setRotation(RightClawRPart2, 1.16093F, -0.0259717F, 0F);
      RightClawMPart1 = new ModelRenderer(this, 0, 58);
      RightClawMPart1.addBox(-0.5F, 0F, -1F, 1, 1, 1);
      RightClawMPart1.setRotationPoint(-1.5F, 9F, 0F);
      setRotation(RightClawMPart1, 0F, 0F, 0F);
      RightClawMPart2 = new ModelRenderer(this, 5, 58);
      RightClawMPart2.addBox(-0.5F, -1F, -3.4F, 1, 1, 3);
      RightClawMPart2.setRotationPoint(0F, 0F, 0F);
      setRotation(RightClawMPart2, 1.16093F, 0F, 0F);
      RightClawLPart1 = new ModelRenderer(this, 0, 58);
      RightClawLPart1.addBox(-0.5F, 0F, -1F, 1, 1, 1);
      RightClawLPart1.setRotationPoint(0F, 9F, 0F);
      setRotation(RightClawLPart1, 0F, -0.5159717F, 0F);
      RightClawLPart2 = new ModelRenderer(this, 5, 58);
      RightClawLPart2.addBox(-0.5F, -1F, -3.4F, 1, 1, 3);
      RightClawLPart2.setRotationPoint(0F, 0F, 0F);
      setRotation(RightClawLPart2, 1.16093F, 0.0059717F, 0F);
      
      //Head\\
      this.Throat.addChild(TopJawCenter);
      this.Throat.addChild(BottomJawCenter);
      this.TopJawCenter.addChild(LeftEarPart1);
      this.TopJawCenter.addChild(RightEarPart1);
      this.TopJawCenter.addChild(TopJawPart1);
      this.TopJawCenter.addChild(TopJawPart2);
      this.TopJawCenter.addChild(LeftTopJaw);
      this.TopJawCenter.addChild(RightTopJaw);
      this.LeftTopJaw.addChild(LeftTopTeeth);
      this.RightTopJaw.addChild(RightTopTeeth);
      this.LeftEarPart1.addChild(LeftEarPart2);
      this.LeftEarPart2.addChild(LeftEarPart3);
      this.RightEarPart1.addChild(RightEarPart2);
      this.RightEarPart2.addChild(RightEarPart3);
      
      this.BottomJawCenter.addChild(BottomJawPart1);
      this.BottomJawCenter.addChild(BottomJawPart2);
      this.BottomJawCenter.addChild(LeftBottomJaw);
      this.BottomJawCenter.addChild(RightBottomJaw);
      this.LeftBottomJaw.addChild(LeftBottomTeeth);
      this.RightBottomJaw.addChild(RightBottomTeeth);
      
      //Torso\\
      this.MidSection.addChild(Pelvis);
      this.MidSection.addChild(UpSection);
      
      //Front Legs\\
      this.LeftHumerus.addChild(LeftRadius);
      this.LeftRadius.addChild(LeftFClawLPart1);
      this.LeftRadius.addChild(LeftFClawMPart1);
      this.LeftRadius.addChild(LeftFClawRPart1);
      this.LeftFClawLPart1.addChild(LeftFClawLPart2);
      this.LeftFClawMPart1.addChild(LeftFClawMPart2);
      this.LeftFClawRPart1.addChild(LeftFClawRPart2);
      this.RightHumerus.addChild(RightRadius);
      this.RightRadius.addChild(RightFClawLPart1);
      this.RightRadius.addChild(RightFClawMPart1);
      this.RightRadius.addChild(RightFClawRPart1);
      this.RightFClawLPart1.addChild(RightFClawLPart2);
      this.RightFClawMPart1.addChild(RightFClawMPart2);
      this.RightFClawRPart1.addChild(RightFClawRPart2);
      
      //Back Legs\\\
      this.LeftFemur.addChild(LeftTibia);
      this.LeftTibia.addChild(LeftMetatarsus);
      this.LeftMetatarsus.addChild(LeftClawLPart1);
      this.LeftMetatarsus.addChild(LeftClawMPart1);
      this.LeftMetatarsus.addChild(LeftClawRPart1);
      this.LeftClawLPart1.addChild(LeftClawLPart2);
      this.LeftClawMPart1.addChild(LeftClawMPart2);
      this.LeftClawRPart1.addChild(LeftClawRPart2);
      this.RightFemur.addChild(RightTibia);
      this.RightTibia.addChild(RightMetatarsus);
      this.RightMetatarsus.addChild(RightClawLPart1);
      this.RightMetatarsus.addChild(RightClawMPart1);
      this.RightMetatarsus.addChild(RightClawRPart1);
      this.RightClawLPart1.addChild(RightClawLPart2);
      this.RightClawMPart1.addChild(RightClawMPart2);
      this.RightClawRPart1.addChild(RightClawRPart2);
      
      //Tail\\
      this.TailPart1.addChild(TailPart2);
      this.TailPart2.addChild(TailPart3);
  }
  
  @Override
  public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
  {
      EntityZertumEntity entity = (EntityZertumEntity)par1Entity;
      boolean flag = entity.isSaddled();
      super.render(par1Entity, par2, par3, par4, par5, par6, par7);
      this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
      if(!entity.hasEvolved())
    	  if (this.isChild)
    	  {
    		  float f6 = 2.0F;
    		  GL11.glPushMatrix();
    		  GL11.glTranslatef(0.0F, 5.0F * par7, 6.0F * par7);
    		  Head.render(par7);
    		  GL11.glPopMatrix();
    		  GL11.glPushMatrix();
    		  GL11.glScalef(1.0F / f6, 1.0F / f6, 1.0F / f6);
    		  GL11.glTranslatef(0.0F, 24.0F * par7, 0.0F);
          	  LeftHindLeg1.render(par7);
          	  RightHindLeg1.render(par7);
          	  Mane1.render(par7);
          	  RightLeg.render(par7);
          	  LeftLeg.render(par7);
          	  Tail1.render(par7);
          	  Torso.render(par7);
          	  GL11.glPopMatrix();
    	  }
    	  else
    	  {
    		  GL11.glPushMatrix();
    		  GL11.glScalef(1.5F, 1.5F, 1.5F);
    		  GL11.glTranslatef(0.0F, -0.5F, 0.0F);
    		  Head.render(par7);
    		  LeftHindLeg1.render(par7);
    		  RightHindLeg1.render(par7);
    		  Mane1.render(par7);
    		  RightLeg.render(par7);
    		  LeftLeg.render(par7);
    		  Tail1.render(par7);
    		  Torso.render(par7);
    		  GL11.glPopMatrix();
          
    		  if(flag){
    			  GL11.glPushMatrix();
    			  GL11.glScalef(1.5F, 1.5F, 1.5F);
    			  GL11.glTranslatef(0.0F, -0.5F, 0.0F);
    			  Pad1.render(par7);
    			  Pad2.render(par7);
    			  Pad3.render(par7);
    			  Pad4.render(par7);
    			  PadPart1.render(par7);
    			  PadPart2.render(par7);
    			  Rope1.render(par7);
    			  Metal1.render(par7);
    			  Rope2.render(par7);
    			  Metal2.render(par7);
    			  Seat1.render(par7);
    			  Seat2.render(par7);
    			  GL11.glPopMatrix();
    		  }
    	  }else if (entity.hasEvolved()){
    	      textureWidth = 256;
    	      textureHeight = 128;
    		    RightJawWebPart1.render(par7);
    		    RightJawWebPart2.render(par7);
    		    LeftJawWebPart1.render(par7);
    		    LeftJawWebPart2.render(par7);
    		    
    		    Throat.render(par7);
    		    MidSection.render(par7);
    		    TailPart1.render(par7);
    		    LeftHumerus.render(par7);
    		    RightHumerus.render(par7);
    		    LeftFemur.render(par7);
    		    RightFemur.render(par7); 
    	  }
  }
  
  /**
   * Used for easily adding entity-dependent animations. The second and third float params here are the same second
   * and third as in the setRotationAngles method.
   */
  @Override
  public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4)
  {
  EntityZertumEntity entityzertum = (EntityZertumEntity)par1EntityLivingBase;
      if(!entityzertum.hasEvolved()){
      if (entityzertum.isAngry())
      {
          this.Ear1.rotateAngleX = -0.5948578F;
          this.Ear2.rotateAngleX = -0.5948578F;
      }else if (entityzertum.getHealth() <=10){
          this.Ear1.rotateAngleX = -0.9948578F;
          this.Ear2.rotateAngleX = -0.9948578F;
      }else{
          this.Ear1.rotateAngleX = 0.0F;
          this.Ear2.rotateAngleX = 0.0F;
      }
      
      if (entityzertum.isSitting()) //TODO
      {
    	  LeftHindLeg1.setRotationPoint(1.5F, 18F, 5F);
    	  LeftHindLeg1.rotateAngleX = -2.082003F;
          LeftHindLeg2.setRotationPoint(0F, 4F, 1.2F);
          LeftHindLeg2.rotateAngleX = 2.6205006F;
          LeftHindLeg3.setRotationPoint(0F, 3.55F, 0.2F);
          LeftHindLeg3.rotateAngleX = -0.5205006F;
          RightHindLeg1.setRotationPoint(-2.5F, 18F, 5F);
          RightHindLeg1.rotateAngleX = -2.082003F;
          RightHindLeg2.setRotationPoint(0F, 4F, 1.2F);
          RightHindLeg2.rotateAngleX = 2.6205006F;
          RightHindLeg3.setRotationPoint(0F, 3.55F, 0.2F);
          RightHindLeg3.rotateAngleX = -0.5205006F;
          Torso.setRotationPoint(-0.5F, 14F, 1F);
          Torso.rotateAngleX = 0.9759358F;
          Tail1.setRotationPoint(-1F, 18.5F, 5F);
          Tail1.rotateAngleX = 1.167248F;
          Tail2.rotateAngleX = 0.315962F;
          Tail3.rotateAngleX = 0.23333F;
          
          //Saddle\\
          Pad1.setRotationPoint(-0.5F, 9.7F, -1.5F);
          setRotation(Pad1, -0.288128F, 0F, 0F);
          Pad2.setRotationPoint(-0.5F, 10F, -0.5F);
          setRotation(Pad2, -0.3346075F, 0F, 0F);
          Pad3.setRotationPoint(-1F, 10.7F, 1.4F);
          setRotation(Pad3, -0.5855569F, 0F, 0F);
          Pad4.setRotationPoint(-0.5F, 12.9F, 4.7F);
          setRotation(Pad4, -0.5948648F, 0F, 0F);
          PadPart1.setRotationPoint(1F, 9.6F, -2.4F);
          setRotation(PadPart1, -0.3624853F, 0F, 0F);
          PadPart2.setRotationPoint(-2F, 9.6F, -2.4F);
          setRotation(PadPart2, -0.3624874F, 0F, 0F);
          Rope1.setRotationPoint(1.8F, 10.6F, 1F);
          setRotation(Rope1, -0.3346075F, 0F, 0F);
          Metal1.setRotationPoint(1.8F, 14.2F, -0.3F);
          setRotation(Metal1, -0.3346145F, 0F, 0F);
          Rope2.setRotationPoint(-2.8F, 10.6F, 1F);
          setRotation(Rope2, -0.3346145F, 0F, 0F);
          Metal2.setRotationPoint(-3.8F, 13.6F, 0F);
          setRotation(Metal2, -0.3346145F, 0F, 0F);
          Seat1.setRotationPoint(-0.5F, 11.6F, 4.3F);
          setRotation(Seat1, -0.5483867F, 0F, 0F);
          Seat2.setRotationPoint(-0.5F, 8.9F, -1.2F);
          setRotation(Seat2, -0.2881364F, 0F, 0F);
    	  
      }
      else
      {
    	LeftHindLeg1.setRotationPoint(1.5F, 13F, 5F);
    	LeftHindLeg1.rotateAngleX = -0.2974289F;
    	LeftHindLeg2.setRotationPoint(0F, 4.3F, -0.3F);
    	LeftHindLeg2.rotateAngleX = leftTibia;
    	LeftHindLeg3.setRotationPoint(0F, 3.55F, 0.2F);
    	LeftHindLeg3.rotateAngleX = leftMetatarus;
    	RightHindLeg1.setRotationPoint(-2.5F, 13F, 5F);
    	RightHindLeg1.rotateAngleX = -0.2974289F;
    	RightHindLeg2.setRotationPoint(0F, 4.3F, -0.3F);
    	RightHindLeg2.rotateAngleX =  rightTibia;
    	RightHindLeg3.setRotationPoint(0F, 3.55F, 0.2F);
    	RightHindLeg3.rotateAngleX = rightMetatarus;
    	Torso.setRotationPoint(-0.5F, 12.5F, 1F);
    	Torso.rotateAngleX = 1.496439F;
        Tail1.setRotationPoint(-1F, 14.3F, 6F);
        Tail1.rotateAngleX = 1.315962F;
        Tail2.setRotationPoint(0.5F, 6F, 0.5F);
        Tail2.rotateAngleX = -0.041605F;
        Tail3.setRotationPoint(0F, 6.5F, 0.5F);
        Tail3.rotateAngleX = 0.001605F;
        //Saddle\\ TODO
        Pad1.setRotationPoint(-0.5F, 9.3F, -2.5F);
        setRotation(Pad1, -0.0650564F, 0F, 0F);
        Pad2.setRotationPoint(-0.5F, 9.4F, -1.5F);
        setRotation(Pad2, -0.0743572F, 0F, 0F);
        Pad3.setRotationPoint(-1F, 9.5F, 0.2F);
        setRotation(Pad3, -0.0650564F, 0F, 0F);
        Pad4.setRotationPoint(-0.5F, 9.8F, 4.1F);
        setRotation(Pad4, -0.0650564F, 0F, 0F);
        PadPart1.setRotationPoint(1F, 9.23F, -3.5F);
        setRotation(PadPart1, -0.0650564F, 0F, 0F);
        PadPart2.setRotationPoint(-2F, 9.2F, -3.5F);
        setRotation(PadPart2, -0.0650564F, 0F, 0F);
        Rope1.setRotationPoint(1.8F, 9.6F, 0F);
        setRotation(Rope1, 0F, 0F, 0F);
        Metal1.setRotationPoint(1.8F, 13.6F, 0F);
        setRotation(Metal1, 0F, 0F, 0F);
        Rope2.setRotationPoint(-2.8F, 9.6F, 0F);
        setRotation(Rope2, 0F, 0F, 0F);
        Metal2.setRotationPoint(-3.8F, 13.6F, 0F);
        setRotation(Metal2, 0F, 0F, 0F);
        Seat1.setRotationPoint(-0.5F, 8.7F, -1.5F);
        setRotation(Seat1, -0.0650484F, 0F, 0F);
        Seat2.setRotationPoint(-0.5F, 9F, 3.2F);
        setRotation(Seat2, -0.0650484F, 0F, 0F);
    	
          this.RightHindLeg1.rotateAngleX = rightFemur + MathHelper.cos(par2 * 0.4662F) * 1.4F * par3;
          this.LeftHindLeg1.rotateAngleX = leftFemur + MathHelper.cos(par2 * 0.4662F + (float)Math.PI) * 1.4F * par3;
          this.RightLeg.rotateAngleX = MathHelper.cos(par2 * 0.4662F + (float)Math.PI) * 1.4F * par3;
          this.LeftLeg.rotateAngleX = MathHelper.cos(par2 * 0.4662F) * 1.4F * par3;
      }
  
      this.Head.rotateAngleZ = entityzertum.getInterestedAngle(par4) + entityzertum.getShakeAngle(par4, 0.0F);
      this.Mane1.rotateAngleZ = entityzertum.getShakeAngle(par4, -0.08F);
      this.Torso.rotateAngleZ = entityzertum.getShakeAngle(par4, -0.16F);
      this.Tail1.rotateAngleZ = entityzertum.getShakeAngle(par4, -0.32F);
      }else{
          this.RightHumerus.rotateAngleX = 0.3869765F + MathHelper.cos(par2 * 0.6662F) * 1.4F * par3;
          this.LeftHumerus.rotateAngleX = 0.3869765F + MathHelper.cos(par2 * 0.6662F + (float)Math.PI) * 1.4F * par3;
          this.RightFemur.rotateAngleX = MathHelper.cos(par2 * 0.6662F) * 1.4F * par3;
          this.LeftFemur.rotateAngleX =  MathHelper.cos(par2 * 0.6662F + (float)Math.PI) * 1.4F * par3;
      }
  }
  
  
  private void setRotation(ModelRenderer model, float x, float y, float z)
  {
    model.rotateAngleX = x;
    model.rotateAngleY = y;
    model.rotateAngleZ = z;
  }
  
  @Override
  public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)
  {
    super.setRotationAngles(par1, par2, par3, par4, par5, par6, par7Entity);
  EntityZertumEntity entityzertum = (EntityZertumEntity)par7Entity;
    if(!entityzertum.hasEvolved()){
    this.Head.rotateAngleX = par5 / (280F / (float)Math.PI);
    this.Head.rotateAngleY = par4 / (180F / (float)Math.PI);
    this.Neck.rotateAngleX = vertebrae + par5 / (280F / (float)Math.PI);
    this.Mane2.rotateAngleX = mane2StartingRotation + par5 / (280F / (float)Math.PI);
    this.Mane1.rotateAngleY = par4 / (180F / (float)Math.PI);
    }else{
        this.TopJawCenter.rotateAngleX = par5 / (280F / (float)Math.PI);
        this.TopJawCenter.rotateAngleY = par4 / (180F / (float)Math.PI);
        this.BottomJawCenter.rotateAngleX = par5 / (280F / (float)Math.PI);
        this.BottomJawCenter.rotateAngleY = par4 / (180F / (float)Math.PI);
        this.Throat.rotateAngleX = + par5 / (280F / (float)Math.PI);
    }
  }
}

 

Renderer:

package common.zeroquest.client.renderer.entity;

import org.lwjgl.opengl.GL11;

import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import common.zeroquest.client.renderer.entity.layers.LayersZertum;
import common.zeroquest.entity.EntityZertum;
import common.zeroquest.lib.Constants;

@SideOnly(Side.CLIENT)
public class RenderZertum extends RenderLiving
{
    private static final ResourceLocation zertumTextures = new ResourceLocation(Constants.modid + ":" + "textures/entity/zertum/zertum.png");
    private static final ResourceLocation evolvedZertumTextures = new ResourceLocation(Constants.modid + ":" + "textures/entity/zertum/evo/zertum.png");
    private static final ResourceLocation evolvedTamedZertumTextures = new ResourceLocation(Constants.modid + ":" + "textures/entity/zertum/evo/zertum_tame.png");
    private static final ResourceLocation tamedZertumTextures = new ResourceLocation(Constants.modid + ":" + "textures/entity/zertum/zertum_tame.png");
    private static final ResourceLocation angryZertumTextures = new ResourceLocation(Constants.modid + ":" + "textures/entity/zertum/zertum_angry.png");
    
    public RenderZertum(RenderManager p_i46128_1_, ModelBase p_i46128_2_, float p_i46128_3_){
    
        super(p_i46128_1_, p_i46128_2_, p_i46128_3_);
        this.addLayer(new LayersZertum(this));
    }

    public void func_177135_a(EntityZertum p_177135_1_, double p_177135_2_, double p_177135_4_, double p_177135_6_, float p_177135_8_, float p_177135_9_)
    {
        if (p_177135_1_.isWolfWet())
        {
            float f2 = p_177135_1_.getBrightness(p_177135_9_) * p_177135_1_.getShadingWhileWet(p_177135_9_);
            GlStateManager.color(f2, f2, f2);
        }

        super.doRender((EntityLiving)p_177135_1_, p_177135_2_, p_177135_4_, p_177135_6_, p_177135_8_, p_177135_9_);
    }

    protected ResourceLocation getEntityTexture(EntityZertum entity)
    {
    	if(!entity.hasEvolved()){
    		if(entity.isTamed()){
    			return tamedZertumTextures;
    		}else if(entity.isAngry()){
    			return angryZertumTextures;
    		}else if(!entity.isTamed() && !entity.isAngry()){
    			return zertumTextures;
    		}
    	}else if(entity.hasEvolved()){
    		if(entity.isTamed()){
    			return evolvedTamedZertumTextures;
    		}else if(!entity.isTamed() && !entity.isAngry()){
    			return evolvedZertumTextures;
    		}
    	}
	return null;
    }

    public void doRender(EntityLiving p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
    {
        this.func_177135_a((EntityZertum)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
    }

    public void doRender(EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
    {
        this.func_177135_a((EntityZertum)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
    }

    protected ResourceLocation getEntityTexture(Entity p_110775_1_)
    {
        return this.getEntityTexture((EntityZertum)p_110775_1_);
    }
    
    @Override
public void passSpecialRender(EntityLivingBase entityLivingBase, double p_77033_2_, double p_77033_4_, double p_77033_6_) {
    	EntityZertum dog = (EntityZertum)entityLivingBase;
        
        if(!dog.getDogName().isEmpty())
        	super.passSpecialRender(entityLivingBase, p_77033_2_, p_77033_4_, p_77033_6_);
    }
    
    @Override
    protected void func_177069_a(Entity entity, double x, double y, double z, String displayName, float scale, double distanceFromPlayer) {
    	super.func_177069_a(entity, x, y, z, displayName, scale, distanceFromPlayer);
        
    	EntityZertum dog = (EntityZertum)entity;
    	
    	if (distanceFromPlayer < 100.0D) {
        	
            y += (double)((float)this.getFontRendererFromRenderManager().FONT_HEIGHT * 1.15F * 0.016666668F * 0.7F);
        	
            String tip = dog.mode.getMode().getTip();
            
            String label = String.format("%s[%d]", tip, dog.getDogHunger());
            
            if (dog.isPlayerSleeping())
                this.renderLivingLabel(dog, label,  x, y - 0.5D, z, 64, 0.7F);
            else
                this.renderLivingLabel(dog, label, x, y, z, 64, 0.7F);
        }
    	
    	if (distanceFromPlayer < 100.0D) {
    		y += (double)((float)this.getFontRendererFromRenderManager().FONT_HEIGHT * 1.15F * 0.016666668F * 0.5F);
              
           if(this.renderManager.livingPlayer.isSneaking()) {
        	   EntityLivingBase owner = dog.getOwnerEntity();
        	   if(owner != null)
        		   this.renderLivingLabel(dog, owner.getDisplayName().getUnformattedText(), x, y, z, 5, 0.5F);
        	   else
        		   this.renderLivingLabel(dog, dog.getOwnerId(), x, y, z, 5, 0.5F);
           }
    	}
    }
    
    protected void renderLivingLabel(Entity p_147906_1_, String p_147906_2_, double p_147906_3_, double p_147906_5_, double p_147906_7_, int p_147906_9_, float scale) {
    	 double d3 = p_147906_1_.getDistanceSqToEntity(this.renderManager.livingPlayer);

         if (d3 <= (double)(p_147906_9_ * p_147906_9_)) {
             FontRenderer fontrenderer = this.getFontRendererFromRenderManager();
             float f1 = 0.016666668F * scale;
             GlStateManager.pushMatrix();
             GlStateManager.translate((float)p_147906_3_ + 0.0F, (float)p_147906_5_ + p_147906_1_.height + 0.5F, (float)p_147906_7_);
             GL11.glNormal3f(0.0F, 1.0F, 0.0F);
             GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
             GlStateManager.rotate(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
             GlStateManager.scale(-f1, -f1, f1);
             GlStateManager.disableLighting();
             GlStateManager.depthMask(false);
             GlStateManager.disableDepth();
             GlStateManager.enableBlend();
             GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
             Tessellator tessellator = Tessellator.getInstance();
             WorldRenderer worldrenderer = tessellator.getWorldRenderer();
             byte b0 = 0;

             if (p_147906_2_.equals("deadmau5"))
                 b0 = -10;

             GlStateManager.disableTexture2D();
             worldrenderer.startDrawingQuads();
             int j = fontrenderer.getStringWidth(p_147906_2_) / 2;
             worldrenderer.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
             worldrenderer.addVertex((double)(-j - 1), (double)(-1 + b0), 0.0D);
             worldrenderer.addVertex((double)(-j - 1), (double)(8 + b0), 0.0D);
             worldrenderer.addVertex((double)(j + 1), (double)(8 + b0), 0.0D);
             worldrenderer.addVertex((double)(j + 1), (double)(-1 + b0), 0.0D);
             tessellator.draw();
             GlStateManager.enableTexture2D();
             fontrenderer.drawString(p_147906_2_, -fontrenderer.getStringWidth(p_147906_2_) / 2, b0, 553648127);
             GlStateManager.enableDepth();
             GlStateManager.depthMask(true);
             fontrenderer.drawString(p_147906_2_, -fontrenderer.getStringWidth(p_147906_2_) / 2, b0, -1);
             GlStateManager.enableLighting();
             GlStateManager.disableBlend();
             GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
             GlStateManager.popMatrix();
         }
    }

}

 

Also, sorry for the post being so long

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

Hi

 

BY crikey your code is hard to read with all those p_177141_3_ in there, perhaps you should refactor it to make it more reader-friendly?

 

I would suggest as a first step to add System.out.println() to your code to make sure the texture binding and rendering code is being executed in the correct order, when you expect it.

 

If it works for one model but not the other, try to find the differences between the two.  Try swapping the rendering order (eg do the collar before the dog) to see if the symptoms swap, that sort of thing.

 

-TGG

 

 

Posted

I'm not sure how to put which texture it switches to on the System.out.println(), also the difference between the textures is that one is 128x64 and the other is 256x128

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

Still can't figure out why the collar textures aren't switching

 

package common.zeroquest.client.renderer.entity.layers;

import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import common.zeroquest.client.renderer.entity.RenderZertum;
import common.zeroquest.entity.EntityZertum;
import common.zeroquest.lib.Constants;

@SideOnly(Side.CLIENT)
public class LayersZertum implements LayerRenderer
{
    private static final ResourceLocation ZertumDyingTexture = new ResourceLocation(Constants.modid + ":" + "textures/entity/zertum/zertum_dying.png");
    private static final ResourceLocation ZertumCollarTexture = new ResourceLocation(Constants.modid + ":" + "textures/entity/zertum/zertum_collar.png");
    private static final ResourceLocation EvolvedZertumDyingTexture = new ResourceLocation(Constants.modid + ":" + "textures/entity/zertum/evo/zertum_dying.png");
    private static final ResourceLocation EvolvedZertumCollarTexture = new ResourceLocation(Constants.modid + ":" + "textures/entity/zertum/evo/zertum_collar.png");
    //private static final ResourceLocation ZertumSaddleTexture = new ResourceLocation(Constants.modid + ":" + "textures/entity/zertum/zertum_saddle.png");
    private final RenderZertum field_177146_b;
    private static final String __OBFID = "CL_00002405";

    public LayersZertum(RenderZertum p_177145_1_)
    {
        this.field_177146_b = p_177145_1_;
    }

    public void func_177145_a(EntityZertum entity, float par1, float par2, float par3, float par4, float par5, float par6, float par7)
    {
    	if(!entity.hasEvolved()){
    		if (entity.isTamed() && !entity.isInvisible() && !entity.hasEvolved())
    		{
    			this.field_177146_b.bindTexture(ZertumCollarTexture);
    			EnumDyeColor enumdyecolor = EnumDyeColor.byMetadata(entity.getCollarColor().getMetadata());
    			float[] afloat = EntitySheep.func_175513_a(enumdyecolor);
    			GlStateManager.color(afloat[0], afloat[1], afloat[2]);
    			this.field_177146_b.getMainModel().render(entity, par1, par2, par4, par5, par6, par7);
    		}
        
    		if(entity.isTamed() && entity.getHealth() <=10 && !entity.isInvisible() && !entity.hasEvolved()){
    			this.field_177146_b.bindTexture(ZertumDyingTexture);
    			GlStateManager.color(1f, 1f, 1f);
    			this.field_177146_b.getMainModel().render(entity, par1, par2, par4, par5, par6, par7);
    		}
        
    		/*if (p_177145_1_.isSaddled())
        	{
            	this.field_177146_b.bindTexture(ZertumSaddleTexture);
            	GlStateManager.color(1f, 1f, 1f);
            	this.field_177146_b.getMainModel().render(p_177145_1_, p_177145_2_, p_177145_3_, p_177145_5_, p_177145_6_, p_177145_7_, p_177145_8_);
        	}*/
    	}
    	else if(entity.hasEvolved()){
    		if (entity.isTamed() && !entity.isInvisible())
    		{
    			this.field_177146_b.bindTexture(EvolvedZertumCollarTexture);
    			EnumDyeColor enumdyecolor = EnumDyeColor.byMetadata(entity.getCollarColor().getMetadata());
    			float[] afloat = EntitySheep.func_175513_a(enumdyecolor);
    			GlStateManager.color(afloat[0], afloat[1], afloat[2]);
    			this.field_177146_b.getMainModel().render(entity, par1, par2, par4, par5, par6, par7);
    		}
        
    		if(entity.isTamed() && entity.getHealth() <=10 && !entity.isInvisible()){
    			this.field_177146_b.bindTexture(EvolvedZertumDyingTexture);
    			GlStateManager.color(1f, 1f, 1f);
    			this.field_177146_b.getMainModel().render(entity, par1, par2, par4, par5, par6, par7);
    		}
    	}
    }

    public boolean shouldCombineTextures()
    {
        return true;
    }

    public void doRenderLayer(EntityLivingBase entity, float par1, float par2, float par3, float par4, float par5, float par6, float par7)
    {
        this.func_177145_a((EntityZertum)entity, par1, par2, par3, par4, par5, par6, par7);
    }
}

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

Woops, I just noticed that the new texture was not 256x128, it was a smaller size and it resulted in the messed up texturing.

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • So me and a couple of friends are playing with a shitpost mod pack and one of the mods in the pack is corail tombstone and for some reason there is a problem with it, where on death to fire the player will get kicked out of the server and the tombstone will not spawn basically deleting an entire inventory, it doesn't matter what type of fire it is, whether it's from vanilla fire/lava, or from modded fire like ice&fire/lycanites and it's common enough to where everyone on the server has experienced at least once or twice and it doesn't give any crash log. a solution to this would be much appreciated thank you!
    • It is 1.12.2 - I have no idea if there is a 1.12 pack
    • Okay, but does the modpack works with 1.12 or just with 1.12.2, because I need the Forge client specifically for Minecraft 1.12, not 1.12.2
    • Version 1.19 - Forge 41.0.63 I want to create a wolf entity that I can ride, so far it seems to be working, but the problem is that when I get on the wolf, I can’t control it. I then discovered that the issue is that the server doesn’t detect that I’m riding the wolf, so I’m struggling with synchronization. However, it seems to not be working properly. As I understand it, the server receives the packet but doesn’t register it correctly. I’m a bit new to Java, and I’ll try to provide all the relevant code and prints *The comments and prints are translated by chatgpt since they were originally in Spanish* Thank you very much in advance No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. MountableWolfEntity package com.vals.valscraft.entity; import com.vals.valscraft.network.MountSyncPacket; import com.vals.valscraft.network.NetworkHandler; import net.minecraft.client.Minecraft; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.Entity; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.network.PacketDistributor; public class MountableWolfEntity extends Wolf { private boolean hasSaddle; private static final EntityDataAccessor<Byte> DATA_ID_FLAGS = SynchedEntityData.defineId(MountableWolfEntity.class, EntityDataSerializers.BYTE); public MountableWolfEntity(EntityType<? extends Wolf> type, Level level) { super(type, level); this.hasSaddle = false; } @Override protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(DATA_ID_FLAGS, (byte)0); } public static AttributeSupplier.Builder createAttributes() { return Wolf.createAttributes() .add(Attributes.MAX_HEALTH, 20.0) .add(Attributes.MOVEMENT_SPEED, 0.3); } @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); if (itemstack.getItem() == Items.SADDLE && !this.hasSaddle()) { if (!player.isCreative()) { itemstack.shrink(1); } this.setSaddle(true); return InteractionResult.SUCCESS; } else if (!level.isClientSide && this.hasSaddle()) { player.startRiding(this); MountSyncPacket packet = new MountSyncPacket(true); // 'true' means the player is mounted NetworkHandler.CHANNEL.sendToServer(packet); // Ensure the server handles the packet return InteractionResult.SUCCESS; } return InteractionResult.PASS; } @Override public void travel(Vec3 travelVector) { if (this.isVehicle() && this.getControllingPassenger() instanceof Player) { System.out.println("The wolf has a passenger."); System.out.println("The passenger is a player."); Player player = (Player) this.getControllingPassenger(); // Ensure the player is the controller this.setYRot(player.getYRot()); this.yRotO = this.getYRot(); this.setXRot(player.getXRot() * 0.5F); this.setRot(this.getYRot(), this.getXRot()); this.yBodyRot = this.getYRot(); this.yHeadRot = this.yBodyRot; float forward = player.zza; float strafe = player.xxa; if (forward <= 0.0F) { forward *= 0.25F; } this.flyingSpeed = this.getSpeed() * 0.1F; this.setSpeed((float) this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 1.5F); this.setDeltaMovement(new Vec3(strafe, travelVector.y, forward).scale(this.getSpeed())); this.calculateEntityAnimation(this, false); } else { // The wolf does not have a passenger or the passenger is not a player System.out.println("No player is mounted, or the passenger is not a player."); super.travel(travelVector); } } public boolean hasSaddle() { return this.hasSaddle; } public void setSaddle(boolean hasSaddle) { this.hasSaddle = hasSaddle; } @Override protected void dropEquipment() { super.dropEquipment(); if (this.hasSaddle()) { this.spawnAtLocation(Items.SADDLE); this.setSaddle(false); } } @SubscribeEvent public static void onServerTick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.START) { MinecraftServer server = net.minecraftforge.server.ServerLifecycleHooks.getCurrentServer(); if (server != null) { for (ServerPlayer player : server.getPlayerList().getPlayers()) { if (player.isPassenger() && player.getVehicle() instanceof MountableWolfEntity) { MountableWolfEntity wolf = (MountableWolfEntity) player.getVehicle(); System.out.println("Tick: " + player.getName().getString() + " is correctly mounted on " + wolf); } } } } } private boolean lastMountedState = false; @Override public void tick() { super.tick(); if (!this.level.isClientSide) { // Only on the server boolean isMounted = this.isVehicle() && this.getControllingPassenger() instanceof Player; // Only print if the state changed if (isMounted != lastMountedState) { if (isMounted) { Player player = (Player) this.getControllingPassenger(); // Verify the passenger is a player System.out.println("Server: Player " + player.getName().getString() + " is now mounted."); } else { System.out.println("Server: The wolf no longer has a passenger."); } lastMountedState = isMounted; } } } @Override public void addPassenger(Entity passenger) { super.addPassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(true)); } } } @Override public void removePassenger(Entity passenger) { super.removePassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is no longer mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(false)); } } } @Override public boolean isControlledByLocalInstance() { Entity entity = this.getControllingPassenger(); return entity instanceof Player; } @Override public void positionRider(Entity passenger) { if (this.hasPassenger(passenger)) { double xOffset = Math.cos(Math.toRadians(this.getYRot() + 90)) * 0.4; double zOffset = Math.sin(Math.toRadians(this.getYRot() + 90)) * 0.4; passenger.setPos(this.getX() + xOffset, this.getY() + this.getPassengersRidingOffset() + passenger.getMyRidingOffset(), this.getZ() + zOffset); } } } MountSyncPacket package com.vals.valscraft.network; import com.vals.valscraft.entity.MountableWolfEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class MountSyncPacket { private final boolean isMounted; public MountSyncPacket(boolean isMounted) { this.isMounted = isMounted; } public void encode(FriendlyByteBuf buffer) { buffer.writeBoolean(isMounted); } public static MountSyncPacket decode(FriendlyByteBuf buffer) { return new MountSyncPacket(buffer.readBoolean()); } public void handle(NetworkEvent.Context context) { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); // Get the player from the context if (player != null) { // Verifies if the player has dismounted if (!isMounted) { Entity vehicle = player.getVehicle(); if (vehicle instanceof MountableWolfEntity wolf) { // Logic to remove the player as a passenger wolf.removePassenger(player); System.out.println("Server: Player " + player.getName().getString() + " is no longer mounted."); } } } }); context.setPacketHandled(true); // Marks the packet as handled } } networkHandler package com.vals.valscraft.network; import com.vals.valscraft.valscraft; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.network.NetworkRegistry; import net.minecraftforge.network.simple.SimpleChannel; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class NetworkHandler { private static final String PROTOCOL_VERSION = "1"; public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel( new ResourceLocation(valscraft.MODID, "main"), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals ); public static void init() { int packetId = 0; // Register the mount synchronization packet CHANNEL.registerMessage( packetId++, MountSyncPacket.class, MountSyncPacket::encode, MountSyncPacket::decode, (msg, context) -> msg.handle(context.get()) // Get the context with context.get() ); } }  
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.