From 118df28fa80f9a4c6461141cf29846b4d0cab618 Mon Sep 17 00:00:00 2001 From: "Alex \"mcmonkey\" Goodwin" Date: Tue, 24 May 2022 10:03:31 -0700 Subject: [PATCH] minor 1.17 mappings fix and fakeitem cleanup --- .../denizen/scripts/commands/item/FakeItemCommand.java | 6 ++++-- .../denizen/nms/v1_17/ReflectionMappingsInfo.java | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/item/FakeItemCommand.java b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/item/FakeItemCommand.java index 7a633f793b..036065bc96 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/item/FakeItemCommand.java +++ b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/item/FakeItemCommand.java @@ -56,6 +56,8 @@ public FakeItemCommand() { // If the player has an open inventory, to apply the item to a slot in that inventory, add 36 to the slot index. // If the player does not have an open inventory, slots 36-40 are equipment, 41 is offhand, 42 is recipe result, 43-46 are recipe. // + // For modifying equipment, consider <@link mechanism PlayerTag.fake_equipment> instead. + // // The slot argument can be any valid slot, see <@link language Slot Inputs>. // // Optionally specify 'raw' to indicate that the slow is a raw network slot ID. @@ -160,7 +162,6 @@ else if (slotSnapshot < 36) { static int translateSlot(Player player, int slot) { // This translates Spigot slot standards to vanilla slots. // The slot order is different when a player is viewing an inventory vs not doing so, leading to this chaos. - int result, total; if (player.getOpenInventory().getTopInventory() instanceof CraftingInventory && slot > 35) { if (slot < 40) { // Armor equipment return 8 - (slot - 36); @@ -172,7 +173,8 @@ else if (slot < 46) { // Recipe (Server slot IDs for this are effectively made u return slot - 41; } } - total = 36 + player.getOpenInventory().getTopInventory().getSize(); + int result; + int total = 36 + player.getOpenInventory().getTopInventory().getSize(); int rowCount = (int) Math.ceil(total / 9.0); if (slot < 9) { // First row on server is last row on client int row = (int) Math.floor(slot / 9.0); diff --git a/v1_17/src/main/java/com/denizenscript/denizen/nms/v1_17/ReflectionMappingsInfo.java b/v1_17/src/main/java/com/denizenscript/denizen/nms/v1_17/ReflectionMappingsInfo.java index 1b570018c8..54fa1f381d 100644 --- a/v1_17/src/main/java/com/denizenscript/denizen/nms/v1_17/ReflectionMappingsInfo.java +++ b/v1_17/src/main/java/com/denizenscript/denizen/nms/v1_17/ReflectionMappingsInfo.java @@ -23,7 +23,7 @@ public class ReflectionMappingsInfo { public static String ServerPlayer_respawnForced = "cS"; - public static String EnderMan_DATA_CREEPY = "bU"; + public static String EnderMan_DATA_CREEPY = "bV"; public static String Zombie_inWaterTime = "cc";