Jump to content

ctwagon

Members
  • Posts

    11
  • Joined

  • Last visited

Everything posted by ctwagon

  1. I am trying to make an entity's arms rotate like an Iron Golem's do but I can't get it to work. I based the code that causes the rotation off of the code for an Iron Golem but the arms don't move. All of the rest of my animations work for the entity. EntityTroll.java package com.ctwagon.testmod.entity.mobs; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAIMate; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.DamageSource; import net.minecraft.world.World; public class EntityTroll extends EntityAnimal { public int attackTimer; public EntityTroll(World par1World) { super(par1World); this.setSize(2.0F, 3.5F); this.getNavigator().setAvoidsWater(true); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 0.8D, true)); this.tasks.addTask(2, new EntityAIWander(this, 0.8D)); this.tasks.addTask(3, new EntityAILookIdle(this)); this.tasks.addTask(4, new EntityAIMate(this, 0.8D)); this.targetTasks.addTask(0, new EntityAIHurtByTarget(this, true)); this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 1, true, true)); } /** * Returns true if the newer Entity AI code should be run */ public boolean isAIEnabled() { return true; } protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(100.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.3D); } /** * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons * use this to react to sunlight and start to burn. */ public void onLivingUpdate() { super.onLivingUpdate(); if (this.attackTimer > 0) { -- this.attackTimer; } } public boolean attackEntityAsMob(Entity par1Entity) { this.attackTimer = 10; boolean flag = par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float)(10.0)); if (!flag) { par1Entity.motionY += 0.4000000059604645D; } return flag; } @SideOnly(Side.CLIENT) public int getAttackTimer() { return this.attackTimer; } public EntityTroll createChild(EntityAgeable par1EntityAgeable) { return new EntityTroll(this.worldObj); } } ModelTroll.java package com.ctwagon.testmod.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 com.ctwagon.testmod.entity.mobs.EntityTroll; public class ModelTroll extends ModelBase { //fields ModelRenderer Body; ModelRenderer Leg_1; ModelRenderer Leg_2; ModelRenderer Arm_1; ModelRenderer Arm_2; ModelRenderer Head_1; ModelRenderer Head_2; public ModelTroll() { textureWidth = 128; textureHeight = 64; Body = new ModelRenderer(this, 0, 24); Body.addBox(-10F, -13F, -5F, 20, 26, 10); Body.setRotationPoint(0F, -9F, 0F); Body.setTextureSize(128, 64); Body.mirror = true; setRotation(Body, 0F, 0F, 0F); Leg_1 = new ModelRenderer(this, 80, 0); Leg_1.addBox(-3F, 0F, -3F, 6, 20, 6); Leg_1.setRotationPoint(5F, 4F, 0F); Leg_1.setTextureSize(128, 64); Leg_1.mirror = true; setRotation(Leg_1, 0F, 0F, 0F); Leg_2 = new ModelRenderer(this, 80, 0); Leg_2.addBox(-3F, 0F, -3F, 6, 20, 6); Leg_2.setRotationPoint(-5F, 4F, 0F); Leg_2.setTextureSize(128, 64); Leg_2.mirror = true; setRotation(Leg_2, 0F, 0F, 0F); Arm_1 = new ModelRenderer(this, 60, 0); Arm_1.addBox(0F, -2F, -2.5F, 5, 20, 5); Arm_1.setRotationPoint(10F, -19F, 0F); Arm_1.setTextureSize(128, 64); Arm_1.mirror = true; setRotation(Arm_1, 0F, 0F, 0F); Arm_2 = new ModelRenderer(this, 60, 0); Arm_2.addBox(-5F, -2F, -2.5F, 5, 20, 5); Arm_2.setRotationPoint(-10F, -19F, 0F); Arm_2.setTextureSize(128, 64); Arm_2.mirror = true; setRotation(Arm_2, 0F, 0F, 0F); Head_1 = new ModelRenderer(this, 0, 14); Head_1.addBox(-3.5F, -3F, -4F, 7, 3, 7); Head_1.setRotationPoint(0F, -22F, 0F); Head_1.setTextureSize(128, 64); Head_1.mirror = true; setRotation(Head_1, 0F, 0F, 0F); Head_2 = new ModelRenderer(this, 0, 0); Head_2.addBox(-4F, -10F, -5F, 8, 7, 7); Head_2.setRotationPoint(0F, -22F, 0F); Head_2.setTextureSize(128, 64); Head_2.mirror = true; setRotation(Head_2, 0F, 0F, 0F); } public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); Body.render(f5); Leg_1.render(f5); Leg_2.render(f5); Arm_1.render(f5); Arm_2.render(f5); Head_1.render(f5); Head_2.render(f5); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); this.Head_1.rotateAngleY = f3 / (180F / (float)Math.PI); this.Head_1.rotateAngleX = f4 / (180F / (float)Math.PI); this.Head_2.rotateAngleY = f3 / (180F / (float)Math.PI); this.Head_2.rotateAngleX = f4 / (180F / (float)Math.PI); this.Leg_1.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1; this.Leg_2.rotateAngleX = MathHelper.cos(f * 0.6662F + (float)Math.PI) * 1.4F * f1; } /** * 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. */ public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4) { EntityTroll entitytroll = (EntityTroll)par1EntityLivingBase; int i = entitytroll.getAttackTimer(); if (i > 0) { this.Arm_1.rotateAngleX = -2.0F + 1.5F * this.moveArms((float)i - par4, 10.0F);; this.Arm_2.rotateAngleX = -2.0F + 1.5F * this.moveArms((float)i - par4, 10.0F);; } else { this.Arm_1.rotateAngleX = (-0.2F + 1.5F * this.moveArms(par2, 13.0F)) * par3; this.Arm_2.rotateAngleX = (-0.2F - 1.5F * this.moveArms(par2, 13.0F)) * par3; } } private float moveArms(float par1, float par2) { return (Math.abs(par1 % par2 - par2 * 0.5F) - par2 * 0.25F) / (par2 * 0.25F); } } RenderTroll.java package com.ctwagon.testmod.render; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; import com.ctwagon.testmod.Testmod; import com.ctwagon.testmod.entity.mobs.EntityTroll; public class RenderTroll extends RenderLiving { private static final ResourceLocation mobTextures = new ResourceLocation(Testmod.MODID + ":textures/entity/Troll.png"); private static final String __OBFID = "CL_00000984"; public RenderTroll(ModelBase par1ModelBase, float par2) { super(par1ModelBase, par2); } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(EntityTroll par1EntityTroll) { return mobTextures; } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(Entity par1Entity) { return this.getEntityTexture((EntityTroll)par1Entity); } }
  2. So I have a custom entity and almost everything is fine with it. It can be ridden and moved, but when it does, the parts don't rotate. Everything rotates fine when it is not being ridden. Here is the code for the mob. EntityElephant.java package com.ctwagon.testmod.entity.mobs; import net.minecraft.block.Block; import net.minecraft.block.BlockGrass; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.IEntityLivingData; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAILeapAtTarget; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAIMate; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import com.ctwagon.testmod.items.ModItems; public class EntityElephant extends EntityAnimal { public boolean moveTrunk; public EntityElephant(World par1World) { super(par1World); this.setSize(3.0F, 2.8F); this.getNavigator().setAvoidsWater(true); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 1.0D, true)); this.tasks.addTask(2, new EntityAIWander(this, 0.7D)); this.tasks.addTask(3, new EntityAILookIdle(this)); this.tasks.addTask(4, new EntityAIMate(this, 1.0D)); this.targetTasks.addTask(0, new EntityAIHurtByTarget(this, true)); } /** * Returns true if the newer Entity AI code should be run */ public boolean isAIEnabled() { return true; } protected void entityInit() { super.entityInit(); this.dataWatcher.addObject(16, Byte.valueOf((byte)0)); } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { super.writeEntityToNBT(par1NBTTagCompound); par1NBTTagCompound.setBoolean("Saddle", this.getSaddled()); } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { super.readEntityFromNBT(par1NBTTagCompound); this.setSaddled(par1NBTTagCompound.getBoolean("Saddle")); } public void setSaddled(boolean par1) { if (par1) { this.dataWatcher.updateObject(16, Byte.valueOf((byte)1)); } else { this.dataWatcher.updateObject(16, Byte.valueOf((byte)0)); } } public boolean getSaddled() { return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0; } protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.3D); } /** * Called when the mob is falling. Calculates and applies fall damage. */ protected void fall(float par1) {} protected Item getDropItem() { return ModItems.tusk; } /** * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param * par2 - Level of Looting used to kill this mob. */ protected void dropFewItems(boolean par1, int par2) { int j = this.rand.nextInt(4) + this.rand.nextInt(1 + par2); int k; for (k = 0; k < j; ++k) { this.dropItem(Items.leather, 1); } int l = this.rand.nextInt(2); int m; for (m=0; m <= l; ++m) { this.dropItem(ModItems.tusk, 1); } } public boolean interact(EntityPlayer par1EntityPlayer) { ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem(); if (itemstack != null && !this.getSaddled() && itemstack.getItem() == ModItems.largeSaddle) { par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null); this.setSaddled(true); return true; } else if (this.getSaddled() && this.riddenByEntity == null) { par1EntityPlayer.mountEntity(this); return true; } else { return false; } } /** * Moves the entity based on the specified heading. Args: strafe, forward */ public void moveEntityWithHeading(float par1, float par2) { if (this.riddenByEntity != null && this.getSaddled()) { this.prevRotationYaw = this.rotationYaw = this.riddenByEntity.rotationYaw; this.rotationPitch = this.riddenByEntity.rotationPitch * 0.5F; this.setRotation(this.rotationYaw, this.rotationPitch); this.rotationYawHead = this.renderYawOffset = this.rotationYaw; par1 = ((EntityLivingBase)this.riddenByEntity).moveStrafing * 0.5F; par2 = ((EntityLivingBase)this.riddenByEntity).moveForward; this.stepHeight = 1.0F; if (!this.worldObj.isRemote) { this.setAIMoveSpeed((float)this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue() * 0.5F); super.moveEntityWithHeading(par1, par2); } } else { this.stepHeight = 0.5F; this.jumpMovementFactor = 0.02F; super.moveEntityWithHeading(par1, par2); } } public boolean isBreedingItem(ItemStack par1ItemStack) { return par1ItemStack != null && par1ItemStack.getItem() == Item.getItemFromBlock(Blocks.tallgrass); } public boolean attackEntityAsMob(Entity par1Entity) { return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), 6.0F); } public EntityElephant createChild(EntityAgeable par1EntityAgeable) { return new EntityElephant(this.worldObj); } } ModelElephant.java package com.ctwagon.testmod.model; import com.ctwagon.testmod.entity.mobs.EntityElephant; import com.ctwagon.testmod.entity.mobs.EntityLion; 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.entity.passive.EntityHorse; import net.minecraft.util.MathHelper; public class ModelElephant extends ModelBase { //fields ModelRenderer Body1; ModelRenderer Body2; ModelRenderer Body3; ModelRenderer Body4; ModelRenderer Body5; ModelRenderer Saddle; ModelRenderer Leg1; ModelRenderer Leg2; ModelRenderer Leg3; ModelRenderer Leg4; ModelRenderer Head; ModelRenderer Ear1; ModelRenderer Ear2; ModelRenderer Trunk1; ModelRenderer Trunk2; ModelRenderer Trunk3; ModelRenderer Trunk4; ModelRenderer Tail; ModelRenderer Tusk1_1; ModelRenderer Tusk1_2; ModelRenderer Tusk1_3; ModelRenderer Tusk2_1; ModelRenderer Tusk2_2; ModelRenderer Tusk2_3; public ModelElephant() { textureWidth = 512; textureHeight = 256; Body1 = new ModelRenderer(this, 0, 17); Body1.addBox(-12F, -12F, -24F, 24, 20, 48); Body1.setRotationPoint(0F, -2F, 0F); Body1.setTextureSize(512, 256); Body1.mirror = true; setRotation(Body1, 0F, 0F, 0F); Body2 = new ModelRenderer(this, 0, 85); Body2.addBox(-11F, -13F, -23F, 22, 1, 46); Body2.setRotationPoint(0F, -2F, 0F); Body2.setTextureSize(512, 256); Body2.mirror = true; setRotation(Body2, 0F, 0F, 0F); Body3 = new ModelRenderer(this, 0, 132); Body3.addBox(-10F, -14F, -22F, 20, 1, 44); Body3.setRotationPoint(0F, -2F, 0F); Body3.setTextureSize(512, 256); Body3.mirror = true; setRotation(Body3, 0F, 0F, 0F); Body4 = new ModelRenderer(this, 0, 177); Body4.addBox(-8F, -15F, -20F, 16, 1, 40); Body4.setRotationPoint(0F, -2F, 0F); Body4.setTextureSize(512, 256); Body4.mirror = true; setRotation(Body4, 0F, 0F, 0F); Body5 = new ModelRenderer(this, 0, 218); Body5.addBox(-6F, -16F, -18F, 12, 1, 36); Body5.setRotationPoint(0F, -2F, 0F); Body5.setTextureSize(512, 256); Body5.mirror = true; setRotation(Body5, 0F, 0F, 0F); Saddle = new ModelRenderer(this, 176, 0); Saddle.addBox(-6F, -18F, -10F, 12, 3, 20); Saddle.setRotationPoint(0F, -2F, 0F); Saddle.setTextureSize(512, 256); Saddle.mirror = true; setRotation(Saddle, 0F, 0F, 0F); Leg1 = new ModelRenderer(this, 144, 17); Leg1.addBox(-3F, 0F, -3F, 6, 18, 6); Leg1.setRotationPoint(8F, 6F, -20F); Leg1.setTextureSize(512, 256); Leg1.mirror = true; setRotation(Leg1, 0F, 0F, 0F); Leg2 = new ModelRenderer(this, 144, 17); Leg2.addBox(-3F, 0F, -3F, 6, 18, 6); Leg2.setRotationPoint(-8F, 6F, -20F); Leg2.setTextureSize(512, 256); Leg2.mirror = true; setRotation(Leg2, 0F, 0F, 0F); Leg3 = new ModelRenderer(this, 144, 17); Leg3.addBox(-3F, 0F, -3F, 6, 18, 6); Leg3.setRotationPoint(8F, 6F, 20F); Leg3.setTextureSize(512, 256); Leg3.mirror = true; setRotation(Leg3, 0F, 0F, 0F); Leg4 = new ModelRenderer(this, 144, 17); Leg4.addBox(-3F, 0F, -3F, 6, 18, 6); Leg4.setRotationPoint(-8F, 6F, 20F); Leg4.setTextureSize(512, 256); Leg4.mirror = true; setRotation(Leg4, 0F, 0F, 0F); Head = new ModelRenderer(this, 0, 0); Head.addBox(-5F, -4F, -9F, 10, 8, 9); Head.setRotationPoint(0F, -6F, -24F); Head.setTextureSize(512, 256); Head.mirror = true; setRotation(Head, 0F, 0F, 0F); Ear1 = new ModelRenderer(this, 38, 0); Ear1.addBox(0F, -5F, 0F, 7, 13, 1); Ear1.setRotationPoint(5F, -6F, -27F); Ear1.setTextureSize(512, 256); Ear1.mirror = true; setRotation(Ear1, 0F, 0F, 0F); Ear2 = new ModelRenderer(this, 38, 0); Ear2.addBox(-7F, -5F, 0F, 7, 13, 1); Ear2.setRotationPoint(-5F, -6F, -27F); Ear2.setTextureSize(512, 256); Ear2.mirror = true; setRotation(Ear2, 0F, 0F, 0F); Trunk1 = new ModelRenderer(this, 54, 0); Trunk1.addBox(-2F, -1F, -2F, 4, 6, 4); Trunk1.setRotationPoint(0F, -3F, -35F); Trunk1.setTextureSize(512, 256); Trunk1.mirror = true; setRotation(Trunk1, 0F, 0F, 0F); Trunk2 = new ModelRenderer(this, 54, 0); Trunk2.addBox(-2F, 2F, -2F, 4, 6, 4); Trunk2.setRotationPoint(0F, -1F, -35F); Trunk2.setTextureSize(512, 256); Trunk2.mirror = true; setRotation(Trunk2, 0F, 0F, 0F); Trunk3 = new ModelRenderer(this, 54, 0); Trunk3.addBox(-2F, 4F, -2F, 4, 6, 4); Trunk3.setRotationPoint(0F, 2F, -35F); Trunk3.setTextureSize(512, 256); Trunk3.mirror = true; setRotation(Trunk3, 0F, 0F, 0F); Trunk4 = new ModelRenderer(this, 54, 0); Trunk4.addBox(-2F, 6F, -2F, 4, 6, 4); Trunk4.setRotationPoint(0F, 5F, -35F); Trunk4.setTextureSize(512, 256); Trunk4.mirror = true; setRotation(Trunk4, 0F, 0F, 0F); Tail = new ModelRenderer(this, 168, 17); Tail.addBox(-1F, 0F, 0F, 2, 10, 2); Tail.setRotationPoint(0F, -12F, 24F); Tail.setTextureSize(512, 256); Tail.mirror = true; setRotation(Tail, 0F, 0F, 0F); Tusk1_1 = new ModelRenderer(this, 70, 0); Tusk1_1.addBox(5F, 3F, -11F, 2, 2, 4); Tusk1_1.setRotationPoint(0F, -6F, -24F); Tusk1_1.setTextureSize(512, 256); Tusk1_1.mirror = true; setRotation(Tusk1_1, 0F, 0F, 0F); Tusk1_2 = new ModelRenderer(this, 82, 0); Tusk1_2.addBox(5F, 4F, -16F, 2, 2, 5); Tusk1_2.setRotationPoint(0F, -6F, -24F); Tusk1_2.setTextureSize(512, 256); Tusk1_2.mirror = true; setRotation(Tusk1_2, 0F, 0F, 0F); Tusk1_3 = new ModelRenderer(this, 96, 0); Tusk1_3.addBox(4F, 3F, -18F, 2, 2, 2); Tusk1_3.setRotationPoint(0F, -6F, -24F); Tusk1_3.setTextureSize(512, 256); Tusk1_3.mirror = true; setRotation(Tusk1_3, 0F, 0F, 0F); Tusk2_1 = new ModelRenderer(this, 70, 0); Tusk2_1.addBox(-7F, 3F, -11F, 2, 2, 4); Tusk2_1.setRotationPoint(0F, -6F, -24F); Tusk2_1.setTextureSize(512, 256); Tusk2_1.mirror = true; setRotation(Tusk2_1, 0F, 0F, 0F); Tusk2_2 = new ModelRenderer(this, 82, 0); Tusk2_2.addBox(-7F, 4F, -16F, 2, 2, 5); Tusk2_2.setRotationPoint(0F, -6F, -24F); Tusk2_2.setTextureSize(512, 256); Tusk2_2.mirror = true; setRotation(Tusk2_2, 0F, 0F, 0F); Tusk2_3 = new ModelRenderer(this, 96, 0); Tusk2_3.addBox(-6F, 3F, -18F, 2, 2, 2); Tusk2_3.setRotationPoint(0F, -6F, -24F); Tusk2_3.setTextureSize(512, 256); Tusk2_3.mirror = true; setRotation(Tusk2_3, 0F, 0F, 0F); } public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); EntityElephant entityelephant = (EntityElephant)entity; setRotationAngles(f, f1, f2, f3, f4, f5, entity); Body1.render(f5); Body2.render(f5); Body3.render(f5); Body4.render(f5); Body5.render(f5); Leg1.render(f5); Leg2.render(f5); Leg3.render(f5); Leg4.render(f5); Head.render(f5); Ear1.render(f5); Ear2.render(f5); Trunk1.render(f5); Trunk2.render(f5); Trunk3.render(f5); Trunk4.render(f5); Tail.render(f5); Tusk1_1.render(f5); Tusk1_2.render(f5); Tusk1_3.render(f5); Tusk2_1.render(f5); Tusk2_2.render(f5); Tusk2_3.render(f5); if (entityelephant.getSaddled()) { Saddle.render(f5); } } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); this.Leg1.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1; this.Leg2.rotateAngleX = MathHelper.cos(f * 0.6662F + (float)Math.PI) * 1.4F * f1; this.Leg3.rotateAngleX = MathHelper.cos(f * 0.6662F + (float)Math.PI) * 1.4F * f1; this.Leg4.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1; this.Tail.rotateAngleZ = MathHelper.cos(f * 0.6662F) * 1.4F * f1; this.Ear1.rotateAngleY = MathHelper.cos(f * 0.3332F) * 1.4F * f1; this.Ear2.rotateAngleY = -MathHelper.cos(f * 0.3332F) * 1.4F * f1; this.Trunk1.rotateAngleZ = MathHelper.cos(f * 0.6662F) * 1.05F * f1; this.Trunk2.rotateAngleZ = MathHelper.cos(f * 0.6662F) * 1.1F * f1; this.Trunk3.rotateAngleZ = MathHelper.cos(f * 0.6662F) * 1.15F * f1; this.Trunk4.rotateAngleZ = MathHelper.cos(f * 0.6662F) * 1.2F * f1; } } RenderElephant.java package com.ctwagon.testmod.render; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.ResourceLocation; import com.ctwagon.testmod.Testmod; import com.ctwagon.testmod.entity.mobs.EntityElephant; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class RenderElephant extends RenderLiving { private static final ResourceLocation mobTextures = new ResourceLocation(Testmod.MODID + ":textures/entity/Elephant.png"); private static final String __OBFID = "CL_00000984"; public RenderElephant(ModelBase par1ModelBase, float par2) { super(par1ModelBase, par2); } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(EntityElephant par1EntityElephant) { return mobTextures; } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(Entity par1Entity) { return this.getEntityTexture((EntityElephant)par1Entity); } }
  3. I can get it to work with an ItemBlock but have not tried it without yet.
  4. I understand what you are saying Black and have changed my code. Thank you for explaining yourself and also for your help.
  5. Sorry that I am still relatively new to java. I am still learning as I am making this so there is no reason to be rude. I copied and pasted because it is faster then writing the same code myself. If anyone else is kind enough to help it would be greatly appreciated.
  6. I am trying to make custom leaf blocks but I am having trouble. I copied the code from BlockNewLeaf and tweaked it a little. The problem I am having is that the leaves don't seem to have damage values. I can see two different blocks with my textures in the creative inventory, but instead of having the Id with a slash and the damage value, they both only show the same Id. When they are placed in the world, the two different blocks get the same texture and using the pick block key gives you just that type of block. Another problem I am having is that the blocks allow you to see through the world when placed next to another block. ModLeaves.java
  7. The issue is not in the class rendering the fish, it is with the model. I would need to see the fish model code to help you.
  8. Try registering your small iceball as a new entity in your client proxy. RenderingRegistry.registerEntityRenderingHandler(EntitySmallIceball.class, new RenderIceball(0.5F));
  9. I have tried extending EntityArrow but now I get hit in the back with the projectile. I have tried what was suggested in the post that was linked but cannot figure out the problem.
  10. You set RightFin.mirror to true twice then set it to false. I have had this problem with techne before. Just take out the extra RightFin.mirror s and it should work.
  11. I made a blowgun that shoots custom projectiles. The code for the gun and the darts are copies of the code for bows and arrows. When I shoot the gun in creative, the dart flies just fine but when I am in survival, the dart appears to shoot behind me before appearing ahead of me and hitting its target. When I change the projectile to an arrow in the gun code, I do not have this problem even though it is the same code as my darts. Blowgun.java EntityDart.java RenderDart.java
×
×
  • Create New...

Important Information

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