Class DecodeLPElement
java.lang.Object
org.cyclops.integrateddynamics.core.logicprogrammer.DecodeLPElement
- All Implemented Interfaces:
IGuiInputElement<ISubGuiBox, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase, DecodeLPElementClient>, ILogicProgrammerElement<ISubGuiBox, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase, DecodeLPElementClient>
public class DecodeLPElement
extends Object
implements ILogicProgrammerElement<ISubGuiBox, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase, DecodeLPElementClient>
Element for creating a variable from an encoded value,
which may have been encoded in another world.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()Called when this element is activated.booleanIf this element in its current state can be deactivated because of another item being inserted into the write slot.booleanvoidclear()net.minecraft.world.inventory.SlotcreateSlot(net.minecraft.world.Container temporaryInputSlots, int slotId, int x, int y) Create a temporary input slot for this element.voidCalled when this element is deactivated.intgetColor()net.minecraft.network.chat.ComponentgetError()intnet.minecraft.network.chat.ComponentgetName()getType()getValue()booleanisFor(IVariableFacade variableFacade) booleanisItemValidForSlot(int slotId, net.minecraft.world.item.ItemStack itemStack) Check if the given item can be inserted into the given slot.voidloadElement(IVariableFacade variableFacade) The variable facade to load onto this element.voidloadTooltip(Consumer<net.minecraft.network.chat.Component> tooltipAdder) booleanmatchesInput(IValueType<?> valueType) If the given value type matches with this element's input.booleanmatchesOutput(IValueType<?> valueType) If the given value type matches with this element's output.voidonInputSlotUpdated(net.minecraft.world.entity.player.Player player, int slotId, net.minecraft.world.item.ItemStack itemStack) Called when an input item slot has been updated.voidsetError(net.minecraft.network.chat.Component error) voidsetInputString(String inputString) voidvoidsetValueInContainer(ContainerLogicProgrammerBase container) Set the currently stored value in the given container.booleanslotClick(int slotId, net.minecraft.world.inventory.Slot slot, int mouseButton, net.minecraft.world.inventory.ContainerInput clickType, net.minecraft.world.entity.player.Player player) Called when a player clicks on a slot.net.minecraft.network.chat.Componentvalidate()Validates the current state of the element.net.minecraft.world.item.ItemStackwriteElement(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack itemStack) The stack to write the current state of this element to.
-
Constructor Details
-
DecodeLPElement
public DecodeLPElement()
-
-
Method Details
-
getClient
- Specified by:
getClientin interfaceIGuiInputElement<ISubGuiBox, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase, DecodeLPElementClient>
-
getInputString
- Returns:
- What was pasted into the text field, which is only known client-side.
-
setInputString
-
getError
@Nullable public net.minecraft.network.chat.Component getError() -
getValue
-
setValue
-
setError
public void setError(@Nullable net.minecraft.network.chat.Component error) -
clear
public void clear() -
getType
- Specified by:
getTypein interfaceILogicProgrammerElement<ISubGuiBox, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase, DecodeLPElementClient>- Returns:
- The element type.
-
getMatchString
- Specified by:
getMatchStringin interfaceILogicProgrammerElement<ISubGuiBox, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase, DecodeLPElementClient>- Returns:
- The string used to match regex searching.
-
matchesInput
Description copied from interface:ILogicProgrammerElementIf the given value type matches with this element's input.- Specified by:
matchesInputin interfaceILogicProgrammerElement<ISubGuiBox, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase, DecodeLPElementClient>- Parameters:
valueType- The value type to match.- Returns:
- If it matches
-
matchesOutput
Description copied from interface:ILogicProgrammerElementIf the given value type matches with this element's output.- Specified by:
matchesOutputin interfaceILogicProgrammerElement<ISubGuiBox, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase, DecodeLPElementClient>- Parameters:
valueType- The value type to match.- Returns:
- If it matches
-
onInputSlotUpdated
public void onInputSlotUpdated(net.minecraft.world.entity.player.Player player, int slotId, net.minecraft.world.item.ItemStack itemStack) Description copied from interface:ILogicProgrammerElementCalled when an input item slot has been updated.- Specified by:
onInputSlotUpdatedin interfaceILogicProgrammerElement<ISubGuiBox, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase, DecodeLPElementClient>- Parameters:
player-slotId- The slot id.itemStack- The itemstack currently in the slot, can be null.
-
canWriteElementPre
public boolean canWriteElementPre()- Specified by:
canWriteElementPrein interfaceILogicProgrammerElement<ISubGuiBox, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase, DecodeLPElementClient>- Returns:
- If this element can be written to an item in its current state.
-
writeElement
public net.minecraft.world.item.ItemStack writeElement(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack itemStack) Description copied from interface:ILogicProgrammerElementThe stack to write the current state of this element to.- Specified by:
writeElementin interfaceILogicProgrammerElement<ISubGuiBox, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase, DecodeLPElementClient>- Parameters:
player- The player that is writing the element.itemStack- The stack to write to.- Returns:
- The resulting itemstack.
-
loadElement
Description copied from interface:ILogicProgrammerElementThe variable facade to load onto this element.- Specified by:
loadElementin interfaceILogicProgrammerElement<ISubGuiBox, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase, DecodeLPElementClient>- Parameters:
variableFacade- The variable facade to load.
-
canCurrentlyReadFromOtherItem
public boolean canCurrentlyReadFromOtherItem()Description copied from interface:ILogicProgrammerElementIf this element in its current state can be deactivated because of another item being inserted into the write slot.- Specified by:
canCurrentlyReadFromOtherItemin interfaceILogicProgrammerElement<ISubGuiBox, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase, DecodeLPElementClient>- Returns:
- If this element can be deactivated.
-
isFor
- Specified by:
isForin interfaceILogicProgrammerElement<ISubGuiBox, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase, DecodeLPElementClient>- Parameters:
variableFacade- A variable facade- Returns:
- If this element corresponds to the given variable facade.
-
isItemValidForSlot
public boolean isItemValidForSlot(int slotId, net.minecraft.world.item.ItemStack itemStack) Description copied from interface:ILogicProgrammerElementCheck if the given item can be inserted into the given slot.- Specified by:
isItemValidForSlotin interfaceILogicProgrammerElement<ISubGuiBox, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase, DecodeLPElementClient>- Parameters:
slotId- The slot id.itemStack- The item that will be inserted.- Returns:
- If it can be inserted.
-
slotClick
public boolean slotClick(int slotId, net.minecraft.world.inventory.Slot slot, int mouseButton, net.minecraft.world.inventory.ContainerInput clickType, net.minecraft.world.entity.player.Player player) Description copied from interface:ILogicProgrammerElementCalled when a player clicks on a slot.- Specified by:
slotClickin interfaceILogicProgrammerElement<ISubGuiBox, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase, DecodeLPElementClient>- Parameters:
slotId- The slot id.slot- The slot.mouseButton- The mouse buttong id.clickType- The click type.player- The clicking player.- Returns:
- If further processing of the clicking should stop.
-
getItemStackSizeLimit
public int getItemStackSizeLimit()- Specified by:
getItemStackSizeLimitin interfaceILogicProgrammerElement<ISubGuiBox, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase, DecodeLPElementClient>- Returns:
- The max stacksize.
-
createSlot
public net.minecraft.world.inventory.Slot createSlot(net.minecraft.world.Container temporaryInputSlots, int slotId, int x, int y) Description copied from interface:ILogicProgrammerElementCreate a temporary input slot for this element. The number of slots depends on the provided render pattern return byIGuiInputElement.getRenderPattern().- Specified by:
createSlotin interfaceILogicProgrammerElement<ISubGuiBox, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase, DecodeLPElementClient>- Parameters:
temporaryInputSlots- The inventory behind this slot.slotId- The slot id.x- The X position for this slot.y- The Y position for this slot.- Returns:
- The created slot.
-
getName
public net.minecraft.network.chat.Component getName()- Specified by:
getNamein interfaceIGuiInputElement<ISubGuiBox, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase, DecodeLPElementClient>- Returns:
- Name used for rendering.
-
loadTooltip
- Specified by:
loadTooltipin interfaceIGuiInputElement<ISubGuiBox, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase, DecodeLPElementClient>- Parameters:
tooltipAdder- The list to add tooltip lines to.
-
getRenderPattern
- Specified by:
getRenderPatternin interfaceIGuiInputElement<ISubGuiBox, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase, DecodeLPElementClient>- Returns:
- The render pattern.
-
activate
public void activate()Description copied from interface:IGuiInputElementCalled when this element is activated.- Specified by:
activatein interfaceIGuiInputElement<ISubGuiBox, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase, DecodeLPElementClient>
-
deactivate
public void deactivate()Description copied from interface:IGuiInputElementCalled when this element is deactivated.- Specified by:
deactivatein interfaceIGuiInputElement<ISubGuiBox, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase, DecodeLPElementClient>
-
validate
public net.minecraft.network.chat.Component validate()Description copied from interface:IGuiInputElementValidates the current state of the element.- Specified by:
validatein interfaceIGuiInputElement<ISubGuiBox, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase, DecodeLPElementClient>- Returns:
- An error or null.
-
getColor
public int getColor()- Specified by:
getColorin interfaceIGuiInputElement<ISubGuiBox, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase, DecodeLPElementClient>- Returns:
- The color used to identify this element.
-
getSymbol
- Specified by:
getSymbolin interfaceIGuiInputElement<ISubGuiBox, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase, DecodeLPElementClient>- Returns:
- The symbol used to identify this element.
-
setValueInContainer
Description copied from interface:ILogicProgrammerElementSet the currently stored value in the given container. This is only relevant to values that use things like slots, which must be updated server-side as well.- Specified by:
setValueInContainerin interfaceILogicProgrammerElement<ISubGuiBox, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase, DecodeLPElementClient>- Parameters:
container- The container to put the currently stored value in.
-