From 624433f650846801bdc894dcfd784faefff887d8 Mon Sep 17 00:00:00 2001 From: Emily Rose Alexandra Date: Sun, 30 May 2021 16:10:13 -0500 Subject: [PATCH] Slot.isEnabled and CommandItemSlot -> StackReference (#2452) * Fix infuriatingly mismapped Slot method * CommandItemSlot -> StackReference * Update command name --- mappings/net/minecraft/entity/Entity.mapping | 6 +-- .../net/minecraft/entity/LivingEntity.mapping | 2 +- .../entity/passive/HorseBaseEntity.mapping | 7 +++ .../inventory/CommandItemSlot.mapping | 43 ------------------ .../inventory/StackReference.mapping | 45 +++++++++++++++++++ mappings/net/minecraft/item/Item.mapping | 2 +- mappings/net/minecraft/item/ItemStack.mapping | 2 +- .../minecraft/screen/ScreenHandler.mapping | 2 +- .../net/minecraft/screen/slot/Slot.mapping | 2 +- 9 files changed, 60 insertions(+), 51 deletions(-) delete mode 100644 mappings/net/minecraft/inventory/CommandItemSlot.mapping create mode 100644 mappings/net/minecraft/inventory/StackReference.mapping diff --git a/mappings/net/minecraft/entity/Entity.mapping b/mappings/net/minecraft/entity/Entity.mapping index 6c7d0f6e6b..160c7c5878 100644 --- a/mappings/net/minecraft/entity/Entity.mapping +++ b/mappings/net/minecraft/entity/Entity.mapping @@ -322,9 +322,9 @@ CLASS net/minecraft/class_1297 net/minecraft/entity/Entity METHOD method_32316 canFreeze ()Z METHOD method_32317 setFrozenTicks (I)V ARG 1 frozenTicks - METHOD method_32318 getCommandItemSlot (I)Lnet/minecraft/class_5630; - COMMENT Obtains an item slot for command modification purpose. Used by commands - COMMENT like {@code /loot} or {@code /replaceitem}. + METHOD method_32318 getStackReference (I)Lnet/minecraft/class_5630; + COMMENT Obtains a stack reference to be modified. Used by commands like + COMMENT {@code /loot} or {@code /item}. COMMENT COMMENT @see net.minecraft.command.argument.ItemSlotArgumentType ARG 1 mappedIndex diff --git a/mappings/net/minecraft/entity/LivingEntity.mapping b/mappings/net/minecraft/entity/LivingEntity.mapping index b97c6d04e8..8547e29088 100644 --- a/mappings/net/minecraft/entity/LivingEntity.mapping +++ b/mappings/net/minecraft/entity/LivingEntity.mapping @@ -248,7 +248,7 @@ CLASS net/minecraft/class_1309 net/minecraft/entity/LivingEntity METHOD method_30129 getEquipment ()Ljava/util/Map; METHOD method_31079 positionInPortal (Lnet/minecraft/class_243;)Lnet/minecraft/class_243; ARG 0 pos - METHOD method_32321 getCommandItemSlot (Lnet/minecraft/class_1309;Lnet/minecraft/class_1304;)Lnet/minecraft/class_5630; + METHOD method_32321 getStackReference (Lnet/minecraft/class_1309;Lnet/minecraft/class_1304;)Lnet/minecraft/class_5630; ARG 0 entity ARG 1 slot METHOD method_32322 getEquipmentSlot (I)Lnet/minecraft/class_1304; diff --git a/mappings/net/minecraft/entity/passive/HorseBaseEntity.mapping b/mappings/net/minecraft/entity/passive/HorseBaseEntity.mapping index 07a4c41f35..8c16e3fc71 100644 --- a/mappings/net/minecraft/entity/passive/HorseBaseEntity.mapping +++ b/mappings/net/minecraft/entity/passive/HorseBaseEntity.mapping @@ -32,6 +32,13 @@ CLASS net/minecraft/class_1496 net/minecraft/entity/passive/HorseBaseEntity METHOD method_30009 interactHorse (Lnet/minecraft/class_1657;Lnet/minecraft/class_1799;)Lnet/minecraft/class_1269; ARG 1 player ARG 2 stack + METHOD method_32335 createInventoryStackReference (ILjava/util/function/Predicate;)Lnet/minecraft/class_5630; + ARG 1 slot + ARG 2 predicate + METHOD method_32336 (Lnet/minecraft/class_1799;)Z + ARG 1 stack + METHOD method_32337 (Lnet/minecraft/class_1799;)Z + ARG 0 stack METHOD method_6001 initAttributes ()V METHOD method_6721 onChestedStatusChanged ()V METHOD method_6722 openInventory (Lnet/minecraft/class_1657;)V diff --git a/mappings/net/minecraft/inventory/CommandItemSlot.mapping b/mappings/net/minecraft/inventory/CommandItemSlot.mapping deleted file mode 100644 index d51ca11ff7..0000000000 --- a/mappings/net/minecraft/inventory/CommandItemSlot.mapping +++ /dev/null @@ -1,43 +0,0 @@ -CLASS net/minecraft/class_5630 net/minecraft/inventory/CommandItemSlot - COMMENT Represents an item slot for command access. Usually obtained from entities. - COMMENT - COMMENT

Some dispenser behaviors also use this to simulate commands' behavior - COMMENT of equipping items. - COMMENT - COMMENT @see net.minecraft.entity.Entity#getCommandItemSlot(int) - FIELD field_27860 EMPTY Lnet/minecraft/class_5630; - COMMENT An immutable empty slot. - METHOD method_32327 get ()Lnet/minecraft/class_1799; - COMMENT Gets the current item stack in this slot. - METHOD method_32328 of (Lnet/minecraft/class_1263;I)Lnet/minecraft/class_5630; - COMMENT Creates a slot backed by an index within an inventory. - ARG 0 inventory - ARG 1 index - METHOD method_32329 of (Lnet/minecraft/class_1263;ILjava/util/function/Predicate;)Lnet/minecraft/class_5630; - COMMENT Creates a slot backed by an index within an inventory and guarded by - COMMENT a condition for setting stacks into the inventory. - ARG 0 inventory - ARG 1 index - ARG 2 stackFilter - COMMENT the condition to guard stack setting - METHOD method_32330 of (Lnet/minecraft/class_1309;Lnet/minecraft/class_1304;)Lnet/minecraft/class_5630; - COMMENT Creates a slot backed by an equipment slot of an living entity. - ARG 0 entity - ARG 1 equipmentSlot - METHOD method_32331 of (Lnet/minecraft/class_1309;Lnet/minecraft/class_1304;Ljava/util/function/Predicate;)Lnet/minecraft/class_5630; - COMMENT Creates a slot backed by an equipment slot of an living entity and guarded by - COMMENT a condition for setting stacks into the inventory. - ARG 0 entity - ARG 1 equipmentSlot - ARG 2 stackFilter - COMMENT the condition to guard stack setting - METHOD method_32332 set (Lnet/minecraft/class_1799;)Z - COMMENT Sets the {@code stack} to this slot. - COMMENT - COMMENT @return {@code true} if the setting is successful, {@code false} if rejected - ARG 1 stack - COMMENT the item stack to set - METHOD method_32333 (Lnet/minecraft/class_1799;)Z - ARG 0 stack - METHOD method_32334 (Lnet/minecraft/class_1799;)Z - ARG 0 stack diff --git a/mappings/net/minecraft/inventory/StackReference.mapping b/mappings/net/minecraft/inventory/StackReference.mapping new file mode 100644 index 0000000000..d2bfb3ad12 --- /dev/null +++ b/mappings/net/minecraft/inventory/StackReference.mapping @@ -0,0 +1,45 @@ +CLASS net/minecraft/class_5630 net/minecraft/inventory/StackReference + COMMENT Represents a reference to a stack that supports getting and setting. + COMMENT Often for command access. Usually obtained from entities. + COMMENT + COMMENT

Screen handlers also use stack references to pass a mutable cursor + COMMENT stack to some methods. + COMMENT + COMMENT @see net.minecraft.entity.Entity#getStackReference(int) + FIELD field_27860 EMPTY Lnet/minecraft/class_5630; + COMMENT An immutable empty stack reference. + METHOD method_32327 get ()Lnet/minecraft/class_1799; + COMMENT Gets the current item stack. + METHOD method_32328 of (Lnet/minecraft/class_1263;I)Lnet/minecraft/class_5630; + COMMENT Creates a stack reference backed by an index within an inventory. + ARG 0 inventory + ARG 1 index + METHOD method_32329 of (Lnet/minecraft/class_1263;ILjava/util/function/Predicate;)Lnet/minecraft/class_5630; + COMMENT Creates a stack reference backed by an index within an inventory and guarded + COMMENT by a condition for setting stacks into the inventory. + ARG 0 inventory + ARG 1 index + ARG 2 stackFilter + COMMENT the condition to guard stack setting + METHOD method_32330 of (Lnet/minecraft/class_1309;Lnet/minecraft/class_1304;)Lnet/minecraft/class_5630; + COMMENT Creates a stack reference backed by an equipment slot of an living entity with + COMMENT no filter, allowing direct manipulation of the equipment slot. + ARG 0 entity + ARG 1 slot + METHOD method_32331 of (Lnet/minecraft/class_1309;Lnet/minecraft/class_1304;Ljava/util/function/Predicate;)Lnet/minecraft/class_5630; + COMMENT Creates a stack reference backed by an equipment slot of an living entity and + COMMENT guarded by a condition for setting stacks into the inventory. + ARG 0 entity + ARG 1 slot + ARG 2 filter + COMMENT the condition to guard stack setting + METHOD method_32332 set (Lnet/minecraft/class_1799;)Z + COMMENT Sets the {@code stack}. + COMMENT + COMMENT @return {@code true} if the setting is successful, {@code false} if rejected + ARG 1 stack + COMMENT the item stack to set + METHOD method_32333 (Lnet/minecraft/class_1799;)Z + ARG 0 stack + METHOD method_32334 (Lnet/minecraft/class_1799;)Z + ARG 0 stack diff --git a/mappings/net/minecraft/item/Item.mapping b/mappings/net/minecraft/item/Item.mapping index 3682503c08..d72a3b9a8c 100644 --- a/mappings/net/minecraft/item/Item.mapping +++ b/mappings/net/minecraft/item/Item.mapping @@ -34,7 +34,7 @@ CLASS net/minecraft/class_1792 net/minecraft/item/Item ARG 3 slot ARG 4 clickType ARG 5 player - ARG 6 cursorSlot + ARG 6 cursorStackReference METHOD method_31567 isItemBarVisible (Lnet/minecraft/class_1799;)Z ARG 1 stack METHOD method_31568 canBeNested ()Z diff --git a/mappings/net/minecraft/item/ItemStack.mapping b/mappings/net/minecraft/item/ItemStack.mapping index 28933727c0..dec897ddb4 100644 --- a/mappings/net/minecraft/item/ItemStack.mapping +++ b/mappings/net/minecraft/item/ItemStack.mapping @@ -80,7 +80,7 @@ CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack ARG 2 slot ARG 3 clickType ARG 4 player - ARG 5 cursorSlot + ARG 5 cursorStackReference METHOD method_31577 canCombine (Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Z ARG 0 stack ARG 1 otherStack diff --git a/mappings/net/minecraft/screen/ScreenHandler.mapping b/mappings/net/minecraft/screen/ScreenHandler.mapping index c223237642..ed764d1e3f 100644 --- a/mappings/net/minecraft/screen/ScreenHandler.mapping +++ b/mappings/net/minecraft/screen/ScreenHandler.mapping @@ -77,7 +77,7 @@ CLASS net/minecraft/class_1703 net/minecraft/screen/ScreenHandler METHOD method_34256 disableSyncing ()V METHOD method_34257 enableSyncing ()V METHOD method_34258 checkCursorStackUpdates ()V - METHOD method_34259 getCursorCommandItemSlot ()Lnet/minecraft/class_5630; + METHOD method_34259 getCursorStackReference ()Lnet/minecraft/class_5630; METHOD method_34715 checkPropertyUpdates (II)V ARG 1 id ARG 2 value diff --git a/mappings/net/minecraft/screen/slot/Slot.mapping b/mappings/net/minecraft/screen/slot/Slot.mapping index 23f4fb76ad..5b703cced5 100644 --- a/mappings/net/minecraft/screen/slot/Slot.mapping +++ b/mappings/net/minecraft/screen/slot/Slot.mapping @@ -55,4 +55,4 @@ CLASS net/minecraft/class_1735 net/minecraft/screen/slot/Slot METHOD method_7680 canInsert (Lnet/minecraft/class_1799;)Z ARG 1 stack METHOD method_7681 hasStack ()Z - METHOD method_7682 doDrawHoveringEffect ()Z + METHOD method_7682 isEnabled ()Z