Skip to content

Commit

Permalink
Fixes dehumidifier (Closes #165)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaargolo committed Oct 9, 2022
1 parent 6893694 commit 1f18c6e
Showing 1 changed file with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,33 @@

import io.github.lucaargolo.kibe.blocks.miscellaneous.DehumidifierBlockEntity;
import net.minecraft.client.render.WorldRenderer;
import net.minecraft.client.world.ClientWorld;
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.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
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);
}


}

0 comments on commit 1f18c6e

Please sign in to comment.