diff --git a/src/main/java/org/maxgamer/QuickShop/Shop/Item/FakeItem_17.java b/src/main/java/org/maxgamer/QuickShop/Shop/Item/FakeItem_17.java index d243883..784f662 100644 --- a/src/main/java/org/maxgamer/QuickShop/Shop/Item/FakeItem_17.java +++ b/src/main/java/org/maxgamer/QuickShop/Shop/Item/FakeItem_17.java @@ -23,10 +23,6 @@ public class FakeItem_17 extends FakeItem { super(loc, item); } - private static int getNormalizedDistance(final double value) { - return (int) Math.floor(value * 32.0D); - } - @Override protected PacketContainer setMetadataPacket(PacketContainer fakePacket) { fakePacket.getIntegers().write(0, eid); @@ -41,9 +37,9 @@ public class FakeItem_17 extends FakeItem { protected PacketContainer setSpawnPacket(PacketContainer fakePacket) { StructureModifier is = fakePacket.getIntegers(); is.write(0, eid); - is.write(1, getNormalizedDistance(location.getX())); - is.write(2, getNormalizedDistance(location.getY())); - is.write(3, getNormalizedDistance(location.getZ())); + is.write(1, (int) location.getX()); + is.write(2, (int) location.getY()); + is.write(3, (int) location.getZ()); is.write(9, 2); return fakePacket; } diff --git a/src/main/java/org/maxgamer/QuickShop/Shop/Item/FakeItem_18.java b/src/main/java/org/maxgamer/QuickShop/Shop/Item/FakeItem_18.java index e80910a..b203987 100644 --- a/src/main/java/org/maxgamer/QuickShop/Shop/Item/FakeItem_18.java +++ b/src/main/java/org/maxgamer/QuickShop/Shop/Item/FakeItem_18.java @@ -3,6 +3,9 @@ package org.maxgamer.QuickShop.Shop.Item; import org.bukkit.Location; import org.bukkit.inventory.ItemStack; +import com.comphenix.protocol.events.PacketContainer; +import com.comphenix.protocol.reflect.StructureModifier; + /** * Minecraft 虚拟悬浮物品工具类 * 需要depend ProtocolLib @@ -16,7 +19,13 @@ public class FakeItem_18 extends FakeItem_17 { super(loc, item); } - private static int getNormalizedDistance(final double value) { - return (int) Math.floor(value * 32.0D); + @Override + protected PacketContainer setSpawnPacket(PacketContainer fakePacket) { + StructureModifier is = fakePacket.getIntegers(); + is.write(0, eid); + is.write(1, (int) location.getX() * 32); + is.write(2, (int) location.getY() * 32); + is.write(3, (int) location.getZ() * 32); + return fakePacket; } }