Skip to content

Commit

Permalink
Merge remote-tracking branch 'GTNH/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	.gitignore
#	dependencies.gradle
  • Loading branch information
Johann Bernhardt committed Dec 19, 2021
2 parents 87a76b9 + bf778d5 commit 143d51c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public enum Mixin {
EntityMixin("minecraft.EntityMixin", VANILLA),
EntityRendererMixin("minecraft.EntityRendererMixin", Side.CLIENT, VANILLA),
WorldMixin("minecraft.WorldMixin", VANILLA),
WorldMixinClient("minecraft.WorldMixinClient", Side.CLIENT, VANILLA),
WorldRendererMixin("minecraft.WorldRendererMixin", Side.CLIENT, VANILLA);

public final String mixinClass;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
package com.sinthoras.hydroenergy.mixins.minecraft;

import com.sinthoras.hydroenergy.client.light.HELightSMPHooks;
import com.sinthoras.hydroenergy.hooks.HEHooksUtil;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.common.util.BlockSnapshot;
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.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

@Mixin(value = World.class)
public class WorldMixin {
Expand All @@ -31,13 +25,4 @@ private Block onHandleMaterialAccelerationGetBlock(World world, int blockX, int
private Block onIsAnyLiquidGetBlock(World world, int blockX, int blockY, int blockZ) {
return HEHooksUtil.getBlockForWorldAndEntity(world.getBlock(blockX, blockY, blockZ), blockY);
}

// Notify water cache about block change
@Inject(method = "setBlock(IIILnet/minecraft/block/Block;II)Z",
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/chunk/Chunk;func_150807_a(IIILnet/minecraft/block/Block;I)Z", shift = At.Shift.AFTER),
locals = LocalCapture.CAPTURE_FAILEXCEPTION,
require = 1)
private void onSetBlock(int blockX, int blockY, int blockZ, Block newBlock, int unused1, int unused2, CallbackInfoReturnable<Boolean> callbackInfoReturnable, Chunk chunk, Block oldBlock, BlockSnapshot blockSnapshot) {
HELightSMPHooks.onSetBlock((World) ((Object) this), blockX, blockY, blockZ, newBlock, oldBlock);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.sinthoras.hydroenergy.mixins.minecraft;

import com.sinthoras.hydroenergy.client.light.HELightSMPHooks;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.common.util.BlockSnapshot;
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;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

@Mixin(value = World.class)
public class WorldMixinClient {

// Notify water cache about block change
@Inject(method = "setBlock(IIILnet/minecraft/block/Block;II)Z",
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/chunk/Chunk;func_150807_a(IIILnet/minecraft/block/Block;I)Z", shift = At.Shift.AFTER),
locals = LocalCapture.CAPTURE_FAILEXCEPTION,
require = 1)
private void onSetBlock(int blockX, int blockY, int blockZ, Block newBlock, int unused1, int unused2, CallbackInfoReturnable<Boolean> callbackInfoReturnable, Chunk chunk, Block oldBlock, BlockSnapshot blockSnapshot) {
HELightSMPHooks.onSetBlock((World) ((Object) this), blockX, blockY, blockZ, newBlock, oldBlock);
}
}

0 comments on commit 143d51c

Please sign in to comment.