
BOP Farmland blocks can cause the player to get stuck if trampled
oliwier509 opened this issue ยท 0 comments
Description of the Bug
possible fix:
private void turnToDirt(World worldIn, BlockPos pos) {
IBlockState iblockstate = Blocks.DIRT.getDefaultState();
worldIn.setBlockState(pos, iblockstate);
AxisAlignedBB axisalignedbb = iblockstate.getCollisionBoundingBox(worldIn, pos).offset(pos);
for (Entity entity : worldIn.getEntitiesWithinAABBExcludingEntity((Entity)null, axisalignedbb)) {
if (entity instanceof EntityPlayerMP) {
double delta = axisalignedbb.maxY - entity.posY;
((EntityPlayerMP) entity).connection.setPlayerLocation(0, delta, 0, 0, 0, EnumSet.allOf(SPacketPlayerPosLook.EnumFlags.class));
} else {
entity.setPosition(entity.posX, axisalignedbb.maxY, entity.posZ);
}
}
}
relevant post: https://discord.com/channels/881234100504109166/1333065684233486449
this is the same behavior as: https://bugs.mojang.com/browse/MC-104259