#1325: Use CraftBlockType and CraftItemType instead of CraftMagicNumbers to convert between minecraft and bukkit block / item representation

By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
CraftBukkit/Spigot
2023-12-29 08:36:38 +11:00
parent b245f22351
commit d15575db91
32 changed files with 137 additions and 102 deletions

View File

@@ -29,8 +29,8 @@
+import org.bukkit.craftbukkit.entity.CraftPlayer;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.craftbukkit.inventory.CraftItemType;
+import org.bukkit.craftbukkit.util.CraftChatMessage;
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
+import org.bukkit.craftbukkit.util.LazyPlayerSet;
+import org.bukkit.craftbukkit.util.Waitable;
@@ -1462,7 +1462,7 @@
+ ItemStack cursor = this.player.containerMenu.getCarried();
+ action = InventoryAction.NOTHING;
+ // Quick check for if we have any of the item
+ if (inventory.getTopInventory().contains(CraftMagicNumbers.getMaterial(cursor.getItem())) || inventory.getBottomInventory().contains(CraftMagicNumbers.getMaterial(cursor.getItem()))) {
+ if (inventory.getTopInventory().contains(CraftItemType.minecraftToBukkit(cursor.getItem())) || inventory.getBottomInventory().contains(CraftItemType.minecraftToBukkit(cursor.getItem()))) {
+ action = InventoryAction.COLLECT_TO_CURSOR;
+ }
+ }