mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-24 12:15:41 +01:00
Update TODO, fix wrong version references
This commit is contained in:
parent
4e97abe15d
commit
bd047de3de
@ -33,6 +33,10 @@ import java.io.File;
|
|||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
* TODO | Port 1.21.3
|
||||||
|
* - VehicleMovePacket handling now has distance check
|
||||||
|
* - Game options are now only send if they changed
|
||||||
|
*
|
||||||
* TODO | Port 1.20.6
|
* TODO | Port 1.20.6
|
||||||
* - ClientPlayerInteractionManager#interactBlockInternal added new condition
|
* - ClientPlayerInteractionManager#interactBlockInternal added new condition
|
||||||
* - Command arguments (Probably not everything worth, but least them with nbt)
|
* - Command arguments (Probably not everything worth, but least them with nbt)
|
||||||
|
@ -53,7 +53,7 @@ public abstract class MixinBedBlock extends HorizontalFacingBlock {
|
|||||||
|
|
||||||
@Inject(method = "onUse", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "onUse", at = @At("HEAD"), cancellable = true)
|
||||||
private void dontSwingHand(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit, CallbackInfoReturnable<ActionResult> cir) {
|
private void dontSwingHand(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit, CallbackInfoReturnable<ActionResult> cir) {
|
||||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_1)) {
|
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_21)) {
|
||||||
cir.setReturnValue(ActionResult.CONSUME);
|
cir.setReturnValue(ActionResult.CONSUME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ public abstract class MixinDecoratedPotBlock {
|
|||||||
|
|
||||||
@Redirect(method = "onUseWithItem", at = @At(value = "FIELD", target = "Lnet/minecraft/util/ActionResult;SUCCESS:Lnet/minecraft/util/ActionResult$Success;", ordinal = 0))
|
@Redirect(method = "onUseWithItem", at = @At(value = "FIELD", target = "Lnet/minecraft/util/ActionResult;SUCCESS:Lnet/minecraft/util/ActionResult$Success;", ordinal = 0))
|
||||||
private ActionResult.Success dontSwingHand() {
|
private ActionResult.Success dontSwingHand() {
|
||||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_1)) {
|
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_21)) {
|
||||||
return ActionResult.CONSUME;
|
return ActionResult.CONSUME;
|
||||||
} else {
|
} else {
|
||||||
return ActionResult.SUCCESS;
|
return ActionResult.SUCCESS;
|
||||||
|
@ -58,7 +58,7 @@ public abstract class MixinFenceBlock extends HorizontalConnectingBlock {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ActionResult onUseWithItem(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
|
protected ActionResult onUseWithItem(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
|
||||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_1)) {
|
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_21)) {
|
||||||
return stack.isOf(Items.LEAD) ? ActionResult.SUCCESS : ActionResult.PASS;
|
return stack.isOf(Items.LEAD) ? ActionResult.SUCCESS : ActionResult.PASS;
|
||||||
} else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_10)) {
|
} else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_10)) {
|
||||||
return ActionResult.SUCCESS;
|
return ActionResult.SUCCESS;
|
||||||
|
@ -32,7 +32,7 @@ public abstract class MixinHoneyBlock {
|
|||||||
|
|
||||||
@Inject(method = { "method_65067", "method_65068" }, at = @At("HEAD"), cancellable = true)
|
@Inject(method = { "method_65067", "method_65068" }, at = @At("HEAD"), cancellable = true)
|
||||||
private static void simplifyVelocityComparisons(double d, CallbackInfoReturnable<Double> cir) {
|
private static void simplifyVelocityComparisons(double d, CallbackInfoReturnable<Double> cir) {
|
||||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_1)) {
|
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_21)) {
|
||||||
cir.setReturnValue(d);
|
cir.setReturnValue(d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public abstract class MixinVaultBlock {
|
|||||||
|
|
||||||
@Redirect(method = "onUseWithItem", at = @At(value = "FIELD", target = "Lnet/minecraft/util/ActionResult;SUCCESS_SERVER:Lnet/minecraft/util/ActionResult$Success;"))
|
@Redirect(method = "onUseWithItem", at = @At(value = "FIELD", target = "Lnet/minecraft/util/ActionResult;SUCCESS_SERVER:Lnet/minecraft/util/ActionResult$Success;"))
|
||||||
private ActionResult.Success dontSwingHand() {
|
private ActionResult.Success dontSwingHand() {
|
||||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_1)) {
|
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_21)) {
|
||||||
return ActionResult.CONSUME;
|
return ActionResult.CONSUME;
|
||||||
} else {
|
} else {
|
||||||
return ActionResult.SUCCESS_SERVER;
|
return ActionResult.SUCCESS_SERVER;
|
||||||
|
@ -88,7 +88,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
|
|||||||
|
|
||||||
@Inject(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;sendSprintingPacket()V"))
|
@Inject(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;sendSprintingPacket()V"))
|
||||||
private void sendSneakingAfterSprinting(CallbackInfo ci) {
|
private void sendSneakingAfterSprinting(CallbackInfo ci) {
|
||||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_1)) {
|
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_21)) {
|
||||||
this.sendSneakingPacket();
|
this.sendSneakingPacket();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,7 +96,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
|
|||||||
@Redirect(method = "sendMovementPackets", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerEntity;lastHorizontalCollision:Z", ordinal = 0))
|
@Redirect(method = "sendMovementPackets", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerEntity;lastHorizontalCollision:Z", ordinal = 0))
|
||||||
private boolean removeHorizontalCollisionFromOnGroundCheck(ClientPlayerEntity instance) {
|
private boolean removeHorizontalCollisionFromOnGroundCheck(ClientPlayerEntity instance) {
|
||||||
// Since it doesn't exist in older versions, we need to exclude it from the check to prevent bad packets
|
// Since it doesn't exist in older versions, we need to exclude it from the check to prevent bad packets
|
||||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_1)) {
|
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_21)) {
|
||||||
return this.horizontalCollision;
|
return this.horizontalCollision;
|
||||||
} else {
|
} else {
|
||||||
return this.lastHorizontalCollision;
|
return this.lastHorizontalCollision;
|
||||||
|
@ -167,7 +167,7 @@ public abstract class MixinEntity implements IEntity {
|
|||||||
private double fixBlockCollisionMargin(double constant) {
|
private double fixBlockCollisionMargin(double constant) {
|
||||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
|
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
|
||||||
return 1E-3;
|
return 1E-3;
|
||||||
} else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_1)) {
|
} else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_21)) {
|
||||||
return 1E-7;
|
return 1E-7;
|
||||||
} else {
|
} else {
|
||||||
return constant;
|
return constant;
|
||||||
|
@ -102,7 +102,7 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH
|
|||||||
|
|
||||||
@Redirect(method = "onEntityPosition", at = @At(value = "INVOKE", target = "Ljava/util/OptionalInt;isPresent()Z"))
|
@Redirect(method = "onEntityPosition", at = @At(value = "INVOKE", target = "Ljava/util/OptionalInt;isPresent()Z"))
|
||||||
private boolean dontHandleRemovedVehiclePositionChange(OptionalInt instance) {
|
private boolean dontHandleRemovedVehiclePositionChange(OptionalInt instance) {
|
||||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_1)) {
|
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_21)) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return instance.isPresent();
|
return instance.isPresent();
|
||||||
@ -111,7 +111,7 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH
|
|||||||
|
|
||||||
@Inject(method = "onPlayerRespawn", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld;addEntity(Lnet/minecraft/entity/Entity;)V", shift = At.Shift.BEFORE))
|
@Inject(method = "onPlayerRespawn", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld;addEntity(Lnet/minecraft/entity/Entity;)V", shift = At.Shift.BEFORE))
|
||||||
private void dontApplyRotationAndVelocity(PlayerRespawnS2CPacket packet, CallbackInfo ci, @Local(ordinal = 1) ClientPlayerEntity clientPlayerEntity) {
|
private void dontApplyRotationAndVelocity(PlayerRespawnS2CPacket packet, CallbackInfo ci, @Local(ordinal = 1) ClientPlayerEntity clientPlayerEntity) {
|
||||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_1)) {
|
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_21)) {
|
||||||
clientPlayerEntity.init();
|
clientPlayerEntity.init();
|
||||||
clientPlayerEntity.setYaw(-180.0F);
|
clientPlayerEntity.setYaw(-180.0F);
|
||||||
}
|
}
|
||||||
@ -119,7 +119,7 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH
|
|||||||
|
|
||||||
@Redirect(method = "onSignEditorOpen", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V"))
|
@Redirect(method = "onSignEditorOpen", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V"))
|
||||||
private void openEmptySignEditor(Logger instance, String format, Object arg1, Object arg2, @Local(argsOnly = true) SignEditorOpenS2CPacket packet) {
|
private void openEmptySignEditor(Logger instance, String format, Object arg1, Object arg2, @Local(argsOnly = true) SignEditorOpenS2CPacket packet) {
|
||||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_1)) {
|
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_21)) {
|
||||||
final BlockPos pos = packet.getPos();
|
final BlockPos pos = packet.getPos();
|
||||||
|
|
||||||
final SignBlockEntity emptySignBlockEntity = new SignBlockEntity(pos, this.world.getBlockState(pos));
|
final SignBlockEntity emptySignBlockEntity = new SignBlockEntity(pos, this.world.getBlockState(pos));
|
||||||
@ -225,8 +225,7 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH
|
|||||||
@Redirect(method = {"onEntityPosition", "onEntity"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;isLogicalSideForUpdatingMovement()Z"))
|
@Redirect(method = {"onEntityPosition", "onEntity"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;isLogicalSideForUpdatingMovement()Z"))
|
||||||
private boolean allowPlayerToBeMovedByEntityPackets(Entity instance) {
|
private boolean allowPlayerToBeMovedByEntityPackets(Entity instance) {
|
||||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_3) || ProtocolTranslator.getTargetVersion().equals(BedrockProtocolVersion.bedrockLatest)) {
|
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_3) || ProtocolTranslator.getTargetVersion().equals(BedrockProtocolVersion.bedrockLatest)) {
|
||||||
final boolean logicalMovementSide = instance.getControllingPassenger() instanceof PlayerEntity player ? player.isMainPlayer() : !instance.getWorld().isClient;
|
return instance.getControllingPassenger() instanceof PlayerEntity player ? player.isMainPlayer() : !instance.getWorld().isClient;
|
||||||
return !logicalMovementSide; // Older versions had the logic which is now executed if logicalMovementSide is false, so we need to invert values
|
|
||||||
} else {
|
} else {
|
||||||
return instance.isLogicalSideForUpdatingMovement();
|
return instance.isLogicalSideForUpdatingMovement();
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ public abstract class MixinClientPlayerInteractionManager implements IClientPlay
|
|||||||
|
|
||||||
@Redirect(method = "interactBlockInternal", at = @At(value = "FIELD", target = "Lnet/minecraft/util/ActionResult;CONSUME:Lnet/minecraft/util/ActionResult$Success;"))
|
@Redirect(method = "interactBlockInternal", at = @At(value = "FIELD", target = "Lnet/minecraft/util/ActionResult;CONSUME:Lnet/minecraft/util/ActionResult$Success;"))
|
||||||
private ActionResult.Success changeSpectatorAction() {
|
private ActionResult.Success changeSpectatorAction() {
|
||||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_1)) {
|
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_21)) {
|
||||||
return ActionResult.SUCCESS;
|
return ActionResult.SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
return ActionResult.CONSUME;
|
return ActionResult.CONSUME;
|
||||||
|
Loading…
Reference in New Issue
Block a user