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 9dc3c77 commit 74575d0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ fabric_kotlin_version=1.8.0+kotlin.1.7.0
pal_version=1.6.0
trinkets_version=3.4.0
dashloader_version=2.0
modmenu_version=4.0.0
rei_version=9.1.537
modmenu_version=4.0.6
rei_version=9.1.550

# Publishing
curseforge_id=388832
Expand Down
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);
}


}

0 comments on commit 74575d0

Please sign in to comment.