Delete MixinPlayerInteractionManager.java
This commit is contained in:
@@ -1,33 +0,0 @@
|
|||||||
package xyz.nodrop.farmingtools.mixin.client;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
|
||||||
import net.minecraft.client.network.ClientPlayerInteractionManager;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
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 xyz.nodrop.farmingtools.client.hud.FarmingTrackerModule;
|
|
||||||
|
|
||||||
@Mixin(ClientPlayerInteractionManager.class)
|
|
||||||
public class MixinPlayerInteractionManager {
|
|
||||||
|
|
||||||
private Block pendingBrokenBlock = null; // tymczasowe przechowanie
|
|
||||||
|
|
||||||
@Inject(method = "breakBlock", at = @At("HEAD"))
|
|
||||||
private void beforeBreakBlock(BlockPos pos, CallbackInfoReturnable<Boolean> cir) {
|
|
||||||
MinecraftClient client = MinecraftClient.getInstance();
|
|
||||||
if (client.world != null) {
|
|
||||||
pendingBrokenBlock = client.world.getBlockState(pos).getBlock();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(method = "breakBlock", at = @At("RETURN"))
|
|
||||||
private void onBreakBlock(BlockPos pos, CallbackInfoReturnable<Boolean> cir) {
|
|
||||||
if (Boolean.TRUE.equals(cir.getReturnValue()) && pendingBrokenBlock != null) {
|
|
||||||
FarmingTrackerModule.INSTANCE.onBlockBroken(pendingBrokenBlock);
|
|
||||||
}
|
|
||||||
pendingBrokenBlock = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user