
qpwoeiruty
Members-
Posts
159 -
Joined
-
Last visited
Everything posted by qpwoeiruty
-
Okay I will try figure it out now, thanks for the help.
-
Ahh, thank you. By "mod support" I mean so I can spawn my entity in mod biomes. So I have: EntityRegistry.addSpawn(entityName, 10, 1, 1, EnumCreatureType.monster, BiomeGenBase.exampleBiome); But I don't know what to do with other mods biomes.
-
Is there a way to spawn my entity in any biome without listing them all out? Also how would I go about adding mod support like biomes o plenty?
-
Ohhhhhh, I didn't know that classed as an int. Anyway, thanks that was easier than I thought
-
How do I change the colour of my text, as I see something in the FontRenderer class, but I don't know how to do it. It seems it is to do with this number. this.fontRendererObj.drawString(this.entityBlockling.getCustomNameTag(), this.xSize / 2 - this.fontRendererObj.getStringWidth(this.entityBlockling.getCustomNameTag()) / 2, 6, 4210752);
-
[1.7.10] Getting Variables From Entity Class To Display In Gui
qpwoeiruty replied to qpwoeiruty's topic in Modder Support
Oh yeah, sorry: public GUIBlockling(InventoryPlayer inventoryPlayer, InventoryBlockling inv, EntityBlockling entityBlockling) { -
I have a gui that displays fine but I want to access the variables from that class. I have successfully done this I think by looking at the horse gui, but now get a crash when I try to open it. I think it is due to: return new GUIBlockling(player.inventory, new InventoryBlockling("Inventory", 22), null); I had an error there before, but am not sure how to resolve it, sorry I am still trying to learn both java and modding.
-
I have an entity that can spawn with a different max health each time, but it only has the default 2 health that the default would have. I want to heal the entity when it spawns so it actually has full health and doesn't just appear to. I have tried doing it before but it doesn't seem like it wants to work. I also want to make sure that it doesn't happen again so it doesn't have a natural regen, just once when it first spawns.
-
[1.7.10] Sitting Isn't Unique To The Entity
qpwoeiruty replied to qpwoeiruty's topic in Modder Support
It was fine in my old mod which I am just rewriting, but I might try writing my own field to NBT then syncing it using packets. -
I have a custom entity that when sitting changes position like a wolf. However, despite it working fine, when another of my custom entity is walking, the sitting entity starts to perform the walking animation even though I have specified it to be only when it isn't walking. package com.blocklings.entity; import java.util.Random; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAIBeg; import net.minecraft.entity.ai.EntityAIFollowOwner; 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.EntityAIOwnerHurtByTarget; import net.minecraft.entity.ai.EntityAIOwnerHurtTarget; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAITargetNonTamed; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.ai.attributes.IAttributeInstance; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.entity.passive.EntityTameable; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.pathfinding.PathEntity; import net.minecraft.util.ChatComponentText; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import com.blocklings.network.CreatePacketServerSide; public class EntityBlockling extends EntityTameable { Random random = new Random(); public int currentXP = 0; public int currentLevel = 1; public int requiredXP = 200; public float moveTimer = 0; public boolean moveTimerSwitch = true; public EntityBlockling(World world) { super(world); this.setSize(0.5F, 0.5F); this.getNavigator().setAvoidsWater(true); this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(2, this.aiSit); this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F)); this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, true)); this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F)); this.tasks.addTask(6, new EntityAIMate(this, 1.0D)); this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(9, new EntityAILookIdle(this)); this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this)); this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this)); this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true)); this.setTamed(false); } @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.3D); this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2.0D); } @Override public void onLivingUpdate() { super.onLivingUpdate(); this.moveTimer(); if(!this.worldObj.isRemote) { CreatePacketServerSide.sendS2CEntitySync(this); } } @Override public boolean attackEntityAsMob(Entity entity) { this.addXP(random.nextInt(5)); return entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue()); } @Override public boolean interact(EntityPlayer entityPlayer) { ItemStack itemstack = entityPlayer.inventory.getCurrentItem(); Item yellowFlower = Item.getItemFromBlock(Blocks.yellow_flower); Item redFlower = Item.getItemFromBlock(Blocks.red_flower); Item tallFlower = Item.getItemFromBlock(Blocks.double_plant); if(itemstack != null && (itemstack.getItem() == yellowFlower || itemstack.getItem() == redFlower || itemstack.getItem() == tallFlower) && !this.isTamed() && !this.worldObj.isRemote) { if(random.nextInt(3) == 0) { this.setTamed(true); this.setPathToEntity((PathEntity) null); this.setAttackTarget((EntityLivingBase) null); this.func_152115_b(entityPlayer.getUniqueID().toString()); this.playTameEffect(true); this.worldObj.setEntityState(this, (byte) 7); } else { this.playTameEffect(false); this.worldObj.setEntityState(this, (byte) 6); } } if(this.func_152114_e(entityPlayer) && entityPlayer.isSneaking() && !this.worldObj.isRemote) { if(this.getCustomNameTag().length() > 0) { entityPlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + " - " + this.getCustomNameTag() + " -")); entityPlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "Level: " + EnumChatFormatting.WHITE + "" + EnumChatFormatting.ITALIC + "" + this.currentLevel)); entityPlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "XP: " + EnumChatFormatting.WHITE + "" + EnumChatFormatting.ITALIC + "" + this.currentXP + "/" + this.requiredXP)); entityPlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "Max Health: " + EnumChatFormatting.WHITE + "" + EnumChatFormatting.ITALIC + "" + (int) this.getHealth() + "/" + (int) this.getEntityAttribute(SharedMonsterAttributes.maxHealth).getAttributeValue())); } else { entityPlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + " - " + "Your Blockling" + " -")); entityPlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "" + "Level: " + EnumChatFormatting.WHITE + "" + EnumChatFormatting.ITALIC + "" + this.currentLevel)); entityPlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "" + "XP: " + EnumChatFormatting.WHITE + "" + EnumChatFormatting.ITALIC + "" + this.currentXP + "/" + this.requiredXP)); entityPlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "Max Health: " + EnumChatFormatting.WHITE + "" + EnumChatFormatting.ITALIC + "" + (int) this.getHealth() + "/" + (int) this.getEntityAttribute(SharedMonsterAttributes.maxHealth).getAttributeValue())); } } if (this.func_152114_e(entityPlayer) && !entityPlayer.isSneaking() && !this.worldObj.isRemote) { this.aiSit.setSitting(!this.isSitting()); } return super.interact(entityPlayer); } /*@Override protected float applyArmorCalculations(DamageSource p_70655_1_, float p_70655_2_) { return 1.0F; }*/ @Override public boolean isAIEnabled() { return true; } @Override public void writeEntityToNBT(NBTTagCompound compound) { super.writeEntityToNBT(compound); compound.setInteger("currentXP", this.currentXP); compound.setInteger("currentLevel", this.currentLevel); compound.setInteger("requiredXP", this.requiredXP); compound.setFloat("moveTimer", this.moveTimer); } @Override public void readEntityFromNBT(NBTTagCompound compound) { super.readEntityFromNBT(compound); this.currentXP = compound.getInteger("currentXP"); this.currentLevel = compound.getInteger("currentLevel"); this.requiredXP = compound.getInteger("requiredXP"); this.moveTimer = compound.getFloat("moveTimer"); } @Override public EntityAgeable createChild(EntityAgeable entityAgeable) { return null; } public void addXP(int xp) { this.currentXP = this.currentXP + xp; setBlocklingLevel(); } public void calculateRequiredXP() { this.requiredXP = (50 * (this.currentLevel * this.currentLevel) + (150 * this.currentLevel)); } public void setBlocklingLevel() { if (this.currentXP > this.requiredXP) { this.currentLevel = this.currentLevel + 1; this.calculateRequiredXP(); this.currentXP = 0; if(!this.worldObj.isRemote) { CreatePacketServerSide.sendS2CEntitySync(this); } } } public void moveTimer() { if(this.moveTimerSwitch) { this.moveTimer += 2.5F; } if(!this.moveTimerSwitch) { this.moveTimer -= 2.5F; } if(this.moveTimer >= 10.0F) { this.moveTimerSwitch = false; } if(this.moveTimer <= -10.0) { this.moveTimerSwitch = true; } } public int getLevel() { return this.currentLevel; } public void setLevel(int currentLevel) { this.currentLevel = currentLevel; } public float getMoveTimer() { return this.moveTimer; } public void setMoveTimer(float moveTimer) { this.moveTimer = moveTimer; } } package com.blocklings.model; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import com.blocklings.entity.EntityBlockling; public class ModelBlockling extends ModelBase { ModelRenderer body; ModelRenderer leftArm; ModelRenderer rightArm; ModelRenderer leftEye; ModelRenderer rightEye; ModelRenderer leftFoot; ModelRenderer rightFoot; public ModelBlockling() { textureWidth = 64; textureHeight = 32; body = new ModelRenderer(this, 0, 0); body.addBox(-4F, -4F, -4F, 8, 8, ; body.setRotationPoint(0F, 18.5F, 0F); body.setTextureSize(64, 32); body.mirror = true; setRotation(body, 0.1047198F, 0F, 0F); leftArm = new ModelRenderer(this, 32, 0); leftArm.addBox(-5F, 0F, -1F, 2, 3, 3); leftArm.setRotationPoint(0F, 18.5F, 0F); leftArm.setTextureSize(64, 32); leftArm.mirror = true; setRotation(leftArm, -0.8726646F, 0F, 0F); rightArm = new ModelRenderer(this, 42, 0); rightArm.addBox(3F, 0F, -1F, 2, 3, 3); rightArm.setRotationPoint(0F, 18.5F, 0F); rightArm.setTextureSize(64, 32); rightArm.mirror = true; setRotation(rightArm, -0.8726646F, 0F, 0F); leftEye = new ModelRenderer(this, 32, 12); leftEye.addBox(-2F, 0F, -4.5F, 1, 2, 1); leftEye.setRotationPoint(0F, 18.5F, 0F); leftEye.setTextureSize(64, 32); leftEye.mirror = true; setRotation(leftEye, 0.1047198F, 0F, 0F); rightEye = new ModelRenderer(this, 36, 12); rightEye.addBox(1F, 0F, -4.5F, 1, 2, 1); rightEye.setRotationPoint(0F, 18.5F, 0F); rightEye.setTextureSize(64, 32); rightEye.mirror = true; setRotation(rightEye, 0.1047198F, 0F, 0F); leftFoot = new ModelRenderer(this, 32, 6); leftFoot.addBox(-3.5F, 2.5F, -1F, 3, 3, 3); leftFoot.setRotationPoint(0F, 18.5F, 0F); leftFoot.setTextureSize(64, 32); leftFoot.mirror = true; setRotation(leftFoot, 0F, 0F, 0F); rightFoot = new ModelRenderer(this, 44, 6); rightFoot.addBox(0.5F, 2.5F, -1F, 3, 3, 3); rightFoot.setRotationPoint(0F, 18.5F, 0F); rightFoot.setTextureSize(64, 32); rightFoot.mirror = true; setRotation(rightFoot, 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); leftArm.render(f5); rightArm.render(f5); leftEye.render(f5); rightEye.render(f5); leftFoot.render(f5); rightFoot.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); } public void setLivingAnimations(EntityLivingBase entityLivingBase, float f1, float f2, float f3) { EntityBlockling entityBlockling = (EntityBlockling) entityLivingBase; float moveTimer = entityBlockling.getMoveTimer(); if(entityBlockling.isSitting()) { body.offsetY = 0.1F; leftEye.offsetY = 0.1F; rightEye.offsetY = 0.1F; leftArm.offsetY = 0.1F; rightArm.offsetY = 0.1F; System.out.println("a"); } if(!entityBlockling.isSitting()) { body.rotateAngleX = ((moveTimer * f2) / 100) + 0.05F; leftEye.rotateAngleX = ((moveTimer * f2) / 100) + 0.05F; rightEye.rotateAngleX = ((moveTimer * f2) / 100) + 0.05F; leftFoot.rotateAngleX = (moveTimer * f2 * 2) / -40; rightFoot.rotateAngleX = (moveTimer * f2 * 2) / 40; leftArm.rotateAngleX = ((moveTimer * f2 * 2) / 25) - 0.9F; rightArm.rotateAngleX = ((moveTimer * f2 * 2) / -25) - 0.9F; body.offsetY = 0.0F; leftEye.offsetY = 0.0F; rightEye.offsetY = 0.0F; leftArm.offsetY = 0.0F; rightArm.offsetY = 0.0F; System.out.println("b"); } } }
-
My custom entity will sit, but then it will still move around at its own accord, I have no idea why this is happening. package com.blocklings.entity; import java.util.Random; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAIBeg; import net.minecraft.entity.ai.EntityAIFollowOwner; 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.EntityAIOwnerHurtByTarget; import net.minecraft.entity.ai.EntityAIOwnerHurtTarget; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAITargetNonTamed; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.ai.attributes.IAttributeInstance; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.entity.passive.EntityTameable; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.pathfinding.PathEntity; import net.minecraft.util.ChatComponentText; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import com.blocklings.network.CreatePacketServerSide; public class EntityBlockling extends EntityTameable { Random random = new Random(); public int currentXP = 0; public int currentLevel = 1; public int requiredXP = 200; public float moveTimer = 0; public boolean moveTimerSwitch = true; public EntityBlockling(World world) { super(world); setSize(0.5F, 0.5F); getNavigator().setAvoidsWater(true); tasks.addTask(1, new EntityAISwimming(this)); tasks.addTask(2, this.aiSit); tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F)); tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, true)); tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F)); tasks.addTask(6, new EntityAIMate(this, 1.0D)); tasks.addTask(7, new EntityAIWander(this, 1.0D)); tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); tasks.addTask(9, new EntityAILookIdle(this)); targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this)); targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this)); targetTasks.addTask(3, new EntityAIHurtByTarget(this, true)); setTamed(false); } @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D); getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.3D); getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage); getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2.0D); } @Override public void onLivingUpdate() { super.onLivingUpdate(); moveTimer(); if(!worldObj.isRemote) { CreatePacketServerSide.sendS2CEntitySync(this); } } @Override public boolean attackEntityAsMob(Entity entity) { addXP(random.nextInt(5)); return entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue()); } @Override public boolean interact(EntityPlayer entityPlayer) { ItemStack itemstack = entityPlayer.inventory.getCurrentItem(); Item yellowFlower = Item.getItemFromBlock(Blocks.yellow_flower); Item redFlower = Item.getItemFromBlock(Blocks.red_flower); Item tallFlower = Item.getItemFromBlock(Blocks.double_plant); EntityLivingBase owner = this.getOwner(); if(itemstack != null && (itemstack.getItem() == yellowFlower || itemstack.getItem() == redFlower || itemstack.getItem() == tallFlower) && !this.isTamed() && !this.worldObj.isRemote) { if(random.nextInt(3) == 0) { setTamed(true); setPathToEntity((PathEntity) null); setAttackTarget((EntityLivingBase) null); setOwner(entityPlayer.getCommandSenderName()); playTameEffect(true); worldObj.setEntityState(this, (byte) 7); } else { playTameEffect(false); worldObj.setEntityState(this, (byte) 6); } } if(entityPlayer == owner && entityPlayer.isSneaking() && !worldObj.isRemote) { if(getCustomNameTag().length() > 0) { entityPlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + " - " + getCustomNameTag() + " -")); entityPlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "Level: " + EnumChatFormatting.WHITE + "" + EnumChatFormatting.ITALIC + "" + currentLevel)); entityPlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "XP: " + EnumChatFormatting.WHITE + "" + EnumChatFormatting.ITALIC + "" + currentXP + "/" + requiredXP)); entityPlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "Max Health: " + EnumChatFormatting.WHITE + "" + EnumChatFormatting.ITALIC + "" + (int) getHealth() + "/" + (int) getEntityAttribute(SharedMonsterAttributes.maxHealth).getAttributeValue())); } else { entityPlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + " - " + "Your Blockling" + " -")); entityPlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "" + "Level: " + EnumChatFormatting.WHITE + "" + EnumChatFormatting.ITALIC + "" + currentLevel)); entityPlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "" + "XP: " + EnumChatFormatting.WHITE + "" + EnumChatFormatting.ITALIC + "" + currentXP + "/" + requiredXP)); entityPlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "Max Health: " + EnumChatFormatting.WHITE + "" + EnumChatFormatting.ITALIC + "" + (int) getHealth() + "/" + (int) getEntityAttribute(SharedMonsterAttributes.maxHealth).getAttributeValue())); } } if (entityPlayer == owner && !entityPlayer.isSneaking() && !this.worldObj.isRemote) { setSitting(!isSitting()); } return super.interact(entityPlayer); } @Override protected float applyArmorCalculations(DamageSource p_70655_1_, float p_70655_2_) { return 1.0F; } @Override public boolean isAIEnabled() { return true; } @Override public void writeEntityToNBT(NBTTagCompound compound) { super.writeEntityToNBT(compound); compound.setInteger("currentXP", currentXP); compound.setInteger("currentLevel", currentLevel); compound.setInteger("requiredXP", requiredXP); } @Override public void readEntityFromNBT(NBTTagCompound compound) { super.readEntityFromNBT(compound); currentXP = compound.getInteger("currentXP"); currentLevel = compound.getInteger("currentLevel"); requiredXP = compound.getInteger("requiredXP"); } @Override public EntityAgeable createChild(EntityAgeable entityAgeable) { return null; } public void addXP(int xp) { currentXP = currentXP + xp; setBlocklingLevel(); } public void calculateRequiredXP() { requiredXP = (50 * (currentLevel * currentLevel) + (150 * currentLevel)); } public void setBlocklingLevel() { if (currentXP > requiredXP) { currentLevel = currentLevel + 1; calculateRequiredXP(); currentXP = 0; if(!worldObj.isRemote) { CreatePacketServerSide.sendS2CEntitySync(this); } } } public void moveTimer() { if(moveTimerSwitch) { moveTimer += 2.5F; } if(!moveTimerSwitch) { moveTimer -= 2.5F; } if(moveTimer >= 10.0F) { moveTimerSwitch = false; } if(moveTimer <= -10.0) { moveTimerSwitch = true; } } public int getLevel() { return currentLevel; } public void setLevel(int currentLevel) { this.currentLevel = currentLevel; } public float getMoveTimer() { return moveTimer; } public void setMoveTimer(float moveTimer) { this.moveTimer = moveTimer; } }
-
No change, perhaps it is just something to do with forge or maybe the hitbox, I am not sure.
-
My custom entity, no matter what always sinks to the bottom of any pool of water and just sits there awaiting its death. Here is all the AI code: this.getNavigator().setAvoidsWater(true); this.getNavigator().setCanSwim(true); this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(2, this.aiSit); this.tasks.addTask(3, new EntityAIAttackOnCollide(this, 1.0D, false)); this.tasks.addTask(4, new EntityAIFollowOwner(this, 1.0D, 6.0F, 3.0F)); this.tasks.addTask(5, new EntityAIWander(this, 1.0D)); this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(6, new EntityAILookIdle(this)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true)); this.targetTasks.addTask(2, new EntityAIOwnerHurtByTarget(this)); this.targetTasks.addTask(3, new EntityAIOwnerHurtTarget(this)); this.setTamed(false);
-
[1.7.10] Child Parts Of Model Unable To Rotate
qpwoeiruty replied to qpwoeiruty's topic in Modder Support
Just so you can visualize what I mean. You can't rotate that part of the model if it is a child or the parent, but you can if it isn't. -
[1.7.10] Child Parts Of Model Unable To Rotate
qpwoeiruty replied to qpwoeiruty's topic in Modder Support
Well in Techne when I have a part that is a child I can't rotate it but if it isn't I can. -
[1.7.10] Child Parts Of Model Unable To Rotate
qpwoeiruty replied to qpwoeiruty's topic in Modder Support
The body part goes back to being horizontal instead of rotated 12. -
Does anyone know why this is. They just reset back to 0, 0, 0 and no matter what you do they don't rotate.
-
Thanks I will look at your tutorial now
-
I was wondering how I use the addChild() method correctly so that my animations don't mess up.
-
Ahhh, thanks I think I can get it working.
-
Here is the model class if that helps: package com.blocklings.model; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import com.blocklings.entity.EntityBlockling; public class ModelBlockling extends ModelBase { ModelRenderer BlocklingBody1; ModelRenderer BlocklingArmLeft1; ModelRenderer BlocklingArmRight1; public ModelBlockling() { textureWidth = 256; textureHeight = 128; BlocklingBody1 = new ModelRenderer(this, 0, 0); BlocklingBody1.addBox(-4F, -4F, -4F, 8, 8, ; BlocklingBody1.setRotationPoint(0F, 20F, 0F); BlocklingBody1.setTextureSize(256, 128); BlocklingBody1.mirror = true; setRotation(BlocklingBody1, 0F, 0F, 0F); BlocklingArmLeft1 = new ModelRenderer(this, 175, 0); BlocklingArmLeft1.addBox(-2F, 0F, -1F, 2, 5, 2); BlocklingArmLeft1.setRotationPoint(-3F, 18F, 0F); BlocklingArmLeft1.setTextureSize(256, 128); BlocklingArmLeft1.mirror = true; setRotation(BlocklingArmLeft1, 0F, 0F, 0.3490659F); BlocklingArmRight1 = new ModelRenderer(this, 100, 0); BlocklingArmRight1.addBox(0F, 0F, -1F, 2, 5, 2); BlocklingArmRight1.setRotationPoint(3F, 18F, 0F); BlocklingArmRight1.setTextureSize(256, 128); BlocklingArmRight1.mirror = true; setRotation(BlocklingArmRight1, 0F, 0F, -0.3490659F); } 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); BlocklingBody1.render(f5); BlocklingArmLeft1.render(f5); BlocklingArmRight1.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); } public void setLivingAnimations(EntityLivingBase entityLivingBase, float par2, float par3, float par4) { EntityBlockling entityBlockling = (EntityBlockling)entityLivingBase; int level = entityBlockling.getLevel(); if(level == 1) { this.BlocklingArmLeft1.rotateAngleX = (-0.2F + 1.0F * this.func_78172_a(par2, 13.0F)) * par3; this.BlocklingArmRight1.rotateAngleX = (-0.2F - 1.0F * this.func_78172_a(par2, 13.0F)) * par3; } else { this.BlocklingArmLeft1.rotateAngleX = (-2000F + 1.0F * this.func_78172_a(par2, 13.0F)) * par3; this.BlocklingArmRight1.rotateAngleX = (-2000F - 1.0F * this.func_78172_a(par2, 13.0F)) * par3; } } private float func_78172_a(float par1, float par2) { return (Math.abs(par1 % par2 - par2 * 0.5F) - par2 * 0.25F) / (par2 * 0.25F); } }
-
I have a model and when something is true it is supposed to get bigger. I have done this before by creating both sizes and hiding the one that is not needed, but I was wondering if there was a way to just update the model size instead of creating different ones.
-
[1.7.10] Printing Custom Name To Chat Problem
qpwoeiruty replied to qpwoeiruty's topic in Modder Support
Thanks for the reply, it all works now. I tried it without the empty string earlier but received an error, probably because I can't use the chat formatting next to a field by itself. -
When you shift right click I want my custom entities name to appear on the first line and then its xp (my custom field) on the next. That works fine, but if it doesn't have a name I just want it to print the line with the xp, but it doesn't it prints a blank line, then the xp, as if it tries to print the custom name even though I have specified it to only print one line if there is not custom name. if(this.func_152114_e(entityPlayer) && entityPlayer.isSneaking() && !this.worldObj.isRemote) { if(this.getCustomNameTag() != null) { entityPlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "" + this.getCustomNameTag())); entityPlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "" + this.currentXP)); } else if (this.getCustomNameTag() == null) { entityPlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "" + this.currentXP)); } }
-
Ohhh, that would make sense I suppose, thank you