Compare commits

..

No commits in common. "e7542418f36704545f9901fb32c349dd2d970641" and "bddabd405c3efa621188144676705cded4a261c7" have entirely different histories.

2 changed files with 17 additions and 20 deletions

View file

@ -1,7 +1,6 @@
package de.cscherr.mcpht; package de.cscherr.mcpht;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
@ -10,7 +9,7 @@ import java.util.Collection;
import java.util.List; import java.util.List;
public class XRay { public class XRay {
public boolean enable = true; public boolean enable = false;
public ArrayList<Block> whitelistBlocks; public ArrayList<Block> whitelistBlocks;
public ArrayList<Fluid> whitelistFluids; public ArrayList<Fluid> whitelistFluids;
@ -26,7 +25,6 @@ public class XRay {
Blocks.DIAMOND_ORE, Blocks.DIAMOND_ORE,
Blocks.EMERALD_ORE, Blocks.EMERALD_ORE,
Blocks.REDSTONE_ORE, Blocks.REDSTONE_ORE,
Blocks.ANCIENT_DEBRIS,
// Deepslate Ores // Deepslate Ores
Blocks.DEEPSLATE_COAL_ORE, Blocks.DEEPSLATE_COAL_ORE,
@ -60,7 +58,6 @@ public class XRay {
// Danger // Danger
Blocks.TNT, Blocks.TNT,
Blocks.SPAWNER,
// Shulker Boxes // Shulker Boxes
// FIXME: Add the ones I forgot // FIXME: Add the ones I forgot
@ -82,7 +79,4 @@ public class XRay {
) )
); );
} }
public boolean showRenderBlock(BlockState state) {
return whitelistBlocks.contains(state.getBlock());
}
} }

View file

@ -1,8 +1,6 @@
package de.cscherr.mcpht.mixin.client; package de.cscherr.mcpht.mixin.client;
import de.cscherr.mcpht.MCPHTClient; import de.cscherr.mcpht.MCPHTClient;
import de.cscherr.mcpht.XRay;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -14,18 +12,23 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(Block.class) @Mixin(value = Block.class)
public abstract class BlockMixin { public abstract class BlockMixin {
@Inject(method = "shouldDrawSide", at = @At("RETURN"), cancellable = true) @Inject(at = @At("RETURN"), method = "shouldDrawSide(" + "Lnet/minecraft/block/BlockState;" + // state
private static void shouldDrawSide(BlockState state, "Lnet/minecraft/world/BlockView;" + // reader
BlockView world, "Lnet/minecraft/util/math/BlockPos;" + // pos
BlockPos pos, "Lnet/minecraft/util/math/Direction;" + // face
Direction side, "Lnet/minecraft/util/math/BlockPos;" + // blockPosaaa
BlockPos otherPos, ")Z", // ci
CallbackInfoReturnable<Boolean> cir cancellable = true)
) { private static void shouldDrawSide(BlockState state, BlockView reader, BlockPos pos, Direction face,
if (MCPHTClient.XRAY.enable && MCPHTClient.CONFIG.xRay.enable) { BlockPos blockPos, CallbackInfoReturnable<Boolean> ci) {
cir.setReturnValue(MCPHTClient.XRAY.showRenderBlock(state)); if (MCPHTClient.CONFIG.xRay.enable) {
if (MCPHTClient.XRAY.whitelistBlocks.contains(state.getBlock())) {
ci.setReturnValue(true);
} else {
ci.setReturnValue(false);
}
} }
} }
} }