• 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

29.63
/src/main/java/org/cyclops/integrateddynamics/block/BlockProxy.java
1
package org.cyclops.integrateddynamics.block;
2

3
import com.mojang.serialization.MapCodec;
4
import net.minecraft.core.BlockPos;
5
import net.minecraft.core.Direction;
6
import net.minecraft.world.entity.LivingEntity;
7
import net.minecraft.world.item.ItemStack;
8
import net.minecraft.world.item.context.BlockPlaceContext;
9
import net.minecraft.world.level.Level;
10
import net.minecraft.world.level.block.BaseEntityBlock;
11
import net.minecraft.world.level.block.Block;
12
import net.minecraft.world.level.block.entity.BlockEntity;
13
import net.minecraft.world.level.block.entity.BlockEntityTicker;
14
import net.minecraft.world.level.block.entity.BlockEntityType;
15
import net.minecraft.world.level.block.state.BlockState;
16
import net.minecraft.world.level.block.state.StateDefinition;
17
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
18
import net.minecraft.world.level.block.state.properties.EnumProperty;
19
import org.cyclops.cyclopscore.helper.IModHelpers;
20
import org.cyclops.integrateddynamics.RegistryEntries;
21
import org.cyclops.integrateddynamics.blockentity.BlockEntityProxy;
22
import org.cyclops.integrateddynamics.core.block.BlockWithEntityGuiCabled;
23

24
import javax.annotation.Nullable;
25

26
/**
27
 * A block that can expose variables.
28
 * @author rubensworks
29
 */
30
public class BlockProxy extends BlockWithEntityGuiCabled {
31

32
    public static final MapCodec<BlockProxy> CODEC = simpleCodec(BlockProxy::new);
3✔
33

34
    public static final EnumProperty<Direction> FACING = BlockStateProperties.HORIZONTAL_FACING;
3✔
35

36
    public BlockProxy(Properties properties) {
37
        super(properties, BlockEntityProxy::new);
4✔
38
        this.registerDefaultState(this.stateDefinition.any()
8✔
39
                .setValue(FACING, Direction.NORTH));
2✔
40
    }
1✔
41

42
    @Override
43
    protected MapCodec<? extends BaseEntityBlock> codec() {
44
        return CODEC;
×
45
    }
46

47
    @Override
48
    @Nullable
49
    public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState blockState, BlockEntityType<T> blockEntityType) {
50
        return level.isClientSide() ? null : createTickerHelper(blockEntityType, RegistryEntries.BLOCK_ENTITY_PROXY.get(), new BlockEntityProxy.Ticker<>());
×
51
    }
52

53
    @Override
54
    protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
55
        builder.add(FACING);
9✔
56
    }
1✔
57

58
    @Override
59
    public BlockState getStateForPlacement(BlockPlaceContext context) {
60
        return this.defaultBlockState().setValue(FACING, context.getHorizontalDirection());
×
61
    }
62

63
    @Override
64
    public void setPlacedBy(Level world, BlockPos blockPos, BlockState state, LivingEntity placer, ItemStack itemStack) {
65
        if (!world.isClientSide()) {
×
66
            IModHelpers.get().getBlockEntityHelpers().get(world, blockPos, BlockEntityProxy.class)
×
67
                    .ifPresent(tile -> {
×
68
                        if (itemStack.has(RegistryEntries.DATACOMPONENT_PROXY_ID)) {
×
69
                            tile.setProxyId(itemStack.get(RegistryEntries.DATACOMPONENT_PROXY_ID));
×
70
                        } else {
71
                            tile.generateNewProxyId();
×
72
                        }
73
                        tile.setChanged();
×
74
                    });
×
75
        }
76
        super.setPlacedBy(world, blockPos, state, placer, itemStack);
×
77
    }
×
78
}
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