Jump to content

[1.7.10] Custom Mob Falls/Gets Stuck in Block


Chasingu

Recommended Posts

Hello all!

 

I have recently created a custom mob that is only around 3 pixel blocks high. When spawning the custom rendered mob, it appears for a brief second, turns black, and disappears. After searching for a while, if I dug up the block, it would fall out, and then fall into the block under it.

 

Testing with a pillar, I was able to get this image after spamming F2 to capture it: https://i.imgur.com/FcESXoK.png

 

To create this scenario, I placed the Spawn Egg on the Dirt Block off screen at the top. The mob falls like this until you break it, and then rinse and repeat until you get to bed rock where it then falls though the world.

 

Any help would be appreciated! Thanks!

 

Link to comment
Share on other sites

Here's the Entity File (Pretty Bare Bones):

	
public EntityCustomMob(World world) {
super(world);
}

protected void applyEntityAttributes() {
        super.applyEntityAttributes();
        this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D);
        //this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D);
}

@Override
public EntityAgeable createChild(EntityAgeable p_90011_1_) {
return null;
}

 

I disabled the movement speed because I thought that might have been causing it, but it appeared not to.

Link to comment
Share on other sites

So I skimmed through and changed my Entity file to look like this *I only took what I needed*:

 

public EntityCustomMob(World world) {
super(world);
}

protected void applyEntityAttributes(){
        super.applyEntityAttributes();
        this.setSize(0.9F, 1.3F);
        this.getNavigator().setAvoidsWater(true);
        this.tasks.addTask(5, new EntityAIWander(this, 1.0D));
        this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D);
        this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D);
}

public boolean isAIEnabled() {
    return true;
}

@Override
public EntityAgeable createChild(EntityAgeable p_90011_1_) {
return null;
}

 

However, adding these lines of Code to my Entity Class now generates errors when I attempt to spawn it.

[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: java.lang.reflect.InvocationTargetException
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at java.lang.reflect.Constructor.newInstance(Unknown Source)
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.entity.EntityList.createEntityByID(EntityList.java:221)
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.item.ItemMonsterPlacer.spawnCreature(ItemMonsterPlacer.java:173)
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.item.ItemMonsterPlacer.onItemUse(ItemMonsterPlacer.java:79)
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(ForgeHooks.java:456)
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.item.ItemStack.tryPlaceItemIntoWorld(ItemStack.java:142)
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:422)
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:593)
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74)
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122)
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241)
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726)
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485)
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: Caused by: java.lang.NullPointerException
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at com.misccraft.mod.entity.EntityCustomMob.applyEntityAttributes(EntityCustomMob.java:19)
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.entity.EntityLivingBase.<init>(EntityLivingBase.java:156)
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.entity.EntityLiving.<init>(EntityLiving.java:78)
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.entity.EntityCreature.<init>(EntityCreature.java:36)
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.entity.EntityAgeable.<init>(EntityAgeable.java:17)
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.entity.passive.EntityAnimal.<init>(EntityAnimal.java:34)
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at com.misccraft.mod.entity.EntityCustomMob.<init>(EntityCustomMob.java:12)
[21:03:30] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	... 20 more
[21:03:30] [server thread/WARN]: Skipping Entity with id 3

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



×
×
  • Create New...

Important Information

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