-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9dc3c77
commit 74575d0
Showing
2 changed files
with
24 additions
and
16 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
36 changes: 22 additions & 14 deletions
36
src/main/java/io/github/lucaargolo/kibe/mixin/WorldRendererMixin.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 |
---|---|---|
@@ -1,26 +1,34 @@ | ||
package io.github.lucaargolo.kibe.mixin; | ||
|
||
import io.github.lucaargolo.kibe.blocks.miscellaneous.DehumidifierBlockEntity; | ||
import net.minecraft.client.render.WorldRenderer; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.ChunkPos; | ||
import net.minecraft.world.Heightmap; | ||
import net.minecraft.world.World; | ||
import net.minecraft.world.WorldView; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
@Mixin(WorldRenderer.class) | ||
public class WorldRendererMixin { | ||
|
||
// @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld;getTopY(Lnet/minecraft/world/Heightmap$Type;II)I"), method = "renderWeather") | ||
// private int onRenderWeather(ClientWorld clientWorld, Heightmap.Type heightmap, int x, int z) { | ||
// if(DehumidifierBlockEntity.Companion.isBeingDehumidified(new ChunkPos(new BlockPos(x, 0, z)))) { | ||
// return 512; | ||
// } | ||
// return clientWorld.getTopY(heightmap, x, z); | ||
// } | ||
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;getTopY(Lnet/minecraft/world/Heightmap$Type;II)I"), method = "renderWeather") | ||
private int onRenderWeather(World world, Heightmap.Type heightmap, int x, int z) { | ||
if(DehumidifierBlockEntity.Companion.isBeingDehumidified(new ChunkPos(new BlockPos(x, 0, z)))) { | ||
return 512; | ||
} | ||
return world.getTopY(heightmap, x, z); | ||
} | ||
|
||
// @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld;getTopPosition(Lnet/minecraft/world/Heightmap$Type;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/util/math/BlockPos;"), method = "tickRainSplashing") | ||
// private BlockPos onTickRainSplashing(ClientWorld clientWorld, Heightmap.Type heightmap, BlockPos pos) { | ||
// if(DehumidifierBlockEntity.Companion.isBeingDehumidified(new ChunkPos(pos))) { | ||
// return new BlockPos(pos.getX(), 512, pos.getZ()); | ||
// } | ||
// return clientWorld.getTopPosition(heightmap, pos); | ||
// } | ||
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/WorldView;getTopPosition(Lnet/minecraft/world/Heightmap$Type;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/util/math/BlockPos;"), method = "tickRainSplashing") | ||
private BlockPos onTickRainSplashing(WorldView world, Heightmap.Type heightmap, BlockPos pos) { | ||
if(DehumidifierBlockEntity.Companion.isBeingDehumidified(new ChunkPos(pos))) { | ||
return new BlockPos(pos.getX(), 512, pos.getZ()); | ||
} | ||
return world.getTopPosition(heightmap, pos); | ||
} | ||
|
||
|
||
} |