Jump to content

MagnumMike55

Members
  • Posts

    30
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • URL
    http://magzgamez.weebly.com/
  • Location
    Colorado
  • Personal Text
    Owner of -[]MagZ Aquatic Life Experience[]-

MagnumMike55's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Quick question coolAlias. When you said "create a custom AI class and add it as a task for your fish" does that mean make the custom ai class and in my entityfishmob class, extend it? Ex: public class EntityFishMob extends CustomAI() { } I think i'm just confused on what you're saying, even if it is obvious. Anyway thanks for the help!
  2. Thanks for the reply! But yeah I can't find any open source code for fish mobs . Could you possibly help me work things out? Like how to make it pathfind and such. I'm a little new to how mob AI's work for minecraft. I was mainly focused on gui's, tile entities and such. So could anyone help me out? Please don't post code, just tell me how to work things out. Thanks
  3. What I mean is my water mob is jumping in the water like regular mobs do. Here is my code and yes I did extend the entitywatermob class. If things look like they shoudn't be there, it's becuase im trying to write my own AI since the entitysquid class isn't helping. My entityfishmob class: 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(4.0D); } public boolean canBreatheUnderwater() { return true; } public void moveEntityWithHeading(float par1, float par2) { this.moveEntity(this.motionX, this.motionY, this.motionZ); } @Override public boolean isInWater() { return this.worldObj.handleMaterialAcceleration(this.boundingBox.expand(1.0D, 0.0D, 0.0D), Material.water, this); } @Override public void onLivingUpdate() { super.onLivingUpdate(); if(this.isInWater()) { this.randomMotionSpeed = 2.0F; } if(!this.isInWater()) { this.randomMotionSpeed = 0.0F; } } protected String getLivingSound() { return ""; } protected String getDeathSound() { return ""; } }
  4. Hello everyone. I know i've been asking this for a while now, but still even without asking for help, I still cant get my fish mob working the way I want it to. My fish mob will float like regular mobs would. So can anyone help me? How can I make a water mob? Should I make my own AI for it or something? I really need help guys becuase I have no clue what to do. Any help is appretiated like always .
  5. Well for some reason my mob just sits there and when i punch him or move him, he doesn't stop moving. Could you help me with that? EntityFishMob class: 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 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; } } @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 ""; } } Like I said before, any help is appretiated
  6. Hello everyone. I've been asking and trying to find an answer, but with no avail. I'm still trying to find an answer, but really, no one cares about water mobs and my mod is all about water mobs. So can anyone please show me how to make a water mob, like a tutorial or something, becuase mine doesn't work. I'm actually pretty experienced with java, but I have no idea how to make a water mob. And yes I have checked the entitysquid class and I have copied and pasted code and switched it around, but it still doesn't work. Really i'm sick of trying to find an answer, becuase no one cares about water mobs or bothers to make a tutorial on it. So can anyone help me? Could anyone point me in a direction to go in to learn how water mobs work or something? Anything is appretiated!
  7. 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 ""; } }
  8. 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!
  9. It's illegal to post Mojang code? woops. Sorry if I seem desperate, but thanks for the reply!
  10. I guess i'm back to bumping . Can anyone help me? I've been trying all day to try and get this to work, I would search around the minecraft forge forums and find nothing. I would look deeply into any code that involves underwater entity methods and or the entitysquid class and end up with no success. I'm not a noob(even though I kinda sound like one), I know how to code with java, but I have no experience on how underwater mobs work. So even if you don't know how to fix this, can you please point me out in some direction to learning how water mobs work? Any help would be appretiated.
  11. I've been looking around in the entity squid class and copying and pasting important info and changing it up a little bit. But my mob still doesn't do anything and it still dies even in water. Here is my entity class: 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(2.0D); } protected boolean canTriggerWalking() { return false; } public boolean isInWater() { return this.worldObj.handleMaterialAcceleration(this.boundingBox.expand(0.0D, -0.6000000238418579D, 0.0D), Material.water, this); } public void onLivingUpdate() { super.onLivingUpdate(); if (this.isInWater()) { float f= 0; if ((double)f > 0.75D) { this.randomMotionSpeed = 1.0F; } else { } } else { this.randomMotionSpeed *= 0.9F; } 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); } float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); } { if (!this.worldObj.isRemote) { this.motionX = 0.0D; this.motionY -= 0.08D; this.motionY *= 0.9800000190734863D; this.motionZ = 0.0D; } } public void moveEntityWithHeading(float par1, float par2) { this.moveEntity(this.motionX, this.motionY, this.motionZ); } 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(); } public boolean getCanSpawnHere() { return this.posY > 45.0D && this.posY < 63.0D && super.getCanSpawnHere(); } 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 Item getDropItem() { return Item.getItemById(349); } protected String getLivingSound() { return ""; } protected String getDeathSound() { return ""; } } Is there a specific part i'm missing in my entityfishmob class that i don't have that the entitySquid class has? or what? Please help.
  12. I'm still having trouble understanding this. My mob won't move and it dies after a certain amount of time becuase the entity id isn't registered? Or what? I'm completly lost. I think if I know whats wrong, i'll understand my situation a little bit more.
×
×
  • Create New...

Important Information

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