• 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

49.79
/src/main/java/org/cyclops/integrateddynamics/part/aspect/read/AspectReadBuilders.java
1
package org.cyclops.integrateddynamics.part.aspect.read;
2

3
import com.google.common.collect.ImmutableList;
4
import net.minecraft.core.BlockPos;
5
import net.minecraft.core.Direction;
6
import net.minecraft.nbt.Tag;
7
import net.minecraft.server.MinecraftServer;
8
import net.minecraft.world.entity.decoration.ItemFrame;
9
import net.minecraft.world.item.ItemStack;
10
import net.minecraft.world.level.block.Blocks;
11
import net.minecraft.world.level.block.RedStoneWireBlock;
12
import net.minecraft.world.level.block.state.BlockState;
13
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
14
import net.minecraft.world.phys.AABB;
15
import net.minecraft.world.phys.Vec3;
16
import net.neoforged.neoforge.event.level.NoteBlockEvent;
17
import net.neoforged.neoforge.fluids.FluidStack;
18
import net.neoforged.neoforge.server.ServerLifecycleHooks;
19
import net.neoforged.neoforge.transfer.EmptyResourceHandler;
20
import net.neoforged.neoforge.transfer.ResourceHandler;
21
import net.neoforged.neoforge.transfer.energy.EnergyHandler;
22
import net.neoforged.neoforge.transfer.fluid.FluidResource;
23
import net.neoforged.neoforge.transfer.item.ItemResource;
24
import org.apache.commons.lang3.tuple.Pair;
25
import org.cyclops.commoncapabilities.api.capability.Capabilities;
26
import org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeHandler;
27
import org.cyclops.commoncapabilities.api.capability.temperature.ITemperature;
28
import org.cyclops.commoncapabilities.api.capability.work.IWorker;
29
import org.cyclops.cyclopscore.datastructure.DimPos;
30
import org.cyclops.cyclopscore.helper.IModHelpersNeoForge;
31
import org.cyclops.integrateddynamics.api.evaluate.variable.IValue;
32
import org.cyclops.integrateddynamics.api.network.INetwork;
33
import org.cyclops.integrateddynamics.api.network.IPositionedAddonsNetwork;
34
import org.cyclops.integrateddynamics.api.part.PartPos;
35
import org.cyclops.integrateddynamics.api.part.PartTarget;
36
import org.cyclops.integrateddynamics.api.part.aspect.property.IAspectProperties;
37
import org.cyclops.integrateddynamics.api.part.aspect.property.IAspectPropertyTypeInstance;
38
import org.cyclops.integrateddynamics.core.NoteBlockEventReceiver;
39
import org.cyclops.integrateddynamics.core.evaluate.variable.*;
40
import org.cyclops.integrateddynamics.core.helper.NetworkHelpers;
41
import org.cyclops.integrateddynamics.core.part.aspect.build.AspectBuilder;
42
import org.cyclops.integrateddynamics.core.part.aspect.build.IAspectValuePropagator;
43
import org.cyclops.integrateddynamics.core.part.aspect.property.AspectProperties;
44
import org.cyclops.integrateddynamics.core.part.aspect.property.AspectPropertyTypeInstance;
45

46
import java.util.List;
47
import java.util.Locale;
48
import java.util.Optional;
49
import java.util.function.Predicate;
50

51
/**
52
 * Collection of aspect read builders and value propagators.
53
 * @author rubensworks
54
 */
55
public class AspectReadBuilders {
×
56

57
    // --------------- Value type builders ---------------
58
    public static final AspectBuilder<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean, Pair<PartTarget, IAspectProperties>>
59
            BUILDER_BOOLEAN = AspectBuilder.forReadType(ValueTypes.BOOLEAN);
3✔
60
    public static final AspectBuilder<ValueTypeInteger.ValueInteger, ValueTypeInteger, Pair<PartTarget, IAspectProperties>>
61
            BUILDER_INTEGER = AspectBuilder.forReadType(ValueTypes.INTEGER);
3✔
62
    public static final AspectBuilder<ValueTypeDouble.ValueDouble, ValueTypeDouble, Pair<PartTarget, IAspectProperties>>
63
            BUILDER_DOUBLE = AspectBuilder.forReadType(ValueTypes.DOUBLE);
3✔
64
    public static final AspectBuilder<ValueTypeLong.ValueLong, ValueTypeLong, Pair<PartTarget, IAspectProperties>>
65
            BUILDER_LONG = AspectBuilder.forReadType(ValueTypes.LONG);
3✔
66
    public static final AspectBuilder<ValueTypeString.ValueString, ValueTypeString, Pair<PartTarget, IAspectProperties>>
67
            BUILDER_STRING = AspectBuilder.forReadType(ValueTypes.STRING);
3✔
68
    public static final AspectBuilder<ValueObjectTypeEntity.ValueEntity, ValueObjectTypeEntity, Pair<PartTarget, IAspectProperties>>
69
            BUILDER_ENTITY = AspectBuilder.forReadType(ValueTypes.OBJECT_ENTITY);
3✔
70
    public static final AspectBuilder<ValueTypeList.ValueList, ValueTypeList, Pair<PartTarget, IAspectProperties>>
71
            BUILDER_LIST = AspectBuilder.forReadType(ValueTypes.LIST);
3✔
72
    public static final AspectBuilder<ValueTypeNbt.ValueNbt, ValueTypeNbt, Pair<PartTarget, IAspectProperties>>
73
            BUILDER_NBT = AspectBuilder.forReadType(ValueTypes.NBT);
3✔
74
    public static final AspectBuilder<IValue, ValueTypeCategoryAny, Pair<PartTarget, IAspectProperties>>
75
            BUILDER_ANY = AspectBuilder.forReadType(ValueTypes.CATEGORY_ANY);
3✔
76
    public static final AspectBuilder<ValueTypeOperator.ValueOperator, ValueTypeOperator, Pair<PartTarget, IAspectProperties>>
77
            BUILDER_OPERATOR = AspectBuilder.forReadType(ValueTypes.OPERATOR);
3✔
78

79
    public static final AspectBuilder<ValueObjectTypeItemStack.ValueItemStack, ValueObjectTypeItemStack, Pair<PartTarget, IAspectProperties>>
80
            BUILDER_OBJECT_ITEMSTACK = AspectBuilder.forReadType(ValueTypes.OBJECT_ITEMSTACK);
3✔
81
    public static final AspectBuilder<ValueObjectTypeBlock.ValueBlock, ValueObjectTypeBlock, Pair<PartTarget, IAspectProperties>>
82
            BUILDER_OBJECT_BLOCK = AspectBuilder.forReadType(ValueTypes.OBJECT_BLOCK);
3✔
83
    public static final AspectBuilder<ValueObjectTypeFluidStack.ValueFluidStack, ValueObjectTypeFluidStack, Pair<PartTarget, IAspectProperties>>
84
            BUILDER_OBJECT_FLUIDSTACK = AspectBuilder.forReadType(ValueTypes.OBJECT_FLUIDSTACK);
3✔
85

86
    // --------------- Value type propagators ---------------
87
    public static final IAspectValuePropagator<Boolean, ValueTypeBoolean.ValueBoolean>
88
        PROP_GET_BOOLEAN = ValueTypeBoolean.ValueBoolean::of;
2✔
89

90
    public static final IAspectValuePropagator<Integer, ValueTypeInteger.ValueInteger>
91
        PROP_GET_INTEGER = ValueTypeInteger.ValueInteger::of;
2✔
92

93
    public static final IAspectValuePropagator<Double, ValueTypeDouble.ValueDouble>
94
        PROP_GET_DOUBLE = ValueTypeDouble.ValueDouble::of;
2✔
95

96
    public static final IAspectValuePropagator<Long, ValueTypeLong.ValueLong>
97
        PROP_GET_LONG = ValueTypeLong.ValueLong::of;
2✔
98

99
    public static final IAspectValuePropagator<ItemStack, ValueObjectTypeItemStack.ValueItemStack>
100
        PROP_GET_ITEMSTACK = ValueObjectTypeItemStack.ValueItemStack::of;
2✔
101

102
    public static final IAspectValuePropagator<String, ValueTypeString.ValueString>
103
        PROP_GET_STRING = ValueTypeString.ValueString::of;
2✔
104

105
    public static final IAspectValuePropagator<BlockState, ValueObjectTypeBlock.ValueBlock>
106
        PROP_GET_BLOCK = ValueObjectTypeBlock.ValueBlock::of;
2✔
107

108
    public static final IAspectValuePropagator<FluidStack, ValueObjectTypeFluidStack.ValueFluidStack>
109
        PROP_GET_FLUIDSTACK = ValueObjectTypeFluidStack.ValueFluidStack::of;
2✔
110

111
    public static final IAspectValuePropagator<Optional<Tag>,ValueTypeNbt.ValueNbt>
112
        PROP_GET_NBT = ValueTypeNbt.ValueNbt::of;
2✔
113

114
    // --------------- Value type validators ---------------
115
    public static final Predicate<ValueTypeInteger.ValueInteger>
116
        VALIDATOR_INTEGER_POSITIVE = input -> input.getRawValue() >= 0;
2!
117

118
    public static final Predicate<ValueTypeDouble.ValueDouble>
119
        VALIDATOR_DOUBLE_POSITIVE = input -> input.getRawValue() >= 0;
2!
120

121
    // --------------- Generic properties ---------------
122
    public static final IAspectPropertyTypeInstance<ValueTypeInteger, ValueTypeInteger.ValueInteger> PROPERTY_LISTINDEX =
7✔
123
            new AspectPropertyTypeInstance<>(ValueTypes.INTEGER, "aspect.aspecttypes.integrateddynamics.integer.listindex", VALIDATOR_INTEGER_POSITIVE);
124
    public static final IAspectProperties LIST_PROPERTIES = new AspectProperties(ImmutableList.<IAspectPropertyTypeInstance>of(
6✔
125
            PROPERTY_LISTINDEX
126
    ));
127
    static {
128
        LIST_PROPERTIES.setValue(PROPERTY_LISTINDEX, ValueTypeInteger.ValueInteger.of(0));
5✔
129
    }
1✔
130

131
    public static final class Audio {
×
132

133
        public static final IAspectPropertyTypeInstance<ValueTypeInteger, ValueTypeInteger.ValueInteger> PROPERTY_RANGE =
7✔
134
                new AspectPropertyTypeInstance<>(ValueTypes.INTEGER, "aspect.aspecttypes.integrateddynamics.integer.range", VALIDATOR_INTEGER_POSITIVE);
135
        public static final IAspectProperties NOTE_PROPERTIES = new AspectProperties(ImmutableList.<IAspectPropertyTypeInstance>of(
6✔
136
                PROPERTY_RANGE
137
        ));
138
        static {
139
            NOTE_PROPERTIES.setValue(PROPERTY_RANGE, ValueTypeInteger.ValueInteger.of(64));
5✔
140
        }
141

142
        public static final AspectBuilder<ValueTypeInteger.ValueInteger, ValueTypeInteger, Pair<PartTarget, IAspectProperties>>
143
                BUILDER_INTEGER = AspectReadBuilders.BUILDER_INTEGER.appendKind("audio");
5✔
144

145
        public static AspectBuilder<ValueTypeInteger.ValueInteger, ValueTypeInteger, Integer> forInstrument(final NoteBlockInstrument instrument) {
146
            return BUILDER_INTEGER.appendKind("instrument").handle(input -> {
9✔
147
                for (NoteBlockEvent.Play event : NoteBlockEventReceiver.getInstance().getEvents().get(instrument)) {
×
148
                    net.minecraft.world.level.Level world = input.getLeft().getTarget().getPos().getLevel(false);
×
149
                    if (world != null) {
×
150
                        BlockPos pos = input.getLeft().getTarget().getPos().getBlockPos();
×
151
                        int range = input.getRight().getValue(PROPERTY_RANGE).getRawValue();
×
152
                        if (world.dimensionType() == event.getLevel().dimensionType()
×
153
                                && pos.distSqr(event.getPos()) <= range * range) {
×
154
                            return event.getVanillaNoteId();
×
155
                        }
156
                    }
157
                }
×
158
                return -1;
×
159
            }, instrument.name().toLowerCase(Locale.ENGLISH)).withProperties(NOTE_PROPERTIES);
4✔
160
        }
161

162
    }
163

164
    public static final class Block {
×
165

166
        public static final IAspectValuePropagator<Pair<PartTarget, IAspectProperties>, DimPos>
167
                PROP_GET = input -> input.getLeft().getTarget().getPos();
2✔
168

169
        public static final AspectBuilder<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean, DimPos>
170
                BUILDER_BOOLEAN = AspectReadBuilders.BUILDER_BOOLEAN.handle(PROP_GET, "block");
5✔
171
        public static final AspectBuilder<ValueTypeInteger.ValueInteger, ValueTypeInteger, DimPos>
172
                BUILDER_INTEGER = AspectReadBuilders.BUILDER_INTEGER.handle(PROP_GET, "block");
5✔
173
        public static final AspectBuilder<ValueTypeString.ValueString, ValueTypeString, DimPos>
174
                BUILDER_STRING = AspectReadBuilders.BUILDER_STRING.handle(PROP_GET, "block");
5✔
175
        public static final AspectBuilder<ValueObjectTypeBlock.ValueBlock, ValueObjectTypeBlock, DimPos>
176
                BUILDER_BLOCK = AspectReadBuilders.BUILDER_OBJECT_BLOCK.handle(PROP_GET, "block");
5✔
177
        public static final AspectBuilder<ValueTypeNbt.ValueNbt, ValueTypeNbt, DimPos>
178
                BUILDER_NBT = AspectReadBuilders.BUILDER_NBT.handle(PROP_GET, "block");
6✔
179

180
    }
181

182
    public static final class Entity {
×
183

184
        public static final IAspectValuePropagator<Pair<PartTarget, IAspectProperties>, DimPos>
185
                PROP_GET = input -> input.getLeft().getTarget().getPos();
2✔
186

187
        public static final AspectBuilder<ValueObjectTypeEntity.ValueEntity, ValueObjectTypeEntity, Pair<PartTarget, IAspectProperties>>
188
                BUILDER_ENTITY = AspectReadBuilders.BUILDER_ENTITY.appendKind("entity");
4✔
189
        public static final AspectBuilder<ValueTypeList.ValueList, ValueTypeList, DimPos>
190
                BUILDER_LIST = AspectReadBuilders.BUILDER_LIST.handle(PROP_GET, "entity");
5✔
191
        public static final AspectBuilder<ValueObjectTypeItemStack.ValueItemStack, ValueObjectTypeItemStack, Pair<PartTarget, IAspectProperties>>
192
                BUILDER_ITEMSTACK = AspectReadBuilders.BUILDER_OBJECT_ITEMSTACK.appendKind("entity");
4✔
193
        public static final AspectBuilder<ValueTypeInteger.ValueInteger, ValueTypeInteger, Pair<PartTarget, IAspectProperties>>
194
                BUILDER_INTEGER_ALL = AspectReadBuilders.BUILDER_INTEGER.appendKind("entity");
5✔
195

196
    }
197

198
    public static final class ExtraDimensional {
×
199

200
        public static final IAspectValuePropagator<Pair<PartTarget, IAspectProperties>, MinecraftServer>
201
                PROP_GET = input -> ServerLifecycleHooks.getCurrentServer();
2✔
202

203
        public static final AspectBuilder<ValueTypeInteger.ValueInteger, ValueTypeInteger, MinecraftServer>
204
                BUILDER_INTEGER = AspectReadBuilders.BUILDER_INTEGER.handle(PROP_GET, "extradimensional");
5✔
205
        public static final AspectBuilder<ValueTypeDouble.ValueDouble, ValueTypeDouble, MinecraftServer>
206
                BUILDER_DOUBLE = AspectReadBuilders.BUILDER_DOUBLE.handle(PROP_GET, "extradimensional");
5✔
207
        public static final AspectBuilder<ValueTypeList.ValueList, ValueTypeList, MinecraftServer>
208
                BUILDER_LIST = AspectReadBuilders.BUILDER_LIST.handle(PROP_GET, "extradimensional");
6✔
209

210
    }
211

212
    public static final class Fluid {
×
213

214
        public static final IAspectPropertyTypeInstance<ValueTypeInteger, ValueTypeInteger.ValueInteger> PROP_TANKID =
7✔
215
                new AspectPropertyTypeInstance<>(ValueTypes.INTEGER, "aspect.aspecttypes.integrateddynamics.integer.tankid", VALIDATOR_INTEGER_POSITIVE);
216
        public static final IAspectProperties PROPERTIES = new AspectProperties(ImmutableList.<IAspectPropertyTypeInstance>of(
6✔
217
                PROP_TANKID
218
        ));
219
        static {
220
            PROPERTIES.setValue(PROP_TANKID, ValueTypeInteger.ValueInteger.of(0)); // Not required in this case, but we do this here just as an example on how to set default values.
5✔
221
        }
222

223
        public static final IAspectValuePropagator<Pair<PartTarget, IAspectProperties>, ResourceHandler<FluidResource>> PROP_GET = input -> {
2✔
224
            DimPos dimPos = input.getLeft().getTarget().getPos();
×
225
            return IModHelpersNeoForge.get().getCapabilityHelpers().getCapability(dimPos, input.getLeft().getTarget().getSide(),
×
226
                    net.neoforged.neoforge.capabilities.Capabilities.Fluid.BLOCK)
227
                    .orElse(EmptyResourceHandler.instance());
×
228
        };
229
        public static final IAspectValuePropagator<Pair<PartTarget, IAspectProperties>, Pair<ResourceHandler<FluidResource>, Integer>> PROP_GET_ACTIVATABLE = input -> {
2✔
230
            DimPos dimPos = input.getLeft().getTarget().getPos();
×
231
            ResourceHandler<FluidResource> fluidHandler = IModHelpersNeoForge.get().getCapabilityHelpers().getCapability(dimPos, input.getLeft().getTarget().getSide(),
×
232
                    net.neoforged.neoforge.capabilities.Capabilities.Fluid.BLOCK).orElse(null);
×
233
            if(fluidHandler != null) {
×
234
                int i = input.getRight().getValue(PROP_TANKID).getRawValue();
×
235
                if(i < fluidHandler.size()) {
×
236
                    return Pair.of(fluidHandler, i);
×
237
                }
238
            }
239
            return null;
×
240
        };
241
        public static final IAspectValuePropagator<Pair<ResourceHandler<FluidResource>, Integer>, FluidStack>
242
                PROP_GET_FLUIDSTACK = tankInfo -> tankInfo != null ? tankInfo.getLeft().getResource(tankInfo.getRight()).toStack(tankInfo.getLeft().getAmountAsInt(tankInfo.getRight())) : FluidStack.EMPTY;
2!
243

244
        public static final IAspectValuePropagator<Pair<PartTarget, IAspectProperties>, ValueTypeList.ValueList>
245
                PROP_GET_LIST_FLUIDSTACKS = input -> ValueTypeList.ValueList.ofFactory(new ValueTypeListProxyPositionedTankFluidStacks(
2✔
246
                        input.getLeft().getTarget().getPos(), input.getLeft().getTarget().getSide()
×
247
                ));
248
        public static final IAspectValuePropagator<Pair<PartTarget, IAspectProperties>, ValueTypeList.ValueList>
249
                PROP_GET_LIST_CAPACITIES = input -> ValueTypeList.ValueList.ofFactory(new ValueTypeListProxyPositionedTankCapacities(
2✔
250
                        input.getLeft().getTarget().getPos(), input.getLeft().getTarget().getSide()
×
251
                ));
252

253
        public static final AspectBuilder<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean, ResourceHandler<FluidResource>>
254
                BUILDER_BOOLEAN = AspectReadBuilders.BUILDER_BOOLEAN.handle(PROP_GET, "fluid");
5✔
255
        public static final AspectBuilder<ValueTypeInteger.ValueInteger, ValueTypeInteger, ResourceHandler<FluidResource>>
256
                BUILDER_INTEGER = AspectReadBuilders.BUILDER_INTEGER.handle(PROP_GET, "fluid");
5✔
257
        public static final AspectBuilder<ValueTypeLong.ValueLong, ValueTypeLong, ResourceHandler<FluidResource>>
258
                BUILDER_LONG = AspectReadBuilders.BUILDER_LONG.handle(PROP_GET, "fluid");
5✔
259
        public static final AspectBuilder<ValueTypeLong.ValueLong, ValueTypeLong, Pair<ResourceHandler<FluidResource>, Integer>>
260
                BUILDER_LONG_ACTIVATABLE = AspectReadBuilders.BUILDER_LONG.handle(PROP_GET_ACTIVATABLE, "fluid").withProperties(PROPERTIES);
7✔
261
        public static final AspectBuilder<ValueTypeDouble.ValueDouble, ValueTypeDouble, Pair<ResourceHandler<FluidResource>, Integer>>
262
                BUILDER_DOUBLE_ACTIVATABLE = AspectReadBuilders.BUILDER_DOUBLE.handle(PROP_GET_ACTIVATABLE, "fluid").withProperties(PROPERTIES);
8✔
263

264
    }
265

266
    public static final class Inventory {
×
267

268
        public static final IAspectPropertyTypeInstance<ValueTypeInteger, ValueTypeInteger.ValueInteger> PROPERTY_SLOTID =
7✔
269
                new AspectPropertyTypeInstance<>(ValueTypes.INTEGER, "aspect.aspecttypes.integrateddynamics.integer.slotid", VALIDATOR_INTEGER_POSITIVE);
270
        public static final IAspectProperties PROPERTIES = new AspectProperties(ImmutableList.<IAspectPropertyTypeInstance>of(
6✔
271
                PROPERTY_SLOTID
272
        ));
273
        static {
274
            PROPERTIES.setValue(PROPERTY_SLOTID, ValueTypeInteger.ValueInteger.of(0)); // Not required in this case, but we do this here just as an example on how to set default values.
5✔
275
        }
276

277
        public static final IAspectValuePropagator<Pair<PartTarget, IAspectProperties>, ResourceHandler<ItemResource>> PROP_GET = input -> {
2✔
278
            PartPos target = input.getLeft().getTarget();
×
279
            return IModHelpersNeoForge.get().getCapabilityHelpers().getCapability(target.getPos().getLevel(true), target.getPos().getBlockPos(), target.getSide(), net.neoforged.neoforge.capabilities.Capabilities.Item.BLOCK).orElse(null);
×
280
        };
281
        public static final IAspectValuePropagator<Pair<PartTarget, IAspectProperties>, ItemStack> PROP_GET_SLOT = input -> {
2✔
282
            PartPos target = input.getLeft().getTarget();
×
283
            ResourceHandler<ItemResource> itemHandler = IModHelpersNeoForge.get().getCapabilityHelpers().getCapability(target.getPos().getLevel(true), target.getPos().getBlockPos(), target.getSide(), net.neoforged.neoforge.capabilities.Capabilities.Item.BLOCK).orElse(null);
×
284
            int slotId = input.getRight().getValue(PROPERTY_SLOTID).getRawValue();
×
285
            if(itemHandler != null && slotId >= 0 && slotId < itemHandler.size()) {
×
286
                return itemHandler.getResource(slotId).toStack(itemHandler.getAmountAsInt(slotId));
×
287
            }
288
            return ItemStack.EMPTY;
×
289
        };
290
        public static final IAspectValuePropagator<Pair<PartTarget, IAspectProperties>, ValueTypeList.ValueList>
291
                PROP_GET_LIST = input -> ValueTypeList.ValueList.ofFactory(new ValueTypeListProxyPositionedInventory(input.getLeft().getTarget().getPos(), input.getLeft().getTarget().getSide()));
2✔
292

293
        public static final AspectBuilder<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean, ResourceHandler<ItemResource>>
294
                BUILDER_BOOLEAN = AspectReadBuilders.BUILDER_BOOLEAN.handle(PROP_GET, "inventory");
5✔
295
        public static final AspectBuilder<ValueTypeInteger.ValueInteger, ValueTypeInteger, ResourceHandler<ItemResource>>
296
                BUILDER_INTEGER = AspectReadBuilders.BUILDER_INTEGER.handle(PROP_GET, "inventory");
5✔
297
        public static final AspectBuilder<ValueTypeDouble.ValueDouble, ValueTypeDouble, ResourceHandler<ItemResource>>
298
                BUILDER_DOUBLE = AspectReadBuilders.BUILDER_DOUBLE.handle(PROP_GET, "inventory");
5✔
299
        public static final AspectBuilder<ValueObjectTypeItemStack.ValueItemStack, ValueObjectTypeItemStack, ItemStack>
300
                BUILDER_ITEMSTACK = BUILDER_OBJECT_ITEMSTACK.handle(PROP_GET_SLOT, "inventory").withProperties(PROPERTIES);
8✔
301

302
    }
303

304
    public static final class Machine {
×
305

306
        public static final IAspectValuePropagator<Pair<PartTarget, IAspectProperties>, IWorker> PROP_GET_WORKER = input -> {
2✔
307
            DimPos dimPos = input.getLeft().getTarget().getPos();
×
308
            return IModHelpersNeoForge.get().getCapabilityHelpers().getCapability(dimPos.getLevel(true), dimPos.getBlockPos(), input.getLeft().getTarget().getSide(), Capabilities.Worker.BLOCK).orElse(null);
×
309
        };
310
        public static final IAspectValuePropagator<Pair<PartTarget, IAspectProperties>, ITemperature> PROP_GET_TEMPERATURE = input -> {
2✔
311
            DimPos dimPos = input.getLeft().getTarget().getPos();
×
312
            return IModHelpersNeoForge.get().getCapabilityHelpers().getCapability(dimPos.getLevel(true), dimPos.getBlockPos(), input.getLeft().getTarget().getSide(), org.cyclops.commoncapabilities.api.capability.Capabilities.Temperature.BLOCK).orElse(null);
×
313
        };
314
        public static final IAspectValuePropagator<Pair<PartTarget, IAspectProperties>, IRecipeHandler> PROP_GET_RECIPE_HANDLER = new IAspectValuePropagator<Pair<PartTarget, IAspectProperties>, IRecipeHandler>() {
7✔
315
            @Override
316
            public IRecipeHandler getOutput(Pair<PartTarget, IAspectProperties> input) {
317
                DimPos dimPos = input.getLeft().getTarget().getPos();
×
318
                return IModHelpersNeoForge.get().getCapabilityHelpers().getCapability(dimPos.getLevel(true), dimPos.getBlockPos(), input.getLeft().getTarget().getSide(), org.cyclops.commoncapabilities.api.capability.Capabilities.RecipeHandler.BLOCK).orElse(null);
×
319
            }
320
        };
321

322
        public static final AspectBuilder<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean, IWorker>
323
                BUILDER_WORKER_BOOLEAN = AspectReadBuilders.BUILDER_BOOLEAN.handle(PROP_GET_WORKER, "machine");
5✔
324
        public static final AspectBuilder<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean, ITemperature>
325
                BUILDER_TEMPERATURE_BOOLEAN = AspectReadBuilders.BUILDER_BOOLEAN.handle(PROP_GET_TEMPERATURE, "temperature");
5✔
326
        public static final AspectBuilder<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean, IRecipeHandler>
327
                BUILDER_RECIPE_HANDLER_BOOLEAN = AspectReadBuilders.BUILDER_BOOLEAN.handle(PROP_GET_RECIPE_HANDLER, "recipehandler");
5✔
328

329
        public static final AspectBuilder<ValueTypeDouble.ValueDouble, ValueTypeDouble, ITemperature>
330
                BUILDER_TEMPERATURE_DOUBLE = AspectReadBuilders.BUILDER_DOUBLE.handle(PROP_GET_TEMPERATURE, "temperature");
5✔
331

332
        public static final AspectBuilder<ValueTypeList.ValueList, ValueTypeList, Pair<PartTarget, IAspectProperties>>
333
                BUILDER_RECIPE_HANDLER_LIST = AspectReadBuilders.BUILDER_LIST.appendKind("recipehandler");
4✔
334
        public static final AspectBuilder<ValueTypeOperator.ValueOperator, ValueTypeOperator, Pair<PartTarget, IAspectProperties>>
335
                BUILDER_RECIPE_HANDLER_OPERATOR = AspectReadBuilders.BUILDER_OPERATOR.appendKind("recipehandler");
5✔
336
    }
337

338
    public static final class Network {
×
339

340
        public static final IAspectPropertyTypeInstance<ValueTypeInteger, ValueTypeInteger.ValueInteger> PROPERTY_CHANNEL =
6✔
341
                new AspectPropertyTypeInstance<>(ValueTypes.INTEGER, "aspect.aspecttypes.integrateddynamics.integer.channel");
342
        public static final IAspectProperties PROPERTIES = new AspectProperties(ImmutableList.<IAspectPropertyTypeInstance>of(
6✔
343
                PROPERTY_CHANNEL
344
        ));
345
        static {
346
            PROPERTIES.setValue(PROPERTY_CHANNEL, ValueTypeInteger.ValueInteger.of(IPositionedAddonsNetwork.WILDCARD_CHANNEL));
5✔
347
        }
348

349
        public static final IAspectValuePropagator<Pair<PartTarget, IAspectProperties>, INetwork> PROP_GET_NETWORK = input -> {
2✔
350
            DimPos dimPos = input.getLeft().getTarget().getPos();
×
351
            return NetworkHelpers.getNetwork(dimPos.getLevel(true), dimPos.getBlockPos(), input.getLeft().getTarget().getSide()).orElse(null);
×
352
        };
353

354
        public static final AspectBuilder<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean, INetwork>
355
                BUILDER_BOOLEAN = AspectReadBuilders.BUILDER_BOOLEAN.handle(PROP_GET_NETWORK, "network");
5✔
356
        public static final AspectBuilder<ValueTypeInteger.ValueInteger, ValueTypeInteger, INetwork>
357
                BUILDER_INTEGER = AspectReadBuilders.BUILDER_INTEGER.handle(PROP_GET_NETWORK, "network");
5✔
358

359
        public static final IAspectValuePropagator<Pair<PartTarget, IAspectProperties>, EnergyHandler> PROP_GET_ENERGY_CHANNEL = input -> {
2✔
360
            DimPos dimPos = input.getLeft().getTarget().getPos();
×
361
            INetwork network = NetworkHelpers.getNetwork(dimPos.getLevel(true), dimPos.getBlockPos(), input.getLeft().getTarget().getSide()).orElse(null);
×
362
            int channel = input.getRight().getValue(PROPERTY_CHANNEL).getRawValue();
×
363
            return network != null ? network.getCapability(org.cyclops.integrateddynamics.Capabilities.EnergyNetwork.NETWORK)
×
364
                    .map(energyNetwork -> energyNetwork.getChannelExternal(net.neoforged.neoforge.capabilities.Capabilities.Energy.BLOCK, channel))
×
365
                    .orElse(null) : null;
×
366
        };
367

368
        public static final AspectBuilder<ValueTypeInteger.ValueInteger, ValueTypeInteger, EnergyHandler>
369
                ENERGY_BUILDER = AspectReadBuilders.BUILDER_INTEGER.handle(PROP_GET_ENERGY_CHANNEL, "network").withProperties(PROPERTIES);
7✔
370
        public static final AspectBuilder<ValueTypeLong.ValueLong, ValueTypeLong, EnergyHandler>
371
                ENERGY_BUILDER_LONG = AspectReadBuilders.BUILDER_LONG.handle(PROP_GET_ENERGY_CHANNEL, "network").withProperties(PROPERTIES);
8✔
372

373
    }
374

375
    public static final class Redstone {
×
376

377
        public static final IAspectPropertyTypeInstance<ValueTypeInteger, ValueTypeInteger.ValueInteger> PROPERTY_INTERVAL =
7✔
378
                new AspectPropertyTypeInstance<>(ValueTypes.INTEGER, "aspect.aspecttypes.integrateddynamics.integer.interval", VALIDATOR_INTEGER_POSITIVE);
379
        public static final IAspectPropertyTypeInstance<ValueTypeInteger, ValueTypeInteger.ValueInteger> PROPERTY_LENGTH =
7✔
380
                new AspectPropertyTypeInstance<>(ValueTypes.INTEGER, "aspect.aspecttypes.integrateddynamics.integer.length", VALIDATOR_INTEGER_POSITIVE);
381
        public static final IAspectPropertyTypeInstance<ValueTypeInteger, ValueTypeInteger.ValueInteger> PROPERTY_OFFSET =
7✔
382
                new AspectPropertyTypeInstance<>(ValueTypes.INTEGER, "aspect.aspecttypes.integrateddynamics.integer.offset", VALIDATOR_INTEGER_POSITIVE);
383
        public static final IAspectProperties PROPERTIES_CLOCK = new AspectProperties(ImmutableList.<IAspectPropertyTypeInstance>of(
8✔
384
                PROPERTY_INTERVAL,
385
                PROPERTY_LENGTH,
386
                PROPERTY_OFFSET
387
        ));
388
        static {
389
            PROPERTIES_CLOCK.setValue(PROPERTY_INTERVAL, ValueTypeInteger.ValueInteger.of(20));
5✔
390
            PROPERTIES_CLOCK.setValue(PROPERTY_LENGTH, ValueTypeInteger.ValueInteger.of(1));
5✔
391
            PROPERTIES_CLOCK.setValue(PROPERTY_OFFSET, ValueTypeInteger.ValueInteger.of(0));
5✔
392
        }
393

394
        public static final IAspectValuePropagator<Pair<PartTarget, IAspectProperties>, Integer> PROP_GET = input -> {
2✔
395
            DimPos dimPos = input.getLeft().getTarget().getPos();
×
396
            int power = dimPos.getLevel(true).getSignal(dimPos.getBlockPos(), input.getLeft().getTarget().getSide());
×
397
            if (power == 0) {
×
398
                BlockState targetBlockState = dimPos.getLevel(true).getBlockState(dimPos.getBlockPos());
×
399
                power = targetBlockState.getBlock() == Blocks.REDSTONE_WIRE ? targetBlockState.getValue(RedStoneWireBlock.POWER) : 0;
×
400
            }
401
            return power;
×
402
        };
403
        public static final IAspectValuePropagator<Pair<PartTarget, IAspectProperties>, Integer> PROP_GET_COMPARATOR = input -> {
2✔
404
            DimPos dimPos = input.getLeft().getTarget().getPos();
×
405
            BlockState blockState = dimPos.getLevel(true).getBlockState(dimPos.getBlockPos());
×
406
            return blockState.hasAnalogOutputSignal()
×
407
                    ? blockState.getAnalogOutputSignal(dimPos.getLevel(true), dimPos.getBlockPos(), input.getLeft().getTarget().getSide()) : 0;
×
408
        };
409
        public static final IAspectValuePropagator<Pair<PartTarget, IAspectProperties>, Boolean> PROP_GET_CLOCK = input -> {
2✔
410
            int interval = Math.max(1, input.getRight().getValue(PROPERTY_INTERVAL).getRawValue());
×
411
            int length = Math.max(1, input.getRight().getValue(PROPERTY_LENGTH).getRawValue());
×
412
            int offset = input.getRight().getValue(PROPERTY_OFFSET).getRawValue();
×
413
            return (input.getLeft().getTarget().getPos().getLevel(true).getGameTime() - offset) % interval < length;
×
414
        };
415

416
        public static final AspectBuilder<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean, Integer>
417
                BUILDER_BOOLEAN = AspectReadBuilders.BUILDER_BOOLEAN.handle(PROP_GET, "redstone");
5✔
418
        public static final AspectBuilder<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean, Boolean>
419
                BUILDER_BOOLEAN_CLOCK = AspectReadBuilders.BUILDER_BOOLEAN.handle(PROP_GET_CLOCK, "redstone")
5✔
420
                    .withProperties(PROPERTIES_CLOCK);
2✔
421
        public static final AspectBuilder<ValueTypeInteger.ValueInteger, ValueTypeInteger, Integer>
422
                BUILDER_INTEGER = AspectReadBuilders.BUILDER_INTEGER.handle(PROP_GET, "redstone");
5✔
423
        public static final AspectBuilder<ValueTypeInteger.ValueInteger, ValueTypeInteger, Integer>
424
                BUILDER_INTEGER_COMPARATOR = AspectReadBuilders.BUILDER_INTEGER.handle(PROP_GET_COMPARATOR, "redstone");
6✔
425

426
    }
427

428
    public static final class World {
×
429

430
        public static final IAspectValuePropagator<Pair<PartTarget, IAspectProperties>, DimPos>
431
                PROP_GET = input -> input.getLeft().getTarget().getPos();
2✔
432

433
        public static final IAspectValuePropagator<DimPos, net.minecraft.world.level.Level>
434
                PROP_GET_WORLD = dimPos -> dimPos.getLevel(true);
2✔
435

436
        public static final IAspectValuePropagator<DimPos, BlockPos>
437
                PROP_GET_POS = DimPos::getBlockPos;
2✔
438

439
        private static final com.google.common.base.Predicate<net.minecraft.world.entity.Entity>
440
                ENTITY_SELECTOR_ITEMFRAME = entity -> entity instanceof ItemFrame;
2✔
441

442
        public static final IAspectValuePropagator<Pair<PartTarget, IAspectProperties>, ItemFrame> PROP_GET_ITEMFRAME = pair -> {
2✔
443
            DimPos dimPos = pair.getLeft().getTarget().getPos();
×
444
            Direction facing = pair.getLeft().getTarget().getSide();
×
445
            List<net.minecraft.world.entity.Entity> entities = dimPos.getLevel(true).getEntities((net.minecraft.world.entity.Entity) null,
×
446
                    new AABB(Vec3.atLowerCornerOf(dimPos.getBlockPos()), Vec3.atLowerCornerOf(dimPos.getBlockPos().offset(1, 1, 1))), ENTITY_SELECTOR_ITEMFRAME);
×
447
            for(net.minecraft.world.entity.Entity entity : entities) {
×
448
                if(Direction.fromYRot(((ItemFrame) entity).yRotO) == facing.getOpposite()) {
×
449
                    return ((ItemFrame) entity);
×
450
                }
451
            }
×
452
            return null;
×
453
        };
454

455
        public static final AspectBuilder<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean, DimPos>
456
                BUILDER_BOOLEAN = AspectReadBuilders.BUILDER_BOOLEAN.handle(PROP_GET, "world");
5✔
457
        public static final AspectBuilder<ValueTypeInteger.ValueInteger, ValueTypeInteger, DimPos>
458
                BUILDER_INTEGER = AspectReadBuilders.BUILDER_INTEGER.handle(PROP_GET, "world");
5✔
459
        public static final AspectBuilder<ValueTypeDouble.ValueDouble, ValueTypeDouble, DimPos>
460
                BUILDER_DOUBLE = AspectReadBuilders.BUILDER_DOUBLE.handle(PROP_GET, "world");
5✔
461
        public static final AspectBuilder<ValueTypeLong.ValueLong, ValueTypeLong, DimPos>
462
                BUILDER_LONG = AspectReadBuilders.BUILDER_LONG.handle(PROP_GET, "world");
5✔
463
        public static final AspectBuilder<ValueTypeString.ValueString, ValueTypeString, DimPos>
464
                BUILDER_STRING = AspectReadBuilders.BUILDER_STRING.handle(PROP_GET, "world");
5✔
465
        public static final AspectBuilder<ValueTypeList.ValueList, ValueTypeList, DimPos>
466
                BUILDER_LIST = AspectReadBuilders.BUILDER_LIST.handle(PROP_GET, "world");
6✔
467

468
    }
469

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