mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2025-02-02 23:31:36 +01:00
Reimplement repetitive 1.14.3 START_DESTROY_BLOCK calls for same block breaking (#121)
* Reimplement 1.14.3 second PlayerActionC2SPacket.Action.START_DESTROY_BLOCK calls for same block breaking * Expression simplification
This commit is contained in:
parent
9453d26b81
commit
60cec9b000
@ -44,6 +44,7 @@ import net.minecraft.screen.slot.SlotActionType;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
@ -69,12 +70,22 @@ public abstract class MixinClientPlayerInteractionManager {
|
||||
@Final
|
||||
private ClientPlayNetworkHandler networkHandler;
|
||||
|
||||
@Shadow
|
||||
private BlockPos currentBreakingPos;
|
||||
|
||||
@Unique
|
||||
private ItemStack viafabricplus_oldCursorStack;
|
||||
|
||||
@Unique
|
||||
private List<ItemStack> viafabricplus_oldItems;
|
||||
|
||||
@Inject(method = "breakBlock", at = @At("TAIL"))
|
||||
public void resetBlockBreaking(BlockPos pos, CallbackInfoReturnable<Boolean> cir) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_14_3)) {
|
||||
this.currentBreakingPos = new BlockPos(this.currentBreakingPos.getX(), -1, this.currentBreakingPos.getZ());
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "attackEntity", at = @At("HEAD"))
|
||||
private void injectAttackEntity(PlayerEntity player, Entity target, CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8) && player instanceof IClientPlayerEntity) {
|
||||
|
Loading…
Reference in New Issue
Block a user