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

CyclopsMC / IntegratedDynamics / 16552051255

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

push

github

rubensworks
Resolve minor TODOs

2888 of 8740 branches covered (33.04%)

Branch coverage included in aggregate %.

17341 of 29280 relevant lines covered (59.22%)

3.08 hits per line

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

80.0
/src/main/java/org/cyclops/integrateddynamics/block/shapes/VoxelShapeComponentsFactoryHandlerCableCenter.java
1
package org.cyclops.integrateddynamics.block.shapes;
2

3
import net.minecraft.core.BlockPos;
4
import net.minecraft.core.Direction;
5
import net.minecraft.world.InteractionHand;
6
import net.minecraft.world.InteractionResult;
7
import net.minecraft.world.entity.player.Player;
8
import net.minecraft.world.item.ItemStack;
9
import net.minecraft.world.level.BlockGetter;
10
import net.minecraft.world.level.Level;
11
import net.minecraft.world.level.block.state.BlockState;
12
import net.minecraft.world.phys.AABB;
13
import net.minecraft.world.phys.shapes.CollisionContext;
14
import net.minecraft.world.phys.shapes.Shapes;
15
import net.minecraft.world.phys.shapes.VoxelShape;
16
import net.neoforged.neoforge.common.extensions.ILevelExtension;
17
import org.cyclops.integrateddynamics.RegistryEntries;
18
import org.cyclops.integrateddynamics.client.model.CableModel;
19
import org.cyclops.integrateddynamics.core.block.BlockRayTraceResultComponent;
20
import org.cyclops.integrateddynamics.core.block.VoxelShapeComponents;
21
import org.cyclops.integrateddynamics.core.block.VoxelShapeComponentsFactory;
22
import org.cyclops.integrateddynamics.core.helper.CableHelpers;
23

24
import javax.annotation.Nullable;
25
import java.util.Collection;
26
import java.util.Collections;
27

28
/**
29
 * Shape handler for cable centers.
30
 * @author rubensworks
31
 */
32
public class VoxelShapeComponentsFactoryHandlerCableCenter implements VoxelShapeComponentsFactory.IHandler {
3✔
33

34
    private static final VoxelShape BOUNDS = Shapes.create(new AABB(
11✔
35
            CableModel.MIN, CableModel.MIN, CableModel.MIN,
36
            CableModel.MAX, CableModel.MAX, CableModel.MAX));
37
    private static final VoxelShapeComponentsFactoryHandlerCableCenter.Component COMPONENT = new Component();
5✔
38

39
    @Override
40
    public Collection<VoxelShapeComponents.IComponent> createComponents(BlockState blockState, BlockGetter world, BlockPos blockPos, CollisionContext selectionContext) {
41
        if (world instanceof ILevelExtension level) {
6✔
42
            if (CableHelpers.isNoFakeCable(level, blockPos, null, blockState)) {
6✔
43
                return Collections.singletonList(COMPONENT);
3✔
44
            }
45
        }
46
        return Collections.emptyList();
2✔
47
    }
48

49
    public static class Component implements VoxelShapeComponents.IComponent {
3✔
50

51
        public String getStateId(BlockState blockState, BlockGetter world, BlockPos blockPos) {
52
            return "cent";
2✔
53
        }
54

55
        @Override
56
        public VoxelShape getShape(BlockState blockState, BlockGetter world, BlockPos blockPos, CollisionContext selectionContext) {
57
            return BOUNDS;
2✔
58
        }
59

60
        @Override
61
        public ItemStack getCloneItemStack(Level world, BlockPos pos) {
62
            return new ItemStack(RegistryEntries.BLOCK_CABLE.get());
×
63
        }
64

65
        @Override
66
        public boolean destroy(Level world, BlockPos pos, Player player, boolean saveState) {
67
            if (!world.isClientSide()) {
3!
68
                CableHelpers.removeCable(world, pos, player);
4✔
69
                return true;
2✔
70
            }
71
            return false;
×
72
        }
73

74
        @Override
75
        public InteractionResult onBlockActivated(BlockState state, Level world, BlockPos blockPos, Player player, InteractionHand hand, BlockRayTraceResultComponent hit) {
76
            ItemStack heldItem = player.getItemInHand(hand);
4✔
77
            InteractionResult actionResult = CableHelpers.onCableActivated(world, blockPos, state, player, heldItem, hit.getDirection(), null);
10✔
78
            if(actionResult.consumesAction()) {
3!
79
                return actionResult;
2✔
80
            }
81
            return InteractionResult.PASS;
×
82
        }
83

84
        @Nullable
85
        @Override
86
        public Direction getRaytraceDirection() {
87
            return null;
×
88
        }
89

90
        @Override
91
        public boolean isRaytraceLastForFace() {
92
            return false;
2✔
93
        }
94

95
    }
96

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