August 8, 201411 yr Author Ok, so now my mob doesn't die after a little bit of time, but it doesn't matter if he is in the water or not. Im thinking I could just do this to make it move: this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.5D); and put this under the applyEntityAttributes method. Would that make it actually move or is there something else I have to do? Also what could I do so my fish mob dies on land but not in water? Any help would be appretiated! Hello everyone! I'm the developer and owner of a mod called MagZ Aquatic Life Experience. Right now it's being worked on, but when it's released, check it out! --[Also Check Out My Website!]--
August 9, 201411 yr Author Ok so now I edited and switched around a couple things in my entityfishmob class, but now when I spawn the mob, it just flies straight up and never dies. Can anyone help me out? Here is my code: package com.MagZAquaticLifeExperience.common.entity; import com.MagZAquaticLifeExperience.common.MagzAquaticLifeExperience; import net.minecraft.block.material.Material; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.passive.EntityWaterMob; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class EntityFishMob extends EntityWaterMob { private float randomMotionSpeed; private float randomMotionVecX; private float randomMotionVecY; private float randomMotionVecZ; public EntityFishMob(World par1World) { super(par1World); this.setSize(1.0F, 0.5F); } protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(200.0D); } @Override protected boolean canTriggerWalking() { return false; } @Override public boolean isInWater() { return true; //this.worldObj.handleMaterialAcceleration(this.boundingBox.expand(0.0D, -0.6000000238418579D, 0.0D), Material.water, this) } @Override public void onLivingUpdate() { super.onLivingUpdate(); if (this.isInWater()) { this.randomMotionSpeed = 4.0F; this.randomMotionVecX = 1.0F; this.randomMotionVecY = 1.0F; this.randomMotionVecZ = 1.0F; this.worldObj.handleMaterialAcceleration(this.boundingBox.expand(0.0D, -0.6000000238418579D, 0.0D), Material.water, this); }else{ this.randomMotionSpeed = 0.0F; this.randomMotionVecX = 0.0F; this.randomMotionVecY = 0.0F; this.randomMotionVecZ = 0.0F; } if (!this.worldObj.isRemote) { this.motionX = (double)(this.randomMotionVecX * this.randomMotionSpeed); this.motionY = (double)(this.randomMotionVecY * this.randomMotionSpeed); this.motionZ = (double)(this.randomMotionVecZ * this.randomMotionSpeed); } if (!this.worldObj.isRemote) { this.motionX = 0.0D; this.motionY -= 0.08D; this.motionY *= 0.9800000190734863D; this.motionZ = 0.0D; } } @Override public void moveEntityWithHeading(float par1, float par2) { this.moveEntity(this.motionX, this.motionY, this.motionZ); } @Override protected void updateEntityActionState() { ++this.entityAge; if (this.entityAge > 100) { this.randomMotionVecX = this.randomMotionVecY = this.randomMotionVecZ = 0.0F; } else if (this.rand.nextInt(50) == 0 || !this.inWater || this.randomMotionVecX == 0.0F && this.randomMotionVecY == 0.0F && this.randomMotionVecZ == 0.0F) { float f = this.rand.nextFloat() * (float)Math.PI * 2.0F; this.randomMotionVecX = MathHelper.cos(f) * 0.2F; this.randomMotionVecY = -0.1F + this.rand.nextFloat() * 0.2F; this.randomMotionVecZ = MathHelper.sin(f) * 0.2F; } this.despawnEntity(); } @Override public boolean getCanSpawnHere() { return this.posY > 45.0D && this.posY < 63.0D && super.getCanSpawnHere(); } @Override protected void dropFewItems(boolean par1, int par2) { int j = this.rand.nextInt(3 + par2) + 1; for (int k = 0; k < j; ++k) { this.entityDropItem(new ItemStack(MagzAquaticLifeExperience.SaltwaterFish, 1, 0), 0.0F); } } protected String getLivingSound() { return ""; } protected String getDeathSound() { return ""; } } Hello everyone! I'm the developer and owner of a mod called MagZ Aquatic Life Experience. Right now it's being worked on, but when it's released, check it out! --[Also Check Out My Website!]--
August 10, 201411 yr Author bumparoo Hello everyone! I'm the developer and owner of a mod called MagZ Aquatic Life Experience. Right now it's being worked on, but when it's released, check it out! --[Also Check Out My Website!]--
August 13, 201411 yr Author Anyone? Hello everyone! I'm the developer and owner of a mod called MagZ Aquatic Life Experience. Right now it's being worked on, but when it's released, check it out! --[Also Check Out My Website!]--
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.