|
1 | 1 | package com.robotgryphon.compactmachines.block.walls; |
2 | 2 |
|
3 | | -import com.robotgryphon.compactmachines.core.Registration; |
4 | | -import net.minecraft.block.Block; |
| 3 | +import com.robotgryphon.compactmachines.config.ServerConfig; |
5 | 4 | import net.minecraft.block.BlockState; |
6 | | -import net.minecraft.entity.Entity; |
7 | 5 | import net.minecraft.entity.EntitySpawnPlacementRegistry; |
8 | 6 | import net.minecraft.entity.EntityType; |
9 | | -import net.minecraft.entity.player.PlayerEntity; |
10 | | -import net.minecraft.entity.player.ServerPlayerEntity; |
11 | | -import net.minecraft.fluid.FluidState; |
12 | | -import net.minecraft.item.ItemStack; |
13 | | -import net.minecraft.util.ActionResultType; |
14 | | -import net.minecraft.util.Hand; |
15 | 7 | import net.minecraft.util.math.BlockPos; |
16 | | -import net.minecraft.util.math.BlockRayTraceResult; |
17 | | -import net.minecraft.world.Explosion; |
18 | 8 | import net.minecraft.world.IBlockReader; |
19 | | -import net.minecraft.world.IWorldReader; |
20 | | -import net.minecraft.world.World; |
21 | 9 |
|
22 | 10 | import javax.annotation.Nullable; |
23 | 11 |
|
24 | | -public class SolidWallBlock extends Block { |
| 12 | +public class SolidWallBlock extends ProtectedWallBlock { |
25 | 13 | public SolidWallBlock(Properties props) { |
26 | 14 | super(props); |
27 | 15 | } |
28 | 16 |
|
29 | | - @Override |
30 | | - public void onBlockExploded(BlockState state, World world, BlockPos pos, Explosion explosion) { |
31 | | - // NO-Op, do not destroy on explosions |
32 | | - } |
33 | | - |
34 | | - @Override |
35 | | - public boolean canHarvestBlock(BlockState state, IBlockReader world, BlockPos pos, PlayerEntity player) { |
36 | | - return false; |
37 | | - } |
38 | | - |
39 | | - @Override |
40 | | - public boolean canEntityDestroy(BlockState state, IBlockReader world, BlockPos pos, Entity entity) { |
41 | | - return false; |
42 | | - } |
43 | | - |
44 | | - @Override |
45 | | - public boolean canBeReplacedByLeaves(BlockState state, IWorldReader world, BlockPos pos) { |
46 | | - return false; |
47 | | - } |
48 | | - |
49 | | - @Override |
50 | | - public boolean canDropFromExplosion(BlockState state, IBlockReader world, BlockPos pos, Explosion explosion) { |
51 | | - return false; |
52 | | - } |
53 | | - |
54 | 17 | @Override |
55 | 18 | public boolean canCreatureSpawn(BlockState state, IBlockReader world, BlockPos pos, EntitySpawnPlacementRegistry.PlacementType type, @Nullable EntityType<?> entityType) { |
56 | | - return pos.getY() == 40; |
57 | | - } |
58 | | - |
59 | | - @Override |
60 | | - public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { |
61 | | - ItemStack held = player.getHeldItemMainhand(); |
62 | | - |
63 | | - if (held.isEmpty()) |
64 | | - return ActionResultType.PASS; |
65 | | - |
66 | | - if (player.isSneaking()) |
67 | | - return ActionResultType.PASS; |
68 | | - |
69 | | - // TODO: Tunnels and Personal Shrinking Device |
70 | | - |
71 | | - return super.onBlockActivated(state, worldIn, pos, player, handIn, hit); |
| 19 | + return pos.getY() == ServerConfig.MACHINE_FLOOR_Y.get(); |
72 | 20 | } |
73 | 21 | } |
0 commit comments