• 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

53.78
/src/main/java/org/cyclops/integrateddynamics/part/aspect/Aspects.java
1
package org.cyclops.integrateddynamics.part.aspect;
2

3
import com.google.common.collect.Lists;
4
import com.google.common.math.DoubleMath;
5
import com.google.common.math.Stats;
6
import net.minecraft.core.BlockPos;
7
import net.minecraft.core.Holder;
8
import net.minecraft.core.particles.*;
9
import net.minecraft.core.registries.BuiltInRegistries;
10
import net.minecraft.nbt.Tag;
11
import net.minecraft.network.chat.Component;
12
import net.minecraft.network.protocol.game.ClientboundSoundPacket;
13
import net.minecraft.resources.ResourceLocation;
14
import net.minecraft.server.MinecraftServer;
15
import net.minecraft.server.level.ServerLevel;
16
import net.minecraft.sounds.SoundEvent;
17
import net.minecraft.sounds.SoundSource;
18
import net.minecraft.util.StringUtil;
19
import net.minecraft.world.entity.EntitySelector;
20
import net.minecraft.world.item.ItemStack;
21
import net.minecraft.world.level.Level;
22
import net.minecraft.world.level.block.Blocks;
23
import net.minecraft.world.level.block.LiquidBlock;
24
import net.minecraft.world.level.block.entity.BlockEntity;
25
import net.minecraft.world.level.block.state.BlockState;
26
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
27
import net.minecraft.world.level.storage.ServerLevelData;
28
import net.minecraft.world.phys.AABB;
29
import net.minecraft.world.phys.Vec3;
30
import net.neoforged.neoforge.fluids.FluidStack;
31
import net.neoforged.neoforge.server.ServerLifecycleHooks;
32
import net.neoforged.neoforge.transfer.EmptyResourceHandler;
33
import net.neoforged.neoforge.transfer.ResourceHandler;
34
import net.neoforged.neoforge.transfer.energy.EnergyHandler;
35
import net.neoforged.neoforge.transfer.fluid.FluidResource;
36
import net.neoforged.neoforge.transfer.transaction.Transaction;
37
import org.apache.commons.lang3.tuple.Pair;
38
import org.apache.commons.lang3.tuple.Triple;
39
import org.cyclops.cyclopscore.datastructure.DimPos;
40
import org.cyclops.cyclopscore.helper.IModHelpers;
41
import org.cyclops.cyclopscore.helper.IModHelpersNeoForge;
42
import org.cyclops.cyclopscore.network.IPacketHandler;
43
import org.cyclops.integrateddynamics.Capabilities;
44
import org.cyclops.integrateddynamics.GeneralConfig;
45
import org.cyclops.integrateddynamics.IntegratedDynamics;
46
import org.cyclops.integrateddynamics.Reference;
47
import org.cyclops.integrateddynamics.api.evaluate.EvaluationException;
48
import org.cyclops.integrateddynamics.api.evaluate.IValueInterface;
49
import org.cyclops.integrateddynamics.api.evaluate.variable.IValue;
50
import org.cyclops.integrateddynamics.api.network.IEnergyConsumingNetworkElement;
51
import org.cyclops.integrateddynamics.api.part.PartPos;
52
import org.cyclops.integrateddynamics.api.part.PartTarget;
53
import org.cyclops.integrateddynamics.api.part.aspect.AspectUpdateType;
54
import org.cyclops.integrateddynamics.api.part.aspect.IAspectRead;
55
import org.cyclops.integrateddynamics.api.part.aspect.IAspectRegistry;
56
import org.cyclops.integrateddynamics.api.part.aspect.IAspectWrite;
57
import org.cyclops.integrateddynamics.api.part.aspect.property.IAspectProperties;
58
import org.cyclops.integrateddynamics.core.evaluate.operator.*;
59
import org.cyclops.integrateddynamics.core.evaluate.variable.*;
60
import org.cyclops.integrateddynamics.core.helper.EnergyHelpers;
61
import org.cyclops.integrateddynamics.core.helper.Helpers;
62
import org.cyclops.integrateddynamics.core.helper.L10NValues;
63
import org.cyclops.integrateddynamics.core.part.aspect.build.AspectBuilder;
64
import org.cyclops.integrateddynamics.core.part.aspect.build.IAspectValuePropagator;
65
import org.cyclops.integrateddynamics.network.packet.SpeakTextPacket;
66
import org.cyclops.integrateddynamics.part.aspect.read.AspectReadBuilders;
67
import org.cyclops.integrateddynamics.part.aspect.write.AspectWriteBuilders;
68

69
import java.util.*;
70

71
/**
72
 * Collection of all aspects.
73
 * @author rubensworks
74
 */
75
public class Aspects {
×
76

77
    public static final IAspectRegistry REGISTRY = IntegratedDynamics._instance.getRegistryManager().getRegistry(IAspectRegistry.class);
7✔
78

79
    public static void load() {}
1✔
80

81
    public static final class Read {
×
82

83
        public static final class Audio {
×
84

85
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_HARP_NOTE =
1✔
86
                    AspectReadBuilders.Audio.forInstrument(NoteBlockInstrument.HARP)
2✔
87
                            .handle(AspectReadBuilders.PROP_GET_INTEGER).buildRead();
3✔
88
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_BASEDRUM_NOTE =
1✔
89
                    AspectReadBuilders.Audio.forInstrument(NoteBlockInstrument.BASEDRUM)
2✔
90
                            .handle(AspectReadBuilders.PROP_GET_INTEGER).buildRead();
3✔
91
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_SNARE_NOTE =
1✔
92
                    AspectReadBuilders.Audio.forInstrument(NoteBlockInstrument.SNARE)
2✔
93
                            .handle(AspectReadBuilders.PROP_GET_INTEGER).buildRead();
3✔
94
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_HAT_NOTE =
1✔
95
                    AspectReadBuilders.Audio.forInstrument(NoteBlockInstrument.HAT)
2✔
96
                            .handle(AspectReadBuilders.PROP_GET_INTEGER).buildRead();
3✔
97
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_BASS_NOTE =
1✔
98
                    AspectReadBuilders.Audio.forInstrument(NoteBlockInstrument.BASS)
2✔
99
                            .handle(AspectReadBuilders.PROP_GET_INTEGER).buildRead();
3✔
100
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_FLUTE_NOTE =
1✔
101
                    AspectReadBuilders.Audio.forInstrument(NoteBlockInstrument.FLUTE)
2✔
102
                            .handle(AspectReadBuilders.PROP_GET_INTEGER).buildRead();
3✔
103
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_BELL_NOTE =
1✔
104
                    AspectReadBuilders.Audio.forInstrument(NoteBlockInstrument.BELL)
2✔
105
                            .handle(AspectReadBuilders.PROP_GET_INTEGER).buildRead();
3✔
106
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_GUITAR_NOTE =
1✔
107
                    AspectReadBuilders.Audio.forInstrument(NoteBlockInstrument.GUITAR)
2✔
108
                            .handle(AspectReadBuilders.PROP_GET_INTEGER).buildRead();
3✔
109
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_CHIME_NOTE =
1✔
110
                    AspectReadBuilders.Audio.forInstrument(NoteBlockInstrument.CHIME)
2✔
111
                            .handle(AspectReadBuilders.PROP_GET_INTEGER).buildRead();
3✔
112
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_XYLOPHONE_NOTE =
1✔
113
                    AspectReadBuilders.Audio.forInstrument(NoteBlockInstrument.XYLOPHONE)
2✔
114
                            .handle(AspectReadBuilders.PROP_GET_INTEGER).buildRead();
3✔
115
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_IRON_XYLOPHONE_NOTE =
1✔
116
                    AspectReadBuilders.Audio.forInstrument(NoteBlockInstrument.IRON_XYLOPHONE)
2✔
117
                            .handle(AspectReadBuilders.PROP_GET_INTEGER).buildRead();
3✔
118
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_COW_BELL_NOTE =
1✔
119
                    AspectReadBuilders.Audio.forInstrument(NoteBlockInstrument.COW_BELL)
2✔
120
                            .handle(AspectReadBuilders.PROP_GET_INTEGER).buildRead();
3✔
121
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_DIDGERIDOO_NOTE =
1✔
122
                    AspectReadBuilders.Audio.forInstrument(NoteBlockInstrument.DIDGERIDOO)
2✔
123
                            .handle(AspectReadBuilders.PROP_GET_INTEGER).buildRead();
3✔
124
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_BIT_NOTE =
1✔
125
                    AspectReadBuilders.Audio.forInstrument(NoteBlockInstrument.BIT)
2✔
126
                            .handle(AspectReadBuilders.PROP_GET_INTEGER).buildRead();
3✔
127
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_BANJO_NOTE =
1✔
128
                    AspectReadBuilders.Audio.forInstrument(NoteBlockInstrument.BANJO)
2✔
129
                            .handle(AspectReadBuilders.PROP_GET_INTEGER).buildRead();
3✔
130
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_PLING_NOTE =
1✔
131
                    AspectReadBuilders.Audio.forInstrument(NoteBlockInstrument.PLING)
2✔
132
                            .handle(AspectReadBuilders.PROP_GET_INTEGER).buildRead();
3✔
133
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_ZOMBIE_NOTE =
1✔
134
                    AspectReadBuilders.Audio.forInstrument(NoteBlockInstrument.ZOMBIE)
2✔
135
                            .handle(AspectReadBuilders.PROP_GET_INTEGER).buildRead();
3✔
136
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_SKELETON_NOTE =
1✔
137
                    AspectReadBuilders.Audio.forInstrument(NoteBlockInstrument.SKELETON)
2✔
138
                            .handle(AspectReadBuilders.PROP_GET_INTEGER).buildRead();
3✔
139
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_CREEPER_NOTE =
1✔
140
                    AspectReadBuilders.Audio.forInstrument(NoteBlockInstrument.CREEPER)
2✔
141
                            .handle(AspectReadBuilders.PROP_GET_INTEGER).buildRead();
3✔
142
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_DRAGON_NOTE =
1✔
143
                    AspectReadBuilders.Audio.forInstrument(NoteBlockInstrument.DRAGON)
2✔
144
                            .handle(AspectReadBuilders.PROP_GET_INTEGER).buildRead();
3✔
145
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_WITHER_SKELETON_NOTE =
1✔
146
                    AspectReadBuilders.Audio.forInstrument(NoteBlockInstrument.WITHER_SKELETON)
2✔
147
                            .handle(AspectReadBuilders.PROP_GET_INTEGER).buildRead();
3✔
148
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_PIGLIN_NOTE =
1✔
149
                    AspectReadBuilders.Audio.forInstrument(NoteBlockInstrument.PIGLIN)
2✔
150
                            .handle(AspectReadBuilders.PROP_GET_INTEGER).buildRead();
3✔
151
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_CUSTOM_HEAD_NOTE =
2✔
152
                    AspectReadBuilders.Audio.forInstrument(NoteBlockInstrument.CUSTOM_HEAD)
2✔
153
                            .handle(AspectReadBuilders.PROP_GET_INTEGER).buildRead();
3✔
154

155
        }
156

157
        public static final class Block {
×
158
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_BLOCK =
2✔
159
                    AspectReadBuilders.Block.BUILDER_BOOLEAN.handle(
2✔
160
                        dimPos -> dimPos.getLevel(true).getBlockState(dimPos.getBlockPos()).getBlock() != Blocks.AIR
×
161
                    ).withUpdateType(AspectUpdateType.BLOCK_UPDATE)
3✔
162
                            .handle(AspectReadBuilders.PROP_GET_BOOLEAN, "block").buildRead();
3✔
163
            public static final IAspectRead<ValueTypeString.ValueString, ValueTypeString> STRING_DIMENSION =
2✔
164
                    AspectReadBuilders.Block.BUILDER_STRING.handle(AspectReadBuilders.World.PROP_GET_WORLD).handle(
4✔
165
                            world -> world.dimension().location().toString()
×
166
                    ).withUpdateType(AspectUpdateType.NEVER)
3✔
167
                            .handle(AspectReadBuilders.PROP_GET_STRING, "dimension").buildRead();
3✔
168
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_POSX =
2✔
169
                    AspectReadBuilders.Block.BUILDER_INTEGER.handle(AspectReadBuilders.World.PROP_GET_POS).handle(
4✔
170
                        BlockPos::getX
171
                    ).withUpdateType(AspectUpdateType.NEVER)
3✔
172
                            .handle(AspectReadBuilders.PROP_GET_INTEGER, "posx").buildRead();
3✔
173
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_POSY =
2✔
174
                    AspectReadBuilders.Block.BUILDER_INTEGER.handle(AspectReadBuilders.World.PROP_GET_POS).handle(
4✔
175
                        BlockPos::getY
176
                    ).withUpdateType(AspectUpdateType.NEVER)
3✔
177
                            .handle(AspectReadBuilders.PROP_GET_INTEGER, "posy").buildRead();
3✔
178
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_POSZ =
2✔
179
                    AspectReadBuilders.Block.BUILDER_INTEGER.handle(AspectReadBuilders.World.PROP_GET_POS).handle(
4✔
180
                        BlockPos::getZ
181
                    ).withUpdateType(AspectUpdateType.NEVER)
3✔
182
                            .handle(AspectReadBuilders.PROP_GET_INTEGER, "posz").buildRead();
3✔
183
            public static final IAspectRead<ValueObjectTypeBlock.ValueBlock, ValueObjectTypeBlock> BLOCK =
2✔
184
                    AspectReadBuilders.Block.BUILDER_BLOCK
185
                            .handle(
2✔
186
                        dimPos -> dimPos.getLevel(true).getBlockState(dimPos.getBlockPos())
×
187
                    ).withUpdateType(AspectUpdateType.BLOCK_UPDATE)
2✔
188
                            .handle(AspectReadBuilders.PROP_GET_BLOCK).buildRead();
3✔
189
            public static final IAspectRead<ValueTypeNbt.ValueNbt, ValueTypeNbt> NBT =
2✔
190
                    AspectReadBuilders.Block.BUILDER_NBT.handle(dimPos -> {
3✔
191
                        BlockEntity tile = dimPos.getLevel(true).getBlockEntity(dimPos.getBlockPos());
×
192
                        try {
193
                            if (tile != null) {
×
194
                                return Optional.<Tag>of(tile.saveWithFullMetadata(tile.getLevel().registryAccess()));
×
195
                            }
196
                        } catch (Exception e) {
×
197
                            // Catch possible errors
198
                        }
×
199
                        return Optional.<Tag>empty();
×
200
                    }).handle(AspectReadBuilders.PROP_GET_NBT, "tile").buildRead();
3✔
201
            public static final IAspectRead<ValueTypeString.ValueString, ValueTypeString> STRING_BIOME =
2✔
202
                    AspectReadBuilders.Block.BUILDER_STRING
203
                            .handle(
2✔
204
                                    // Copied from DebugScreenOverlay#printBiome
205
                                    dimPos -> dimPos.getLevel(true).getBiome(dimPos.getBlockPos())
×
206
                                            .unwrap().map(key -> key.location().toString(), biome -> "[unregistered " + biome + "]")
×
207
                            ).withUpdateType(AspectUpdateType.BLOCK_UPDATE)
3✔
208
                            .handle(AspectReadBuilders.PROP_GET_STRING, "biome").buildRead();
3✔
209
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_LIGHT =
3✔
210
                    AspectReadBuilders.Block.BUILDER_INTEGER.handle(dimPos -> dimPos.getLevel(true).getMaxLocalRawBrightness(dimPos.getBlockPos()))
3✔
211
                            .handle(AspectReadBuilders.PROP_GET_INTEGER, "light").buildRead();
3✔
212
        }
213

214
        public static final class Entity {
×
215
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_ITEMFRAMEROTATION =
2✔
216
                    AspectReadBuilders.Entity.BUILDER_INTEGER_ALL
217
                            .handle(AspectReadBuilders.World.PROP_GET_ITEMFRAME)
2✔
218
                            .handle(itemFrame -> itemFrame != null ? itemFrame.getRotation() : 0)
3!
219
                            .handle(AspectReadBuilders.PROP_GET_INTEGER, "itemframerotation").buildRead();
3✔
220
            public static final IAspectRead<ValueTypeList.ValueList, ValueTypeList> LIST_ENTITIES =
2✔
221
                    AspectReadBuilders.Entity.BUILDER_LIST.handle(dimPos -> {
2✔
222
                        List<net.minecraft.world.entity.Entity> entities = dimPos.getLevel(true).getEntities((net.minecraft.world.entity.Entity) null,
×
223
                                new AABB(Vec3.atLowerCornerOf(dimPos.getBlockPos()), Vec3.atLowerCornerOf(dimPos.getBlockPos().offset(1, 1, 1))), EntitySelector.NO_SPECTATORS);
×
224
                        return ValueTypeList.ValueList.ofList(ValueTypes.OBJECT_ENTITY, Lists.transform(entities,
×
225
                            ValueObjectTypeEntity.ValueEntity::of
226
                        ));
227
                    }).appendKind("entities").buildRead();
3✔
228
            public static final IAspectRead<ValueTypeList.ValueList, ValueTypeList> LIST_PLAYERS =
2✔
229
                    AspectReadBuilders.Entity.BUILDER_LIST.handle(dimPos -> {
2✔
230
                        List<net.minecraft.world.entity.Entity> entities = dimPos.getLevel(true).getEntities((net.minecraft.world.entity.Entity) null,
×
231
                                new AABB(Vec3.atLowerCornerOf(dimPos.getBlockPos()), Vec3.atLowerCornerOf(dimPos.getBlockPos().offset(1, 1, 1))), Helpers.SELECTOR_IS_PLAYER);
×
232
                        return ValueTypeList.ValueList.ofList(ValueTypes.OBJECT_ENTITY, Lists.transform(entities,
×
233
                            ValueObjectTypeEntity.ValueEntity::of
234
                        ));
235
                    }).appendKind("players").buildRead();
3✔
236

237
            public static final IAspectRead<ValueObjectTypeEntity.ValueEntity, ValueObjectTypeEntity> ENTITY =
2✔
238
                    AspectReadBuilders.Entity.BUILDER_ENTITY.withProperties(AspectReadBuilders.LIST_PROPERTIES).handle(input -> {
3✔
239
                        int i = input.getRight().getValue(AspectReadBuilders.PROPERTY_LISTINDEX).getRawValue();
×
240
                        DimPos dimPos = input.getLeft().getTarget().getPos();
×
241
                        List<net.minecraft.world.entity.Entity> entities = dimPos.getLevel(true).getEntities((net.minecraft.world.entity.Entity) null,
×
242
                                new AABB(Vec3.atLowerCornerOf(dimPos.getBlockPos()), Vec3.atLowerCornerOf(dimPos.getBlockPos().offset(1, 1, 1))), EntitySelector.NO_SPECTATORS);
×
243
                        return ValueObjectTypeEntity.ValueEntity.of(i < entities.size() ? entities.get(i) : null);
×
244
                    }).buildRead();
2✔
245

246
            public static final IAspectRead<ValueObjectTypeItemStack.ValueItemStack, ValueObjectTypeItemStack> ITEMSTACK_ITEMFRAMECONTENTS =
3✔
247
                    AspectReadBuilders.Entity.BUILDER_ITEMSTACK
248
                            .handle(AspectReadBuilders.World.PROP_GET_ITEMFRAME)
2✔
249
                            .handle(itemFrame -> itemFrame != null ? itemFrame.getItem() : ItemStack.EMPTY)
3!
250
                            .handle(AspectReadBuilders.PROP_GET_ITEMSTACK, "itemframecontents").buildRead();
3✔
251
        }
252

253
        public static final class ExtraDimensional {
×
254

255
            private static final Random RANDOM = new Random();
4✔
256

257
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_RANDOM =
2✔
258
                    AspectReadBuilders.ExtraDimensional.BUILDER_INTEGER.handle(
3✔
259
                        minecraft -> RANDOM.nextInt()
×
260
                    ).handle(AspectReadBuilders.PROP_GET_INTEGER, "random").buildRead();
3✔
261
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_PLAYERCOUNT =
2✔
262
                    AspectReadBuilders.ExtraDimensional.BUILDER_INTEGER.handle(
3✔
263
                        MinecraftServer::getPlayerCount
264
                    ).handle(AspectReadBuilders.PROP_GET_INTEGER, "playercount").buildRead();
3✔
265
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_TICKTIME =
2✔
266
                    AspectReadBuilders.ExtraDimensional.BUILDER_INTEGER.handle(
3✔
267
                        minecraft -> (int) DoubleMath.mean(minecraft.getAverageTickTimeNanos())
×
268
                    ).handle(AspectReadBuilders.PROP_GET_INTEGER, "ticktime").buildRead();
3✔
269

270
            public static final IAspectRead<ValueTypeDouble.ValueDouble, ValueTypeDouble> DOUBLE_TPS =
2✔
271
                    AspectReadBuilders.ExtraDimensional.BUILDER_DOUBLE.handle(
3✔
272
                            minecraft -> Math.min(20, Stats.meanOf(minecraft.getTickTimesNanos()) / 1000)
×
273
                    ).handle(AspectReadBuilders.PROP_GET_DOUBLE, "tps").buildRead();
3✔
274

275
            public static final IAspectRead<ValueTypeList.ValueList, ValueTypeList> LIST_PLAYERS =
3✔
276
                    AspectReadBuilders.ExtraDimensional.BUILDER_LIST.handle(
2✔
277
                        minecraft -> ValueTypeList.ValueList.ofList(ValueTypes.OBJECT_ENTITY, Lists.transform(minecraft.getPlayerList().getPlayers(),
×
278
                                ValueObjectTypeEntity.ValueEntity::of))
279
                    ).appendKind("players").buildRead();
3✔
280

281
        }
282

283
        public static final class Fluid {
×
284

285
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_FULL =
2✔
286
                    AspectReadBuilders.Fluid.BUILDER_BOOLEAN.handle(tankInfo -> {
3✔
287
                        boolean allFull = true;
×
288
                        for (int i = 0; i < tankInfo.size(); i++) {
×
289
                            if (tankInfo.getResource(i).isEmpty() && tankInfo.getCapacityAsLong(i, FluidResource.EMPTY) > 0
×
290
                                    || (!tankInfo.getResource(i).isEmpty() && tankInfo.getAmountAsLong(i) < tankInfo.getCapacityAsLong(i, FluidResource.EMPTY))) {
×
291
                                allFull = false;
×
292
                            }
293
                        }
294
                        return allFull;
×
295
                    }).handle(AspectReadBuilders.PROP_GET_BOOLEAN, "full").buildRead();
3✔
296
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_EMPTY =
2✔
297
                    AspectReadBuilders.Fluid.BUILDER_BOOLEAN.handle(tankInfo -> {
3✔
298
                        for (int i = 0; i < tankInfo.size(); i++) {
×
299
                            if (!tankInfo.getResource(i).isEmpty() && tankInfo.getCapacityAsLong(i, FluidResource.EMPTY) > 0
×
300
                                    || (!tankInfo.getResource(i).isEmpty() && tankInfo.getAmountAsLong(i) < tankInfo.getCapacityAsLong(i, FluidResource.EMPTY))) {
×
301
                                return false;
×
302
                            }
303
                        }
304
                        return true;
×
305
                    }).handle(AspectReadBuilders.PROP_GET_BOOLEAN, "empty").buildRead();
3✔
306
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_NONEMPTY =
2✔
307
                    AspectReadBuilders.Fluid.BUILDER_BOOLEAN.handle(tankInfo -> {
3✔
308
                        boolean hasFluid = false;
×
309
                        for (int i = 0; i < tankInfo.size(); i++) {
×
310
                            if (!tankInfo.getResource(i).isEmpty() && tankInfo.getAmountAsLong(i) > 0) {
×
311
                                hasFluid = true;
×
312
                            }
313
                        }
314
                        return hasFluid;
×
315
                    }).handle(AspectReadBuilders.PROP_GET_BOOLEAN, "nonempty").buildRead();
3✔
316
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_APPLICABLE =
2✔
317
                    AspectReadBuilders.Fluid.BUILDER_BOOLEAN.handle(
3✔
318
                        tankInfo -> tankInfo.size() > 0 && tankInfo != EmptyResourceHandler.<FluidResource>instance()
×
319
                    ).handle(AspectReadBuilders.PROP_GET_BOOLEAN, "applicable").buildRead();
3✔
320

321
            public static final IAspectRead<ValueTypeLong.ValueLong, ValueTypeLong> LONG_AMOUNT =
2✔
322
                    AspectReadBuilders.Fluid.BUILDER_LONG_ACTIVATABLE.handle(tankInfo -> tankInfo.getLeft().getAmountAsLong(tankInfo.getRight())
3✔
323
                    ).handle(AspectReadBuilders.PROP_GET_LONG, "amount").buildRead();
3✔
324
            public static final IAspectRead<ValueTypeLong.ValueLong, ValueTypeLong> LONG_AMOUNTTOTAL =
2✔
325
                    AspectReadBuilders.Fluid.BUILDER_LONG.handle(tankInfo -> {
3✔
326
                        long amount = 0;
×
327
                        for (int i = 0; i < tankInfo.size(); i++) {
×
328
                            try {
329
                                amount = Math.addExact(amount, tankInfo.getAmountAsLong(i));
×
330
                            } catch (ArithmeticException e) {
×
331
                                amount = Long.MAX_VALUE;
×
332
                            }
×
333
                            if (amount == Integer.MAX_VALUE) {
×
334
                                break;
×
335
                            }
336
                        }
337
                        return amount;
×
338
                    }).handle(AspectReadBuilders.PROP_GET_LONG, "totalamount").buildRead();
3✔
339
            public static final IAspectRead<ValueTypeLong.ValueLong, ValueTypeLong> LONG_CAPACITY =
2✔
340
                    AspectReadBuilders.Fluid.BUILDER_LONG_ACTIVATABLE.handle(
3✔
341
                        tankInfo -> tankInfo != null ? tankInfo.getLeft().getCapacityAsLong(tankInfo.getRight(), FluidResource.EMPTY) : 0
×
342
                    ).handle(AspectReadBuilders.PROP_GET_LONG, "capacity").buildRead();
3✔
343
            public static final IAspectRead<ValueTypeLong.ValueLong, ValueTypeLong> LONG_CAPACITYTOTAL =
2✔
344
                    AspectReadBuilders.Fluid.BUILDER_LONG.handle(tankInfo -> {
3✔
345
                        long capacity = 0;
×
346
                        for (int i = 0; i < tankInfo.size(); i++) {
×
347
                            try {
348
                                capacity = Math.addExact(capacity, tankInfo.getCapacityAsLong(i, FluidResource.EMPTY));
×
349
                            } catch (ArithmeticException e) {
×
350
                                capacity = Long.MAX_VALUE;
×
351
                            }
×
352
                            if (capacity == Long.MAX_VALUE) {
×
353
                                break;
×
354
                            }
355
                        }
356
                        return capacity;
×
357
                    }).handle(AspectReadBuilders.PROP_GET_LONG, "totalcapacity").buildRead();
3✔
358
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_TANKS =
2✔
359
                    AspectReadBuilders.Fluid.BUILDER_INTEGER.handle(
3✔
360
                            ResourceHandler::size
361
                    ).handle(AspectReadBuilders.PROP_GET_INTEGER, "tanks").buildRead();
3✔
362

363
            public static final IAspectRead<ValueTypeDouble.ValueDouble, ValueTypeDouble> DOUBLE_FILLRATIO =
2✔
364
                    AspectReadBuilders.Fluid.BUILDER_DOUBLE_ACTIVATABLE.handle(tankInfo -> {
3✔
365
                        if(tankInfo == null) {
×
366
                            return 0D;
×
367
                        }
368
                        double amount = tankInfo.getLeft().getAmountAsLong(tankInfo.getRight());
×
369
                        return amount / (double) tankInfo.getLeft().getCapacityAsLong(tankInfo.getRight(), FluidResource.EMPTY);
×
370
                    }).handle(AspectReadBuilders.PROP_GET_DOUBLE, "fillratio").buildRead();
3✔
371

372
            public static final IAspectRead<ValueTypeList.ValueList, ValueTypeList> LIST_TANKFLUIDS =
2✔
373
                    AspectReadBuilders.BUILDER_LIST.appendKind("fluid").handle(AspectReadBuilders.Fluid.PROP_GET_LIST_FLUIDSTACKS, "fluidstacks").buildRead();
6✔
374
            public static final IAspectRead<ValueTypeList.ValueList, ValueTypeList> LIST_TANKCAPACITIES =
2✔
375
                    AspectReadBuilders.BUILDER_LIST.appendKind("fluid").handle(AspectReadBuilders.Fluid.PROP_GET_LIST_CAPACITIES, "capacities").buildRead();
6✔
376

377
            public static final IAspectRead<ValueObjectTypeFluidStack.ValueFluidStack, ValueObjectTypeFluidStack> FLUIDSTACK =
3✔
378
                    AspectReadBuilders.BUILDER_OBJECT_FLUIDSTACK
379
                            .handle(AspectReadBuilders.Fluid.PROP_GET_ACTIVATABLE, "fluid").withProperties(AspectReadBuilders.Fluid.PROPERTIES)
4✔
380
                            .handle(AspectReadBuilders.Fluid.PROP_GET_FLUIDSTACK).handle(AspectReadBuilders.PROP_GET_FLUIDSTACK).buildRead();
5✔
381

382
            public static final IAspectRead<ValueObjectTypeFluidStack.ValueFluidStack, ValueObjectTypeFluidStack> BLOCK =
4✔
383
                    AspectReadBuilders.BUILDER_OBJECT_FLUIDSTACK
384
                            .handle(AspectReadBuilders.Block.PROP_GET, "block")
2✔
385
                            .handle(dimPos -> {
2✔
386
                                BlockState blockState = dimPos.getLevel(true).getBlockState(dimPos.getBlockPos());
×
387
                                net.minecraft.world.level.block.Block block = blockState.getBlock();
×
388
                                if (block instanceof LiquidBlock) {
×
389
                                    return new FluidStack(((LiquidBlock) block).fluid, IModHelpersNeoForge.get().getFluidHelpers().getBucketVolume());
×
390
                                }
391
                                return FluidStack.EMPTY;
×
392
                            })
393
                            .handle(AspectReadBuilders.PROP_GET_FLUIDSTACK).buildRead();
3✔
394

395
        }
396

397
        public static final class Inventory {
×
398
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_FULL =
2✔
399
                    AspectReadBuilders.Inventory.BUILDER_BOOLEAN.handle(inventory -> {
3✔
400
                        if(inventory != null) {
×
401
                            for (int i = 0; i < inventory.size(); i++) {
×
402
                                ItemStack itemStack = inventory.getResource(i).toStack(inventory.getAmountAsInt(i));
×
403
                                if (itemStack.isEmpty()) {
×
404
                                    return false;
×
405
                                }
406
                            }
407
                        }
408
                        return true;
×
409
                    }).handle(AspectReadBuilders.PROP_GET_BOOLEAN, "full").buildRead();
3✔
410
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_EMPTY =
2✔
411
                    AspectReadBuilders.Inventory.BUILDER_BOOLEAN.handle(inventory -> {
3✔
412
                        if(inventory != null) {
×
413
                            for(int i = 0; i < inventory.size(); i++) {
×
414
                                ItemStack itemStack = inventory.getResource(i).toStack(inventory.getAmountAsInt(i));
×
415
                                if(!itemStack.isEmpty()) {
×
416
                                    return false;
×
417
                                }
418
                            }
419
                        }
420
                        return true;
×
421
                    }).handle(AspectReadBuilders.PROP_GET_BOOLEAN, "empty").buildRead();
3✔
422
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_NONEMPTY =
2✔
423
                    AspectReadBuilders.Inventory.BUILDER_BOOLEAN.handle(inventory -> {
3✔
424
                        if(inventory != null) {
×
425
                            for(int i = 0; i < inventory.size(); i++) {
×
426
                                ItemStack itemStack = inventory.getResource(i).toStack(inventory.getAmountAsInt(i));
×
427
                                if(!itemStack.isEmpty()) {
×
428
                                    return true;
×
429
                                }
430
                            }
431
                        }
432
                        return false;
×
433
                    }).handle(AspectReadBuilders.PROP_GET_BOOLEAN, "nonempty").buildRead();
3✔
434
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_APPLICABLE =
2✔
435
                    AspectReadBuilders.Inventory.BUILDER_BOOLEAN.handle(
3✔
436
                        Objects::nonNull
437
                    ).handle(AspectReadBuilders.PROP_GET_BOOLEAN, "applicable").buildRead();
3✔
438

439
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_COUNT =
2✔
440
                    AspectReadBuilders.Inventory.BUILDER_INTEGER.handle(inventory -> {
3✔
441
                        int count = 0;
×
442
                        if(inventory != null) {
×
443
                            for (int i = 0; i < inventory.size(); i++) {
×
444
                                ItemStack itemStack = inventory.getResource(i).toStack(inventory.getAmountAsInt(i));
×
445
                                if (!itemStack.isEmpty()) {
×
446
                                    count += itemStack.getCount();
×
447
                                }
448
                            }
449
                        }
450
                        return count;
×
451
                    }).handle(AspectReadBuilders.PROP_GET_INTEGER, "count").buildRead();
3✔
452
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_SLOTS =
2✔
453
                    AspectReadBuilders.Inventory.BUILDER_INTEGER.handle(
3✔
454
                        inventory -> inventory != null ? inventory.size() : 0
×
455
                    ).handle(AspectReadBuilders.PROP_GET_INTEGER, "slots").buildRead();
3✔
456
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_SLOTSFILLED =
2✔
457
                    AspectReadBuilders.Inventory.BUILDER_INTEGER.handle(inventory -> {
3✔
458
                        int count = 0;
×
459
                        if(inventory != null) {
×
460
                            for (int i = 0; i < inventory.size(); i++) {
×
461
                                ItemStack itemStack = inventory.getResource(i).toStack(inventory.getAmountAsInt(i));
×
462
                                if (!itemStack.isEmpty()) {
×
463
                                    count++;
×
464
                                }
465
                            }
466
                        }
467
                        return count;
×
468
                    }).handle(AspectReadBuilders.PROP_GET_INTEGER, "slotsfilled").buildRead();
3✔
469

470
            public static final IAspectRead<ValueTypeDouble.ValueDouble, ValueTypeDouble> DOUBLE_FILLRATIO =
2✔
471
                    AspectReadBuilders.Inventory.BUILDER_DOUBLE.handle(inventory -> {
3✔
472
                        int count = 0;
×
473
                        if(inventory != null) {
×
474
                            for (int i = 0; i < inventory.size(); i++) {
×
475
                                ItemStack itemStack = inventory.getResource(i).toStack(inventory.getAmountAsInt(i));
×
476
                                if (!itemStack.isEmpty()) {
×
477
                                    count++;
×
478
                                }
479
                            }
480
                        }
481
                        return ((double) count) / (double) (inventory != null ? inventory.size() : 1);
×
482
                    }).handle(AspectReadBuilders.PROP_GET_DOUBLE, "fillratio").buildRead();
3✔
483

484
            public static final IAspectRead<ValueTypeList.ValueList, ValueTypeList> LIST_ITEMSTACKS =
2✔
485
                    AspectReadBuilders.BUILDER_LIST.appendKind("inventory")
3✔
486
                            .handle(AspectReadBuilders.Inventory.PROP_GET_LIST, "itemstacks").buildRead();
3✔
487

488
            public static final IAspectRead<ValueObjectTypeItemStack.ValueItemStack, ValueObjectTypeItemStack> OBJECT_ITEM_STACK_SLOT =
3✔
489
                    AspectReadBuilders.Inventory.BUILDER_ITEMSTACK.handle(AspectReadBuilders.PROP_GET_ITEMSTACK).buildRead();
3✔
490

491
        }
492

493
        public static final class Machine {
×
494

495
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_ISWORKER =
2✔
496
                    AspectReadBuilders.Machine.BUILDER_WORKER_BOOLEAN.handle(
3✔
497
                        Objects::nonNull
498
                    ).handle(AspectReadBuilders.PROP_GET_BOOLEAN, "isworker").buildRead();
3✔
499
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_HASWORK =
2✔
500
                    AspectReadBuilders.Machine.BUILDER_WORKER_BOOLEAN.handle(
3✔
501
                        worker -> worker != null && worker.hasWork()
×
502
                    ).handle(AspectReadBuilders.PROP_GET_BOOLEAN, "haswork").buildRead();
3✔
503
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_CANWORK =
2✔
504
                    AspectReadBuilders.Machine.BUILDER_WORKER_BOOLEAN.handle(
3✔
505
                        worker -> worker != null && worker.canWork()
×
506
                    ).handle(AspectReadBuilders.PROP_GET_BOOLEAN, "canwork").buildRead();
3✔
507
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_ISWORKING =
2✔
508
                    AspectReadBuilders.Machine.BUILDER_WORKER_BOOLEAN.handle(
3✔
509
                        worker -> worker != null && worker.canWork() && worker.hasWork()
×
510
                    ).handle(AspectReadBuilders.PROP_GET_BOOLEAN, "isworking").buildRead();
3✔
511

512
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_ISTEMPERATURE =
2✔
513
                    AspectReadBuilders.Machine.BUILDER_TEMPERATURE_BOOLEAN.handle(
3✔
514
                        Objects::nonNull
515
                    ).handle(AspectReadBuilders.PROP_GET_BOOLEAN, "istemperature").buildRead();
3✔
516
            public static final IAspectRead<ValueTypeDouble.ValueDouble, ValueTypeDouble> DOUBLE_TEMPERATURE =
2✔
517
                    AspectReadBuilders.Machine.BUILDER_TEMPERATURE_DOUBLE.handle(
3✔
518
                        temperature -> temperature != null ? temperature.getTemperature() : 0
×
519
                    ).handle(AspectReadBuilders.PROP_GET_DOUBLE, "temperature").buildRead();
3✔
520
            public static final IAspectRead<ValueTypeDouble.ValueDouble, ValueTypeDouble> DOUBLE_MAXTEMPERATURE =
2✔
521
                    AspectReadBuilders.Machine.BUILDER_TEMPERATURE_DOUBLE.handle(
3✔
522
                        temperature -> temperature != null ? temperature.getMaximumTemperature() : 0
×
523
                    ).handle(AspectReadBuilders.PROP_GET_DOUBLE, "maxtemperature").buildRead();
3✔
524
            public static final IAspectRead<ValueTypeDouble.ValueDouble, ValueTypeDouble> DOUBLE_MINTEMPERATURE =
2✔
525
                    AspectReadBuilders.Machine.BUILDER_TEMPERATURE_DOUBLE.handle(
3✔
526
                        temperature -> temperature != null ? temperature.getMinimumTemperature() : 0
×
527
                    ).handle(AspectReadBuilders.PROP_GET_DOUBLE, "mintemperature").buildRead();
3✔
528
            public static final IAspectRead<ValueTypeDouble.ValueDouble, ValueTypeDouble> DOUBLE_DEFAULTTEMPERATURE =
2✔
529
                    AspectReadBuilders.Machine.BUILDER_TEMPERATURE_DOUBLE.handle(
3✔
530
                        temperature -> temperature != null ? temperature.getDefaultTemperature() : 0
×
531
                    ).handle(AspectReadBuilders.PROP_GET_DOUBLE, "defaulttemperature").buildRead();
3✔
532

533
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_ISRECIPEHANDLER =
2✔
534
                    AspectReadBuilders.Machine.BUILDER_RECIPE_HANDLER_BOOLEAN
535
                            .handle(Objects::nonNull)
3✔
536
                            .handle(AspectReadBuilders.PROP_GET_BOOLEAN, "applicable").buildRead();
3✔
537
            public static final IAspectRead<ValueTypeList.ValueList, ValueTypeList> LIST_GETRECIPES =
2✔
538
                    AspectReadBuilders.Machine.BUILDER_RECIPE_HANDLER_LIST.handle(
2✔
539
                            input -> ValueTypeList.ValueList.ofFactory(new ValueTypeListProxyPositionedRecipes(
×
540
                                    input.getLeft().getTarget().getPos(), input.getLeft().getTarget().getSide()))).appendKind("recipes").buildRead();
3✔
541
            public static final IAspectRead<ValueTypeOperator.ValueOperator, ValueTypeOperator> OPERATOR_GETRECIPEOUTPUT =
2✔
542
                    AspectReadBuilders.Machine.BUILDER_RECIPE_HANDLER_OPERATOR.handle(
2✔
543
                            input -> ValueTypeOperator.ValueOperator.of(new PositionedOperatorRecipeHandlerOutput<>(
×
544
                                    input.getLeft().getTarget().getPos(), input.getLeft().getTarget().getSide()
×
545
                            ))).appendKind("recipeoutputbyinput").buildRead();
3✔
546
            static {
547
                Operators.REGISTRY.registerSerializer(new PositionedOperator.Serializer(
7✔
548
                        PositionedOperatorRecipeHandlerOutput.class, ResourceLocation.fromNamespaceAndPath(Reference.MOD_ID, "positioned_recipe_handler_output")));
2✔
549
            }
550
            public static final IAspectRead<ValueTypeOperator.ValueOperator, ValueTypeOperator> OPERATOR_GETRECIPEINPUTS =
2✔
551
                    AspectReadBuilders.Machine.BUILDER_RECIPE_HANDLER_OPERATOR.handle(input ->
2✔
552
                            ValueTypeOperator.ValueOperator.of(new PositionedOperatorRecipeHandlerInputs<>(
×
553
                                    input.getLeft().getTarget().getPos(), input.getLeft().getTarget().getSide()
×
554
                            ))).appendKind("recipeinputsbyoutput").buildRead();
3✔
555
            static {
556
                Operators.REGISTRY.registerSerializer(new PositionedOperator.Serializer(
7✔
557
                        PositionedOperatorRecipeHandlerInputs.class, ResourceLocation.fromNamespaceAndPath(Reference.MOD_ID, "positioned_recipe_handler_inputs")));
2✔
558
            }
559
            public static final IAspectRead<ValueTypeOperator.ValueOperator, ValueTypeOperator> OPERATOR_GETRECIPESBYINPUT =
2✔
560
                    AspectReadBuilders.Machine.BUILDER_RECIPE_HANDLER_OPERATOR.handle(
2✔
561
                            input -> ValueTypeOperator.ValueOperator.of(new PositionedOperatorRecipeHandlerRecipesByInput<>(
×
562
                                    input.getLeft().getTarget().getPos(), input.getLeft().getTarget().getSide()
×
563
                            ))).appendKind("recipesbyinput").buildRead();
3✔
564
            static {
565
                Operators.REGISTRY.registerSerializer(new PositionedOperator.Serializer(
7✔
566
                        PositionedOperatorRecipeHandlerRecipesByInput.class, ResourceLocation.fromNamespaceAndPath(Reference.MOD_ID, "positioned_recipe_handler_recipes_by_input")));
2✔
567
            }
568
            public static final IAspectRead<ValueTypeOperator.ValueOperator, ValueTypeOperator> OPERATOR_GETRECIPESBYOUTPUT =
2✔
569
                    AspectReadBuilders.Machine.BUILDER_RECIPE_HANDLER_OPERATOR.handle(
2✔
570
                            input -> ValueTypeOperator.ValueOperator.of(new PositionedOperatorRecipeHandlerRecipesByOutput<>(
×
571
                                    input.getLeft().getTarget().getPos(), input.getLeft().getTarget().getSide()
×
572
                            ))).appendKind("recipesbyoutput").buildRead();
3✔
573
            static {
574
                Operators.REGISTRY.registerSerializer(new PositionedOperator.Serializer(
7✔
575
                        PositionedOperatorRecipeHandlerRecipesByOutput.class, ResourceLocation.fromNamespaceAndPath(Reference.MOD_ID, "positioned_recipe_handler_recipes_by_output")));
2✔
576
            }
577
            public static final IAspectRead<ValueTypeOperator.ValueOperator, ValueTypeOperator> OPERATOR_GETRECIPEBYINPUT =
2✔
578
                    AspectReadBuilders.Machine.BUILDER_RECIPE_HANDLER_OPERATOR.handle(
2✔
579
                            input -> ValueTypeOperator.ValueOperator.of(new PositionedOperatorRecipeHandlerRecipeByInput<>(
×
580
                                    input.getLeft().getTarget().getPos(), input.getLeft().getTarget().getSide()
×
581
                            ))).appendKind("recipebyinput").buildRead();
3✔
582
            static {
583
                Operators.REGISTRY.registerSerializer(new PositionedOperator.Serializer(
7✔
584
                        PositionedOperatorRecipeHandlerRecipeByInput.class, ResourceLocation.fromNamespaceAndPath(Reference.MOD_ID, "positioned_recipe_handler_recipe_by_input")));
2✔
585
            }
586
            public static final IAspectRead<ValueTypeOperator.ValueOperator, ValueTypeOperator> OPERATOR_GETRECIPEBYOUTPUT =
2✔
587
                    AspectReadBuilders.Machine.BUILDER_RECIPE_HANDLER_OPERATOR.handle(
2✔
588
                            input -> ValueTypeOperator.ValueOperator.of(new PositionedOperatorRecipeHandlerRecipeByOutput<>(
×
589
                                    input.getLeft().getTarget().getPos(), input.getLeft().getTarget().getSide()
×
590
                            ))).appendKind("recipebyoutput").buildRead();
3✔
591
            static {
592
                Operators.REGISTRY.registerSerializer(new PositionedOperator.Serializer(
7✔
593
                        PositionedOperatorRecipeHandlerRecipeByOutput.class, ResourceLocation.fromNamespaceAndPath(Reference.MOD_ID, "positioned_recipe_handler_recipe_by_output")));
2✔
594
            }
595

596
            public static final IAspectValuePropagator<Pair<PartTarget, IAspectProperties>, EnergyHandler>
597
                    PROP_GET = input -> EnergyHelpers.getEnergyStorage(input.getLeft().getTarget()).orElse(null);
2✔
598

599
            public static final AspectBuilder<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean, EnergyHandler>
600
                    BUILDER_BOOLEAN = AspectReadBuilders.BUILDER_BOOLEAN.handle(PROP_GET, "energy");
5✔
601
            public static final AspectBuilder<ValueTypeLong.ValueLong, ValueTypeLong, EnergyHandler>
602
                    BUILDER_LONG = AspectReadBuilders.BUILDER_LONG.handle(PROP_GET, "energy");
5✔
603
            public static final AspectBuilder<ValueTypeDouble.ValueDouble, ValueTypeDouble, EnergyHandler>
604
                    BUILDER_DOUBLE = AspectReadBuilders.BUILDER_DOUBLE.handle(PROP_GET, "energy");
5✔
605

606
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_ISENERGY =
2✔
607
                    BUILDER_BOOLEAN.handle(
3✔
608
                        Objects::nonNull
609
                    ).handle(AspectReadBuilders.PROP_GET_BOOLEAN, "applicable").buildRead();
3✔
610
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_CANEXTRACTENERGY =
2✔
611
                    BUILDER_BOOLEAN.handle(
3✔
612
                        data -> {
613
                            if (data != null) {
×
614
                                try (var tx = Transaction.openRoot()) {
×
615
                                    return data.extract(1, tx) == 1;
×
616
                                }
617
                            }
618
                            return false;
×
619
                        }
620
                    ).handle(AspectReadBuilders.PROP_GET_BOOLEAN, "canextract").buildRead();
3✔
621
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_CANINSERTENERGY =
2✔
622
                    BUILDER_BOOLEAN.handle(
3✔
623
                        data -> {
624
                            if (data != null) {
×
625
                                try (var tx = Transaction.openRoot()) {
×
626
                                    return data.insert(1, tx) == 1;
×
627
                                }
628
                            }
629
                            return false;
×
630
                        }
631
                    ).handle(AspectReadBuilders.PROP_GET_BOOLEAN, "caninsert").buildRead();
3✔
632
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_ISENERGYFULL =
2✔
633
                    BUILDER_BOOLEAN.handle(
3✔
634
                        data -> data != null && data.getAmountAsLong() == data.getCapacityAsLong()
×
635
                    ).handle(AspectReadBuilders.PROP_GET_BOOLEAN, "isfull").buildRead();
3✔
636
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_ISENERGYEMPTY =
2✔
637
                    BUILDER_BOOLEAN.handle(
3✔
638
                        data -> data != null && data.getAmountAsLong() == 0
×
639
                    ).handle(AspectReadBuilders.PROP_GET_BOOLEAN, "isempty").buildRead();
3✔
640
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_ISENERGYNONEMPTY =
2✔
641
                    BUILDER_BOOLEAN.handle(
3✔
642
                        data -> data != null && data.getAmountAsLong() != 0
×
643
                    ).handle(AspectReadBuilders.PROP_GET_BOOLEAN, "isnonempty").buildRead();
3✔
644

645
            public static final IAspectRead<ValueTypeLong.ValueLong, ValueTypeLong> INTEGER_ENERGYSTORED =
2✔
646
                    BUILDER_LONG.handle(
3✔
647
                        data -> data != null ? data.getAmountAsLong() : 0
×
648
                    ).handle(AspectReadBuilders.PROP_GET_LONG, "amount").buildRead();
3✔
649
            public static final IAspectRead<ValueTypeLong.ValueLong, ValueTypeLong> INTEGER_ENERGYCAPACITY =
2✔
650
                    BUILDER_LONG.handle(
3✔
651
                        data -> data != null ? data.getCapacityAsLong() : 0
×
652
                    ).handle(AspectReadBuilders.PROP_GET_LONG, "capacity").buildRead();
3✔
653

654
            public static final IAspectRead<ValueTypeDouble.ValueDouble, ValueTypeDouble> DOUBLE_ENERGYFILLRATIO =
3✔
655
                    BUILDER_DOUBLE.handle(data -> {
3✔
656
                        if(data != null) {
×
657
                            double capacity = (double) data.getCapacityAsLong();
×
658
                            if(capacity == 0.0D) {
×
659
                                return 0.0D;
×
660
                            }
661
                            return ((double) data.getAmountAsLong()) / capacity;
×
662
                        }
663
                        return 0.0D;
×
664
                    }).handle(AspectReadBuilders.PROP_GET_DOUBLE, "fillratio").buildRead();
3✔
665

666
        }
667

668
        public static final class Network {
×
669

670
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_APPLICABLE =
2✔
671
                    AspectReadBuilders.Network.BUILDER_BOOLEAN.handle(
3✔
672
                        Objects::nonNull
673
                    ).handle(AspectReadBuilders.PROP_GET_BOOLEAN, "applicable").buildRead();
3✔
674

675
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_ELEMENT_COUNT =
2✔
676
                    AspectReadBuilders.Network.BUILDER_INTEGER.handle(
3✔
677
                        network -> network != null ? network.getElements().size() : 0
×
678
                    ).handle(AspectReadBuilders.PROP_GET_INTEGER, "elementcount").buildRead();
3✔
679
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_ENERGY_BATTERY_COUNT =
2✔
680
                    AspectReadBuilders.Network.BUILDER_INTEGER.handle(
3✔
681
                        network -> network != null ? network.getCapability(Capabilities.EnergyNetwork.NETWORK)
×
682
                                .map(energyNetwork -> energyNetwork.getPrioritizedPositions().size())
×
683
                                .orElse(0): 0
×
684
                    ).handle(AspectReadBuilders.PROP_GET_INTEGER, "energy").appendKind("batterycount").buildRead();
5✔
685
            public static final IAspectRead<ValueTypeLong.ValueLong, ValueTypeLong> LONG_ENERGY_STORED =
2✔
686
                    AspectReadBuilders.Network.ENERGY_BUILDER_LONG.handle(
3✔
687
                        storage -> storage != null ? storage.getAmountAsLong() : 0
×
688
                    ).handle(AspectReadBuilders.PROP_GET_LONG, "energy").appendKind("stored").buildRead();
5✔
689
            public static final IAspectRead<ValueTypeLong.ValueLong, ValueTypeLong> LONG_ENERGY_MAX =
2✔
690
                    AspectReadBuilders.Network.ENERGY_BUILDER_LONG.handle(
3✔
691
                        storage -> storage != null ? storage.getCapacityAsLong() : 0
×
692
                    ).handle(AspectReadBuilders.PROP_GET_LONG, "energy").appendKind("max").buildRead();
5✔
693
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_ENERGY_CONSUMPTION_RATE =
2✔
694
                    AspectReadBuilders.Network.BUILDER_INTEGER.handle(
3✔
695
                            network -> network != null && GeneralConfig.energyConsumptionMultiplier > 0
×
696
                                    ? network.getElements().stream()
×
697
                                    .mapToInt((e) -> e instanceof IEnergyConsumingNetworkElement
×
698
                                            ? ((IEnergyConsumingNetworkElement) e).getConsumptionRate() : 0).sum()
×
699
                                    * GeneralConfig.energyConsumptionMultiplier : 0
×
700
                    ).handle(AspectReadBuilders.PROP_GET_INTEGER, "energy").appendKind("consumptionrate").buildRead();
5✔
701
            public static final IAspectRead<IValue, ValueTypeCategoryAny> ANY_VALUE =
2✔
702
                    AspectReadBuilders.BUILDER_ANY.appendKind("network").handle(
4✔
703
                            data -> {
704
                                PartPos target = data.getLeft().getTarget();
×
705
                                IValueInterface valueInterface = IModHelpersNeoForge.get().getCapabilityHelpers()
×
706
                                        .getCapability(target.getPos(), target.getSide(), Capabilities.ValueInterface.BLOCK)
×
707
                                        .orElseThrow(() -> {
×
708
                                            EvaluationException error = new EvaluationException(Component.translatable(
×
709
                                                    L10NValues.ASPECT_ERROR_NOVALUEINTERFACE));
710
                                            error.setRetryEvaluation(true);
×
711
                                            return error;
×
712
                                        });
713
                                return valueInterface.getValue()
×
714
                                        .orElseThrow(() -> new EvaluationException(Component.translatable(
×
715
                                                L10NValues.ASPECT_ERROR_NOVALUEINTERFACEVALUE)));
716
                            }
717
                    ).appendKind("value").buildRead();
3✔
718
            public static final IAspectRead<ValueTypeOperator.ValueOperator, ValueTypeOperator>
719
                    OPERATOR_GETVARIABLEBYID = AspectReadBuilders.BUILDER_OPERATOR
2✔
720
                    .appendKind("network")
2✔
721
                    .handle(input -> ValueTypeOperator.ValueOperator.of(new PositionedOperatorNetworkVariableById(
2✔
722
                            input.getLeft().getTarget().getPos(),
×
723
                            input.getLeft().getTarget().getSide()
×
724
                    )))
725
                    .appendKind("variablebyid")
1✔
726
                    .buildRead();
2✔
727
            static {
728
                Operators.REGISTRY.registerSerializer(new PositionedOperator.Serializer(
7✔
729
                        PositionedOperatorNetworkVariableById.class, ResourceLocation.fromNamespaceAndPath(Reference.MOD_ID, "positioned_network_variable_by_id")));
2✔
730
            }
1✔
731

732
        }
733

734
        public static final class Redstone {
×
735

736
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_LOW =
2✔
737
                    AspectReadBuilders.Redstone.BUILDER_BOOLEAN.handle(
2✔
738
                        input -> input == 0
×
739
                    ).withUpdateType(AspectUpdateType.BLOCK_UPDATE)
3✔
740
                            .handle(AspectReadBuilders.PROP_GET_BOOLEAN, "low").buildRead();
3✔
741
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_NONLOW =
2✔
742
                    AspectReadBuilders.Redstone.BUILDER_BOOLEAN.handle(
2✔
743
                        input -> input > 0
×
744
                    ).withUpdateType(AspectUpdateType.BLOCK_UPDATE)
3✔
745
                            .handle(AspectReadBuilders.PROP_GET_BOOLEAN, "nonlow").buildRead();
3✔
746
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_HIGH =
2✔
747
                    AspectReadBuilders.Redstone.BUILDER_BOOLEAN.handle(
2✔
748
                        input -> input == 15
×
749
                    ).withUpdateType(AspectUpdateType.BLOCK_UPDATE)
3✔
750
                            .handle(AspectReadBuilders.PROP_GET_BOOLEAN, "high").buildRead();
3✔
751
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_CLOCK =
3✔
752
                    AspectReadBuilders.Redstone.BUILDER_BOOLEAN_CLOCK.handle(AspectReadBuilders.PROP_GET_BOOLEAN, "clock").buildRead();
3✔
753

754
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_VALUE =
2✔
755
                    AspectReadBuilders.Redstone.BUILDER_INTEGER.withUpdateType(AspectUpdateType.BLOCK_UPDATE)
3✔
756
                            .handle(AspectReadBuilders.PROP_GET_INTEGER, "value").buildRead();
3✔
757
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_COMPARATOR =
3✔
758
                    AspectReadBuilders.Redstone.BUILDER_INTEGER_COMPARATOR.withUpdateType(AspectUpdateType.BLOCK_UPDATE)
3✔
759
                            .handle(AspectReadBuilders.PROP_GET_INTEGER, "comparator").buildRead();
3✔
760

761
        }
762

763
        public static final class World {
×
764

765
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_WEATHER_CLEAR =
2✔
766
                    AspectReadBuilders.World.BUILDER_BOOLEAN.handle(AspectReadBuilders.World.PROP_GET_WORLD).handle(
5✔
767
                        world -> !world.isRaining()
×
768
                    ).handle(AspectReadBuilders.PROP_GET_BOOLEAN, "weather").appendKind("clear").buildRead();
5✔
769
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_WEATHER_RAINING =
2✔
770
                    AspectReadBuilders.World.BUILDER_BOOLEAN.handle(AspectReadBuilders.World.PROP_GET_WORLD).handle(
5✔
771
                        net.minecraft.world.level.Level::isRaining
772
                    ).handle(AspectReadBuilders.PROP_GET_BOOLEAN, "weather").appendKind("raining").buildRead();
5✔
773
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_WEATHER_THUNDER =
2✔
774
                    AspectReadBuilders.World.BUILDER_BOOLEAN.handle(AspectReadBuilders.World.PROP_GET_WORLD).handle(
5✔
775
                        net.minecraft.world.level.Level::isThundering
776
                    ).handle(AspectReadBuilders.PROP_GET_BOOLEAN, "weather").appendKind("thunder").buildRead();
5✔
777
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_ISDAY =
2✔
778
                    AspectReadBuilders.World.BUILDER_BOOLEAN.handle(AspectReadBuilders.World.PROP_GET_WORLD).handle(
5✔
779
                            net.minecraft.world.level.Level::isBrightOutside
780
                    ).handle(AspectReadBuilders.PROP_GET_BOOLEAN, "isday").buildRead();
3✔
781
            public static final IAspectRead<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_ISNIGHT =
2✔
782
                    AspectReadBuilders.World.BUILDER_BOOLEAN.handle(AspectReadBuilders.World.PROP_GET_WORLD).handle(
5✔
783
                        world -> !world.isBrightOutside()
×
784
                    ).handle(AspectReadBuilders.PROP_GET_BOOLEAN, "isnight").buildRead();
3✔
785

786
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_RAINCOUNTDOWN =
2✔
787
                    AspectReadBuilders.World.BUILDER_INTEGER.handle(AspectReadBuilders.World.PROP_GET_WORLD).handle(
5✔
788
                        world -> ((ServerLevelData) world.getLevelData()).getRainTime()
×
789
                    ).handle(AspectReadBuilders.PROP_GET_INTEGER, "raincountdown").buildRead();
3✔
790
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_TICKTIME =
2✔
791
                    AspectReadBuilders.World.BUILDER_INTEGER.handle(AspectReadBuilders.World.PROP_GET_WORLD).handle(
5✔
792
                        world -> (int) (Helpers.mean(ServerLifecycleHooks.getCurrentServer().getTickTime(world.dimension())) * 1.0E-6D)
×
793
                    ).handle(AspectReadBuilders.PROP_GET_INTEGER, "ticktime").buildRead();
3✔
794
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_DAYTIME =
2✔
795
                    AspectReadBuilders.World.BUILDER_INTEGER.handle(AspectReadBuilders.World.PROP_GET_WORLD).handle(
5✔
796
                        world -> (int) (world.getDayTime() % IModHelpers.get().getMinecraftHelpers().getDayLength())
×
797
                    ).handle(AspectReadBuilders.PROP_GET_INTEGER, "daytime").buildRead();
3✔
798
            public static final IAspectRead<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_LIGHTLEVEL =
2✔
799
                    AspectReadBuilders.World.BUILDER_INTEGER.handle(
3✔
800
                        dimPos -> dimPos.getLevel(true).getMaxLocalRawBrightness(dimPos.getBlockPos())
×
801
                    ).handle(AspectReadBuilders.PROP_GET_INTEGER, "lightlevel").buildRead();
3✔
802

803
            public static final IAspectRead<ValueTypeDouble.ValueDouble, ValueTypeDouble> DOUBLE_TPS =
2✔
804
                    AspectReadBuilders.World.BUILDER_DOUBLE.handle(AspectReadBuilders.World.PROP_GET_WORLD).handle(
5✔
805
                            world -> Helpers.calculateTps(ServerLifecycleHooks.getCurrentServer().getTickTime(world.dimension()))
×
806
                    ).handle(AspectReadBuilders.PROP_GET_DOUBLE, "tps").buildRead();
3✔
807

808
            public static final IAspectRead<ValueTypeLong.ValueLong, ValueTypeLong> LONG_TIME =
2✔
809
                    AspectReadBuilders.World.BUILDER_LONG.handle(AspectReadBuilders.World.PROP_GET_WORLD).handle(
5✔
810
                        net.minecraft.world.level.Level::getDayTime
811
                    ).handle(AspectReadBuilders.PROP_GET_LONG, "time").buildRead();
3✔
812
            public static final IAspectRead<ValueTypeLong.ValueLong, ValueTypeLong> LONG_TOTALTIME =
2✔
813
                    AspectReadBuilders.World.BUILDER_LONG.handle(AspectReadBuilders.World.PROP_GET_WORLD).handle(
5✔
814
                        net.minecraft.world.level.Level::getGameTime
815
                    ).handle(AspectReadBuilders.PROP_GET_LONG, "totaltime").buildRead();
3✔
816

817
            public static final IAspectRead<ValueTypeString.ValueString, ValueTypeString> STRING_NAME =
2✔
818
                    AspectReadBuilders.World.BUILDER_STRING.handle(AspectReadBuilders.World.PROP_GET_WORLD).handle(
5✔
819
                        world -> ((ServerLevelData) world.getLevelData()).getLevelName()
×
820
                    ).handle(AspectReadBuilders.PROP_GET_STRING, "worldname").buildRead();
3✔
821

822
            public static final IAspectRead<ValueTypeList.ValueList, ValueTypeList> LIST_PLAYERS =
3✔
823
                    AspectReadBuilders.World.BUILDER_LIST.handle(dimPos ->
2✔
824
                            ValueTypeList.ValueList.ofList(ValueTypes.OBJECT_ENTITY, Lists.transform(dimPos.getLevel(true).players(),
×
825
                                ValueObjectTypeEntity.ValueEntity::of))
826
                    ).appendKind("players").buildRead();
3✔
827

828
        }
829

830
    }
831

832
    public static final class Write {
×
833

834
        public static final class Audio {
×
835

836
            public static final IAspectWrite<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_HARP_NOTE =
2✔
837
                    AspectWriteBuilders.Audio.BUILDER_INTEGER_INSTRUMENT
838
                            .handle(AspectWriteBuilders.Audio.propWithInstrument(NoteBlockInstrument.HARP), "harp")
4✔
839
                            .handle(AspectWriteBuilders.Audio.PROP_SET).buildWrite();
3✔
840
            public static final IAspectWrite<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_BASEDRUM_NOTE =
2✔
841
                    AspectWriteBuilders.Audio.BUILDER_INTEGER_INSTRUMENT
842
                            .handle(AspectWriteBuilders.Audio.propWithInstrument(NoteBlockInstrument.BASEDRUM), "basedrum")
4✔
843
                            .handle(AspectWriteBuilders.Audio.PROP_SET).buildWrite();
3✔
844
            public static final IAspectWrite<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_SNARE_NOTE =
2✔
845
                    AspectWriteBuilders.Audio.BUILDER_INTEGER_INSTRUMENT
846
                            .handle(AspectWriteBuilders.Audio.propWithInstrument(NoteBlockInstrument.SNARE), "snare")
4✔
847
                            .handle(AspectWriteBuilders.Audio.PROP_SET).buildWrite();
3✔
848
            public static final IAspectWrite<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_HAT_NOTE =
2✔
849
                    AspectWriteBuilders.Audio.BUILDER_INTEGER_INSTRUMENT
850
                            .handle(AspectWriteBuilders.Audio.propWithInstrument(NoteBlockInstrument.HAT), "hat")
4✔
851
                            .handle(AspectWriteBuilders.Audio.PROP_SET).buildWrite();
3✔
852
            public static final IAspectWrite<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_BASS_NOTE =
2✔
853
                    AspectWriteBuilders.Audio.BUILDER_INTEGER_INSTRUMENT
854
                            .handle(AspectWriteBuilders.Audio.propWithInstrument(NoteBlockInstrument.BASS), "bass")
4✔
855
                            .handle(AspectWriteBuilders.Audio.PROP_SET).buildWrite();
3✔
856
            public static final IAspectWrite<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_FLUTE_NOTE =
2✔
857
                    AspectWriteBuilders.Audio.BUILDER_INTEGER_INSTRUMENT
858
                            .handle(AspectWriteBuilders.Audio.propWithInstrument(NoteBlockInstrument.FLUTE), "flute")
4✔
859
                            .handle(AspectWriteBuilders.Audio.PROP_SET).buildWrite();
3✔
860
            public static final IAspectWrite<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_BELL_NOTE =
2✔
861
                    AspectWriteBuilders.Audio.BUILDER_INTEGER_INSTRUMENT
862
                            .handle(AspectWriteBuilders.Audio.propWithInstrument(NoteBlockInstrument.BELL), "bell")
4✔
863
                            .handle(AspectWriteBuilders.Audio.PROP_SET).buildWrite();
3✔
864
            public static final IAspectWrite<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_GUITAR_NOTE =
2✔
865
                    AspectWriteBuilders.Audio.BUILDER_INTEGER_INSTRUMENT
866
                            .handle(AspectWriteBuilders.Audio.propWithInstrument(NoteBlockInstrument.BASS), "guitar")
4✔
867
                            .handle(AspectWriteBuilders.Audio.PROP_SET).buildWrite();
3✔
868
            public static final IAspectWrite<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_CHIME_NOTE =
2✔
869
                    AspectWriteBuilders.Audio.BUILDER_INTEGER_INSTRUMENT
870
                            .handle(AspectWriteBuilders.Audio.propWithInstrument(NoteBlockInstrument.CHIME), "chime")
4✔
871
                            .handle(AspectWriteBuilders.Audio.PROP_SET).buildWrite();
3✔
872
            public static final IAspectWrite<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_XYLOPHONE_NOTE =
2✔
873
                    AspectWriteBuilders.Audio.BUILDER_INTEGER_INSTRUMENT
874
                            .handle(AspectWriteBuilders.Audio.propWithInstrument(NoteBlockInstrument.XYLOPHONE), "xylophone")
4✔
875
                            .handle(AspectWriteBuilders.Audio.PROP_SET).buildWrite();
3✔
876
            public static final IAspectWrite<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_IRON_XYLOPHONE_NOTE =
2✔
877
                    AspectWriteBuilders.Audio.BUILDER_INTEGER_INSTRUMENT
878
                            .handle(AspectWriteBuilders.Audio.propWithInstrument(NoteBlockInstrument.IRON_XYLOPHONE), "iron_xylophone")
4✔
879
                            .handle(AspectWriteBuilders.Audio.PROP_SET).buildWrite();
3✔
880
            public static final IAspectWrite<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_COW_BELL_NOTE =
2✔
881
                    AspectWriteBuilders.Audio.BUILDER_INTEGER_INSTRUMENT
882
                            .handle(AspectWriteBuilders.Audio.propWithInstrument(NoteBlockInstrument.COW_BELL), "cow_bell")
4✔
883
                            .handle(AspectWriteBuilders.Audio.PROP_SET).buildWrite();
3✔
884
            public static final IAspectWrite<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_DIDGERIDOO_NOTE =
2✔
885
                    AspectWriteBuilders.Audio.BUILDER_INTEGER_INSTRUMENT
886
                            .handle(AspectWriteBuilders.Audio.propWithInstrument(NoteBlockInstrument.DIDGERIDOO), "didgeridoo")
4✔
887
                            .handle(AspectWriteBuilders.Audio.PROP_SET).buildWrite();
3✔
888
            public static final IAspectWrite<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_BIT_NOTE =
2✔
889
                    AspectWriteBuilders.Audio.BUILDER_INTEGER_INSTRUMENT
890
                            .handle(AspectWriteBuilders.Audio.propWithInstrument(NoteBlockInstrument.BIT), "bit")
4✔
891
                            .handle(AspectWriteBuilders.Audio.PROP_SET).buildWrite();
3✔
892
            public static final IAspectWrite<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_BANJO_NOTE =
2✔
893
                    AspectWriteBuilders.Audio.BUILDER_INTEGER_INSTRUMENT
894
                            .handle(AspectWriteBuilders.Audio.propWithInstrument(NoteBlockInstrument.BANJO), "banjo")
4✔
895
                            .handle(AspectWriteBuilders.Audio.PROP_SET).buildWrite();
3✔
896
            public static final IAspectWrite<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_PLING_NOTE =
2✔
897
                    AspectWriteBuilders.Audio.BUILDER_INTEGER_INSTRUMENT
898
                            .handle(AspectWriteBuilders.Audio.propWithInstrument(NoteBlockInstrument.PLING), "pling")
4✔
899
                            .handle(AspectWriteBuilders.Audio.PROP_SET).buildWrite();
3✔
900
            public static final IAspectWrite<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_ZOMBIE_NOTE =
2✔
901
                    AspectWriteBuilders.Audio.BUILDER_INTEGER_INSTRUMENT
902
                            .handle(AspectWriteBuilders.Audio.propWithInstrument(NoteBlockInstrument.ZOMBIE), "zombie")
4✔
903
                            .handle(AspectWriteBuilders.Audio.PROP_SET).buildWrite();
3✔
904
            public static final IAspectWrite<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_SKELETON_NOTE =
2✔
905
                    AspectWriteBuilders.Audio.BUILDER_INTEGER_INSTRUMENT
906
                            .handle(AspectWriteBuilders.Audio.propWithInstrument(NoteBlockInstrument.SKELETON), "skeleton")
4✔
907
                            .handle(AspectWriteBuilders.Audio.PROP_SET).buildWrite();
3✔
908
            public static final IAspectWrite<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_CREEPER_NOTE =
2✔
909
                    AspectWriteBuilders.Audio.BUILDER_INTEGER_INSTRUMENT
910
                            .handle(AspectWriteBuilders.Audio.propWithInstrument(NoteBlockInstrument.CREEPER), "creeper")
4✔
911
                            .handle(AspectWriteBuilders.Audio.PROP_SET).buildWrite();
3✔
912
            public static final IAspectWrite<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_DRAGON_NOTE =
2✔
913
                    AspectWriteBuilders.Audio.BUILDER_INTEGER_INSTRUMENT
914
                            .handle(AspectWriteBuilders.Audio.propWithInstrument(NoteBlockInstrument.DRAGON), "dragon")
4✔
915
                            .handle(AspectWriteBuilders.Audio.PROP_SET).buildWrite();
3✔
916
            public static final IAspectWrite<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_WITHER_SKELETON_NOTE =
2✔
917
                    AspectWriteBuilders.Audio.BUILDER_INTEGER_INSTRUMENT
918
                            .handle(AspectWriteBuilders.Audio.propWithInstrument(NoteBlockInstrument.WITHER_SKELETON), "wither_skeleton")
4✔
919
                            .handle(AspectWriteBuilders.Audio.PROP_SET).buildWrite();
3✔
920
            public static final IAspectWrite<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_PIGLIN_NOTE =
2✔
921
                    AspectWriteBuilders.Audio.BUILDER_INTEGER_INSTRUMENT
922
                            .handle(AspectWriteBuilders.Audio.propWithInstrument(NoteBlockInstrument.PIGLIN), "piglin")
4✔
923
                            .handle(AspectWriteBuilders.Audio.PROP_SET).buildWrite();
3✔
924
            public static final IAspectWrite<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_CUSTOM_HEAD_NOTE =
2✔
925
                    AspectWriteBuilders.Audio.BUILDER_INTEGER_INSTRUMENT
926
                            .handle(AspectWriteBuilders.Audio.propWithInstrument(NoteBlockInstrument.CUSTOM_HEAD), "custom_head")
4✔
927
                            .handle(AspectWriteBuilders.Audio.PROP_SET).buildWrite();
3✔
928

929
            public static final IAspectWrite<ValueTypeString.ValueString, ValueTypeString> STRING_SOUND =
2✔
930
                    AspectWriteBuilders.Audio.BUILDER_STRING.withProperties(AspectWriteBuilders.Audio.PROPERTIES_SOUND)
3✔
931
                            .handle(input -> {
1✔
932
                                IAspectProperties properties = input.getMiddle();
×
933
                                BlockPos pos = input.getLeft().getTarget().getPos().getBlockPos();
×
934
                                if(!StringUtil.isNullOrEmpty(input.getRight())) {
×
935
                                    float f = (float) properties.getValue(AspectWriteBuilders.Audio.PROP_FREQUENCY).getRawValue();
×
936
                                    float volume = (float) properties.getValue(AspectWriteBuilders.Audio.PROP_VOLUME).getRawValue();
×
937

938
                                    Level world = input.getLeft().getTarget().getPos().getLevel(false);
×
939
                                    if (world != null) {
×
940
                                        ServerLifecycleHooks.getCurrentServer().getPlayerList().broadcast(null,
×
941
                                                (double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, 64.0D,
×
942
                                                world.dimension(),
×
943
                                                new ClientboundSoundPacket(Holder.direct(SoundEvent.createVariableRangeEvent(ValueHelpers.createResourceLocationInEvaluation(input.getRight()))),
×
944
                                                        SoundSource.RECORDS,
945
                                                        (double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D,
×
946
                                                        volume, f, world.getRandom().nextLong()));
×
947
                                    }
948
                                }
949
                                return null;
×
950
                            }, "sound").buildWrite();
2✔
951

952
            public static final IAspectWrite<ValueTypeString.ValueString, ValueTypeString> STRING_TEXT =
3✔
953
                    AspectWriteBuilders.Audio.BUILDER_STRING.withProperties(AspectWriteBuilders.Audio.PROPERTIES_TEXT)
3✔
954
                            .handle(input -> {
1✔
955
                                IAspectProperties properties = input.getMiddle();
×
956
                                Level world = input.getLeft().getTarget().getPos().getLevel(true);
×
957
                                BlockPos pos = input.getLeft().getTarget().getPos().getBlockPos();
×
958
                                if(!StringUtil.isNullOrEmpty(input.getRight())) {
×
959
                                    int range = properties.getValue(AspectWriteBuilders.Audio.PROP_RANGE).getRawValue();
×
960
                                    IntegratedDynamics._instance.getPacketHandler().sendToAllAroundPoint(
×
961
                                            new SpeakTextPacket(input.getRight(), (float) properties.getValue(AspectWriteBuilders.Audio.PROP_VOLUME).getRawValue()),
×
962
                                            IPacketHandler.createTargetPointFromLocation((ServerLevel) world, pos, range));
×
963
                                }
964
                                return null;
×
965
                            }, "text").buildWrite();
2✔
966

967
        }
968

969
        public static final class Effect {
×
970

971
            public static IAspectWrite<ValueTypeDouble.ValueDouble, ValueTypeDouble> createForParticleSpell(final ParticleType<SpellParticleOption> type) {
972
                // TODO: expose these params as aspect settings?
973
                return createForParticle(SpellParticleOption.create(type, 0, 1));
6✔
974
            }
975

976
            public static IAspectWrite<ValueTypeDouble.ValueDouble, ValueTypeDouble> createForParticlePower(final ParticleType<PowerParticleOption> type) {
977
                // TODO: expose these params as aspect settings?
978
                return createForParticle(PowerParticleOption.create(type, 1));
5✔
979
            }
980

981
            public static IAspectWrite<ValueTypeDouble.ValueDouble, ValueTypeDouble> createForParticleColor(final ParticleType<ColorParticleOption> type) {
982
                // TODO: expose these params as aspect settings?
983
                return createForParticle(ColorParticleOption.create(type, 0));
5✔
984
            }
985

986
            public static IAspectWrite<ValueTypeDouble.ValueDouble, ValueTypeDouble> createForParticle(final ParticleOptions particle) {
987
                return AspectWriteBuilders.Effect.BUILDER_DOUBLE_PARTICLE.appendKind("particle").appendKind(BuiltInRegistries
9✔
988
                                .PARTICLE_TYPE.getKey(particle.getType()).toString().toLowerCase(Locale.ROOT).replaceAll(":", "_"))
8✔
989
                        .handle(input -> {
1✔
990
                            double velocity = input.getRight();
×
991
                            if (velocity < 0) {
×
992
                                return null;
×
993
                            }
994

995
                            IAspectProperties properties = input.getMiddle();
×
996
                            PartPos pos = input.getLeft().getTarget();
×
997

998
                            double x = pos.getPos().getBlockPos().getX() + properties.getValue(AspectWriteBuilders.Effect.PROP_OFFSET_X).getRawValue();
×
999
                            double y = pos.getPos().getBlockPos().getY() + properties.getValue(AspectWriteBuilders.Effect.PROP_OFFSET_Y).getRawValue();
×
1000
                            double z = pos.getPos().getBlockPos().getZ() + properties.getValue(AspectWriteBuilders.Effect.PROP_OFFSET_Z).getRawValue();
×
1001
                            int numberOfParticles = properties.getValue(AspectWriteBuilders.Effect.PROP_PARTICLES).getRawValue();
×
1002

1003
                            double xDir = properties.getValue(AspectWriteBuilders.Effect.PROP_SPREAD_X).getRawValue();
×
1004
                            double yDir = properties.getValue(AspectWriteBuilders.Effect.PROP_SPREAD_Y).getRawValue();
×
1005
                            double zDir = properties.getValue(AspectWriteBuilders.Effect.PROP_SPREAD_Z).getRawValue();
×
1006

1007
                            ServerLevel world = ((ServerLevel) pos.getPos().getLevel(false));
×
1008
                            if (world != null) {
×
1009
                                world.sendParticles(particle, x, y, z, numberOfParticles, xDir, yDir, zDir, velocity);
×
1010
                            }
1011
                            return null;
×
1012
                        }).buildWrite();
1✔
1013
            }
1014

1015
        }
1016

1017
        public static final class Redstone {
×
1018

1019
            public static final IAspectWrite<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN =
2✔
1020
                    AspectWriteBuilders.Redstone.BUILDER_BOOLEAN.handle(
2✔
1021
                        input -> Triple.of(input.getLeft(), input.getMiddle(), input.getRight() ? 15 : 0)
×
1022
                    ).handle(AspectWriteBuilders.Redstone.PROP_SET).buildWrite();
3✔
1023
            public static final IAspectWrite<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER =
2✔
1024
                    AspectWriteBuilders.Redstone.BUILDER_INTEGER.handle(AspectWriteBuilders.Redstone.PROP_SET).buildWrite();
3✔
1025
            public static final IAspectWrite<ValueTypeBoolean.ValueBoolean, ValueTypeBoolean> BOOLEAN_PULSE =
2✔
1026
                    AspectWriteBuilders.Redstone.BUILDER_BOOLEAN
1027
                            .withProperties(AspectWriteBuilders.Redstone.PROPERTIES_REDSTONE_PULSE)
2✔
1028
                            .appendKind("pulse")
2✔
1029
                            .handle(input -> Triple.of(input.getLeft(), input.getMiddle(), input.getRight() ? 15 : 0)
2!
1030
                    ).handle(AspectWriteBuilders.Redstone.PROP_SET_PULSE).buildWrite();
3✔
1031
            public static final IAspectWrite<ValueTypeInteger.ValueInteger, ValueTypeInteger> INTEGER_PULSE =
3✔
1032
                    AspectWriteBuilders.Redstone.BUILDER_INTEGER
1033
                            .withProperties(AspectWriteBuilders.Redstone.PROPERTIES_REDSTONE_PULSE)
2✔
1034
                            .appendKind("pulse")
2✔
1035
                            .handle(AspectWriteBuilders.Redstone.PROP_SET_PULSE).buildWrite();
3✔
1036

1037
        }
1038

1039
    }
1040

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