Skip to content

Commit 6678690

Browse files
authored
Prospecting when Breaking Surface Rock (GregTechCEu#2388)
1 parent 52561ba commit 6678690

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/main/java/com/gregtechceu/gtceu/common/block/SurfaceRockBlock.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import net.minecraft.world.level.block.state.StateDefinition;
2929
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
3030
import net.minecraft.world.level.block.state.properties.DirectionProperty;
31+
import net.minecraft.world.level.material.FluidState;
3132
import net.minecraft.world.phys.BlockHitResult;
3233
import net.minecraft.world.phys.shapes.CollisionContext;
3334
import net.minecraft.world.phys.shapes.VoxelShape;
@@ -66,6 +67,19 @@ public SurfaceRockBlock(Properties properties, Material material) {
6667
}
6768
}
6869

70+
@Override
71+
public boolean onDestroyedByPlayer(BlockState state, Level level, BlockPos pos, Player player, boolean willHarvest,
72+
FluidState fluid) {
73+
if (!level.isClientSide) {
74+
ServerCache.instance.prospectSurfaceRockMaterial(
75+
level.dimension(),
76+
this.material,
77+
pos,
78+
(ServerPlayer) player);
79+
}
80+
return super.onDestroyedByPlayer(state, level, pos, player, willHarvest, fluid);
81+
}
82+
6983
@Override
7084
@SuppressWarnings("deprecation")
7185
public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand,

0 commit comments

Comments
 (0)