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;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.fluid.Fluid;
@ -10,7 +9,7 @@ import java.util.Collection;
import java.util.List;
public class XRay {
public boolean enable = true;
public boolean enable = false;
public ArrayList<Block> whitelistBlocks;
public ArrayList<Fluid> whitelistFluids;
@ -26,7 +25,6 @@ public class XRay {
Blocks.DIAMOND_ORE,
Blocks.EMERALD_ORE,
Blocks.REDSTONE_ORE,
Blocks.ANCIENT_DEBRIS,
// Deepslate Ores
Blocks.DEEPSLATE_COAL_ORE,
@ -60,7 +58,6 @@ public class XRay {
// Danger
Blocks.TNT,
Blocks.SPAWNER,
// Shulker Boxes
// 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;
import de.cscherr.mcpht.MCPHTClient;
import de.cscherr.mcpht.XRay;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Mixin;
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.callback.CallbackInfoReturnable;
@Mixin(Block.class)
@Mixin(value = Block.class)
public abstract class BlockMixin {
@Inject(method = "shouldDrawSide", at = @At("RETURN"), cancellable = true)
private static void shouldDrawSide(BlockState state,
BlockView world,
BlockPos pos,
Direction side,
BlockPos otherPos,
CallbackInfoReturnable<Boolean> cir
) {
if (MCPHTClient.XRAY.enable && MCPHTClient.CONFIG.xRay.enable) {
cir.setReturnValue(MCPHTClient.XRAY.showRenderBlock(state));
@Inject(at = @At("RETURN"), method = "shouldDrawSide(" + "Lnet/minecraft/block/BlockState;" + // state
"Lnet/minecraft/world/BlockView;" + // reader
"Lnet/minecraft/util/math/BlockPos;" + // pos
"Lnet/minecraft/util/math/Direction;" + // face
"Lnet/minecraft/util/math/BlockPos;" + // blockPosaaa
")Z", // ci
cancellable = true)
private static void shouldDrawSide(BlockState state, BlockView reader, BlockPos pos, Direction face,
BlockPos blockPos, CallbackInfoReturnable<Boolean> ci) {
if (MCPHTClient.CONFIG.xRay.enable) {
if (MCPHTClient.XRAY.whitelistBlocks.contains(state.getBlock())) {
ci.setReturnValue(true);
} else {
ci.setReturnValue(false);
}
}
}
}