mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-12-22 16:48:25 +01:00
started with 1.19.4 fixes
This commit is contained in:
parent
1ac8d9fb18
commit
daf663633b
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2023 FlorianMichael/MrLookAtMe (EnZaXD) and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.definition.v1_19_4;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.StoredObject;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentLinkedDeque;
|
||||
|
||||
public class DismountRequestTracker extends StoredObject {
|
||||
|
||||
private final Queue<Boolean> dismountRequests = new ConcurrentLinkedDeque<>();
|
||||
|
||||
public DismountRequestTracker(UserConnection user) {
|
||||
super(user);
|
||||
}
|
||||
|
||||
public Queue<Boolean> getDismountRequests() {
|
||||
return dismountRequests;
|
||||
}
|
||||
}
|
@ -18,7 +18,10 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.definition.v1_19_4.DismountRequestTracker;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import de.florianmichael.viafabricplus.settings.groups.VisualSettings;
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
@ -67,6 +70,8 @@ public abstract class MixinClientPlayNetworkHandler {
|
||||
|
||||
@Shadow public abstract void onEntityVelocityUpdate(EntityVelocityUpdateS2CPacket packet);
|
||||
|
||||
@Shadow @Final private ClientConnection connection;
|
||||
|
||||
@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.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
|
||||
@ -146,6 +151,18 @@ public abstract class MixinClientPlayNetworkHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "onPlayerPositionLook", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkThreadUtils;forceMainThread(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/listener/PacketListener;Lnet/minecraft/util/thread/ThreadExecutor;)V", shift = At.Shift.AFTER))
|
||||
public void dismountIfRequested(PlayerPositionLookS2CPacket packet, CallbackInfo ci) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19_4)) return;
|
||||
|
||||
if (connection.channel.hasAttr(ProtocolHack.LOCAL_VIA_CONNECTION)) {
|
||||
final UserConnection userConnection = connection.channel.attr(ProtocolHack.LOCAL_VIA_CONNECTION).get();
|
||||
if (userConnection.get(DismountRequestTracker.class).getDismountRequests().poll().equals(Boolean.TRUE)) {
|
||||
client.player.dismountVehicle();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "onServerMetadata", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/s2c/play/ServerMetadataS2CPacket;isSecureChatEnforced()Z"))
|
||||
public boolean removeSecureChatWarning(ServerMetadataS2CPacket instance) {
|
||||
return instance.isSecureChatEnforced() || VisualSettings.INSTANCE.disableSecureChatWarning.getValue();
|
||||
|
@ -205,6 +205,19 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "autoJump", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;inverseSqrt(F)F"))
|
||||
public float useFastInverse(float x) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_3)) {
|
||||
final float var1 = 0.5F * x;
|
||||
int var2 = Float.floatToIntBits(x);
|
||||
var2 = 1597463007 - (var2 >> 1);
|
||||
x = Float.intBitsToFloat(var2);
|
||||
|
||||
return x * (1.5F - var1 * x * x);
|
||||
}
|
||||
return MathHelper.inverseSqrt(x);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArmor() {
|
||||
if (VisualSettings.INSTANCE.emulateArmorHud.getValue()) {
|
||||
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2023 FlorianMichael/MrLookAtMe (EnZaXD) and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.viaversion.protocol1_19_4to1_19_3;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.ClientboundPackets1_19_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.ClientboundPackets1_19_4;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.Protocol1_19_4To1_19_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.packets.EntityPackets;
|
||||
import com.viaversion.viaversion.rewriter.EntityRewriter;
|
||||
import de.florianmichael.viafabricplus.definition.v1_19_4.DismountRequestTracker;
|
||||
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.CallbackInfo;
|
||||
|
||||
@Mixin(EntityPackets.class)
|
||||
public abstract class MixinEntityPackets extends EntityRewriter<ClientboundPackets1_19_3, Protocol1_19_4To1_19_3> {
|
||||
|
||||
public MixinEntityPackets(Protocol1_19_4To1_19_3 protocol) {
|
||||
super(protocol);
|
||||
}
|
||||
|
||||
@Inject(method = "registerPackets", at = @At("RETURN"))
|
||||
public void fixPlayerPosition(CallbackInfo ci) {
|
||||
protocol.registerClientbound(ClientboundPackets1_19_3.PLAYER_POSITION, ClientboundPackets1_19_4.PLAYER_POSITION, new PacketHandlers() {
|
||||
@Override
|
||||
protected void register() {
|
||||
map(Type.DOUBLE); // X
|
||||
map(Type.DOUBLE); // Y
|
||||
map(Type.DOUBLE); // Z
|
||||
map(Type.FLOAT); // Yaw
|
||||
map(Type.FLOAT); // Pitch
|
||||
map(Type.BYTE); // Relative arguments
|
||||
map(Type.VAR_INT); // Id
|
||||
handler(wrapper -> {
|
||||
final boolean dismountVehicle = wrapper.read(Type.BOOLEAN);
|
||||
wrapper.user().get(DismountRequestTracker.class).getDismountRequests().add(dismountVehicle);
|
||||
});
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2023 FlorianMichael/MrLookAtMe (EnZaXD) and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.viaversion.protocol1_19_4to1_19_3;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.Protocol1_19_4To1_19_3;
|
||||
import de.florianmichael.viafabricplus.definition.v1_19_4.DismountRequestTracker;
|
||||
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.CallbackInfo;
|
||||
|
||||
@Mixin(Protocol1_19_4To1_19_3.class)
|
||||
public class MixinProtocol1_19_4to1_19_3 {
|
||||
|
||||
@Inject(method = "init", at = @At("RETURN"))
|
||||
public void hookDismountRequestTracker(UserConnection user, CallbackInfo ci) {
|
||||
user.put(new DismountRequestTracker(user));
|
||||
}
|
||||
}
|
@ -72,6 +72,7 @@ public class ProtocolSelectionScreen extends Screen {
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(matrices);
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
|
||||
matrices.push();
|
||||
|
@ -65,6 +65,7 @@ public class SettingsScreen extends Screen {
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(matrices);
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
|
||||
matrices.push();
|
||||
|
@ -15,6 +15,9 @@
|
||||
"bridge.MixinDebugHud",
|
||||
"bridge.MixinDownloadingTerrainScreen",
|
||||
"bridge.MixinOptionsScreen",
|
||||
"fixes.jsonwebtoken.MixinClasses",
|
||||
"fixes.jsonwebtoken.MixinDefaultCompressionCodecResolver",
|
||||
"fixes.jsonwebtoken.MixinDefaultJwtParserBuilder",
|
||||
"fixes.minecraft.MixinBipedEntityModel",
|
||||
"fixes.minecraft.MixinCamera",
|
||||
"fixes.minecraft.MixinClientPlayerInteractionManager",
|
||||
@ -93,6 +96,7 @@
|
||||
"fixes.minecraft.packet.MixinChatMessageC2SPacket",
|
||||
"fixes.minecraft.packet.MixinPacketByteBuf",
|
||||
"fixes.minecraft.packet.MixinUpdatePlayerAbilitiesC2SPacket",
|
||||
"fixes.minecraft.screen.MixinChatHud",
|
||||
"fixes.minecraft.screen.MixinChatScreen",
|
||||
"fixes.minecraft.screen.MixinCommandBlockScreen",
|
||||
"fixes.minecraft.screen.MixinConnectScreen_1",
|
||||
@ -102,7 +106,6 @@
|
||||
"fixes.minecraft.screen.MixinGameModeSelectionScreen_GameModeSelection",
|
||||
"fixes.minecraft.screen.MixinJigsawBlockScreen",
|
||||
"fixes.minecraft.screen.MixinStructureBlockScreen_1",
|
||||
"fixes.minecraft.screen.MixinChatHud",
|
||||
"fixes.minecraft.screen.merchant.MixinMerchantScreen",
|
||||
"fixes.minecraft.screen.merchant.MixinMerchantScreenHandler",
|
||||
"fixes.minecraft.screen.screenhandler.MixinBrewingStandScreenHandler_FuelSlot",
|
||||
@ -110,6 +113,8 @@
|
||||
"fixes.minecraft.screen.screenhandler.MixinScreenHandler",
|
||||
"fixes.sodium.MixinChunkTracker",
|
||||
"fixes.viaaprilfools.MixinProtocol1_16to20w14infinite",
|
||||
"fixes.viabedrock.MixinBedrockProtocol",
|
||||
"fixes.viabedrock.MixinJoinPackets",
|
||||
"fixes.vialegacy.MixinClassicProtocolExtension",
|
||||
"fixes.vialegacy.MixinClientboundPacketsc0_30cpe",
|
||||
"fixes.vialegacy.MixinExtensionProtocolMetadataStorage",
|
||||
@ -140,14 +145,13 @@
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinEntityTracker1_9",
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinMetadataRewriter1_9To1_8",
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinMovementTracker",
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinViaIdleThread",
|
||||
"fixes.jsonwebtoken.MixinClasses",
|
||||
"fixes.jsonwebtoken.MixinDefaultCompressionCodecResolver",
|
||||
"fixes.jsonwebtoken.MixinDefaultJwtParserBuilder",
|
||||
"fixes.viabedrock.MixinBedrockProtocol",
|
||||
"fixes.viabedrock.MixinJoinPackets"
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinViaIdleThread"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
},
|
||||
"mixins": [
|
||||
"fixes.viaversion.protocol1_19_4to1_19_3.MixinEntityPackets",
|
||||
"fixes.viaversion.protocol1_19_4to1_19_3.MixinProtocol1_19_4to1_19_3"
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user