Nature's Aura

Nature's Aura

31M Downloads

[1.16.4] Dispenser code for Ender Pearl crashes on server

TelepathicGrunt opened this issue ยท 0 comments

commented

A friend was getting a crash with the Ender Pearls being dispensed from a Dispenser. Upon closer look at the logs attached at bottom of this post, it was saying the Ender Pearl constructor did not exist at this line in Aura.

return new EnderPearlEntity(worldIn, position.getX(), position.getY(), position.getZ());

When I checked that code in my IDE, it's marked with @OnlyIn(Dist.CLIENT) which means it is stripped out on servers and doesn't exist serverside.
image

To fix this, you should call this instead in your dispenser code which should be the equivalent of the client sided constructor except that it works on servers too.

EnderPearlEntity pearl = new EnderPearlEntity(EntityType.ENDER_PEARL, worldIn);
pearl.setPosition(x, y, z);
return pearl;

Log:
crash-2020-12-21_21.07.02-server.txt
latest.log