[1.16.4] Dispenser code for Ender Pearl crashes on server
TelepathicGrunt opened this issue ยท 0 comments
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.
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.
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;