re-added all ClampClient fixes, renamed Provider

This commit is contained in:
FlorianMichael 2023-02-20 01:35:45 +01:00
parent f623380595
commit b717818911
11 changed files with 486 additions and 7 deletions

View File

@ -31,8 +31,8 @@ import de.florianmichael.viafabricplus.definition.ItemReleaseVersionDefinition;
import de.florianmichael.viafabricplus.definition.PackFormatsDefinition;
import de.florianmichael.viafabricplus.platform.ViaAprilFoolsPlatformImpl;
import de.florianmichael.viafabricplus.platform.ViaLegacyPlatformImpl;
import de.florianmichael.viafabricplus.provider.EveryProtocolHandItemProvider;
import de.florianmichael.viafabricplus.provider.EveryProtocolMovementTransmitterProvider;
import de.florianmichael.viafabricplus.provider.ViaFabricPlusHandItemProvider;
import de.florianmichael.viafabricplus.provider.ViaFabricPlusMovementTransmitterProvider;
import de.florianmichael.viafabricplus.value.ValueHolder;
import de.florianmichael.vialoadingbase.ViaLoadingBase;
import de.florianmichael.vialoadingbase.api.SubPlatform;
@ -111,8 +111,8 @@ public class ViaFabricPlus {
return parentNode;
});
builder = builder.viaProviderCreator(providers -> {
providers.use(MovementTransmitterProvider.class, new EveryProtocolMovementTransmitterProvider());
providers.use(HandItemProvider.class, new EveryProtocolHandItemProvider());
providers.use(MovementTransmitterProvider.class, new ViaFabricPlusMovementTransmitterProvider());
providers.use(HandItemProvider.class, new ViaFabricPlusHandItemProvider());
});
builder = builder.protocolReloader(protocolVersion -> {
availableItemsInTargetVersion.clear();

View File

@ -0,0 +1,6 @@
package de.florianmichael.viafabricplus.injection.access;
public interface IClientPlayerEntity {
void protocolhack_cancelSwingOnce();
}

View File

@ -0,0 +1,77 @@
/**
* --FLORIAN MICHAEL PRIVATE LICENCE v1.2--
*
* This file / project is protected and is the intellectual property of Florian Michael (aka. EnZaXD),
* any use (be it private or public, be it copying or using for own use, be it publishing or modifying) of this
* file / project is prohibited. It requires in that use a written permission with official signature of the owner
* "Florian Michael". "Florian Michael" receives the right to control and manage this file / project. This right is not
* cancelled by copying or removing the license and in case of violation a criminal consequence is to be expected.
* The owner "Florian Michael" is free to change this license. The creator assumes no responsibility for any infringements
* that have arisen, are arising or will arise from this project / file. If this licence is used anywhere,
* the latest version published by the author Florian Michael (aka EnZaXD) always applies automatically.
*
* Changelog:
* v1.0:
* Added License
* v1.1:
* Ownership withdrawn
* v1.2:
* Version-independent validity and automatic renewal
*/
package de.florianmichael.viafabricplus.injection.mixin.fixes;
import de.florianmichael.viafabricplus.value.ValueHolder;
import net.minecraft.client.render.Camera;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.world.BlockView;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(Camera.class)
public class MixinCamera {
@Shadow
private float cameraY;
@Shadow
private float lastCameraY;
@Shadow
private Entity focusedEntity;
@Inject(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Camera;setPos(DDD)V", shift = At.Shift.BEFORE))
public void onUpdateHeight(BlockView area, Entity focusedEntity, boolean thirdPerson, boolean inverseView, float tickDelta, CallbackInfo ci) {
if (!ValueHolder.replaceSneaking.getValue() && ValueHolder.replaceSneaking.getValue()) {
cameraY = lastCameraY = focusedEntity.getStandingEyeHeight();
}
}
@Inject(method = "updateEyeHeight", at = @At(value = "HEAD"), cancellable = true)
public void onUpdateEyeHeight(CallbackInfo ci) {
if (this.focusedEntity == null) return;
if (ValueHolder.replaceSneaking.getValue()) {
ci.cancel();
this.lastCameraY = this.cameraY;
if (this.focusedEntity instanceof PlayerEntity player && !player.isSleeping()) {
if (player.isSneaking()) {
cameraY = 1.54F;
} else if (!ValueHolder.longSneaking.getValue()) {
cameraY = 1.62F;
} else if (cameraY < 1.62F) {
float delta = 1.62F - cameraY;
delta *= 0.4;
cameraY = 1.62F - delta;
}
} else {
cameraY = focusedEntity.getStandingEyeHeight();
}
}
}
}

View File

@ -0,0 +1,159 @@
/**
* --FLORIAN MICHAEL PRIVATE LICENCE v1.2--
* <p>
* This file / project is protected and is the intellectual property of Florian Michael (aka. EnZaXD),
* any use (be it private or public, be it copying or using for own use, be it publishing or modifying) of this
* file / project is prohibited. It requires in that use a written permission with official signature of the owner
* "Florian Michael". "Florian Michael" receives the right to control and manage this file / project. This right is not
* cancelled by copying or removing the license and in case of violation a criminal consequence is to be expected.
* The owner "Florian Michael" is free to change this license. The creator assumes no responsibility for any infringements
* that have arisen, are arising or will arise from this project / file. If this licence is used anywhere,
* the latest version published by the author Florian Michael (aka EnZaXD) always applies automatically.
* <p>
* Changelog:
* v1.0:
* Added License
* v1.1:
* Ownership withdrawn
* v1.2:
* Version-independent validity and automatic renewal
*/
package de.florianmichael.viafabricplus.injection.mixin.fixes;
import com.mojang.authlib.GameProfile;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import de.florianmichael.vialoadingbase.ViaLoadingBase;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.DownloadingTerrainScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.network.ClientPlayNetworkHandler;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.network.PlayerListEntry;
import net.minecraft.client.network.ServerInfo;
import net.minecraft.client.util.telemetry.WorldSession;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.vehicle.BoatEntity;
import net.minecraft.network.ClientConnection;
import net.minecraft.network.packet.s2c.play.*;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.util.math.Vec3d;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.*;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.UUID;
@SuppressWarnings("DataFlowIssue")
@Mixin(ClientPlayNetworkHandler.class)
public abstract class MixinClientPlayNetworkHandler {
@Shadow
@Final
private MinecraftClient client;
@Shadow
public abstract void onEntityStatus(EntityStatusS2CPacket packet);
@Mutable
@Shadow @Final private Set<PlayerListEntry> listedPlayerListEntries;
@Shadow public abstract void onSimulationDistance(SimulationDistanceS2CPacket packet);
@Shadow public abstract void onEntityVelocityUpdate(EntityVelocityUpdateS2CPacket packet);
@Shadow private ClientWorld world;
@Shadow @Nullable public abstract PlayerListEntry getPlayerListEntry(UUID uuid);
@Inject(method = "<init>", at = @At("RETURN"))
public void fixPlayerListOrdering(MinecraftClient client, Screen screen, ClientConnection connection, ServerInfo serverInfo, GameProfile profile, WorldSession worldSession, CallbackInfo ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
this.listedPlayerListEntries = new LinkedHashSet<>();
}
}
@Inject(method = "onPing", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkThreadUtils;forceMainThread(Lnet/minecraft/network/Packet;Lnet/minecraft/network/listener/PacketListener;Lnet/minecraft/util/thread/ThreadExecutor;)V", shift = At.Shift.AFTER), cancellable = true)
private void onPing(PlayPingS2CPacket packet, CallbackInfo ci) {
if (ViaLoadingBase.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_17)) {
return;
}
final int inventoryId = (packet.getParameter() >> 16) & 0xFF; // Fix Via Bug from 1.16.5 (Window Confirmation -> PlayPing) Usage for MiningFast Detection
ScreenHandler handler = null;
if (client.player == null) return;
if (inventoryId == 0) handler = client.player.playerScreenHandler;
if (inventoryId == client.player.currentScreenHandler.syncId) handler = client.player.currentScreenHandler;
if (handler == null) ci.cancel();
}
@Inject(method = "onChunkLoadDistance", at = @At("RETURN"))
public void emulateSimulationDistance(ChunkLoadDistanceS2CPacket packet, CallbackInfo ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_17_1)) {
this.onSimulationDistance(new SimulationDistanceS2CPacket(packet.getDistance()));
}
}
@Inject(method = "onEntitySpawn", at = @At("TAIL"))
public void forceEntityVelocity(EntitySpawnS2CPacket packet, CallbackInfo ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
if (packet.getEntityType() == EntityType.ITEM ||
packet.getEntityType() == EntityType.ARROW || packet.getEntityType() ==
EntityType.SPECTRAL_ARROW || packet.getEntityType() == EntityType.TRIDENT) {
onEntityVelocityUpdate(new EntityVelocityUpdateS2CPacket(
packet.getId(), new Vec3d(packet.getVelocityX(), packet.getVelocityY(), packet.getVelocityZ())
));
}
}
}
@Inject(method = { "onGameJoin", "onPlayerRespawn" }, at = @At("TAIL"))
private void injectOnOnGameJoinOrRespawn(CallbackInfo ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
ClientPlayerEntity player = MinecraftClient.getInstance().player;
assert player != null;
onEntityStatus(new EntityStatusS2CPacket(player, (byte) 28));
}
}
@Redirect(method = "onPlayerSpawnPosition", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/DownloadingTerrainScreen;setReady()V"))
public void moveDownloadingTerrainClosing(DownloadingTerrainScreen instance) {
if (ViaLoadingBase.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19)) {
instance.setReady();
}
}
@Inject(method = "onPlayerPositionLook", at = @At("RETURN"))
public void closeDownloadingTerrain(PlayerPositionLookS2CPacket packet, CallbackInfo ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18_2) && MinecraftClient.getInstance().currentScreen instanceof DownloadingTerrainScreen) {
MinecraftClient.getInstance().setScreen(null);
}
}
@SuppressWarnings("InvalidInjectorMethodSignature")
@ModifyConstant(method = "onEntityPassengersSet", constant = @Constant(classValue = BoatEntity.class))
public Class<?> dontChangePlayerYaw(Object entity, Class<?> constant) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18_2)) {
return Integer.class;
}
return constant;
}
@Redirect(method = "onPlayerList", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V", remap = false))
public void removeNewWarning(Logger instance, String s, Object o) {
if (ViaLoadingBase.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19_3)) {
instance.warn(s, o);
}
}
}

View File

@ -0,0 +1,179 @@
/**
* --FLORIAN MICHAEL PRIVATE LICENCE v1.2--
*
* This file / project is protected and is the intellectual property of Florian Michael (aka. EnZaXD),
* any use (be it private or public, be it copying or using for own use, be it publishing or modifying) of this
* file / project is prohibited. It requires in that use a written permission with official signature of the owner
* "Florian Michael". "Florian Michael" receives the right to control and manage this file / project. This right is not
* cancelled by copying or removing the license and in case of violation a criminal consequence is to be expected.
* The owner "Florian Michael" is free to change this license. The creator assumes no responsibility for any infringements
* that have arisen, are arising or will arise from this project / file. If this licence is used anywhere,
* the latest version published by the author Florian Michael (aka EnZaXD) always applies automatically.
*
* Changelog:
* v1.0:
* Added License
* v1.1:
* Ownership withdrawn
* v1.2:
* Version-independent validity and automatic renewal
*/
package de.florianmichael.viafabricplus.injection.mixin.fixes;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ServerboundPackets1_16_2;
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.Protocol1_17To1_16_4;
import de.florianmichael.viafabricplus.ViaFabricPlus;
import de.florianmichael.viafabricplus.injection.access.IClientPlayerEntity;
import de.florianmichael.viafabricplus.injection.access.IScreenHandler;
import de.florianmichael.viafabricplus.provider.ViaFabricPlusHandItemProvider;
import de.florianmichael.viafabricplus.translator.ItemTranslator;
import de.florianmichael.vialoadingbase.ViaLoadingBase;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayNetworkHandler;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.network.ClientPlayerInteractionManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.network.Packet;
import net.minecraft.network.packet.c2s.play.ClickSlotC2SPacket;
import net.minecraft.screen.slot.SlotActionType;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.*;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.List;
@SuppressWarnings("DataFlowIssue")
@Mixin(ClientPlayerInteractionManager.class)
public abstract class MixinClientPlayerInteractionManager {
@Shadow
@Final
private MinecraftClient client;
@Shadow protected abstract ActionResult interactBlockInternal(ClientPlayerEntity player, Hand hand, BlockHitResult hitResult);
@Shadow @Final private ClientPlayNetworkHandler networkHandler;
@Unique
private ItemStack protocolhack_oldCursorStack;
@Unique
private List<ItemStack> protocolhack_oldItems;
@Inject(method = "attackEntity", at = @At("HEAD"))
private void injectAttackEntity(PlayerEntity player, Entity target, CallbackInfo ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && player instanceof IClientPlayerEntity) {
player.swingHand(Hand.MAIN_HAND);
((IClientPlayerEntity) player).protocolhack_cancelSwingOnce();
}
}
@ModifyVariable(method = "clickSlot", at = @At(value = "STORE"), ordinal = 0)
private List<ItemStack> captureOldItems(List<ItemStack> oldItems) {
assert client.player != null;
protocolhack_oldCursorStack = client.player.currentScreenHandler.getCursorStack().copy();
return this.protocolhack_oldItems = oldItems;
}
// Special Cases
@Unique
private boolean protocolhack_shouldEmpty(final SlotActionType type, final int slot) {
// quick craft always uses empty stack for verification
if (type == SlotActionType.QUICK_CRAFT) return true;
// quick move always uses empty stack for verification since 1.12
if (type == SlotActionType.QUICK_MOVE && ViaLoadingBase.getTargetVersion().isNewerThan(ProtocolVersion.v1_11_1)) return true;
// pickup with slot -999 (outside window) to throw items always uses empty stack for verification
return type == SlotActionType.PICKUP && slot == -999;
}
@Redirect(method = "clickSlot", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/Packet;)V"))
private void modifySlotClickPacket(ClientPlayNetworkHandler instance, Packet<?> packet) {
try {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4) && packet instanceof ClickSlotC2SPacket clickSlot) {
ItemStack slotItemBeforeModification;
if (this.protocolhack_shouldEmpty(clickSlot.getActionType(), clickSlot.getSlot()))
slotItemBeforeModification = ItemStack.EMPTY;
else if (clickSlot.getSlot() < 0 || clickSlot.getSlot() >= protocolhack_oldItems.size())
slotItemBeforeModification = protocolhack_oldCursorStack;
else
slotItemBeforeModification = protocolhack_oldItems.get(clickSlot.getSlot());
final PacketWrapper clickSlotPacket = PacketWrapper.create(ServerboundPackets1_16_2.CLICK_WINDOW, networkHandler.getConnection().channel.attr(ViaFabricPlus.LOCAL_USER_CONNECTION).get());
clickSlotPacket.write(Type.UNSIGNED_BYTE, (short) clickSlot.getSyncId());
clickSlotPacket.write(Type.SHORT, (short) clickSlot.getSlot());
clickSlotPacket.write(Type.BYTE, (byte) clickSlot.getButton());
assert client.player != null;
clickSlotPacket.write(Type.SHORT, ((IScreenHandler) client.player.currentScreenHandler).protocolhack_getAndIncrementLastActionId());
clickSlotPacket.write(Type.VAR_INT, clickSlot.getActionType().ordinal());
clickSlotPacket.write(Type.FLAT_VAR_INT_ITEM, ItemTranslator.minecraftToViaVersion(clickSlotPacket.user(), slotItemBeforeModification, ProtocolVersion.v1_16.getVersion()));
clickSlotPacket.sendToServer(Protocol1_17To1_16_4.class);
protocolhack_oldCursorStack = null;
protocolhack_oldItems = null;
return;
}
} catch (Exception ignored) {
}
instance.sendPacket(packet);
}
@Redirect(method = "interactItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/Packet;)V", ordinal = 0),
slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;syncSelectedSlot()V"),
to = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;sendSequencedPacket(Lnet/minecraft/client/world/ClientWorld;Lnet/minecraft/client/network/SequencedPacketCreator;)V", ordinal = 0)))
private void redirectInteractItem(ClientPlayNetworkHandler clientPlayNetworkHandler, Packet<?> packet) {
if (ViaLoadingBase.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_17)) {
clientPlayNetworkHandler.sendPacket(packet);
}
}
@Inject(method = "interactItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/Packet;)V", ordinal = 0, shift = At.Shift.BEFORE))
public void injectInteractItem(PlayerEntity player, Hand hand, CallbackInfoReturnable<ActionResult> cir) {
ViaFabricPlusHandItemProvider.lastUsedItem = player.getStackInHand(hand).copy();
}
@Inject(method = "interactBlock", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;sendSequencedPacket(Lnet/minecraft/client/world/ClientWorld;Lnet/minecraft/client/network/SequencedPacketCreator;)V", shift = At.Shift.BEFORE))
public void injectInteractBlock(ClientPlayerEntity player, Hand hand, BlockHitResult hitResult, CallbackInfoReturnable<ActionResult> cir) {
ViaFabricPlusHandItemProvider.lastUsedItem = player.getStackInHand(hand).copy();
}
@Unique
private ActionResult protocolhack_actionResult;
@Inject(method = "interactBlock", at = @At("HEAD"), cancellable = true)
public void cacheActionResult(ClientPlayerEntity player, Hand hand, BlockHitResult hitResult, CallbackInfoReturnable<ActionResult> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
this.protocolhack_actionResult = this.interactBlockInternal(player, hand, hitResult);
if (this.protocolhack_actionResult == ActionResult.FAIL) {
cir.setReturnValue(this.protocolhack_actionResult);
}
}
}
@Redirect(method = "method_41933", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;interactBlockInternal(Lnet/minecraft/client/network/ClientPlayerEntity;Lnet/minecraft/util/Hand;Lnet/minecraft/util/hit/BlockHitResult;)Lnet/minecraft/util/ActionResult;"))
public ActionResult provideCachedResult(ClientPlayerInteractionManager instance, ClientPlayerEntity player, Hand hand, BlockHitResult hitResult) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
return this.protocolhack_actionResult;
}
return interactBlockInternal(player, hand, hitResult);
}
}

View File

@ -0,0 +1,40 @@
/**
* --FLORIAN MICHAEL PRIVATE LICENCE v1.2--
*
* This file / project is protected and is the intellectual property of Florian Michael (aka. EnZaXD),
* any use (be it private or public, be it copying or using for own use, be it publishing or modifying) of this
* file / project is prohibited. It requires in that use a written permission with official signature of the owner
* "Florian Michael". "Florian Michael" receives the right to control and manage this file / project. This right is not
* cancelled by copying or removing the license and in case of violation a criminal consequence is to be expected.
* The owner "Florian Michael" is free to change this license. The creator assumes no responsibility for any infringements
* that have arisen, are arising or will arise from this project / file. If this licence is used anywhere,
* the latest version published by the author Florian Michael (aka EnZaXD) always applies automatically.
*
* Changelog:
* v1.0:
* Added License
* v1.1:
* Ownership withdrawn
* v1.2:
* Version-independent validity and automatic renewal
*/
package de.florianmichael.viafabricplus.injection.mixin.fixes;
import de.florianmichael.viafabricplus.value.ValueHolder;
import net.minecraft.client.network.PendingUpdateManager;
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;
@Mixin(PendingUpdateManager.class)
public class MixinPendingUpdateManager {
@Inject(method = "incrementSequence", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/PendingUpdateManager;pendingSequence:Z", shift = At.Shift.BEFORE), cancellable = true)
public void injectIncrementSequence(CallbackInfoReturnable<PendingUpdateManager> cir) {
if (ValueHolder.disableSequencing.getValue()) {
cir.setReturnValue((PendingUpdateManager) (Object) this);
}
}
}

View File

@ -23,6 +23,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.entity;
import com.mojang.authlib.GameProfile;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import de.florianmichael.viafabricplus.injection.access.IClientPlayerEntity;
import de.florianmichael.viafabricplus.value.ValueHolder;
import de.florianmichael.vialoadingbase.ViaLoadingBase;
import net.minecraft.client.MinecraftClient;
@ -47,7 +48,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@SuppressWarnings("ConstantValue")
@Mixin(value = ClientPlayerEntity.class, priority = 2000)
public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity {
public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity implements IClientPlayerEntity {
@Shadow
public Input input;
@ -202,4 +203,9 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
sendSprintingPacket();
}
}
@Override
public void protocolhack_cancelSwingOnce() {
protocolhack_areSwingCanceledThisTick = true;
}
}

View File

@ -28,7 +28,7 @@ import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.HandItemPr
import de.florianmichael.viafabricplus.translator.ItemTranslator;
import net.minecraft.item.ItemStack;
public class EveryProtocolHandItemProvider extends HandItemProvider {
public class ViaFabricPlusHandItemProvider extends HandItemProvider {
public static ItemStack lastUsedItem = null;
@Override

View File

@ -24,7 +24,7 @@ package de.florianmichael.viafabricplus.provider;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider;
public class EveryProtocolMovementTransmitterProvider extends MovementTransmitterProvider {
public class ViaFabricPlusMovementTransmitterProvider extends MovementTransmitterProvider {
@Override
public Object getFlyingPacket() {

View File

@ -15,16 +15,24 @@ public class ValueHolder {
// General settings
public static final BooleanValue removeNotAvailableItemsFromCreativeTab = new BooleanValue("Remove not available items from creative tab", true);
// 1.19 -> 1.18.2
public static final ProtocolSyncBooleanValue disableSequencing = new ProtocolSyncBooleanValue("Disable sequencing", ProtocolRange.andOlder(ProtocolVersion.v1_18_2));
// 1.14 -> 1.13.2
public static final ProtocolSyncBooleanValue smoothOutMerchantScreens = new ProtocolSyncBooleanValue("Smooth out merchant screens", ProtocolRange.andOlder(ProtocolVersion.v1_13_2));
// 1.13 -> 1.12.2
public static final ProtocolSyncBooleanValue executeInputsInSync = new ProtocolSyncBooleanValue("Execute inputs in sync", ProtocolRange.andOlder(ProtocolVersion.v1_12_2));
public static final ProtocolSyncBooleanValue sneakInstant = new ProtocolSyncBooleanValue("Sneak instant", new ProtocolRange(ProtocolVersion.v1_12_2, ProtocolVersion.v1_8));
// 1.9 -> 1.8.x
public static final ProtocolSyncBooleanValue removeCooldowns = new ProtocolSyncBooleanValue("Remove cooldowns", ProtocolRange.andOlder(ProtocolVersion.v1_8));
public static final ProtocolSyncBooleanValue sendIdlePacket = new ProtocolSyncBooleanValue("Send idle packet", new ProtocolRange(ProtocolVersion.v1_8, LegacyProtocolVersions.r1_3_1tor1_3_2));
// 1.8.x -> 1.7.6
public static final ProtocolSyncBooleanValue replaceSneaking = new ProtocolSyncBooleanValue("Replace sneaking", ProtocolRange.andOlder(ProtocolVersion.v1_7_6));
public static final ProtocolSyncBooleanValue longSneaking = new ProtocolSyncBooleanValue("Long sneaking", ProtocolRange.andOlder(ProtocolVersion.v1_7_6));
public static void setup() {
}
}

View File

@ -99,7 +99,11 @@
},
"client": [
"base.MixinMain",
"fixes.MixinCamera",
"fixes.MixinClientPlayerInteractionManager",
"fixes.MixinClientPlayNetworkHandler",
"fixes.MixinMinecraftClient",
"fixes.MixinPendingUpdateManager",
"fixes.MixinPlayerEntityRenderer",
"fixes.MixinProfileKeysImpl",
"fixes.MixinServerAddress",