Jump to content

[1.7.2] My Water Mob Doesn't Work :(


MagnumMike55

Recommended Posts

Hello, everyone. I was wondering how could I make a water mob. I'm having an extremely hard time trying to get my fish mob to swim in the water. It just stays in place and after a little bit, it just dies. I even extended my FishEntityMob class to EntityWaterMob and took some methods from the squid class that looked like it would make the fish move. Here are my classes. (Sorry if some parts of the code look like they shouldn't be their or what. I just have no idea what to do.)

[Also sorry for having the code put out. For some reason it wont let me insert those code things -_-]

 

RENDER CLASS:

---------------------

package com.MagZAquaticLifeExperience.common.render;

 

import com.MagZAquaticLifeExperience.common.entity.EntityFishMob;

import com.MagZAquaticLifeExperience.common.model.ModelFish;

 

import net.minecraft.client.model.ModelBase;

import net.minecraft.client.renderer.entity.RenderLiving;

import net.minecraft.entity.Entity;

import net.minecraft.entity.EntityLiving;

import net.minecraft.util.ResourceLocation;

 

public class RenderFish extends RenderLiving {

private static final ResourceLocation EntityTexture = new ResourceLocation("magzaquaticlifeexperience:/textures/mobs/Fish.png");

 

protected ModelFish model;

 

public RenderFish(ModelBase par1ModelBase, float par2) {

super(par1ModelBase, par2);

model = ((ModelFish)mainModel);

}

 

public void RenderFish(EntityFishMob entity, double par2, double par4, double par6, float par8, float par9) {

super.doRender(entity, par2, par4, par6, par8, par9);

}

 

public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9) {

RenderFish((EntityFishMob)par1EntityLiving, par2, par4, par6, par8, par9);

}

 

public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) {

RenderFish((EntityFishMob)par1Entity, par2, par4, par6, par8, par9);

}

 

@Override

protected ResourceLocation getEntityTexture(Entity entity) {

return EntityTexture;

}

 

}

---------------------------------------------------------

MODEL CLASS

-----------------------------------------------------

// Date: 7/11/2014 10:29:28 PM

// Template version 1.1

// Java generated by Techne

// Keep in mind that you still need to fill in some blanks

// - ZeuX

 

package com.MagZAquaticLifeExperience.common.model;

 

import net.minecraft.client.model.ModelBase;

import net.minecraft.client.model.ModelRenderer;

import net.minecraft.entity.Entity;

 

public class ModelFish extends ModelBase

{

  //fields

    ModelRenderer body001;

    ModelRenderer mouth001;

    ModelRenderer top001;

    ModelRenderer body002;

    ModelRenderer body003;

    ModelRenderer mouth002;

    ModelRenderer body004;

    ModelRenderer body005;

    ModelRenderer body006;

    ModelRenderer body007;

    ModelRenderer sidefin001;

    ModelRenderer sidefin002;

    ModelRenderer topfin001;

    ModelRenderer bottomfin001;

 

  public ModelFish()

  {

    textureWidth = 64;

    textureHeight = 32;

   

      body001 = new ModelRenderer(this, 0, 0);

      body001.addBox(-1F, 0F, 0F, 3, 3, 6);

      body001.setRotationPoint(0F, 20F, -3F);

      body001.setTextureSize(64, 32);

      body001.mirror = true;

      setRotation(body001, 0F, 0F, 0F);

      mouth001 = new ModelRenderer(this, 56, 0);

      mouth001.addBox(0F, 0F, 0F, 3, 2, 1);

      mouth001.setRotationPoint(-1F, 20.5F, -3.6F);

      mouth001.setTextureSize(64, 32);

      mouth001.mirror = true;

      setRotation(mouth001, 0F, 0F, 0F);

      top001 = new ModelRenderer(this, 41, 0);

      top001.addBox(0F, -1F, 0F, 3, 1, 4);

      top001.setRotationPoint(-1F, 20.6F, -2F);

      top001.setTextureSize(64, 32);

      top001.mirror = true;

      setRotation(top001, 0F, 0F, 0F);

      body002 = new ModelRenderer(this, 56, 4);

      body002.addBox(0F, 0F, 0F, 3, 2, 1);

      body002.setRotationPoint(-1F, 20.5F, 2.7F);

      body002.setTextureSize(64, 32);

      body002.mirror = true;

      setRotation(body002, 0F, 0F, 0F);

      body003 = new ModelRenderer(this, 47, 6);

      body003.addBox(0F, 0F, 0F, 3, 2, 1);

      body003.setRotationPoint(-1F, 20.5F, 3.2F);

      body003.setTextureSize(64, 32);

      body003.mirror = true;

      setRotation(body003, 0F, 0F, 0F);

      mouth002 = new ModelRenderer(this, 56, 8);

      mouth002.addBox(0F, 0F, 0F, 3, 1, 1);

      mouth002.setRotationPoint(-1F, 21F, -4F);

      mouth002.setTextureSize(64, 32);

      mouth002.mirror = true;

      setRotation(mouth002, 0F, 0F, 0F);

      body004 = new ModelRenderer(this, 56, 11);

      body004.addBox(0F, 0F, 0F, 3, 1, 1);

      body004.setRotationPoint(-1F, 21F, 3.7F);

      body004.setTextureSize(64, 32);

      body004.mirror = true;

      setRotation(body004, 0F, 0F, 0F);

      body005 = new ModelRenderer(this, 49, 10);

      body005.addBox(0F, 0F, 0F, 2, 1, 1);

      body005.setRotationPoint(-0.5F, 20F, 2.6F);

      body005.setTextureSize(64, 32);

      body005.mirror = true;

      setRotation(body005, 0F, 0F, 0F);

      body006 = new ModelRenderer(this, 51, 13);

      body006.addBox(0F, 0F, 0F, 1, 1, 1);

      body006.setRotationPoint(0F, 19.6F, 2F);

      body006.setTextureSize(64, 32);

      body006.mirror = true;

      setRotation(body006, 0F, 0F, 0F);

      body007 = new ModelRenderer(this, 60, 14);

      body007.addBox(0F, -1F, 0F, 1, 1, 1);

      body007.setRotationPoint(0F, 20.6F, -2.6F);

      body007.setTextureSize(64, 32);

      body007.mirror = true;

      setRotation(body007, 0F, 0F, 0F);

      sidefin001 = new ModelRenderer(this, 34, 0);

      sidefin001.addBox(0F, 0F, 0F, 0, 3, 3);

      sidefin001.setRotationPoint(2F, 19.9F, -2F);

      sidefin001.setTextureSize(64, 32);

      sidefin001.mirror = true;

      setRotation(sidefin001, 0F, 0.4461433F, 0F);

      sidefin002 = new ModelRenderer(this, 27, 0);

      sidefin002.addBox(0F, 0F, 0F, 0, 3, 3);

      sidefin002.setRotationPoint(-1F, 19.9F, -2F);

      sidefin002.setTextureSize(64, 32);

      sidefin002.mirror = true;

      setRotation(sidefin002, 0F, -0.4461411F, 0F);

      topfin001 = new ModelRenderer(this, 32, 7);

      topfin001.addBox(0F, -3F, 0F, 0, 3, 4);

      topfin001.setRotationPoint(0.5F, 20.5F, -2F);

      topfin001.setTextureSize(64, 32);

      topfin001.mirror = true;

      setRotation(topfin001, 0F, 0F, 0F);

      bottomfin001 = new ModelRenderer(this, 20, 0);

      bottomfin001.addBox(0F, -1F, 0F, 0, 3, 3);

      bottomfin001.setRotationPoint(0.5F, 21F, 4.5F);

      bottomfin001.setTextureSize(64, 32);

      bottomfin001.mirror = true;

      setRotation(bottomfin001, 0F, 0F, 0F);

  }

 

  public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)

  {

    setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);

    body001.render(par7);

    mouth001.render(par7);

    top001.render(par7);

    body002.render(par7);

    body003.render(par7);

    mouth002.render(par7);

    body004.render(par7);

    body005.render(par7);

    body006.render(par7);

    body007.render(par7);

    sidefin001.render(par7);

    sidefin002.render(par7);

    topfin001.render(par7);

    bottomfin001.render(par7);

  }

 

  private void setRotation(ModelRenderer model, float x, float y, float z)

  {

    model.rotateAngleX = x;

    model.rotateAngleY = y;

    model.rotateAngleZ = z;

  }

 

  public void setRotationAngles(float par2, float par3, float par4, float par5, float par6, Entity par7Entity) {

 

 

 

  }

 

}

-----------------------------------------------

ENTITY CLASS

------------------------------------------------

package com.MagZAquaticLifeExperience.common.entity;

 

import net.minecraft.block.material.Material;

import net.minecraft.entity.SharedMonsterAttributes;

import net.minecraft.entity.passive.EntityWaterMob;

import net.minecraft.item.Item;

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 Item getDropItem()

    {

        return Item.getItemById(349);

    }

 

protected String getLivingSound() {

return "";

}

 

protected String getDeathSound() {

return "";

}

 

}

--------------------------------------------------------

PROXYCLIENT CLASS

--------------------------------------------------------

 

package com.MagZAquaticLifeExperience.common.lib;

 

 

import com.MagZAquaticLifeExperience.common.entity.EntityFishMob;

import com.MagZAquaticLifeExperience.common.model.ModelFish;

import com.MagZAquaticLifeExperience.common.render.RenderFish;

 

import cpw.mods.fml.client.registry.RenderingRegistry;

 

 

public class ProxyClient extends ProxyCommon{

 

public void RegisterInformation() {

RenderingRegistry.registerEntityRenderingHandler(EntityFishMob.class, new RenderFish(new ModelFish(), 0.2F));

}

}

 

 

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!]--

Link to comment
Share on other sites

[Also sorry for having the code put out. For some reason it wont let me insert those code things -_-]

I don't feel anyone is going to help you until you fix this. It makes your code VERY hard to read with poor formatting and emoticons.

(And it makes your posts unnecessarily long.)

 

[ code ]YOUR CODE[ /code ]

Without the spaces.

 

If you're still having issues, use Gist https://gist.github.com/

 

Edit: And with either method, make sure to use different tags or gists for each class. I just noticed you had multiple classes, if that shows just how difficult it is to read just slapped on the forum.

Link to comment
Share on other sites

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

    • You shouldn't be extracting the mod .jar, just place it in your mods folder.
    • so basically another rundown of my probelm. Im the admin of a 1.20.1 modded server. Were using forge 47.2.0 but tested this issue in other forge versions too on sevrer and client side. so the forge version isnt the issue. The bug happens in following instances. Were using the attacks of the jujutsucraft mod by orca normally. And for everyone that stands there nothing changes. But everyone who wasnt in the chunks before or who relogins again those chunks will appear invisible for the most part. I tried fixing this be removing and adding following mods in many combinations. Embeddium, canary, memoryleakfix, ai improvements, Krypton reforges, better chunkloading, radium reforged, embeddium plus, farsight, betterchunkloading, oculus I tested most of these mods alone and in differents combinations with each other and without the mods. What i noticed is zhat when i removed  . most invisible chunks will return or semi return. and only ine or two chunks stay invisible. I rechanged those mids mostly on the cöient side but also some in the serveside. Ir most likely isnt an issue with another non performance mod since i noticed this thing with embeddium. Ans also the problem wasnt there im the beginning of the server. Granted since then we updated some of the mods that add content and their lib mod. But i went to every big mods discord and community that we have and i didnt find someone else havinf that chunk problem. Heres the link to a video of the Problem. https://streamable.com/9v1if2     heres the link to the modlist: https://ibb.co/myF8dtX     Pleaee im foghting for months with this problem. All the performance mods kn the modlist are for sure not the issue i tested without all of them.
    • It looks like you're only setting the health if the thing you are hitting is a player.  
    • It sounds like you accidentally have two items that are both named "orange". Ensure that you give items unique names in the string when you register them. That's one of the more annoying errors to track down if you don't know what's causing it, though.
    • when i tried downloading blockfront from curseforge for version 1.20.1 i get the winrar file  and that i extract and i just get the "manifest.json" file no mod when exctracted
  • Topics

×
×
  • Create New...

Important Information

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