• 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/inventory/container/ContainerLabeller.java
1
package org.cyclops.integrateddynamics.inventory.container;
2

3
import net.minecraft.core.component.DataComponents;
4
import net.minecraft.network.FriendlyByteBuf;
5
import net.minecraft.network.chat.Component;
6
import net.minecraft.world.entity.player.Inventory;
7
import net.minecraft.world.entity.player.Player;
8
import net.minecraft.world.item.ItemStack;
9
import org.apache.commons.lang3.StringUtils;
10
import org.cyclops.cyclopscore.inventory.ItemLocation;
11
import org.cyclops.cyclopscore.inventory.SimpleInventory;
12
import org.cyclops.cyclopscore.inventory.container.ItemInventoryContainer;
13
import org.cyclops.cyclopscore.inventory.slot.SlotExtended;
14
import org.cyclops.integrateddynamics.RegistryEntries;
15
import org.cyclops.integrateddynamics.core.helper.Helpers;
16
import org.cyclops.integrateddynamics.item.ItemLabeller;
17

18
/**
19
 * Container for the labeller.
20
 * @author rubensworks
21
 */
22
public class ContainerLabeller extends ItemInventoryContainer<ItemLabeller> {
23

24
    private SimpleInventory temporaryInputSlots = null;
×
25

26
    public ContainerLabeller(int id, Inventory inventory, FriendlyByteBuf packetBuffer) {
27
        this(id, inventory, ItemLocation.readFromPacketBuffer(packetBuffer));
×
28
    }
×
29

30
    public ContainerLabeller(int id, Inventory inventory, ItemLocation itemLocation) {
31
        super(RegistryEntries.CONTAINER_LABELLER.get(), id, inventory, itemLocation);
×
32
        this.temporaryInputSlots = new SimpleInventory(1, 1);
×
33
        addSlot(new SlotExtended(temporaryInputSlots, 0, 8, 8));
×
34
        this.addPlayerInventory(player.getInventory(), 8, 31);
×
35
    }
×
36

37
    public SimpleInventory getTemporaryInputSlots() {
38
        return temporaryInputSlots;
×
39
    }
40

41
    public ItemStack getItemStack() {
42
        return temporaryInputSlots.getItem(0);
×
43
    }
44

45
    @Override
46
    protected int getSizeInventory() {
47
        return 1;
×
48
    }
49

50
    @Override
51
    public void removed(Player player) {
52
        super.removed(player);
×
53
        if (!player.level().isClientSide()) {
×
54
            ItemStack itemStack = temporaryInputSlots.getItem(0);
×
55
            if(!itemStack.isEmpty()) {
×
56
                Helpers.returnItemToPlayer(player, itemStack);
×
57
            }
58
        }
59
    }
×
60

61
    public void setItemStackName(String name) {
62
        ItemStack itemStack = getItemStack();
×
63
        if(!itemStack.isEmpty()) {
×
64
            if (StringUtils.isBlank(name)) {
×
65
                itemStack.remove(DataComponents.CUSTOM_NAME);
×
66
            } else {
67
                itemStack.set(DataComponents.CUSTOM_NAME, Component.literal(name));
×
68
            }
69
        }
70
    }
×
71
}
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