aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/MiningStuff.java29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/MiningStuff.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/MiningStuff.java
index 6f706b5c..c6d0f008 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/MiningStuff.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/MiningStuff.java
@@ -6,6 +6,7 @@ import io.github.moulberry.notenoughupdates.overlays.MiningOverlay;
import io.github.moulberry.notenoughupdates.util.SBInfo;
import io.github.moulberry.notenoughupdates.util.SpecialColour;
import io.github.moulberry.notenoughupdates.util.Utils;
+import net.minecraft.block.BlockAir;
import net.minecraft.block.BlockStone;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
@@ -27,6 +28,12 @@ public class MiningStuff {
private static BlockPos overlayLoc = null;
private static long titaniumNotifMillis = 0;
+ private static Minecraft mc;
+
+
+ public MiningStuff(){
+ mc = Minecraft.getMinecraft();
+ }
public static void processBlockChangePacket(S23PacketBlockChange packetIn) {
if(!NotEnoughUpdates.INSTANCE.config.mining.titaniumAlert) {
@@ -45,7 +52,7 @@ public class MiningStuff {
IBlockState existingBlock = Minecraft.getMinecraft().theWorld.getBlockState(pos);
if(existingBlock == null) return;
if(existingBlock.getBlock() == Blocks.stone && existingBlock.getValue(BlockStone.VARIANT) == BlockStone.EnumType.DIORITE_SMOOTH) return;
-
+ if(!checkIfAnyIsAir(getAttachedBlocks(pos))) return;
BlockPos player = Minecraft.getMinecraft().thePlayer.getPosition();
double distSq = pos.distanceSq(player);
@@ -59,6 +66,26 @@ public class MiningStuff {
}
}
+ private static BlockPos[] getAttachedBlocks(BlockPos block){
+ BlockPos[] blocks = new BlockPos[6];
+ blocks[0] = new BlockPos(block.getX()-1, block.getY(), block.getZ());
+ blocks[1] = new BlockPos(block.getX()+1, block.getY(), block.getZ());
+ blocks[2] = new BlockPos(block.getX(), block.getY()-1, block.getZ());
+ blocks[3] = new BlockPos(block.getX(), block.getY()+1, block.getZ());
+ blocks[4] = new BlockPos(block.getX(), block.getY(), block.getZ()-1);
+ blocks[5] = new BlockPos(block.getX(), block.getY(), block.getZ()+1);
+ return blocks;
+ }
+
+ private static boolean checkIfAnyIsAir(BlockPos[] blocks){
+ for (BlockPos block : blocks) {
+ if(mc.theWorld.getBlockState(block).getBlock() instanceof BlockAir){
+ return true;
+ }
+ }
+ return false;
+ }
+
@SubscribeEvent
public void onRenderOverlay(RenderGameOverlayEvent.Post event) {
if(!NotEnoughUpdates.INSTANCE.config.mining.titaniumAlert) {