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

CyclopsMC / IntegratedDynamics / 20210191346

14 Dec 2025 03:32PM UTC coverage: 19.514% (-33.5%) from 53.061%
20210191346

push

github

rubensworks
Remove deprecations

663 of 8728 branches covered (7.6%)

Branch coverage included in aggregate %.

6786 of 29445 relevant lines covered (23.05%)

1.09 hits per line

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

0.0
/src/main/java/org/cyclops/integrateddynamics/gametest/GameTestsAspectsReadInventory.java
1
package org.cyclops.integrateddynamics.gametest;
2

3
import net.minecraft.core.BlockPos;
4
import net.minecraft.gametest.framework.GameTestHelper;
5
import net.minecraft.world.item.ItemStack;
6
import net.minecraft.world.item.Items;
7
import net.minecraft.world.level.block.Blocks;
8
import net.minecraft.world.level.block.entity.ChestBlockEntity;
9
import org.cyclops.cyclopscore.gametest.GameTest;
10
import org.cyclops.integrateddynamics.core.evaluate.variable.*;
11
import org.cyclops.integrateddynamics.core.part.PartTypes;
12
import org.cyclops.integrateddynamics.part.aspect.Aspects;
13

14
import static org.cyclops.integrateddynamics.gametest.GameTestHelpersIntegratedDynamics.testReadAspect;
15

16
public class GameTestsAspectsReadInventory {
×
17

18
    public static final String TEMPLATE_EMPTY = "integrateddynamics:empty10";
19
    public static final BlockPos POS = BlockPos.ZERO.offset(2, 0, 2);
×
20

21
    @GameTest(template = TEMPLATE_EMPTY)
22
    public void testAspectsReadInventoryFullTrue(GameTestHelper helper) {
23
        helper.setBlock(POS.west(), Blocks.CHEST);
×
24
        ChestBlockEntity chest = helper.getBlockEntity(POS.west(), ChestBlockEntity.class);
×
25
        for (int i = 0; i < 27; i++) {
×
26
            chest.setItem(i, new ItemStack(Items.COAL));
×
27
        }
28
        testReadAspect(POS, helper, PartTypes.INVENTORY_READER, Aspects.Read.Inventory.BOOLEAN_FULL, ValueTypeBoolean.ValueBoolean.of(true));
×
29
    }
×
30

31
    @GameTest(template = TEMPLATE_EMPTY)
32
    public void testAspectsReadInventoryFullFalse(GameTestHelper helper) {
33
        helper.setBlock(POS.west(), Blocks.CHEST);
×
34
        ChestBlockEntity chest = helper.getBlockEntity(POS.west(), ChestBlockEntity.class);
×
35
        for (int i = 0; i < 26; i++) {
×
36
            chest.setItem(i, new ItemStack(Items.COAL));
×
37
        }
38
        testReadAspect(POS, helper, PartTypes.INVENTORY_READER, Aspects.Read.Inventory.BOOLEAN_FULL, ValueTypeBoolean.ValueBoolean.of(false));
×
39
    }
×
40

41
    @GameTest(template = TEMPLATE_EMPTY)
42
    public void testAspectsReadInventoryEmptyTrue(GameTestHelper helper) {
43
        helper.setBlock(POS.west(), Blocks.CHEST);
×
44
        ChestBlockEntity chest = helper.getBlockEntity(POS.west(), ChestBlockEntity.class);
×
45
        testReadAspect(POS, helper, PartTypes.INVENTORY_READER, Aspects.Read.Inventory.BOOLEAN_EMPTY, ValueTypeBoolean.ValueBoolean.of(true));
×
46
    }
×
47

48
    @GameTest(template = TEMPLATE_EMPTY)
49
    public void testAspectsReadInventoryEmptyFalse(GameTestHelper helper) {
50
        helper.setBlock(POS.west(), Blocks.CHEST);
×
51
        ChestBlockEntity chest = helper.getBlockEntity(POS.west(), ChestBlockEntity.class);
×
52
        chest.setItem(0, new ItemStack(Items.COAL));
×
53
        testReadAspect(POS, helper, PartTypes.INVENTORY_READER, Aspects.Read.Inventory.BOOLEAN_EMPTY, ValueTypeBoolean.ValueBoolean.of(false));
×
54
    }
×
55

56
    @GameTest(template = TEMPLATE_EMPTY)
57
    public void testAspectsReadInventoryNonEmptyTrue(GameTestHelper helper) {
58
        helper.setBlock(POS.west(), Blocks.CHEST);
×
59
        ChestBlockEntity chest = helper.getBlockEntity(POS.west(), ChestBlockEntity.class);
×
60
        chest.setItem(0, new ItemStack(Items.COAL));
×
61
        testReadAspect(POS, helper, PartTypes.INVENTORY_READER, Aspects.Read.Inventory.BOOLEAN_NONEMPTY, ValueTypeBoolean.ValueBoolean.of(true));
×
62
    }
×
63

64
    @GameTest(template = TEMPLATE_EMPTY)
65
    public void testAspectsReadInventoryNonEmptyFalse(GameTestHelper helper) {
66
        helper.setBlock(POS.west(), Blocks.CHEST);
×
67
        ChestBlockEntity chest = helper.getBlockEntity(POS.west(), ChestBlockEntity.class);
×
68
        testReadAspect(POS, helper, PartTypes.INVENTORY_READER, Aspects.Read.Inventory.BOOLEAN_NONEMPTY, ValueTypeBoolean.ValueBoolean.of(false));
×
69
    }
×
70

71
    @GameTest(template = TEMPLATE_EMPTY)
72
    public void testAspectsReadInventoryApplicableTrue(GameTestHelper helper) {
73
        helper.setBlock(POS.west(), Blocks.CHEST);
×
74
        testReadAspect(POS, helper, PartTypes.INVENTORY_READER, Aspects.Read.Inventory.BOOLEAN_APPLICABLE, ValueTypeBoolean.ValueBoolean.of(true));
×
75
    }
×
76

77
    @GameTest(template = TEMPLATE_EMPTY)
78
    public void testAspectsReadInventoryApplicableFalse(GameTestHelper helper) {
79
        testReadAspect(POS, helper, PartTypes.INVENTORY_READER, Aspects.Read.Inventory.BOOLEAN_APPLICABLE, ValueTypeBoolean.ValueBoolean.of(false));
×
80
    }
×
81

82
    @GameTest(template = TEMPLATE_EMPTY)
83
    public void testAspectsReadInventoryCount(GameTestHelper helper) {
84
        helper.setBlock(POS.west(), Blocks.CHEST);
×
85
        ChestBlockEntity chest = helper.getBlockEntity(POS.west(), ChestBlockEntity.class);
×
86
        chest.setItem(0, new ItemStack(Items.COAL, 10));
×
87
        chest.setItem(1, new ItemStack(Items.COAL, 5));
×
88
        testReadAspect(POS, helper, PartTypes.INVENTORY_READER, Aspects.Read.Inventory.INTEGER_COUNT, ValueTypeInteger.ValueInteger.of(15));
×
89
    }
×
90

91
    @GameTest(template = TEMPLATE_EMPTY)
92
    public void testAspectsReadInventorySlotsValid(GameTestHelper helper) {
93
        helper.setBlock(POS.west(), Blocks.CHEST);
×
94
        testReadAspect(POS, helper, PartTypes.INVENTORY_READER, Aspects.Read.Inventory.INTEGER_SLOTS, ValueTypeInteger.ValueInteger.of(27));
×
95
    }
×
96

97
    @GameTest(template = TEMPLATE_EMPTY)
98
    public void testAspectsReadInventorySlotsInvalid(GameTestHelper helper) {
99
        testReadAspect(POS, helper, PartTypes.INVENTORY_READER, Aspects.Read.Inventory.INTEGER_SLOTS, ValueTypeInteger.ValueInteger.of(0));
×
100
    }
×
101

102
    @GameTest(template = TEMPLATE_EMPTY)
103
    public void testAspectsReadInventorySlotsFilled(GameTestHelper helper) {
104
        helper.setBlock(POS.west(), Blocks.CHEST);
×
105
        ChestBlockEntity chest = helper.getBlockEntity(POS.west(), ChestBlockEntity.class);
×
106
        chest.setItem(0, new ItemStack(Items.COAL, 10));
×
107
        chest.setItem(1, new ItemStack(Items.COAL, 5));
×
108
        chest.setItem(10, new ItemStack(Items.COAL, 5));
×
109
        testReadAspect(POS, helper, PartTypes.INVENTORY_READER, Aspects.Read.Inventory.INTEGER_SLOTSFILLED, ValueTypeInteger.ValueInteger.of(3));
×
110
    }
×
111

112
    @GameTest(template = TEMPLATE_EMPTY)
113
    public void testAspectsReadInventoryFillRatio(GameTestHelper helper) {
114
        helper.setBlock(POS.west(), Blocks.CHEST);
×
115
        ChestBlockEntity chest = helper.getBlockEntity(POS.west(), ChestBlockEntity.class);
×
116
        chest.setItem(0, new ItemStack(Items.COAL, 10));
×
117
        chest.setItem(1, new ItemStack(Items.COAL, 5));
×
118
        chest.setItem(10, new ItemStack(Items.COAL, 5));
×
119
        testReadAspect(POS, helper, PartTypes.INVENTORY_READER, Aspects.Read.Inventory.DOUBLE_FILLRATIO, ValueTypeDouble.ValueDouble.of(3d / 27d));
×
120
    }
×
121

122
    @GameTest(template = TEMPLATE_EMPTY)
123
    public void testAspectsReadInventoryItemStacks(GameTestHelper helper) {
124
        helper.setBlock(POS.west(), Blocks.CHEST);
×
125
        ChestBlockEntity chest = helper.getBlockEntity(POS.west(), ChestBlockEntity.class);
×
126
        chest.setItem(0, new ItemStack(Items.COAL, 10));
×
127
        chest.setItem(1, new ItemStack(Items.COAL, 5));
×
128
        chest.setItem(10, new ItemStack(Items.COAL, 5));
×
129
        testReadAspect(POS, helper, PartTypes.INVENTORY_READER, Aspects.Read.Inventory.LIST_ITEMSTACKS, ValueTypeList.ValueList.ofAll(
×
130
                ValueObjectTypeItemStack.ValueItemStack.of(new ItemStack(Items.COAL, 10)),
×
131
                ValueObjectTypeItemStack.ValueItemStack.of(new ItemStack(Items.COAL, 5)),
×
132
                ValueObjectTypeItemStack.ValueItemStack.of(ItemStack.EMPTY),
×
133
                ValueObjectTypeItemStack.ValueItemStack.of(ItemStack.EMPTY),
×
134
                ValueObjectTypeItemStack.ValueItemStack.of(ItemStack.EMPTY),
×
135
                ValueObjectTypeItemStack.ValueItemStack.of(ItemStack.EMPTY),
×
136
                ValueObjectTypeItemStack.ValueItemStack.of(ItemStack.EMPTY),
×
137
                ValueObjectTypeItemStack.ValueItemStack.of(ItemStack.EMPTY),
×
138
                ValueObjectTypeItemStack.ValueItemStack.of(ItemStack.EMPTY),
×
139
                ValueObjectTypeItemStack.ValueItemStack.of(ItemStack.EMPTY),
×
140
                ValueObjectTypeItemStack.ValueItemStack.of(new ItemStack(Items.COAL, 5)),
×
141
                ValueObjectTypeItemStack.ValueItemStack.of(ItemStack.EMPTY),
×
142
                ValueObjectTypeItemStack.ValueItemStack.of(ItemStack.EMPTY),
×
143
                ValueObjectTypeItemStack.ValueItemStack.of(ItemStack.EMPTY),
×
144
                ValueObjectTypeItemStack.ValueItemStack.of(ItemStack.EMPTY),
×
145
                ValueObjectTypeItemStack.ValueItemStack.of(ItemStack.EMPTY),
×
146
                ValueObjectTypeItemStack.ValueItemStack.of(ItemStack.EMPTY),
×
147
                ValueObjectTypeItemStack.ValueItemStack.of(ItemStack.EMPTY),
×
148
                ValueObjectTypeItemStack.ValueItemStack.of(ItemStack.EMPTY),
×
149
                ValueObjectTypeItemStack.ValueItemStack.of(ItemStack.EMPTY),
×
150
                ValueObjectTypeItemStack.ValueItemStack.of(ItemStack.EMPTY),
×
151
                ValueObjectTypeItemStack.ValueItemStack.of(ItemStack.EMPTY),
×
152
                ValueObjectTypeItemStack.ValueItemStack.of(ItemStack.EMPTY),
×
153
                ValueObjectTypeItemStack.ValueItemStack.of(ItemStack.EMPTY),
×
154
                ValueObjectTypeItemStack.ValueItemStack.of(ItemStack.EMPTY),
×
155
                ValueObjectTypeItemStack.ValueItemStack.of(ItemStack.EMPTY),
×
156
                ValueObjectTypeItemStack.ValueItemStack.of(ItemStack.EMPTY)
×
157
        ));
158
    }
×
159

160
}
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