Skip to content

Commit 8f8300d

Browse files
committed
Fix shenanigans with wall blocks; closes #455
1 parent d956232 commit 8f8300d

File tree

6 files changed

+68
-213
lines changed

6 files changed

+68
-213
lines changed

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ forge_version=35.1.37
88
mappings_version=20201028-1.16.3
99

1010
mod_id=compactmachines
11-
mod_version=4.0.0-alpha.8
11+
mod_version=4.0.0-beta.1
1212

1313
# Dependencies and Libs
1414
jei_version=7.6.0.58
1515
top_version=1.16-3.0.4-beta-7
1616

1717
# Curseforge
1818
cf_project=224218
19-
cf_release_type=alpha
19+
cf_release_type=beta

src/main/java/com/robotgryphon/compactmachines/block/BlockProtected.java

Lines changed: 0 additions & 79 deletions
This file was deleted.

src/main/java/com/robotgryphon/compactmachines/block/walls/BreakableWallBlock.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package com.robotgryphon.compactmachines.block.walls;
22

3-
public class BreakableWallBlock extends WallBlock {
3+
import net.minecraft.block.Block;
4+
5+
public class BreakableWallBlock extends Block {
46
public BreakableWallBlock(Properties props) {
57
super(props);
68
}
Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,68 @@
11
package com.robotgryphon.compactmachines.block.walls;
22

3-
public class SolidWallBlock extends WallBlock {
3+
import com.robotgryphon.compactmachines.core.Registration;
4+
import net.minecraft.block.Block;
5+
import net.minecraft.block.BlockState;
6+
import net.minecraft.entity.Entity;
7+
import net.minecraft.entity.EntitySpawnPlacementRegistry;
8+
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+
import net.minecraft.util.math.BlockPos;
16+
import net.minecraft.util.math.BlockRayTraceResult;
17+
import net.minecraft.world.Explosion;
18+
import net.minecraft.world.IBlockReader;
19+
import net.minecraft.world.IWorldReader;
20+
import net.minecraft.world.World;
21+
22+
import javax.annotation.Nullable;
23+
24+
public class SolidWallBlock extends Block {
425
public SolidWallBlock(Properties props) {
526
super(props);
627
}
28+
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 canEntityDestroy(BlockState state, IBlockReader world, BlockPos pos, Entity entity) {
36+
return false;
37+
}
38+
39+
@Override
40+
public boolean canBeReplacedByLeaves(BlockState state, IWorldReader world, BlockPos pos) {
41+
return false;
42+
}
43+
44+
@Override
45+
public boolean canDropFromExplosion(BlockState state, IBlockReader world, BlockPos pos, Explosion explosion) {
46+
return false;
47+
}
48+
49+
@Override
50+
public boolean canCreatureSpawn(BlockState state, IBlockReader world, BlockPos pos, EntitySpawnPlacementRegistry.PlacementType type, @Nullable EntityType<?> entityType) {
51+
return pos.getY() == 40;
52+
}
53+
54+
@Override
55+
public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
56+
ItemStack held = player.getHeldItemMainhand();
57+
58+
if (held.isEmpty())
59+
return ActionResultType.PASS;
60+
61+
if (player.isSneaking())
62+
return ActionResultType.PASS;
63+
64+
// TODO: Tunnels and Personal Shrinking Device
65+
66+
return super.onBlockActivated(state, worldIn, pos, player, handIn, hit);
67+
}
768
}

src/main/java/com/robotgryphon/compactmachines/block/walls/TunnelWallBlock.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import javax.annotation.Nullable;
3131
import java.util.Optional;
3232

33-
public class TunnelWallBlock extends WallBlock implements IProbeDataProvider {
33+
public class TunnelWallBlock extends Block implements IProbeDataProvider {
3434
public static DirectionProperty TUNNEL_SIDE = DirectionProperty.create("tunnel_side", Direction.values());
3535
public static DirectionProperty CONNECTED_SIDE = DirectionProperty.create("connected_side", Direction.values());
3636

src/main/java/com/robotgryphon/compactmachines/block/walls/WallBlock.java

Lines changed: 0 additions & 129 deletions
This file was deleted.

0 commit comments

Comments
 (0)