aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
authorLorenz <lo.scherf@gmail.com>2022-09-07 23:45:41 +0200
committerLorenz <lo.scherf@gmail.com>2022-09-07 23:45:41 +0200
commita86a2f50c910e371dbea6fc17b7339b57040d62e (patch)
tree2660b2dc0e064898b6c21e32eaab44088014369d /src/main/java/at/hannibal2/skyhanni
parent34e9edc6d74a82be1b7aff003e006ce1e5874e4f (diff)
downloadskyhanni-a86a2f50c910e371dbea6fc17b7339b57040d62e.tar.gz
skyhanni-a86a2f50c910e371dbea6fc17b7339b57040d62e.tar.bz2
skyhanni-a86a2f50c910e371dbea6fc17b7339b57040d62e.zip
reactivated RenderBlockInWorldEvent
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/RenderBlockInWorldEvent.kt18
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/hooks/render/BlockRendererDispatcherHook.kt50
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinBlockRendererDispatcher.java41
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt22
4 files changed, 68 insertions, 63 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/events/RenderBlockInWorldEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/RenderBlockInWorldEvent.kt
index 51e4ca411..f72c81651 100644
--- a/src/main/java/at/hannibal2/skyhanni/events/RenderBlockInWorldEvent.kt
+++ b/src/main/java/at/hannibal2/skyhanni/events/RenderBlockInWorldEvent.kt
@@ -1,9 +1,9 @@
-//package at.hannibal2.skyhanni.events
-//
-//import net.minecraft.block.state.IBlockState
-//import net.minecraft.util.BlockPos
-//import net.minecraft.world.IBlockAccess
-//import net.minecraftforge.fml.common.eventhandler.Cancelable
-//
-//@Cancelable
-//data class RenderBlockInWorldEvent(@JvmField var state: IBlockState?, var world: IBlockAccess, var pos: BlockPos?) : LorenzEvent() \ No newline at end of file
+package at.hannibal2.skyhanni.events
+
+import net.minecraft.block.state.IBlockState
+import net.minecraft.util.BlockPos
+import net.minecraft.world.IBlockAccess
+import net.minecraftforge.fml.common.eventhandler.Cancelable
+
+@Cancelable
+data class RenderBlockInWorldEvent(@JvmField var state: IBlockState?, var world: IBlockAccess, var pos: BlockPos?) : LorenzEvent() \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/render/BlockRendererDispatcherHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/render/BlockRendererDispatcherHook.kt
index d04e248ea..4f951a887 100644
--- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/render/BlockRendererDispatcherHook.kt
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/render/BlockRendererDispatcherHook.kt
@@ -1,25 +1,25 @@
-//package at.hannibal2.skyhanni.mixinhooks.render
-//
-//import at.hannibal2.skyhanni.events.RenderBlockInWorldEvent
-//import net.minecraft.block.state.IBlockState
-//import net.minecraft.client.renderer.BlockRendererDispatcher
-//import net.minecraft.client.resources.model.IBakedModel
-//import net.minecraft.util.BlockPos
-//import net.minecraft.world.IBlockAccess
-//import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable
-//
-//fun modifyGetModelFromBlockState(
-// blockRendererDispatcher: Any,
-// state: IBlockState?,
-// worldIn: IBlockAccess,
-// pos: BlockPos?,
-// cir: CallbackInfoReturnable<IBakedModel>
-//) {
-// (blockRendererDispatcher as BlockRendererDispatcher).apply {
-// val event = RenderBlockInWorldEvent(state, worldIn, pos)
-// event.postAndCatch()
-// if (event.state !== state) {
-// cir.returnValue = blockModelShapes.getModelForState(event.state)
-// }
-// }
-//} \ No newline at end of file
+package at.hannibal2.skyhanni.mixinhooks.render
+
+import at.hannibal2.skyhanni.events.RenderBlockInWorldEvent
+import net.minecraft.block.state.IBlockState
+import net.minecraft.client.renderer.BlockRendererDispatcher
+import net.minecraft.client.resources.model.IBakedModel
+import net.minecraft.util.BlockPos
+import net.minecraft.world.IBlockAccess
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable
+
+fun modifyGetModelFromBlockState(
+ blockRendererDispatcher: Any,
+ state: IBlockState?,
+ worldIn: IBlockAccess,
+ pos: BlockPos?,
+ cir: CallbackInfoReturnable<IBakedModel>
+) {
+ (blockRendererDispatcher as BlockRendererDispatcher).apply {
+ val event = RenderBlockInWorldEvent(state, worldIn, pos)
+ event.postAndCatch()
+ if (event.state !== state) {
+ cir.returnValue = blockModelShapes.getModelForState(event.state)
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinBlockRendererDispatcher.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinBlockRendererDispatcher.java
index baec19192..26c9ab76f 100644
--- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinBlockRendererDispatcher.java
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinBlockRendererDispatcher.java
@@ -1,20 +1,21 @@
-//package at.hannibal2.skyhanni.mixins.transformers.renderer;
-//
-//import net.minecraft.block.state.IBlockState;
-//import net.minecraft.client.renderer.BlockRendererDispatcher;
-//import net.minecraft.client.resources.IResourceManagerReloadListener;
-//import net.minecraft.client.resources.model.IBakedModel;
-//import net.minecraft.util.BlockPos;
-//import net.minecraft.world.IBlockAccess;
-//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(BlockRendererDispatcher.class)
-//public abstract class MixinBlockRendererDispatcher implements IResourceManagerReloadListener {
-// @Inject(method = "getModelFromBlockState", at = @At("RETURN"), cancellable = true)
-// private void modifyGetModelFromBlockState(IBlockState state, IBlockAccess worldIn, BlockPos pos, CallbackInfoReturnable<IBakedModel> cir) {
-//// BlockRendererDispatcherHookKt.modifyGetModelFromBlockState(this, state, worldIn, pos, cir);
-// }
-//}
+package at.hannibal2.skyhanni.mixins.transformers.renderer;
+
+import at.hannibal2.skyhanni.mixinhooks.render.BlockRendererDispatcherHookKt;
+import net.minecraft.block.state.IBlockState;
+import net.minecraft.client.renderer.BlockRendererDispatcher;
+import net.minecraft.client.resources.IResourceManagerReloadListener;
+import net.minecraft.client.resources.model.IBakedModel;
+import net.minecraft.util.BlockPos;
+import net.minecraft.world.IBlockAccess;
+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(BlockRendererDispatcher.class)
+public abstract class MixinBlockRendererDispatcher implements IResourceManagerReloadListener {
+ @Inject(method = "getModelFromBlockState", at = @At("RETURN"), cancellable = true)
+ private void modifyGetModelFromBlockState(IBlockState state, IBlockAccess worldIn, BlockPos pos, CallbackInfoReturnable<IBakedModel> cir) {
+ BlockRendererDispatcherHookKt.modifyGetModelFromBlockState(this, state, worldIn, pos, cir);
+ }
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt
index d6d136ce2..5e36dd285 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt
@@ -204,21 +204,25 @@ class LorenzTest {
// @SubscribeEvent
// fun onGetBlockModel(event: RenderBlockInWorldEvent) {
// if (!LorenzUtils.inSkyblock || !SkyHanniMod.feature.debug.enabled) return
+//
// val state = event.state
//
// if (event.state != null && event.pos != null) {
//// if ((event.pos as BlockPos).y <= 76) {
-// val block = (state as IBlockState).block
-//
-//
-// if (block === Blocks.flowing_lava) {
-// event.state = Blocks.flowing_water.blockState.block.defaultState
-// }
+//// val block = (state as IBlockState).block
+////
+//// if (block == Blocks.wool || block == Blocks.stained_hardened_clay || block == Blocks.bedrock ||
+//// block == Blocks.netherrack || block == Blocks.nether_brick || block == Blocks.coal_block) {
+//// event.state = Blocks.stained_hardened_clay.blockState.block.defaultState
+//// }
//
-// if (block === Blocks.lava) {
-// event.state = Blocks.water.blockState.block.defaultState
-// }
+//// if (block === Blocks.flowing_lava) {
+//// event.state = Blocks.flowing_water.blockState.block.defaultState
+//// }
//
+//// if (block === Blocks.lava) {
+//// event.state = Blocks.water.blockState.block.defaultState
+//// }
//
//
//// if (block === Blocks.redstone_lamp) {