Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Mob spawning, then immediately disappear?

Featured Replies

Posted

So I have my mob, and an egg for it.  I right click with the egg, and as soon as the mob appears, it disappears an extremely short time later.  Can anyone explain why?  Here's the code that I have to this point:

 

Main mod class entity register method:

 

 

public void entityRegisters(){

EntityRegistry.registerModEntity(EntityWispBasic.class, "BasicWisp", 1, this, 80, 3, true);

LanguageRegistry.instance().addStringLocalization("entity.eli_CiTS.BasicWisp.name", "Newborn Wisp");

}

 

 

RenderWispBasic:

 

package eli.CiTS.entities;

 

import org.lwjgl.opengl.GL11;

import org.lwjgl.opengl.GL12;

 

import eli.CiTS.models.ModelWispBasic;

 

import net.minecraft.client.model.ModelBase;

import net.minecraft.client.renderer.Tessellator;

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

import net.minecraft.entity.Entity;

import net.minecraft.entity.EntityLiving;

import net.minecraft.entity.passive.EntityCow;

 

public class RenderWispBasic extends RenderLiving

{

    public RenderWispBasic(ModelBase par1ModelBase, float par2)

    {

        super(par1ModelBase, par2);

    }

 

    public void renderWispBasic(EntityWispBasic par1EntityCow, double par2, double par4, double par6, float par8, float par9)

    {

        super.doRenderLiving(par1EntityCow, par2, par4, par6, par8, par9);

    }

 

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

    {

        this.renderWispBasic((EntityWispBasic)par1EntityLiving, par2, par4, par6, par8, par9);

    }

 

    /**

    * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then

    * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic

    * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,

    * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.

    */

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

    {

        this.renderWispBasic((EntityWispBasic)par1Entity, par2, par4, par6, par8, par9);

    }

}

 

 

 

 

EntityWispBasic:

 

package eli.CiTS.entities;

 

import cpw.mods.fml.common.Mod.Item;

import net.minecraft.entity.Entity;

import net.minecraft.entity.EnumCreatureAttribute;

import net.minecraft.entity.ai.*;

import net.minecraft.entity.monster.EntityMob;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.nbt.NBTTagCompound;

import net.minecraft.world.World;

 

public class EntityWispBasic extends EntityMob {

 

public EntityWispBasic(World par1World) {

super(par1World);

this.texture = "/eli/CiTS/textures/basicwisp.png";

this.moveSpeed = 0.4F;

this.tasks.addTask(0, new EntityAISwimming(this));

this.tasks.addTask(1, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));

this.tasks.addTask(2, new EntityAIWander(this, this.moveSpeed));

this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));

}

 

public int getTotalArmorValue(){

return 10;

}

 

protected boolean isAIEnabled(){

return true;

}

 

@Override

public int getMaxHealth() {

return 30;

}

 

public int getAttackStrength(Entity par1Entity){

return 4;

}

 

public EnumCreatureAttribute getCreatureAttribute(){

return EnumCreatureAttribute.UNDEFINED;

}

 

protected String getLivingSound(){

return "mob.enderman.idle";

}

 

protected String getHurtSound(){

return "mob.blaze.hurt";

}

 

protected String getDeathSound(){

return "mob.blaze.death";

}

 

 

}

 

 

 

ModelWispBasic:

 

package eli.CiTS.models;

 

import net.minecraft.client.model.ModelBase;

import net.minecraft.client.model.ModelRenderer;

import net.minecraft.entity.Entity;

 

public class ModelWispBasic extends ModelBase {

 

ModelRenderer Center;

ModelRenderer Upper1;

ModelRenderer Upper2;

 

public ModelWispBasic()

{

textureWidth = 64;

textureHeight = 64;

 

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

Center.addBox(-3F, -3F, -3F, 6, 6, 6);

Center.setRotationPoint(0F, 19F, 0F);

Center.setTextureSize(64, 64);

Center.mirror = true;

setRotation(Center, 0F, 0F, 0F);

Upper1 = new ModelRenderer(this, 0, 12);

Upper1.addBox(-2F, -3F, -2F, 4, 4, 4);

Upper1.setRotationPoint(0F, 16F, 0F);

Upper1.setTextureSize(64, 64);

Upper1.mirror = true;

setRotation(Upper1, 0F, 0F, 0F);

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

Upper2.addBox(-1F, -3F, -1F, 2, 3, 2);

Upper2.setRotationPoint(0F, 14F, 0F);

Upper2.setTextureSize(64, 64);

Upper2.mirror = true;

setRotation(Upper2, 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);

Center.render(f5);

Upper1.render(f5);

Upper2.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)

{

super.setRotationAngles(f, f1, f2, f3, f4, f5, null);

}

 

}

 

 

 

Feedback is much appreciated!  If any other files are needed, please let me know.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.