Class ReferenceSlot<T>
java.lang.Object
com.portingdeadmods.portingdeadlibs.api.gui.menus.slots.AbstractSlot
com.portingdeadmods.portingdeadlibs.api.gui.menus.slots.ReferenceSlot<T>
- Type Parameters:
T- The type of reference (ItemStack or FluidStack)
- Direct Known Subclasses:
FluidReferenceSlot,ItemReferenceSlot
A generic base reference slot that doesn't actually consume items when set.
Used for pattern/filter/setting slots.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceListener interface for reference changes -
Field Summary
FieldsFields inherited from class com.portingdeadmods.portingdeadlibs.api.gui.menus.slots.AbstractSlot
index, slot, x, y -
Constructor Summary
ConstructorsConstructorDescriptionReferenceSlot(int index, int x, int y, int width, int height, @Nullable ReferenceSlot.ReferenceListener<T> listener) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract booleanareReferencesEqual(T reference1, T reference2) Checks if two references are equalvoidClears the current referenceprotected abstract TcopyReference(T reference) Creates a copy of the referenceprotected abstract TReturns an empty reference of type TGets the current referencebooleanhandleSpecialClick(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 abstract booleanisReferenceEmpty(T reference) Checks if a reference is emptyabstract booleansetReference(net.minecraft.world.item.ItemStack stack) Called when a player clicks on this slot with an itembooleansetReferenceDirectly(T reference) Sets the reference directlyMethods inherited from class com.portingdeadmods.portingdeadlibs.api.gui.menus.slots.AbstractSlot
getX, getY
-
Field Details
-
reference
-
listener
-
-
Constructor Details
-
Method Details
-
getEmptyReference
Returns an empty reference of type T -
setReference
public abstract boolean setReference(net.minecraft.world.item.ItemStack stack) Called when a player clicks on this slot with an item- Parameters:
stack- The stack the player is holding- Returns:
- true if the reference was set, false otherwise
-
setReferenceDirectly
Sets the reference directly- Parameters:
reference- The reference to set- Returns:
- true if the reference was set, false otherwise
-
copyReference
Creates a copy of the reference -
areReferencesEqual
Checks if two references are equal -
isReferenceEmpty
Checks if a reference is empty -
clearReference
public void clearReference()Clears the current reference -
getReference
Gets the current reference -
handleSpecialClick
public boolean handleSpecialClick(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 container- Parameters:
player- The player clickingclickType- The type of clickclickAction- The click action- Returns:
- true if the click was handled
-