We continue to fall

This commit is contained in:
FlorianMichael 2024-10-26 02:13:50 +02:00
parent 35182cb989
commit 6dd0d8cbfe
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
5 changed files with 61 additions and 61 deletions

View File

@ -32,6 +32,7 @@ import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
import net.minecraft.client.gui.screen.multiplayer.MultiplayerServerListWidget;
import net.minecraft.client.gui.screen.world.WorldIcon;
import net.minecraft.client.network.ServerInfo;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.text.OrderedText;
import net.minecraft.text.StringVisitable;
import net.minecraft.text.Text;
@ -44,6 +45,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.function.Function;
@Mixin(MultiplayerServerListWidget.ServerEntry.class)
public abstract class MixinMultiplayerServerListWidget_ServerEntry {
@ -98,11 +100,10 @@ public abstract class MixinMultiplayerServerListWidget_ServerEntry {
return x;
}
// TODO UPDATE-1.21.3
// @WrapWithCondition(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Lnet/minecraft/util/Identifier;IIII)V", ordinal = 0))
// private boolean disableServerPinging(DrawContext instance, Identifier texture, int x, int y, int width, int height) {
// return !viaFabricPlus$disableServerPinging; // Remove ping bar
// }
@WrapWithCondition(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Ljava/util/function/Function;Lnet/minecraft/util/Identifier;IIII)V", ordinal = 0))
private boolean disableServerPinging(DrawContext instance, Function<Identifier, RenderLayer> renderLayers, Identifier sprite, int x, int y, int width, int height) {
return !viaFabricPlus$disableServerPinging; // Remove ping bar
}
@WrapWithCondition(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/multiplayer/MultiplayerScreen;setTooltip(Ljava/util/List;)V"))
private boolean disableServerPinging(MultiplayerScreen instance, List<Text> tooltip) {

View File

@ -140,12 +140,6 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_15_1) && original;
}
// TODO UPDATE-1.21.3
// @Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;hasVehicle()Z", ordinal = 3))
// private boolean allowElytraInVehicle(ClientPlayerEntity instance) {
// return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_14_4) && instance.hasVehicle();
// }
@Inject(method = "tickMovement()V",
slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isCamera()Z")),
at = @At(value = "INVOKE", target = "Lnet/minecraft/util/PlayerInput;sneak()Z", ordinal = 0))
@ -209,13 +203,14 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
}
}
// TODO UPDATE-1.21.3
// @Inject(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;hasVehicle()Z"))
// private void moveLastPosPacketIncrement(CallbackInfo ci) {
// if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) {
// this.ticksSinceLastPositionPacketSent++;
// }
// }
@Redirect(method = "sendMovementPackets", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerEntity;ticksSinceLastPositionPacketSent:I", ordinal = 2))
private int moveLastPosPacketIncrement2(ClientPlayerEntity instance) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) {
return this.ticksSinceLastPositionPacketSent++; // Return previous value, then increment
} else {
return this.ticksSinceLastPositionPacketSent;
}
}
@Redirect(method = "sendMovementPackets", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerEntity;lastOnGround:Z", ordinal = 0))
private boolean sendIdlePacket(ClientPlayerEntity instance) {

View File

@ -163,15 +163,16 @@ public abstract class MixinEntity implements IEntity {
}
}
// TODO UPDATE-1.21.3: No longer subtracts 1.0E-7 from the box values, instead the boundingBox is contracted
// @ModifyConstant(method = "checkBlockCollision", constant = @Constant(doubleValue = 1.0E-7))
// private double fixBlockCollisionMargin(double constant) {
// if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
// return 1E-3;
// } else {
// return constant;
// }
// }
@ModifyConstant(method = "checkBlockCollision", constant = @Constant(doubleValue = 9.999999747378752E-6))
private double fixBlockCollisionMargin(double constant) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
return 1E-3;
} else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_1)) {
return 1E-7;
} else {
return constant;
}
}
@Inject(method = "getVelocityAffectingPos", at = @At("HEAD"), cancellable = true)
private void modifyVelocityAffectingPos(CallbackInfoReturnable<BlockPos> cir) {

View File

@ -136,14 +136,14 @@ public abstract class MixinLivingEntity extends Entity {
}
}
// @Redirect(method = "travel", at = @At(value = "INVOKE", target = "Ljava/lang/Math;cos(D)D", remap = false))
// private double fixCosTable(double a) { TODO UPDATE-1.21.3
// if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_18)) {
// return MathHelper.cos((float) a);
// } else {
// return Math.cos(a);
// }
// }
@Redirect(method = "calcGlidingVelocity", at = @At(value = "INVOKE", target = "Ljava/lang/Math;cos(D)D", remap = false))
private double fixCosTable(double a) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_18)) {
return MathHelper.cos((float) a);
} else {
return Math.cos(a);
}
}
@Redirect(method = "travelInFluid", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getFluidHeight(Lnet/minecraft/registry/tag/TagKey;)D"))
private double dontApplyLavaMovement(LivingEntity instance, TagKey<Fluid> tagKey) {
@ -159,6 +159,11 @@ public abstract class MixinLivingEntity extends Entity {
return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_15_2) && instance.hasStatusEffect(effect);
}
@Redirect(method = "canGlide", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;hasVehicle()Z"))
private boolean allowElytraInVehicle(LivingEntity instance) {
return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_14_4) && instance.hasVehicle();
}
@Redirect(method = "travelMidAir", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;isChunkLoaded(Lnet/minecraft/util/math/BlockPos;)Z"))
private boolean modifyLoadedCheck(World instance, BlockPos blockPos) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) {

View File

@ -61,31 +61,29 @@ public abstract class MixinInGameHud {
}
}
// TODO UPDATE-1.21.3
// @ModifyArgs(method = "renderArmor", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Lnet/minecraft/util/Identifier;IIII)V"), require = 0)
// private static void moveArmorPositions(Args args, @Local(ordinal = 3, argsOnly = true) int x, @Local(ordinal = 6) int n) {
// if (!VisualSettings.global().hideModernHUDElements.isEnabled()) {
// return;
// }
// final MinecraftClient client = MinecraftClient.getInstance();
//
// final int armorWidth = 10 * viaFabricPlus$ARMOR_ICON_WIDTH;
// final int offset = n * viaFabricPlus$ARMOR_ICON_WIDTH;
//
// args.set(1, client.getWindow().getScaledWidth() - x - armorWidth + offset - 1);
// args.set(2, (int) args.get(2) + client.textRenderer.fontHeight + 1);
// }
//
// @ModifyArg(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Lnet/minecraft/util/Identifier;IIII)V"), slice = @Slice(
// from = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", ordinal = 2),
// to = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;pop()V")), index = 1, require = 0)
// private int moveAir(int value) {
// if (VisualSettings.global().hideModernHUDElements.isEnabled()) {
// final MinecraftClient client = MinecraftClient.getInstance();
// return client.getWindow().getScaledWidth() - value - client.textRenderer.fontHeight;
// } else {
// return value;
// }
// }
@ModifyArgs(method = "renderArmor", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Ljava/util/function/Function;Lnet/minecraft/util/Identifier;IIII)V"), require = 0)
private static void moveArmorPositions(Args args, @Local(ordinal = 3, argsOnly = true) int x, @Local(ordinal = 6) int n) {
if (!VisualSettings.global().hideModernHUDElements.isEnabled()) {
return;
}
final MinecraftClient client = MinecraftClient.getInstance();
final int armorWidth = 10 * viaFabricPlus$ARMOR_ICON_WIDTH;
final int offset = n * viaFabricPlus$ARMOR_ICON_WIDTH;
args.set(1, client.getWindow().getScaledWidth() - x - armorWidth + offset - 1);
args.set(2, (int) args.get(2) + client.textRenderer.fontHeight + 1);
}
@ModifyArg(method = "renderAirBubbles", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Ljava/util/function/Function;Lnet/minecraft/util/Identifier;IIII)V"),
index = 2, require = 0)
private int moveAirBubbles(int value) {
if (VisualSettings.global().hideModernHUDElements.isEnabled()) {
final MinecraftClient client = MinecraftClient.getInstance();
return client.getWindow().getScaledWidth() - value - client.textRenderer.fontHeight;
} else {
return value;
}
}
}