• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CyclopsMC / IntegratedDynamics / 16552051255

27 Jul 2025 01:58PM UTC coverage: 53.206% (+8.0%) from 45.161%
16552051255

push

github

rubensworks
Resolve minor TODOs

2888 of 8740 branches covered (33.04%)

Branch coverage included in aggregate %.

17341 of 29280 relevant lines covered (59.22%)

3.08 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/org/cyclops/integrateddynamics/api/logicprogrammer/ILogicProgrammerElement.java
1
package org.cyclops.integrateddynamics.api.logicprogrammer;
2

3
import net.minecraft.client.gui.screens.Screen;
4
import net.minecraft.world.Container;
5
import net.minecraft.world.entity.player.Player;
6
import net.minecraft.world.inventory.AbstractContainerMenu;
7
import net.minecraft.world.inventory.ClickType;
8
import net.minecraft.world.inventory.Slot;
9
import net.minecraft.world.item.ItemStack;
10
import org.cyclops.cyclopscore.inventory.slot.SlotExtended;
11
import org.cyclops.integrateddynamics.api.client.gui.subgui.IGuiInputElement;
12
import org.cyclops.integrateddynamics.api.client.gui.subgui.ISubGuiBox;
13
import org.cyclops.integrateddynamics.api.evaluate.variable.IValueType;
14
import org.cyclops.integrateddynamics.api.item.IVariableFacade;
15

16
/**
17
 * An element instantiation inside the logic programmer.
18
 * @param <G> The type of gui.
19
 * @param <C> The type of container.
20
 * @param <S> The sub gui box type.
21
 * @author rubensworks
22
 */
23
public interface ILogicProgrammerElement<S extends ISubGuiBox, G extends Screen, C extends AbstractContainerMenu, GIC extends ILogicProgrammerElementClient<S, G, C>>
24
        extends IGuiInputElement<S, G, C, GIC> {
25

26
    /**
27
     * @return The element type.
28
     */
29
    public ILogicProgrammerElementType getType();
30

31
    /**
32
     * @return The string used to match regex searching.
33
     */
34
    public String getMatchString();
35

36
    /**
37
     * If the given value type matches with this element's input.
38
     * @param valueType The value type to match.
39
     * @return If it matches
40
     */
41
    public boolean matchesInput(IValueType<?> valueType);
42

43
    /**
44
     * If the given value type matches with this element's output.
45
     * @param valueType The value type to match.
46
     * @return If it matches
47
     */
48
    public boolean matchesOutput(IValueType<?> valueType);
49

50
    /**
51
     * Create a temporary input slot for this element.
52
     * The number of slots depends on the provided render pattern
53
     * return by {@link #getRenderPattern()}.
54
     * @param temporaryInputSlots The inventory behind this slot.
55
     * @param slotId The slot id.
56
     * @param x The X position for this slot.
57
     * @param y The Y position for this slot.
58
     * @return The created slot.
59
     */
60
    default Slot createSlot(Container temporaryInputSlots, int slotId, int x, int y) {
61
        return createSlotDefault(this, temporaryInputSlots, slotId, x, y);
×
62
    }
63

64
    public static Slot createSlotDefault(ILogicProgrammerElement logicProgrammerElement, Container temporaryInputSlots, int slotId, int x, int y) {
65
        SlotExtended slot = new SlotExtended(temporaryInputSlots, slotId, x, y) {
×
66
            @Override
67
            public boolean mayPlace(ItemStack itemStack) {
68
                return logicProgrammerElement.isItemValidForSlot(slotId, itemStack);
×
69
            }
70
        };
71
        slot.setPhantom(true);
×
72
        return slot;
×
73
    }
74

75
    /**
76
     * Called when an input item slot has been updated.
77
     * @param player
78
     * @param slotId The slot id.
79
     * @param itemStack The itemstack currently in the slot, can be null.
80
     */
81
    public void onInputSlotUpdated(Player player, int slotId, ItemStack itemStack);
82

83
    /**
84
     * @return If this element can be written to an item in its current state.
85
     */
86
    public boolean canWriteElementPre();
87

88
    /**
89
     * The stack to write the current state of this element to.
90
     * @param player The player that is writing the element.
91
     * @param itemStack The stack to write to.
92
     * @return The resulting itemstack.
93
     */
94
    public ItemStack writeElement(Player player, ItemStack itemStack);
95

96
    /**
97
     * The variable facade to load onto this element.
98
     *
99
     * @param variableFacade        The variable facade to load.
100
     */
101
    public void loadElement(IVariableFacade variableFacade);
102

103
    /**
104
     * If this element in its current state can be deactivated because of another item being inserted into the
105
     * write slot.
106
     * @return If this element can be deactivated.
107
     */
108
    public boolean canCurrentlyReadFromOtherItem();
109

110
    /**
111
     * @param variableFacade A variable facade
112
     * @return If this element corresponds to the given variable facade.
113
     */
114
    public boolean isFor(IVariableFacade variableFacade);
115

116
    /**
117
     * Check if the given item can be inserted into the given slot.
118
     * @param slotId The slot id.
119
     * @param itemStack The item that will be inserted.
120
     * @return If it can be inserted.
121
     */
122
    public boolean isItemValidForSlot(int slotId, ItemStack itemStack);
123

124
    /**
125
     * Called when a player clicks on a slot.
126
     * @param slotId The slot id.
127
     * @param slot The slot.
128
     * @param mouseButton The mouse buttong id.
129
     * @param clickType The click type.
130
     * @param player The clicking player.
131
     * @return If further processing of the clicking should stop.
132
     */
133
    boolean slotClick(int slotId, Slot slot, int mouseButton, ClickType clickType, Player player);
134

135
    /**
136
     * @return The max stacksize.
137
     */
138
    public int getItemStackSizeLimit();
139

140
    /**
141
     * Set the currently stored value in the given container.
142
     * This is only relevant to values that use things like slots, which must be updated server-side as well.
143
     * @param container The container to put the currently stored value in.
144
     */
145
    public void setValueInContainer(C container);
146
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc