• 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

23.33
/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) {
3!
42
            if (CableHelpers.isNoFakeCable(level, blockPos, null, blockState)) {
×
43
                return Collections.singletonList(COMPONENT);
×
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";
×
53
        }
54

55
        @Override
56
        public VoxelShape getShape(BlockState blockState, BlockGetter world, BlockPos blockPos, CollisionContext selectionContext) {
57
            return BOUNDS;
×
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()) {
×
68
                CableHelpers.removeCable(world, pos, player);
×
69
                return true;
×
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);
×
77
            InteractionResult actionResult = CableHelpers.onCableActivated(world, blockPos, state, player, heldItem, hit.getDirection(), null);
×
78
            if(actionResult.consumesAction()) {
×
79
                return actionResult;
×
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;
×
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