Class ItemReferenceSlot
java.lang.Object
com.portingdeadmods.portingdeadlibs.api.gui.menus.slots.AbstractSlot
com.portingdeadmods.portingdeadlibs.api.gui.menus.slots.ReferenceSlot<net.minecraft.world.item.ItemStack>
com.portingdeadmods.portingdeadlibs.api.gui.menus.slots.ItemReferenceSlot
A slot that displays a reference ItemStack without actually consuming it.
Perfect for filter/pattern settings.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.portingdeadmods.portingdeadlibs.api.gui.menus.slots.ReferenceSlot
ReferenceSlot.ReferenceListener<T> -
Field Summary
Fields inherited from class com.portingdeadmods.portingdeadlibs.api.gui.menus.slots.ReferenceSlot
listener, referenceFields inherited from class com.portingdeadmods.portingdeadlibs.api.gui.menus.slots.AbstractSlot
index, slot, x, y -
Constructor Summary
ConstructorsConstructorDescriptionItemReferenceSlot(int index, int x, int y, int width, int height, @Nullable ReferenceSlot.ReferenceListener<net.minecraft.world.item.ItemStack> listener) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanareReferencesEqual(net.minecraft.world.item.ItemStack reference1, net.minecraft.world.item.ItemStack reference2) Checks if two references are equalprotected net.minecraft.world.item.ItemStackcopyReference(net.minecraft.world.item.ItemStack reference) Creates a copy of the referenceprotected net.minecraft.world.item.ItemStackReturns an empty reference of type TbooleanhandleSpecialClick(net.minecraft.world.entity.player.Player player, net.minecraft.world.inventory.ClickType clickType, net.minecraft.world.inventory.ClickAction clickAction) Override this to handle clicking with a fluid containerprotected booleanisReferenceEmpty(net.minecraft.world.item.ItemStack reference) Checks if a reference is emptybooleansetReference(net.minecraft.world.item.ItemStack stack) Called when a player clicks on this slot with an itemMethods inherited from class com.portingdeadmods.portingdeadlibs.api.gui.menus.slots.ReferenceSlot
clearReference, getReference, setReferenceDirectlyMethods inherited from class com.portingdeadmods.portingdeadlibs.api.gui.menus.slots.AbstractSlot
getX, getY
-
Constructor Details
-
Method Details
-
getEmptyReference
protected net.minecraft.world.item.ItemStack getEmptyReference()Description copied from class:ReferenceSlotReturns an empty reference of type T- Specified by:
getEmptyReferencein classReferenceSlot<net.minecraft.world.item.ItemStack>
-
setReference
public boolean setReference(net.minecraft.world.item.ItemStack stack) Description copied from class:ReferenceSlotCalled when a player clicks on this slot with an item- Specified by:
setReferencein classReferenceSlot<net.minecraft.world.item.ItemStack>- Parameters:
stack- The stack the player is holding- Returns:
- true if the reference was set, false otherwise
-
copyReference
protected net.minecraft.world.item.ItemStack copyReference(net.minecraft.world.item.ItemStack reference) Description copied from class:ReferenceSlotCreates a copy of the reference- Specified by:
copyReferencein classReferenceSlot<net.minecraft.world.item.ItemStack>
-
areReferencesEqual
protected boolean areReferencesEqual(net.minecraft.world.item.ItemStack reference1, net.minecraft.world.item.ItemStack reference2) Description copied from class:ReferenceSlotChecks if two references are equal- Specified by:
areReferencesEqualin classReferenceSlot<net.minecraft.world.item.ItemStack>
-
isReferenceEmpty
protected boolean isReferenceEmpty(net.minecraft.world.item.ItemStack reference) Description copied from class:ReferenceSlotChecks if a reference is empty- Specified by:
isReferenceEmptyin classReferenceSlot<net.minecraft.world.item.ItemStack>
-
handleSpecialClick
public boolean handleSpecialClick(net.minecraft.world.entity.player.Player player, net.minecraft.world.inventory.ClickType clickType, net.minecraft.world.inventory.ClickAction clickAction) Description copied from class:ReferenceSlotOverride this to handle clicking with a fluid container- Overrides:
handleSpecialClickin classReferenceSlot<net.minecraft.world.item.ItemStack>- Parameters:
player- The player clickingclickType- The type of clickclickAction- The click action- Returns:
- true if the click was handled
-