diff --git a/src/main/java/com/glodblock/github/inventory/item/WirelessMagnet.java b/src/main/java/com/glodblock/github/inventory/item/WirelessMagnet.java index bf35550e..0678e423 100644 --- a/src/main/java/com/glodblock/github/inventory/item/WirelessMagnet.java +++ b/src/main/java/com/glodblock/github/inventory/item/WirelessMagnet.java @@ -60,9 +60,10 @@ public class WirelessMagnet { return data.hasKey(modeKey); } + // This method uses the same algorithm as the magnet from draconic evolution + // if changes are ever made, they should be made on both public static void doMagnet(ItemStack wirelessTerm, EntityPlayer player) { if (player.ticksExisted % 5 != 0 || player.isSneaking() || !isConfigured(wirelessTerm)) return; - World world = player.worldObj; final List items = getEntitiesInRange( EntityItem.class, @@ -91,9 +92,12 @@ public class WirelessMagnet { itemToGet.motionX = 0; itemToGet.motionY = 0; itemToGet.motionZ = 0; + // account for the server/client desync + double playerEyesPos = player.posY + + (world.isRemote ? player.getEyeHeight() - player.getDefaultEyeHeight() : player.getEyeHeight()); itemToGet.setPosition( player.posX - 0.2 + (world.rand.nextDouble() * 0.4), - player.posY - 0.6, + playerEyesPos - 0.62, player.posZ - 0.2 + (world.rand.nextDouble() * 0.4)); }