Merge remote-tracking branch 'origin/drawer_holdclick' into dev

This commit is contained in:
Martin Robertz committed 2026-02-06 20:02:08 +01:00
commit 4e3dfab5f4
2 files changed
+8 -5

No files matched your search

@@ -5,7 +5,6 @@ import java.util.UUID;
import javax.annotation.Nullable;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
@@ -641,8 +640,6 @@ public abstract class TileEntityDrawers extends BaseTileEntity implements IDrawe
property.lastLeftClickTime = worldObj.getTotalWorldTime();
Minecraft.getMinecraft().playerController.curBlockDamageMP = 0.0F;
int ticksConsecutiveClickRequirement = 50 / (itemsOutputInARow + 5);
if (ticksClickedInARow < ticksConsecutiveClickRequirement) return null;
@@ -23,11 +23,16 @@ public abstract class MixinPlayerControllerMP {
@Shadow
private Minecraft mc;
@Shadow
public float curBlockDamageMP;
@Inject(
method = "onPlayerDamageBlock",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/block/Block;getPlayerRelativeBlockHardness(Lnet/minecraft/entity/player/EntityPlayer;Lnet/minecraft/world/World;III)F"))
value = "FIELD",
target = "Lnet/minecraft/client/multiplayer/PlayerControllerMP;curBlockDamageMP:F",
opcode = org.objectweb.asm.Opcodes.PUTFIELD,
shift = At.Shift.AFTER))
private void storageDrawers$checkIfClickingDrawer(int x, int y, int z, int clickedSide, CallbackInfo ci) {
final var thisTile = mc.theWorld.getTileEntity(x, y, z);
if (!(thisTile instanceof TileEntityDrawers drawer)) return;
@@ -50,6 +55,7 @@ public abstract class MixinPlayerControllerMP {
float hitY = (float) (mop.hitVec.yCoord - mop.blockY);
float hitZ = (float) (mop.hitVec.zCoord - mop.blockZ);
boolean invertShift = StorageDrawers.config.cache.invertShift;
curBlockDamageMP = 0.0F;
StorageDrawers.network.sendToServer(new BlockClickMessage(x, y, z, clickedSide, hitX, hitY, hitZ, invertShift));
}
}