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.

Featured Replies

Posted

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!

 

  • Author

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.

  • Author

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

you may need to use setSize. I had the same problem once.

  • Author

Adjusting the above code to use setSize doesn't seem to alleviate the problem.

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.