This repository has been archived by the owner on Apr 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
12 changed files
with
239 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/org/kamiblue/client/mixin/client/render/MixinTileRendererDispatcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.kamiblue.client.mixin.client.render; | ||
|
||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; | ||
import net.minecraft.tileentity.TileEntity; | ||
import org.kamiblue.client.module.modules.render.Xray; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(TileEntityRendererDispatcher.class) | ||
public class MixinTileRendererDispatcher { | ||
|
||
@Inject(method = "render(Lnet/minecraft/tileentity/TileEntity;FI)V", at = @At("HEAD"), cancellable = true) | ||
public void render(TileEntity tileEntityIn, float partialTicks, int destroyStage, CallbackInfo ci) { | ||
if (Xray.shouldReplace(tileEntityIn.getBlockType().getDefaultState())) { | ||
ci.cancel(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/java/org/kamiblue/client/mixin/client/world/MixinBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.kamiblue.client.mixin.client.world; | ||
|
||
import net.minecraft.block.Block; | ||
import net.minecraft.block.state.IBlockState; | ||
import org.kamiblue.client.module.modules.render.Xray; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
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) | ||
public class MixinBlock { | ||
@Inject(method = "getLightValue(Lnet/minecraft/block/state/IBlockState;)I", at = @At("HEAD"), cancellable = true) | ||
public void getLightValue(IBlockState state, CallbackInfoReturnable<Integer> cir) { | ||
if (Xray.INSTANCE.isEnabled()) { | ||
cir.setReturnValue(15); | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/org/kamiblue/client/mixin/client/world/MixinBlockFluidRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.kamiblue.client.mixin.client.world; | ||
|
||
import net.minecraft.block.state.IBlockState; | ||
import net.minecraft.client.renderer.BlockFluidRenderer; | ||
import net.minecraft.client.renderer.BufferBuilder; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.IBlockAccess; | ||
import org.kamiblue.client.module.modules.render.Xray; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(BlockFluidRenderer.class) | ||
public class MixinBlockFluidRenderer { | ||
@Inject(method = "renderFluid", at = @At("HEAD"), cancellable = true) | ||
public void renderFluid(IBlockAccess blockAccess, IBlockState blockStateIn, BlockPos blockPosIn, BufferBuilder bufferBuilderIn, CallbackInfoReturnable<Boolean> ci) { | ||
if (Xray.shouldReplace(blockStateIn)) { | ||
ci.cancel(); | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/org/kamiblue/client/mixin/client/world/MixinBlockModelRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.kamiblue.client.mixin.client.world; | ||
|
||
import net.minecraft.block.state.IBlockState; | ||
import net.minecraft.client.renderer.BlockModelRenderer; | ||
import net.minecraft.client.renderer.BufferBuilder; | ||
import net.minecraft.client.renderer.block.model.IBakedModel; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.IBlockAccess; | ||
import org.kamiblue.client.module.modules.render.Xray; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(BlockModelRenderer.class) | ||
public class MixinBlockModelRenderer { | ||
@Inject(method = "renderModel(Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/client/renderer/block/model/IBakedModel;Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/renderer/BufferBuilder;ZJ)Z", at = @At("HEAD"), cancellable = true) | ||
public void renderModel(IBlockAccess worldIn, IBakedModel modelIn, IBlockState stateIn, BlockPos posIn, BufferBuilder buffer, boolean checkSides, long rand, CallbackInfoReturnable<Boolean> ci) { | ||
if (Xray.shouldReplace(stateIn)) { | ||
ci.cancel(); | ||
} | ||
} | ||
} |
79 changes: 79 additions & 0 deletions
79
src/main/kotlin/org/kamiblue/client/command/commands/XrayCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package org.kamiblue.client.command.commands | ||
|
||
import org.kamiblue.client.command.ClientCommand | ||
import org.kamiblue.client.module.modules.render.Xray | ||
import org.kamiblue.client.util.text.MessageSendHelper | ||
import org.kamiblue.client.util.text.formatValue | ||
|
||
// TODO: Remove once GUI has List | ||
object XrayCommand : ClientCommand( | ||
name = "Xray", | ||
description = "Manage visible xray blocks" | ||
) { | ||
|
||
init { | ||
literal("add", "+") { | ||
block("block") { blockArg -> | ||
execute("Add a block to visible xray list") { | ||
val blockName = blockArg.value.registryName.toString() | ||
|
||
if (Xray.visibleList.contains(blockName)) { | ||
MessageSendHelper.sendErrorMessage("${formatValue(blockName)} is already added to the visible block list") | ||
} else { | ||
Xray.visibleList.editValue { it.add(blockName) } | ||
MessageSendHelper.sendChatMessage("${formatValue(blockName)} has been added to the visible block list") | ||
} | ||
} | ||
} | ||
} | ||
|
||
literal("remove", "-") { | ||
block("block") { blockArg -> | ||
execute("Remove a block from visible xray list") { | ||
val blockName = blockArg.value.registryName.toString() | ||
|
||
if (!Xray.visibleList.contains(blockName)) { | ||
MessageSendHelper.sendErrorMessage("You do not have ${formatValue(blockName)} added to xray visible block list") | ||
} else { | ||
Xray.visibleList.editValue { it.remove(blockName) } | ||
MessageSendHelper.sendChatMessage("Removed ${formatValue(blockName)} from xray visible block list") | ||
} | ||
} | ||
} | ||
} | ||
|
||
literal("set", "=") { | ||
block("block") { blockArg -> | ||
execute("Set the xray list to one block") { | ||
val blockName = blockArg.value.registryName.toString() | ||
|
||
Xray.visibleList.editValue { | ||
it.clear() | ||
it.add(blockName) | ||
} | ||
MessageSendHelper.sendChatMessage("Set the xray block list to ${formatValue(blockName)}") | ||
} | ||
} | ||
} | ||
|
||
literal("reset", "default") { | ||
execute("Reset the visible block list to defaults") { | ||
Xray.visibleList.editValue { it.resetValue() } | ||
MessageSendHelper.sendChatMessage("Reset the visible block list to defaults") | ||
} | ||
} | ||
|
||
literal("list") { | ||
execute("Print visible list") { | ||
MessageSendHelper.sendChatMessage(Xray.visibleList.joinToString()) | ||
} | ||
} | ||
|
||
literal("clear") { | ||
execute("Set the visible list to nothing") { | ||
Xray.visibleList.editValue { it.clear() } | ||
MessageSendHelper.sendChatMessage("Cleared the visible block list") | ||
} | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/main/kotlin/org/kamiblue/client/module/modules/render/Xray.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.kamiblue.client.module.modules.render | ||
|
||
import net.minecraft.block.state.IBlockState | ||
import org.kamiblue.client.module.Category | ||
import org.kamiblue.client.module.Module | ||
import org.kamiblue.client.setting.settings.impl.collection.CollectionSetting | ||
|
||
internal object Xray : Module( | ||
name = "Xray", | ||
description = "Lets you see through blocks", | ||
category = Category.RENDER | ||
) { | ||
private val defaultVisibleList = linkedSetOf("minecraft:diamond_ore", "minecraft:iron_ore", "minecraft:gold_ore", "minecraft:portal", "minecraft:cobblestone") | ||
|
||
val visibleList = setting(CollectionSetting("Visible List", defaultVisibleList, { false })) | ||
|
||
@JvmStatic | ||
fun shouldReplace(state: IBlockState): Boolean { | ||
return isEnabled && !visibleList.contains(state.block.registryName.toString()) | ||
} | ||
|
||
init { | ||
onToggle { | ||
mc.renderGlobal.loadRenderers() | ||
} | ||
|
||
visibleList.editListeners.add { | ||
mc.renderGlobal.loadRenderers() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters