diff --git a/README.md b/README.md index 32466d17c..48e5a3891 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ ViaFabricPlus is intended to replace [multiconnect](https://github.com/Earthcomp - Alpha (a1.0.15 - a1.2.6) - Classic (c0.0.15 - c0.30 including [CPE](https://wiki.vg/Classic_Protocol_Extension)) - Snapshots (3D Shareware, 20w14infinite, Combat Test 8C) -- Bedrock (1.20.0) +- Bedrock (1.20.30) ### If you want to talk with me, feel free to join my [Discord](https://discord.gg/BwWhCHUKDf) @@ -110,8 +110,7 @@ repositories { } dependencies { - implementation ("de.florianmichael:viafabricplus:2.8.5") { // Get latest version from releases - exclude group: "com.terraformersmc" + implementation ("de.florianmichael:viafabricplus:2.8.7") { // Get the latest version from releases transitive = false } } @@ -129,7 +128,7 @@ dependencies { de.florianmichael viafabricplus - 2.8.2 + 2.8.7 ``` diff --git a/build.gradle b/build.gradle index 85e978ee1..accb2180b 100644 --- a/build.gradle +++ b/build.gradle @@ -9,6 +9,9 @@ group = project.maven_group configurations { api.extendsFrom library + + include.extendsFrom jij + implementation.extendsFrom jij } allprojects { @@ -54,9 +57,6 @@ dependencies { modApi "com.terraformersmc:modmenu:${project.mod_menu_version}" library "de.florianmichael:Classic4J:${project.classic4j_version}" - library ("net.raphimc:ViaLoader:${project.vialoader_version}") { - exclude group: "org.slf4j", module: "slf4j-api" - } library "com.viaversion:viaversion:${project.viaversion_version}" library ("com.viaversion:viabackwards-common:${project.viabackwards_version}") { @@ -65,6 +65,9 @@ dependencies { exclude group: "com.google.guava", module: "guava" } + library ("net.raphimc:ViaLoader:${project.vialoader_version}") { + exclude group: "org.slf4j", module: "slf4j-api" + } library ("net.raphimc:ViaLegacy:${project.vialegacy_version}") { exclude group: "com.google.code.gson", module: "gson" } @@ -73,6 +76,7 @@ dependencies { exclude group: "net.lenni0451.mcstructs", module: "text" exclude group: "io.jsonwebtoken", module: "jjwt-impl" exclude group: "io.jsonwebtoken", module: "jjwt-gson" + exclude group: "com.mojang", module: "brigadier" } library ("net.raphimc:MinecraftAuth:${project.minecraftauth_version}") { exclude group: "com.google.code.gson", module: "gson" @@ -86,7 +90,7 @@ dependencies { exclude group: "io.netty", module: "netty-transport" } - library "net.lenni0451:Reflect:${project.reflect_version}" + jij "net.lenni0451:Reflect:${project.reflect_version}" include implementation(annotationProcessor("com.github.llamalad7.mixinextras:mixinextras-fabric:${project.mixin_extras_version}")) } diff --git a/gradle.properties b/gradle.properties index d2808d342..435734834 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,31 +9,31 @@ loader_version=0.14.22 fabric_api_version=0.86.1+1.20.1 # viafabricplus -mod_version=2.9.0-SNAPSHOT +mod_version=2.8.8 maven_group=de.florianmichael archives_base_name=viafabricplus # base lib raknet_transport_version=1.0.0.CR1-SNAPSHOT -classic4j_version=1.2.0 +classic4j_version=2.0.1 # viaversion (and required) libs -viaversion_version=4.8.0 -viabackwards_version=4.8.0 +viaversion_version=4.9.0-23w41a-SNAPSHOT +viabackwards_version=4.9.0-23w41a-SNAPSHOT -vialoader_version=2.2.9 +vialoader_version=2.2.11-SNAPSHOT -vialegacy_version=2.2.19 -viaaprilfools_version=2.0.9 +vialegacy_version=2.2.21-SNAPSHOT +viaaprilfools_version=2.0.10-SNAPSHOT viabedrock_version=0.0.3-SNAPSHOT # raphimc libs -minecraftauth_version=2.1.6-SNAPSHOT +minecraftauth_version=2.1.7-SNAPSHOT # lenni0451 libs -reflect_version=1.2.2 +reflect_version=1.2.4 # other libs mod_menu_version=7.2.1 netty_codec_http_version=4.1.96.Final -mixin_extras_version=0.2.0-beta.9 +mixin_extras_version=0.2.0 diff --git a/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java b/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java index 1b3ac65f0..2dc42d3cd 100644 --- a/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java +++ b/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java @@ -73,6 +73,7 @@ public void init() { // Load overriding jars first so other code can access the new classes ViaJarReplacer.loadOverridingJars(); + // PreLoad Callback (for example to register new protocols) PreLoadCallback.EVENT.invoker().onLoad(); // Classic Stuff diff --git a/src/main/java/de/florianmichael/viafabricplus/base/settings/groups/ExperimentalSettings.java b/src/main/java/de/florianmichael/viafabricplus/base/settings/groups/ExperimentalSettings.java index 700e9cf0e..d6bd19f74 100644 --- a/src/main/java/de/florianmichael/viafabricplus/base/settings/groups/ExperimentalSettings.java +++ b/src/main/java/de/florianmichael/viafabricplus/base/settings/groups/ExperimentalSettings.java @@ -26,6 +26,7 @@ public class ExperimentalSettings extends SettingGroup { public final BooleanSetting fixChunkBorders = new BooleanSetting(this, Text.translatable("experimental.viafabricplus.chunkborderfix"), true); public final BooleanSetting waterMovementEdgeDetection = new BooleanSetting(this, Text.translatable("experimental.viafabricplus.watermovement"), true); + public final BooleanSetting emulateBoatMovement = new BooleanSetting(this, Text.translatable("experimental.viafabricplus.boatmovement"), false); public ExperimentalSettings() { super(Text.translatable("settings.viafabricplus.experimental")); diff --git a/src/main/java/de/florianmichael/viafabricplus/base/settings/groups/VisualSettings.java b/src/main/java/de/florianmichael/viafabricplus/base/settings/groups/VisualSettings.java index acad235b1..876ec3dd0 100644 --- a/src/main/java/de/florianmichael/viafabricplus/base/settings/groups/VisualSettings.java +++ b/src/main/java/de/florianmichael/viafabricplus/base/settings/groups/VisualSettings.java @@ -43,6 +43,9 @@ public class VisualSettings extends SettingGroup { public final ProtocolSyncBooleanSetting emulateArmorHud = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.armor"), VersionRange.andOlder(VersionEnum.r1_8)); public final ProtocolSyncBooleanSetting removeNewerFeaturesFromCommandBlockScreen = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.command"), VersionRange.andOlder(VersionEnum.r1_8)); + // 1.8.x -> r1_7_6tor1_7_10 + public final ProtocolSyncBooleanSetting blockHitAnimation = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.blockhitanimation"), VersionRange.andOlder(VersionEnum.r1_7_6tor1_7_10)); + // r1_0_0tor1_0_1 -> b1_8tob1_8_1 public final ProtocolSyncBooleanSetting replaceHurtSoundWithOOFSound = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.oof"), VersionRange.andOlder(VersionEnum.b1_8tob1_8_1)); diff --git a/src/main/java/de/florianmichael/viafabricplus/definition/account/ClassiCubeAccountHandler.java b/src/main/java/de/florianmichael/viafabricplus/definition/account/ClassiCubeAccountHandler.java index bac52a504..d20b7bddd 100644 --- a/src/main/java/de/florianmichael/viafabricplus/definition/account/ClassiCubeAccountHandler.java +++ b/src/main/java/de/florianmichael/viafabricplus/definition/account/ClassiCubeAccountHandler.java @@ -18,7 +18,7 @@ package de.florianmichael.viafabricplus.definition.account; import com.google.gson.JsonObject; -import de.florianmichael.classic4j.model.classicube.highlevel.CCAccount; +import de.florianmichael.classic4j.model.classicube.account.CCAccount; import de.florianmichael.viafabricplus.base.event.DisconnectConnectionCallback; import de.florianmichael.viafabricplus.protocolhack.provider.vialegacy.ViaFabricPlusClassicMPPassProvider; import de.florianmichael.viafabricplus.util.FileSaver; diff --git a/src/main/java/de/florianmichael/viafabricplus/definition/boat/BoatModel_1_8.java b/src/main/java/de/florianmichael/viafabricplus/definition/boat/BoatModel_1_8.java new file mode 100644 index 000000000..33ecc39d0 --- /dev/null +++ b/src/main/java/de/florianmichael/viafabricplus/definition/boat/BoatModel_1_8.java @@ -0,0 +1,58 @@ +/* + * This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus + * Copyright (C) 2021-2023 FlorianMichael/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 . + */ +package de.florianmichael.viafabricplus.definition.boat; + +import com.google.common.collect.ImmutableList; +import net.minecraft.client.model.*; +import net.minecraft.client.render.entity.model.CompositeEntityModel; +import net.minecraft.client.render.entity.model.EntityModelLayer; +import net.minecraft.entity.vehicle.BoatEntity; +import net.minecraft.util.Identifier; + +public class BoatModel_1_8 extends CompositeEntityModel { + public static final EntityModelLayer MODEL_LAYER = new EntityModelLayer(new Identifier("viafabricplus", "boat_1_8"), "main"); + private final ImmutableList parts; + + public BoatModel_1_8(ModelPart root) { + this.parts = ImmutableList.of(root.getChild("bottom"), root.getChild("back"), root.getChild("front"), root.getChild("right"), root.getChild("left")); + } + + public static TexturedModelData getTexturedModelData() { + ModelData modelData = new ModelData(); + ModelPartData root = modelData.getRoot(); + final float width = 24; + final float wallHeight = 6; + final float baseWidth = 20; + final float pivotY = 4; + root.addChild("bottom", ModelPartBuilder.create().uv(0, 8).cuboid(-width / 2, -baseWidth / 2 + 2, -3, width, baseWidth - 4, 4), ModelTransform.of(0, pivotY, 0, (float) Math.PI / 2, 0, 0)); + root.addChild("back", ModelPartBuilder.create().uv(0, 0).cuboid(-width / 2 + 2, -wallHeight - 1, -1, width - 4, wallHeight, 2), ModelTransform.of(-width / 2 + 1, pivotY, 0, 0, (float) Math.PI * 1.5f, 0)); + root.addChild("front", ModelPartBuilder.create().uv(0, 0).cuboid(-width / 2 + 2, -wallHeight - 1, -1, width - 4, wallHeight, 2), ModelTransform.of(width / 2 - 1, pivotY, 0, 0, (float) Math.PI / 2, 0)); + root.addChild("right", ModelPartBuilder.create().uv(0, 0).cuboid(-width / 2 + 2, -wallHeight - 1, -1, width - 4, wallHeight, 2), ModelTransform.of(0, pivotY, -baseWidth / 2 + 1, 0, (float) Math.PI, 0)); + root.addChild("left", ModelPartBuilder.create().uv(0, 0).cuboid(-width / 2 + 2, -wallHeight - 1, -1, width - 4, wallHeight, 2), ModelTransform.pivot(0, pivotY, baseWidth / 2 - 1)); + return TexturedModelData.of(modelData, 64, 32); + } + + @Override + public Iterable getParts() { + return parts; + } + + @Override + public void setAngles(BoatEntity entity, float limbAngle, float limbDistance, float animationProgress, float headYaw, float headPitch) { + } +} \ No newline at end of file diff --git a/src/main/java/de/florianmichael/viafabricplus/definition/boat/BoatRenderer_1_8.java b/src/main/java/de/florianmichael/viafabricplus/definition/boat/BoatRenderer_1_8.java new file mode 100644 index 000000000..d080dbadd --- /dev/null +++ b/src/main/java/de/florianmichael/viafabricplus/definition/boat/BoatRenderer_1_8.java @@ -0,0 +1,69 @@ +/* + * This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus + * Copyright (C) 2021-2023 FlorianMichael/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 . + */ +package de.florianmichael.viafabricplus.definition.boat; + +import net.minecraft.client.render.OverlayTexture; +import net.minecraft.client.render.VertexConsumer; +import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.client.render.entity.EntityRenderer; +import net.minecraft.client.render.entity.EntityRendererFactory; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.entity.vehicle.BoatEntity; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.RotationAxis; + +public class BoatRenderer_1_8 extends EntityRenderer { + private static final Identifier TEXTURE = new Identifier("viafabricplus", "textures/boat_1_8.png"); + private final BoatModel_1_8 model; + + public BoatRenderer_1_8(EntityRendererFactory.Context ctx) { + super(ctx); + shadowRadius = 0.5f; + model = new BoatModel_1_8(ctx.getPart(BoatModel_1_8.MODEL_LAYER)); + } + + @Override + public Identifier getTexture(BoatEntity entity) { + return TEXTURE; + } + + @Override + public void render(BoatEntity entity, float yaw, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light) { + matrices.push(); + matrices.translate(0, 0.25, 0); + matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(180 - yaw)); + float damageWobbleTicks = entity.getDamageWobbleTicks() - tickDelta; + float damageWobbleStrength = entity.getDamageWobbleStrength() - tickDelta; + if (damageWobbleStrength < 0) { + damageWobbleStrength = 0; + } + + if (damageWobbleTicks > 0) { + matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(MathHelper.sin(damageWobbleTicks) * damageWobbleTicks * damageWobbleStrength / 10 * entity.getDamageWobbleSide())); + } + + matrices.scale(-1, -1, 1); + model.setAngles(entity, tickDelta, 0, -0.1f, 0, 0); + VertexConsumer vertexConsumer = vertexConsumers.getBuffer(model.getLayer(TEXTURE)); + model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1); + + matrices.pop(); + super.render(entity, yaw, tickDelta, matrices, vertexConsumers, light); + } +} \ No newline at end of file diff --git a/src/main/java/de/florianmichael/viafabricplus/definition/classic/ClassicWorldHeightInjection.java b/src/main/java/de/florianmichael/viafabricplus/definition/classic/ClassicWorldHeightInjection.java index 185a2543f..f9da45def 100644 --- a/src/main/java/de/florianmichael/viafabricplus/definition/classic/ClassicWorldHeightInjection.java +++ b/src/main/java/de/florianmichael/viafabricplus/definition/classic/ClassicWorldHeightInjection.java @@ -39,6 +39,7 @@ import java.util.BitSet; import java.util.List; +@SuppressWarnings("all") public class ClassicWorldHeightInjection { public static PacketHandler handleJoinGame(final PacketHandler parentHandler) { @@ -47,10 +48,10 @@ public static PacketHandler handleJoinGame(final PacketHandler parentHandler) { if (wrapper.isCancelled()) return; if (ProtocolHack.getTargetVersion(wrapper.user().getChannel()).isOlderThanOrEqualTo(VersionEnum.c0_28toc0_30)) { - for (Tag dimension : wrapper.get(Type.NBT, 0).get("minecraft:dimension_type").get("value")) { + for (Tag dimension : wrapper.get(Type.NAMED_COMPOUND_TAG, 0).get("minecraft:dimension_type").get("value")) { changeDimensionTagHeight(wrapper.user(), ((CompoundTag) dimension).get("element")); } - changeDimensionTagHeight(wrapper.user(), wrapper.get(Type.NBT, 1)); + changeDimensionTagHeight(wrapper.user(), wrapper.get(Type.NAMED_COMPOUND_TAG, 1)); } }; } @@ -61,7 +62,7 @@ public static PacketHandler handleRespawn(final PacketHandler parentHandler) { if (wrapper.isCancelled()) return; if (ProtocolHack.getTargetVersion(wrapper.user().getChannel()).isOlderThanOrEqualTo(VersionEnum.c0_28toc0_30)) { - changeDimensionTagHeight(wrapper.user(), wrapper.get(Type.NBT, 0)); + changeDimensionTagHeight(wrapper.user(), wrapper.get(Type.NAMED_COMPOUND_TAG, 0)); } }; } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/access/IBoatEntity_1_8.java b/src/main/java/de/florianmichael/viafabricplus/injection/access/IBoatEntity_1_8.java new file mode 100644 index 000000000..b21b49f50 --- /dev/null +++ b/src/main/java/de/florianmichael/viafabricplus/injection/access/IBoatEntity_1_8.java @@ -0,0 +1,23 @@ +/* + * This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus + * Copyright (C) 2021-2023 FlorianMichael/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 . + */ +package de.florianmichael.viafabricplus.injection.access; + +public interface IBoatEntity_1_8 { + + void viafabricplus_setBoatEmpty(boolean boatEmpty); +} \ No newline at end of file diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinDownloadingTerrainScreenAndConnectScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinDownloadingTerrainScreenAndConnectScreen.java index 6626254c4..0fec7a789 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinDownloadingTerrainScreenAndConnectScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinDownloadingTerrainScreenAndConnectScreen.java @@ -29,7 +29,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -@SuppressWarnings("DataFlowIssue") +@SuppressWarnings("all") @Mixin(targets = { "net.minecraft.client.gui.screen.DownloadingTerrainScreen", "net.minecraft.client.gui.screen.ConnectScreen" }) public class MixinDownloadingTerrainScreenAndConnectScreen extends Screen { diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/classic4j/MixinCCAuthenticationResponse.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/classic4j/MixinCCAuthenticationResponse.java index 5805bd1d1..fe40ace45 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/classic4j/MixinCCAuthenticationResponse.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/classic4j/MixinCCAuthenticationResponse.java @@ -17,8 +17,8 @@ */ package de.florianmichael.viafabricplus.injection.mixin.classic4j; -import de.florianmichael.classic4j.model.classicube.highlevel.CCError; -import de.florianmichael.classic4j.request.classicube.auth.base.CCAuthenticationResponse; +import de.florianmichael.classic4j.model.classicube.CCAuthenticationResponse; +import de.florianmichael.classic4j.model.classicube.CCError; import de.florianmichael.viafabricplus.integration.Classic4JImpl; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -27,7 +27,7 @@ @Mixin(value = CCAuthenticationResponse.class, remap = false) public class MixinCCAuthenticationResponse { - @Redirect(method = "getErrorDisplay", at = @At(value = "FIELD", target = "Lde/florianmichael/classic4j/model/classicube/highlevel/CCError;description:Ljava/lang/String;")) + @Redirect(method = "getErrorDisplay", at = @At(value = "FIELD", target = "Lde/florianmichael/classic4j/model/classicube/CCError;description:Ljava/lang/String;")) public String mapTranslations(CCError instance) { return Classic4JImpl.fromError(instance).getString(); } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/compat/ipnext/MixinAutoRefillHandler_ItemSlotMonitor.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/compat/ipnext/MixinAutoRefillHandler_ItemSlotMonitor.java index 2ff6b0049..5210e78d4 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/compat/ipnext/MixinAutoRefillHandler_ItemSlotMonitor.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/compat/ipnext/MixinAutoRefillHandler_ItemSlotMonitor.java @@ -32,8 +32,9 @@ * * Fixes https://github.com/ViaVersion/ViaFabricPlus/issues/209 */ +@SuppressWarnings("all") @Pseudo -@Mixin(targets = "org.anti_ad.mc.ipnext.event.AutoRefillHandler$ItemSlotMonitor") +@Mixin(targets = "org.anti_ad.mc.ipnext.event.AutoRefillHandler$ItemSlotMonitor", remap = false) public class MixinAutoRefillHandler_ItemSlotMonitor { @Shadow diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/authlib/MixinKeyPairResponse.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/authlib/MixinKeyPairResponse.java index 546eb8c21..f2c7b0cb4 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/authlib/MixinKeyPairResponse.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/authlib/MixinKeyPairResponse.java @@ -8,7 +8,7 @@ import java.nio.ByteBuffer; -@Mixin(KeyPairResponse.class) +@Mixin(value = KeyPairResponse.class, remap = false) public class MixinKeyPairResponse implements IKeyPairResponse { @Unique @@ -19,4 +19,4 @@ public class MixinKeyPairResponse implements IKeyPairResponse { public ByteBuffer viafabricplus_getLegacyPublicKeySignature() { return this.viafabricplus_legacyKeySignature; } -} +} \ No newline at end of file diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinClientPlayNetworkHandler.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinClientPlayNetworkHandler.java index f822077da..8f26d6d26 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinClientPlayNetworkHandler.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinClientPlayNetworkHandler.java @@ -22,6 +22,7 @@ import de.florianmichael.viafabricplus.ViaFabricPlus; import de.florianmichael.viafabricplus.base.settings.groups.VisualSettings; import de.florianmichael.viafabricplus.definition.ClientsideFixes; +import de.florianmichael.viafabricplus.injection.access.IBoatEntity_1_8; import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.DownloadingTerrainScreen; @@ -136,7 +137,7 @@ public void closeDownloadingTerrain(PlayerPositionLookS2CPacket packet, Callback } } - @SuppressWarnings("InvalidInjectorMethodSignature") + @SuppressWarnings("all") @ModifyConstant(method = "onEntityPassengersSet", constant = @Constant(classValue = BoatEntity.class)) public Class dontChangePlayerYaw(Object entity, Class constant) { if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_18_2)) { @@ -145,6 +146,16 @@ public Class dontChangePlayerYaw(Object entity, Class constant) { return constant; } + @Inject(method = "onEntityPassengersSet", at = @At("RETURN")) + private void handle1_8BoatPassengers(EntityPassengersSetS2CPacket packet, CallbackInfo ci) { + if (!ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) return; + + final var entity = this.world.getEntityById(packet.getId()); + if (entity instanceof IBoatEntity_1_8 boatEntity) { + boatEntity.viafabricplus_setBoatEmpty(packet.getPassengerIds().length == 0); + } + } + @WrapWithCondition(method = "onPlayerList", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V", remap = false)) public boolean removeWarning(Logger instance, String s, Object o) { return ProtocolHack.getTargetVersion().isNewerThanOrEqualTo(VersionEnum.r1_19_3); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinClientPlayerInteractionManager.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinClientPlayerInteractionManager.java index e331fa7e2..39ed8dcfc 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinClientPlayerInteractionManager.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinClientPlayerInteractionManager.java @@ -21,6 +21,7 @@ import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; +import de.florianmichael.viafabricplus.ViaFabricPlus; import de.florianmichael.viafabricplus.definition.ClientPlayerInteractionManager1_18_2; import net.minecraft.client.network.SequencedPacketCreator; import net.minecraft.client.world.ClientWorld; @@ -129,29 +130,20 @@ else if (clickSlot.getSlot() < 0 || clickSlot.getSlot() >= viafabricplus_oldItem else slotItemBeforeModification = viafabricplus_oldItems.get(clickSlot.getSlot()); - final UserConnection userConnection = networkHandler.getConnection().channel.attr(ProtocolHack.LOCAL_VIA_CONNECTION).get(); - final short syncId = (short) clickSlot.getSyncId(); - final short slot = (short) clickSlot.getSlot(); - final byte button = (byte) clickSlot.getButton(); - final short lastActionId = ((IScreenHandler) client.player.currentScreenHandler).viafabricplus_getAndIncrementLastActionId(); - final int actionType = clickSlot.getActionType().ordinal(); - final Item item = ItemTranslator.MC_TO_VIA_LATEST_TO_TARGET(slotItemBeforeModification, VersionEnum.r1_16); - - userConnection.getChannel().eventLoop().submit(() -> { - final PacketWrapper clickSlotPacket = PacketWrapper.create(ServerboundPackets1_16_2.CLICK_WINDOW, userConnection); - - clickSlotPacket.write(Type.UNSIGNED_BYTE, syncId); - clickSlotPacket.write(Type.SHORT, slot); - clickSlotPacket.write(Type.BYTE, button); - clickSlotPacket.write(Type.SHORT, lastActionId); - clickSlotPacket.write(Type.VAR_INT, actionType); - clickSlotPacket.write(Type.FLAT_VAR_INT_ITEM, item); - - try { - clickSlotPacket.sendToServer(Protocol1_17To1_16_4.class); - } catch (Exception ignored) { - } - }); + final var clickSlotPacket = PacketWrapper.create(ServerboundPackets1_16_2.CLICK_WINDOW, networkHandler.getConnection().channel.attr(ProtocolHack.LOCAL_VIA_CONNECTION).get()); + + clickSlotPacket.write(Type.UNSIGNED_BYTE, (short) clickSlot.getSyncId()); + clickSlotPacket.write(Type.SHORT, (short) clickSlot.getSlot()); + clickSlotPacket.write(Type.BYTE, (byte) clickSlot.getButton()); + clickSlotPacket.write(Type.SHORT, ((IScreenHandler) client.player.currentScreenHandler).viafabricplus_getAndIncrementLastActionId()); + clickSlotPacket.write(Type.VAR_INT, clickSlot.getActionType().ordinal()); + clickSlotPacket.write(Type.FLAT_VAR_INT_ITEM, ItemTranslator.MC_TO_VIA_LATEST_TO_TARGET(slotItemBeforeModification, VersionEnum.r1_16)); + + try { + clickSlotPacket.sendToServer(Protocol1_17To1_16_4.class); + } catch (Exception e) { + ViaFabricPlus.LOGGER.error("Failed to send Click Slot Packet", e); + } viafabricplus_oldCursorStack = null; viafabricplus_oldItems = null; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinMinecraftClient.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinMinecraftClient.java index 2c3b0e389..e83f7ea18 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinMinecraftClient.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinMinecraftClient.java @@ -24,6 +24,7 @@ import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.protocols.protocol1_12to1_11_1.Protocol1_12To1_11_1; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3; +import de.florianmichael.viafabricplus.ViaFabricPlus; import de.florianmichael.viafabricplus.injection.access.IMinecraftClient; import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; import de.florianmichael.viafabricplus.base.settings.groups.DebugSettings; @@ -54,7 +55,8 @@ public abstract class MixinMinecraftClient implements IMinecraftClient { @Nullable public ClientPlayerEntity player; - @Shadow protected int attackCooldown; + @Shadow + public int attackCooldown; @Shadow @Nullable public abstract ClientPlayNetworkHandler getNetworkHandler(); @@ -127,14 +129,14 @@ private void onInventoryKeyPressed(CallbackInfo ci) { final UserConnection userConnection = ProtocolHack.getMainUserConnection(); if (userConnection != null && userConnection.getProtocolInfo().getPipeline().contains(Protocol1_12To1_11_1.class)) { - userConnection.getChannel().eventLoop().submit(() -> { - final PacketWrapper clientStatus = PacketWrapper.create(ServerboundPackets1_9_3.CLIENT_STATUS, userConnection); - clientStatus.write(Type.VAR_INT, 2); // Open Inventory Achievement - - try { - clientStatus.sendToServer(Protocol1_12To1_11_1.class); - } catch (Exception ignored) {} - }); + final PacketWrapper clientStatus = PacketWrapper.create(ServerboundPackets1_9_3.CLIENT_STATUS, userConnection); + clientStatus.write(Type.VAR_INT, 2); // Open Inventory Achievement + + try { + clientStatus.sendToServer(Protocol1_12To1_11_1.class); + } catch (Exception e) { + ViaFabricPlus.LOGGER.error("Failed to send Open Inventory Packet", e); + } } } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinBoatEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinBoatEntity.java index 27c06e001..8d00eef47 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinBoatEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinBoatEntity.java @@ -1,20 +1,326 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity; +import de.florianmichael.viafabricplus.base.settings.groups.ExperimentalSettings; +import de.florianmichael.viafabricplus.injection.access.IBoatEntity_1_8; import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import net.minecraft.block.Block; +import net.minecraft.block.Blocks; +import net.minecraft.entity.*; import net.minecraft.entity.vehicle.BoatEntity; +import net.minecraft.particle.ParticleTypes; +import net.minecraft.registry.tag.FluidTags; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Box; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; import net.raphimc.vialoader.util.VersionEnum; +import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.Constant; -import org.spongepowered.asm.mixin.injection.ModifyConstant; +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; @Mixin(BoatEntity.class) -public class MixinBoatEntity { +public abstract class MixinBoatEntity extends Entity implements IBoatEntity_1_8 { - @ModifyConstant(method = "getMountedHeightOffset", constant = @Constant(doubleValue = 0.25)) - public double modifyConstant(double constant) { - if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_4)) { - return 0.3; + @Shadow + private double x; + + @Shadow + private double y; + + @Shadow + private double z; + + @Shadow + private double boatYaw; + + @Shadow + private double boatPitch; + + @Shadow + public abstract int getDamageWobbleTicks(); + + @Shadow + public abstract void setDamageWobbleTicks(int wobbleTicks); + + @Shadow + public abstract float getDamageWobbleStrength(); + + @Shadow + public abstract void setDamageWobbleStrength(float wobbleStrength); + + @Shadow + public abstract @Nullable LivingEntity getControllingPassenger(); + + @Shadow + private BoatEntity.Location location; + + public MixinBoatEntity(EntityType type, World world) { + super(type, world); + } + + @Unique + private boolean viafabricplus_boatEmpty = true; + + @Unique + private double viafabricplus_speedMultiplier = 0.07; + + @Unique + private int viafabricplus_boatPosRotationIncrements; + + @Unique + private double viafabricplus_velocityX; + + @Unique + private double viafabricplus_velocityY; + + @Unique + private double viafabricplus_velocityZ; + + @Inject(method = "pushAwayFrom", at = @At("HEAD"), cancellable = true) + private void onPushAwayFrom(Entity entity, CallbackInfo ci) { + if (this.viafabricplus_boatMovementEmulation()) { + super.pushAwayFrom(entity); + ci.cancel(); + } + } + + @Inject(method = "updateTrackedPositionAndAngles", at = @At("HEAD"), cancellable = true) + private void onUpdateTrackedPositionAndAngles(double x, double y, double z, float yaw, float pitch, int interpolationSteps, boolean interpolate, CallbackInfo ci) { + if (this.viafabricplus_boatMovementEmulation()) { + if (hasPassengers()) { + this.prevX = x; + this.prevY = y; + this.prevZ = z; + this.viafabricplus_boatPosRotationIncrements = 0; + setPosition(x, y, z); + setRotation(yaw, pitch); + setVelocity(Vec3d.ZERO); + viafabricplus_velocityX = viafabricplus_velocityY = viafabricplus_velocityZ = 0; + } else { + if (viafabricplus_boatEmpty) { + viafabricplus_boatPosRotationIncrements = interpolationSteps + 5; + } else { + if (squaredDistanceTo(x, y, z) <= 1) { + return; + } + viafabricplus_boatPosRotationIncrements = 3; + } + + this.x = x; + this.y = y; + this.z = z; + this.boatYaw = yaw; + this.boatPitch = pitch; + setVelocity(viafabricplus_velocityX, viafabricplus_velocityY, viafabricplus_velocityZ); + } + ci.cancel(); } - return constant; } -} + + @Override + public void setVelocityClient(double x, double y, double z) { + super.setVelocityClient(x, y, z); + viafabricplus_velocityX = x; + viafabricplus_velocityY = y; + viafabricplus_velocityZ = z; + } + + @Inject(method = "tick", at = @At("HEAD"), cancellable = true) + private void onTick(CallbackInfo ci) { + if (this.viafabricplus_boatMovementEmulation()) { + super.tick(); + + if (getDamageWobbleTicks() > 0) { + setDamageWobbleTicks(getDamageWobbleTicks() - 1); + } + if (getDamageWobbleStrength() > 0) { + setDamageWobbleStrength(getDamageWobbleStrength() - 1); + } + prevX = getX(); + prevY = getY(); + prevZ = getZ(); + + // calculate how submerged in water the boat is + final int yPartitions = 5; + double percentSubmerged = 0; + for (int partitionIndex = 0; partitionIndex < yPartitions; partitionIndex++) { + double minY = getBoundingBox().minY + getBoundingBox().getYLength() * partitionIndex / yPartitions - 0.125; + double maxY = getBoundingBox().minY + getBoundingBox().getYLength() * (partitionIndex + 1) / yPartitions - 0.125; + Box box = new Box(getBoundingBox().minX, minY, getBoundingBox().minZ, getBoundingBox().maxX, maxY, getBoundingBox().maxZ); + if (BlockPos.stream(box).anyMatch(pos -> getWorld().getFluidState(pos).isIn(FluidTags.WATER))) { + percentSubmerged += 1.0 / yPartitions; + } + } + + // spawn boat movement splash particles + double oldHorizontalSpeed = Math.sqrt(getVelocity().x * getVelocity().x + getVelocity().z * getVelocity().z); + if (oldHorizontalSpeed > 0.2975) { + double rx = Math.cos(getYaw() * Math.PI / 180); + double rz = Math.sin(getYaw() * Math.PI / 180); + for (int i = 0; i < 1 + oldHorizontalSpeed * 60; i++) { + double dForward = random.nextFloat() * 2 - 1; + double dSideways = (random.nextInt(2) * 2 - 1) * 0.7; + if (random.nextBoolean()) { + // particles on the side of the boat + double x = getX() - rx * dForward * 0.8 + rz * dSideways; + double z = getZ() - rz * dForward * 0.8 - rx * dSideways; + getWorld().addParticle(ParticleTypes.SPLASH, x, getY() - 0.125, z, getVelocity().x, getVelocity().y, getVelocity().z); + } else { + // particles trailing behind the boat + double x = getX() + rx + rz * dForward * 0.7; + double z = getZ() + rz - rx * dForward * 0.7; + getWorld().addParticle(ParticleTypes.SPLASH, x, getY() - 0.125, z, getVelocity().x, getVelocity().y, getVelocity().z); + } + } + } + + if (viafabricplus_boatEmpty) { + if (viafabricplus_boatPosRotationIncrements > 0) { + double newX = getX() + (this.x - getX()) / viafabricplus_boatPosRotationIncrements; + double newY = getY() + (this.y - getY()) / viafabricplus_boatPosRotationIncrements; + double newZ = getZ() + (this.z - getZ()) / viafabricplus_boatPosRotationIncrements; + double newYaw = this.getYaw() + (this.boatYaw - this.getYaw()) / viafabricplus_boatPosRotationIncrements; + double newPitch = this.getPitch() + (this.boatPitch - this.getPitch()) / viafabricplus_boatPosRotationIncrements; + viafabricplus_boatPosRotationIncrements--; + setPosition(newX, newY, newZ); + setRotation((float) newYaw, (float) newPitch); + } else { + setPosition(getX() + getVelocity().x, getY() + getVelocity().y, getZ() + getVelocity().z); + if (isOnGround()) { + setVelocity(getVelocity().multiply(0.5)); + } + setVelocity(getVelocity().multiply(0.99, 0.95, 0.99)); + } + } else { + if (percentSubmerged < 1) { + double normalizedDistanceFromMiddle = percentSubmerged * 2 - 1; + setVelocity(getVelocity().add(0, 0.04 * normalizedDistanceFromMiddle, 0)); + } else { + if (getVelocity().y < 0) { + setVelocity(getVelocity().multiply(1, 0.5, 1)); + } + setVelocity(getVelocity().add(0, 0.007, 0)); + } + + if (getControllingPassenger() != null) { + final LivingEntity passenger = getControllingPassenger(); + + float boatAngle = passenger.getYaw() - passenger.sidewaysSpeed * 90; + double xAcceleration = -Math.sin(boatAngle * Math.PI / 180) * viafabricplus_speedMultiplier * passenger.forwardSpeed * 0.05; + double zAcceleration = Math.cos(boatAngle * Math.PI / 180) * viafabricplus_speedMultiplier * passenger.forwardSpeed * 0.05; + setVelocity(getVelocity().add(xAcceleration, 0, zAcceleration)); + } + + double newHorizontalSpeed = Math.sqrt(getVelocity().x * getVelocity().x + getVelocity().z * getVelocity().z); + // cap horizontal speed at 0.35 + if (newHorizontalSpeed > 0.35) { + double multiplier = 0.35 / newHorizontalSpeed; + setVelocity(getVelocity().multiply(multiplier, 1, multiplier)); + newHorizontalSpeed = 0.35; + } + + if (newHorizontalSpeed > oldHorizontalSpeed && viafabricplus_speedMultiplier < 0.35) { + viafabricplus_speedMultiplier += (0.35 - viafabricplus_speedMultiplier) / 35; + if (viafabricplus_speedMultiplier > 0.35) { + viafabricplus_speedMultiplier = 0.35; + } + } else { + viafabricplus_speedMultiplier -= (viafabricplus_speedMultiplier - 0.07) / 35; + if (viafabricplus_speedMultiplier < 0.07) { + viafabricplus_speedMultiplier = 0.07; + } + } + + for (int i = 0; i < 4; i++) { + int dx = MathHelper.floor(getX() + ((i % 2) - 0.5) * 0.8); + //noinspection IntegerDivisionInFloatingPointContext + int dz = MathHelper.floor(getZ() + ((i / 2) - 0.5) * 0.8); + for (int ddy = 0; ddy < 2; ddy++) { + int dy = MathHelper.floor(getY()) + ddy; + BlockPos pos = new BlockPos(dx, dy, dz); + Block block = getWorld().getBlockState(pos).getBlock(); + if (block == Blocks.SNOW) { + getWorld().setBlockState(pos, Blocks.AIR.getDefaultState()); + horizontalCollision = false; + } else if (block == Blocks.LILY_PAD) { + getWorld().breakBlock(pos, true); + horizontalCollision = false; + } + } + } + + if (isOnGround()) { + setVelocity(getVelocity().multiply(0.5)); + } + + move(MovementType.SELF, getVelocity()); + + if (!horizontalCollision || oldHorizontalSpeed <= 0.2975) { + setVelocity(getVelocity().multiply(0.99, 0.95, 0.99)); + } + + setPitch(0); + double deltaX = prevX - getX(); + double deltaZ = prevZ - getZ(); + if (deltaX * deltaX + deltaZ * deltaZ > 0.001) { + setYaw(MathHelper.clampAngle(getYaw(), (float) (MathHelper.atan2(deltaZ, deltaX) * 180 / Math.PI), 20)); + } + + } + + ci.cancel(); + } + } + + @Inject(method = "updatePassengerPosition", at = @At("HEAD"), cancellable = true) + private void onUpdatePassengerPosition(Entity passenger, PositionUpdater positionUpdater, CallbackInfo ci) { + if (this.viafabricplus_boatMovementEmulation()) { + if (hasPassenger(passenger)) { + double dx = Math.cos(this.getYaw() * Math.PI / 180) * 0.4; + double dz = Math.sin(this.getYaw() * Math.PI / 180) * 0.4; + passenger.setPosition(getX() + dx, getY() - 0.3, getZ() + dz); + } + ci.cancel(); + } + } + + @Inject(method = "onPassengerLookAround", at = @At("HEAD"), cancellable = true) + private void onOnPassengerLookAround(Entity passenger, CallbackInfo ci) { + if (this.viafabricplus_boatMovementEmulation()) { + // don't prevent entities looking around in the boat + super.onPassengerLookAround(passenger); + ci.cancel(); + } + } + + @Inject(method = "fall", at = @At("HEAD")) + private void onFall(CallbackInfo ci) { + if (this.viafabricplus_boatMovementEmulation()) { + // prevent falling from being negated + location = BoatEntity.Location.ON_LAND; + } + } + + @Inject(method = "canAddPassenger", at = @At("HEAD"), cancellable = true) + private void onCanAddPassenger(Entity passenger, CallbackInfoReturnable ci) { + if (this.viafabricplus_boatMovementEmulation()) { + // only one entity can ride a boat at a time + ci.setReturnValue(super.canAddPassenger(passenger)); + } + } + + @Unique + private boolean viafabricplus_boatMovementEmulation() { + return ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8) && ExperimentalSettings.INSTANCE.emulateBoatMovement.getValue(); + } + + @Override + public void viafabricplus_setBoatEmpty(boolean boatEmpty) { + viafabricplus_boatEmpty = boatEmpty; + } +} \ No newline at end of file diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinEntityModels.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinEntityModels.java new file mode 100644 index 000000000..42ddca247 --- /dev/null +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinEntityModels.java @@ -0,0 +1,36 @@ +/* + * This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus + * Copyright (C) 2021-2023 FlorianMichael/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 . + */ +package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity; + +import com.google.common.collect.ImmutableMap; +import de.florianmichael.viafabricplus.definition.boat.BoatModel_1_8; +import net.minecraft.client.model.TexturedModelData; +import net.minecraft.client.render.entity.model.EntityModelLayer; +import net.minecraft.client.render.entity.model.EntityModels; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyVariable; + +@Mixin(EntityModels.class) +public class MixinEntityModels { + + @ModifyVariable(method = "getModels", at = @At(value = "STORE", ordinal = 0), ordinal = 0) + private static ImmutableMap.Builder addBoatModel(ImmutableMap.Builder builder) { + return builder.put(BoatModel_1_8.MODEL_LAYER, BoatModel_1_8.getTexturedModelData()); + } +} \ No newline at end of file diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinEntityRenderDispatcher.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinEntityRenderDispatcher.java new file mode 100644 index 000000000..62fdaec42 --- /dev/null +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinEntityRenderDispatcher.java @@ -0,0 +1,58 @@ +/* + * This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus + * Copyright (C) 2021-2023 FlorianMichael/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 . + */ +package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity; + +import de.florianmichael.viafabricplus.base.settings.groups.ExperimentalSettings; +import de.florianmichael.viafabricplus.definition.boat.BoatRenderer_1_8; +import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import net.minecraft.client.render.entity.EntityRenderDispatcher; +import net.minecraft.client.render.entity.EntityRenderer; +import net.minecraft.client.render.entity.EntityRendererFactory; +import net.minecraft.entity.Entity; +import net.minecraft.entity.vehicle.BoatEntity; +import net.minecraft.resource.ResourceManager; +import net.raphimc.vialoader.util.VersionEnum; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; + +@Mixin(EntityRenderDispatcher.class) +public class MixinEntityRenderDispatcher { + + @Unique + public BoatRenderer_1_8 viafabricplus_boatRenderer; + + @SuppressWarnings("unchecked") + @Inject(method = "getRenderer", at = @At("HEAD"), cancellable = true) + private void onGetRenderer(T entity, CallbackInfoReturnable> ci) { + if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8) && ExperimentalSettings.INSTANCE.emulateBoatMovement.getValue() && entity instanceof BoatEntity) { + ci.setReturnValue((EntityRenderer) viafabricplus_boatRenderer); + } + } + + @Inject(method = "reload", at = @At("TAIL"), locals = LocalCapture.CAPTURE_FAILHARD) + private void onReload(ResourceManager manager, CallbackInfo ci, EntityRendererFactory.Context context) { + if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8) && ExperimentalSettings.INSTANCE.emulateBoatMovement.getValue()) { + viafabricplus_boatRenderer = new BoatRenderer_1_8(context); + } + } +} \ No newline at end of file diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinHeldItemRenderer.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinHeldItemRenderer.java index fa655c0d3..ef70e2713 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinHeldItemRenderer.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinHeldItemRenderer.java @@ -23,6 +23,7 @@ */ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item; +import de.florianmichael.viafabricplus.base.settings.groups.VisualSettings; import net.minecraft.util.Arm; import net.raphimc.vialoader.util.VersionEnum; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; @@ -56,7 +57,7 @@ private void transformLegacyBlockAnimations(AbstractClientPlayerEntity player, f if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) { matrices.translate(-0.1F, 0.05F, 0.0F); - if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_7_6tor1_7_10)) { + if (VisualSettings.INSTANCE.blockHitAnimation.isEnabled()) { final var arm = (hand == Hand.MAIN_HAND) ? player.getMainArm() : player.getMainArm().getOpposite(); applySwingOffset(matrices, arm, swingProgress); } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinScreen.java index d3a8539c6..73a519a8d 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinScreen.java @@ -30,6 +30,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +@SuppressWarnings("all") @Mixin(Screen.class) public class MixinScreen { diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/vialegacy/MixinProtocolc0_30toc0_30cpe.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/vialegacy/MixinProtocolc0_30toc0_30cpe.java index f805dd23c..df7fe7188 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/vialegacy/MixinProtocolc0_30toc0_30cpe.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/vialegacy/MixinProtocolc0_30toc0_30cpe.java @@ -21,7 +21,8 @@ import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; 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 de.florianmichael.viafabricplus.definition.classic.CustomClassicProtocolExtensions; import de.florianmichael.viafabricplus.definition.classic.model.WeatherTypes; import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.ClientboundPacketsc0_28; @@ -46,16 +47,16 @@ public void register() { wrapper.cancel(); final byte weatherType = wrapper.read(Type.BYTE); - final PacketWrapper changeRainState = PacketWrapper.create(ClientboundPackets1_19_3.GAME_EVENT, wrapper.user()); + final PacketWrapper changeRainState = PacketWrapper.create(ClientboundPackets1_19_4.GAME_EVENT, wrapper.user()); changeRainState.write(Type.BYTE, weatherType == WeatherTypes.SUNNY ? (byte) 2 : (byte) 1); // start raining changeRainState.write(Type.FLOAT, 0F); // unused - changeRainState.sendRaw(); + changeRainState.send(Protocol1_19_4To1_19_3.class); if (weatherType == WeatherTypes.RAINING || weatherType == WeatherTypes.SNOWING) { - final PacketWrapper changeRainType = PacketWrapper.create(ClientboundPackets1_19_3.GAME_EVENT, wrapper.user()); + final PacketWrapper changeRainType = PacketWrapper.create(ClientboundPackets1_19_4.GAME_EVENT, wrapper.user()); changeRainType.write(Type.BYTE, (byte) 7); changeRainType.write(Type.FLOAT, weatherType == WeatherTypes.RAINING ? 0F : 1F); - changeRainType.sendRaw(); + changeRainType.send(Protocol1_19_4To1_19_3.class); } }); } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinNBTType.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinNamedCompoundTagType.java similarity index 93% rename from src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinNBTType.java rename to src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinNamedCompoundTagType.java index 900ffc7b4..4a8b619f2 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinNBTType.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinNamedCompoundTagType.java @@ -17,15 +17,15 @@ */ package de.florianmichael.viafabricplus.injection.mixin.fixes.viaversion; -import com.viaversion.viaversion.api.type.types.minecraft.NBTType; +import com.viaversion.viaversion.api.type.types.minecraft.NamedCompoundTagType; import com.viaversion.viaversion.libs.opennbt.tag.limiter.TagLimiter; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; -@Mixin(value = NBTType.class, remap = false) -public class MixinNBTType { +@Mixin(value = NamedCompoundTagType.class, remap = false) +public class MixinNamedCompoundTagType { @Unique private static final TagLimiter viafabricplus_tag_limiter = new TagLimiter() { diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinProtocolVersion.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinProtocolVersion.java index 66f0ebcd5..8296541bc 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinProtocolVersion.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinProtocolVersion.java @@ -46,6 +46,7 @@ private static void initMaps(CallbackInfo ci) { viafabricplus_remaps.put("1.18/1.18.1", new Pair<>("1.18-1.18.1", null)); viafabricplus_remaps.put("1.19.1/2", new Pair<>("1.19.1-1.19.2", null)); viafabricplus_remaps.put("1.20/1.20.1", new Pair<>("1.20-1.20.1", null)); + viafabricplus_remaps.put("1.20.3", new Pair<>("23w41a", null)); } @Redirect(method = "", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;register(ILjava/lang/String;)Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;")) @@ -58,7 +59,7 @@ private static ProtocolVersion unregisterAndRenameVersions(int version, String n return ProtocolVersion.register(version, name); } - @SuppressWarnings({"UnresolvedMixinReference", "MixinAnnotationTarget", "InvalidInjectorMethodSignature"}) // Optional injection + @SuppressWarnings({"all"}) // Optional injection @Redirect(method = "", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;register(IILjava/lang/String;)Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;"), require = 0) private static ProtocolVersion unregisterAndRenameVersions(int version, int snapshotVersion, String name) { final Pair remapEntry = viafabricplus_remaps.get(name); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/protocol1_19_3to1_19_1/MixinProtocol1_19_3To1_19_1.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/protocol1_19_3to1_19_1/MixinProtocol1_19_3To1_19_1.java index fb66a6857..a877f59f2 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/protocol1_19_3to1_19_1/MixinProtocol1_19_3To1_19_1.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/protocol1_19_3to1_19_1/MixinProtocol1_19_3To1_19_1.java @@ -49,12 +49,6 @@ @Mixin(value = Protocol1_19_3To1_19_1.class, remap = false) public class MixinProtocol1_19_3To1_19_1 extends AbstractProtocol { - @Unique - private final static ByteArrayType.OptionalByteArrayType OPTIONAL_MESSAGE_SIGNATURE_BYTES_TYPE = new ByteArrayType.OptionalByteArrayType(256); - - @Unique - private final static ByteArrayType MESSAGE_SIGNATURE_BYTES_TYPE = new ByteArrayType(256); - @Unique private final static BitSetType ACKNOWLEDGED_BIT_SET_TYPE = new BitSetType(20); @@ -125,12 +119,12 @@ public void register() { for (int i = 0; i < signatures; i++) { if (signingEnabled) { wrapper.read(Type.STRING); // Argument name - wrapper.read(MESSAGE_SIGNATURE_BYTES_TYPE); // Signature + wrapper.read(Type.SIGNATURE_BYTES); // Signature } else { wrapper.passthrough(Type.STRING); // Argument name // Signature - wrapper.read(MESSAGE_SIGNATURE_BYTES_TYPE); + wrapper.read(Type.SIGNATURE_BYTES); wrapper.write(Type.BYTE_ARRAY_PRIMITIVE, new byte[0]); } } @@ -169,7 +163,7 @@ public void register() { map(Type.STRING); // Command map(Type.LONG); // Timestamp map(Type.LONG); // Salt - read(OPTIONAL_MESSAGE_SIGNATURE_BYTES_TYPE); // Signature + read(Type.OPTIONAL_SIGNATURE_BYTES); // Signature handler(wrapper -> { final ChatSession1_19_2 chatSession1192 = wrapper.user().get(ChatSession1_19_2.class); final ReceivedMessagesStorage messagesStorage = wrapper.user().get(ReceivedMessagesStorage.class); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/jsonwebtoken/MixinDefaultCompressionCodecResolver.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/jsonwebtoken/MixinDefaultCompressionCodecResolver.java deleted file mode 100644 index 2184b8617..000000000 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/jsonwebtoken/MixinDefaultCompressionCodecResolver.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus - * Copyright (C) 2021-2023 FlorianMichael/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 . - */ -package de.florianmichael.viafabricplus.injection.mixin.jsonwebtoken; - -import io.jsonwebtoken.impl.compression.DefaultCompressionCodecResolver; -import io.jsonwebtoken.impl.compression.DeflateCompressionCodec; -import io.jsonwebtoken.impl.compression.GzipCompressionCodec; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -import java.util.Arrays; -import java.util.List; - -/* - * JsonWebToken is used by MinecraftAuth and since it's using Java services, it's not working with the fabric loader - * So we have to change all services usages by using the normal Java API - */ -@Mixin(value = DefaultCompressionCodecResolver.class, remap = false) -public class MixinDefaultCompressionCodecResolver { - - @Redirect(method = "", at = @At(value = "INVOKE", target = "Lio/jsonwebtoken/impl/lang/Services;loadAll(Ljava/lang/Class;)Ljava/util/List;")) - public List removeServicesSupport(Class implementations) { - return Arrays.asList(new GzipCompressionCodec(), new DeflateCompressionCodec()); - } -} diff --git a/src/main/java/de/florianmichael/viafabricplus/integration/Classic4JImpl.java b/src/main/java/de/florianmichael/viafabricplus/integration/Classic4JImpl.java index beeba07d6..8b4681767 100644 --- a/src/main/java/de/florianmichael/viafabricplus/integration/Classic4JImpl.java +++ b/src/main/java/de/florianmichael/viafabricplus/integration/Classic4JImpl.java @@ -19,7 +19,7 @@ import com.mojang.authlib.exceptions.AuthenticationException; import de.florianmichael.classic4j.api.JoinServerInterface; -import de.florianmichael.classic4j.model.classicube.highlevel.CCError; +import de.florianmichael.classic4j.model.classicube.CCError; import net.minecraft.client.MinecraftClient; import net.minecraft.text.Text; diff --git a/src/main/java/de/florianmichael/viafabricplus/mappings/PackFormatsMappings.java b/src/main/java/de/florianmichael/viafabricplus/mappings/PackFormatsMappings.java index 659e29c92..551a2c8cb 100644 --- a/src/main/java/de/florianmichael/viafabricplus/mappings/PackFormatsMappings.java +++ b/src/main/java/de/florianmichael/viafabricplus/mappings/PackFormatsMappings.java @@ -18,7 +18,6 @@ package de.florianmichael.viafabricplus.mappings; import net.raphimc.vialoader.util.VersionEnum; -import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; import net.minecraft.GameVersion; import net.minecraft.SaveVersion; @@ -33,6 +32,8 @@ public class PackFormatsMappings { private final static Map protocolMap = new HashMap<>(); public static void load() { + registerVersion(VersionEnum.r1_20_3, 18, "23w41a"); + registerVersion(VersionEnum.r1_20_2, 18, "1.20.2"); registerVersion(VersionEnum.r1_20tor1_20_1, 15, "1.20.1"); // 1.20 and 1.20.1 are the same, why care... registerVersion(VersionEnum.r1_19_4, 13, "1.19.4"); registerVersion(VersionEnum.r1_19_3, 12, "1.19.3"); diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/platform/ViaFabricPlusViaVersionPlatformImpl.java b/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/platform/ViaFabricPlusViaVersionPlatformImpl.java index f17fb09a5..c265ed58c 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/platform/ViaFabricPlusViaVersionPlatformImpl.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/platform/ViaFabricPlusViaVersionPlatformImpl.java @@ -32,7 +32,7 @@ public ViaFabricPlusViaVersionPlatformImpl(File rootFolder) { @Override protected AbstractViaConfig createConfig() { final AbstractViaConfig config = new ViaFabricPlusVLViaConfig(new File(this.getDataFolder(), "viaversion.yml")); - config.reloadConfig(); + config.reload(); return config; } } diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/netty/viaversion/ViaFabricPlusViaDecoder.java b/src/main/java/de/florianmichael/viafabricplus/protocolhack/netty/viaversion/ViaFabricPlusViaDecoder.java index 76c3b12ac..3b601b22a 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/netty/viaversion/ViaFabricPlusViaDecoder.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocolhack/netty/viaversion/ViaFabricPlusViaDecoder.java @@ -22,6 +22,7 @@ import de.florianmichael.viafabricplus.base.settings.groups.GeneralSettings; import de.florianmichael.viafabricplus.util.ChatUtil; import io.netty.channel.ChannelHandlerContext; +import net.minecraft.text.Text; import net.minecraft.util.Formatting; import net.raphimc.vialoader.netty.ViaDecoder; @@ -41,7 +42,7 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception } catch (Throwable t) { ViaFabricPlus.LOGGER.error("Error occurred while decoding packet in ViaDecoder", t); if (mode == 1) { - ChatUtil.sendPrefixedMessage(Formatting.RED + "An error occurred while decoding a packet! See more details in the logs!"); + ChatUtil.sendPrefixedMessage(Text.literal("An error occurred while decoding a packet! See more details in the logs!").formatted(Formatting.RED)); } } return; diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/provider/vialegacy/ViaFabricPlusClassicMPPassProvider.java b/src/main/java/de/florianmichael/viafabricplus/protocolhack/provider/vialegacy/ViaFabricPlusClassicMPPassProvider.java index ac1b45d97..e1329b96a 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/provider/vialegacy/ViaFabricPlusClassicMPPassProvider.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocolhack/provider/vialegacy/ViaFabricPlusClassicMPPassProvider.java @@ -18,7 +18,8 @@ package de.florianmichael.viafabricplus.protocolhack.provider.vialegacy; import com.viaversion.viaversion.api.connection.UserConnection; -import de.florianmichael.classic4j.JSPBetaCraftHandler; +import de.florianmichael.classic4j.BetaCraftHandler; +import de.florianmichael.viafabricplus.ViaFabricPlus; import de.florianmichael.viafabricplus.integration.Classic4JImpl; import de.florianmichael.viafabricplus.base.settings.groups.AuthenticationSettings; import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.providers.ClassicMPPassProvider; @@ -30,11 +31,17 @@ public class ViaFabricPlusClassicMPPassProvider extends ClassicMPPassProvider { @Override public String getMpPass(UserConnection user) { - if (classiCubeMPPass != null) return classiCubeMPPass; + if (classiCubeMPPass != null) { + return classiCubeMPPass; + } if (AuthenticationSettings.INSTANCE.useBetaCraftAuthentication.getValue()) { final HandshakeStorage handshakeStorage = user.get(HandshakeStorage.class); - return JSPBetaCraftHandler.requestMPPass(user.getProtocolInfo().getUsername(), handshakeStorage.getHostname(), handshakeStorage.getPort(), Classic4JImpl.JOIN_SERVER_CALL); + if (handshakeStorage == null) { + return super.getMpPass(user); + } + return BetaCraftHandler.requestMPPass(user.getProtocolInfo().getUsername(), handshakeStorage.getHostname(), handshakeStorage.getPort(), Classic4JImpl.JOIN_SERVER_CALL, throwable -> + ViaFabricPlus.LOGGER.error("Error occurred while requesting the MP-Pass to verify session", throwable)); } else { return super.getMpPass(user); } diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/util/BlockStateTranslator.java b/src/main/java/de/florianmichael/viafabricplus/protocolhack/util/BlockStateTranslator.java index d42688559..2d6c0b5e3 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/util/BlockStateTranslator.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocolhack/util/BlockStateTranslator.java @@ -27,6 +27,7 @@ import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.connection.UserConnectionImpl; import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18; +import de.florianmichael.viafabricplus.ViaFabricPlus; import io.netty.buffer.Unpooled; import net.minecraft.SharedConstants; import net.minecraft.network.PacketByteBuf; @@ -53,7 +54,7 @@ public static int translateBlockState1_18(int oldId) { wrapper.read(Type.POSITION1_14); return wrapper.read(Type.VAR_INT); } catch (Exception e) { - e.printStackTrace(); + ViaFabricPlus.LOGGER.error("Failed to translate block state " + oldId + " to 1.18.2", e); } return oldId; diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/util/ItemTranslator.java b/src/main/java/de/florianmichael/viafabricplus/protocolhack/util/ItemTranslator.java index 080883ec9..e083eeb9e 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/util/ItemTranslator.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocolhack/util/ItemTranslator.java @@ -27,6 +27,7 @@ import com.viaversion.viaversion.connection.UserConnectionImpl; import com.viaversion.viaversion.protocol.packet.PacketWrapperImpl; import com.viaversion.viaversion.protocols.protocol1_9to1_8.storage.InventoryTracker; +import de.florianmichael.viafabricplus.ViaFabricPlus; import io.netty.buffer.Unpooled; import net.minecraft.SharedConstants; import net.minecraft.item.ItemStack; @@ -68,7 +69,7 @@ public static Item MC_TO_VIA_LATEST_TO_TARGET(final ItemStack stack, final Versi return wrapper.read(Type.ITEM); } } catch (Exception e) { - e.printStackTrace(); + ViaFabricPlus.LOGGER.error("Failed to translate item", e); } return null; } @@ -97,7 +98,8 @@ public static ItemStack VIA_TO_MC_B1_8_TO_LATEST(final Item item) { final var viaItem = wrapper.read(Type.FLAT_VAR_INT_ITEM); return new ItemStack(() -> Registries.ITEM.get(viaItem.identifier()), viaItem.amount()); } catch (Exception e) { - throw new RuntimeException(e); + ViaFabricPlus.LOGGER.error("Failed to translate item", e); + return null; } } } diff --git a/src/main/java/de/florianmichael/viafabricplus/screen/base/ProtocolSelectionScreen.java b/src/main/java/de/florianmichael/viafabricplus/screen/base/ProtocolSelectionScreen.java index 40599e953..e45b0c011 100644 --- a/src/main/java/de/florianmichael/viafabricplus/screen/base/ProtocolSelectionScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/screen/base/ProtocolSelectionScreen.java @@ -74,7 +74,7 @@ protected void init() { if (BetaCraftScreen.SERVER_LIST == null) { betaCraftButton = button; - BetaCraftHandler.requestServerList(serverList -> { + BetaCraftHandler.requestV1ServerList(serverList -> { BetaCraftScreen.SERVER_LIST = serverList; BetaCraftScreen.INSTANCE.open(this); diff --git a/src/main/java/de/florianmichael/viafabricplus/screen/thirdparty/BetaCraftScreen.java b/src/main/java/de/florianmichael/viafabricplus/screen/thirdparty/BetaCraftScreen.java index c900a9ab9..bf3b74e84 100644 --- a/src/main/java/de/florianmichael/viafabricplus/screen/thirdparty/BetaCraftScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/screen/thirdparty/BetaCraftScreen.java @@ -17,11 +17,9 @@ */ package de.florianmichael.viafabricplus.screen.thirdparty; -import de.florianmichael.classic4j.model.betacraft.BCServerInfo; +import de.florianmichael.classic4j.model.betacraft.BCServerInfoSpec; import de.florianmichael.classic4j.model.betacraft.BCServerList; -import de.florianmichael.classic4j.model.betacraft.BCVersion; -import de.florianmichael.viafabricplus.definition.ClientsideFixes; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.classic4j.model.betacraft.BCVersionCategory; import de.florianmichael.viafabricplus.base.screen.MappedSlotEntry; import de.florianmichael.viafabricplus.base.screen.VFPScreen; import de.florianmichael.viafabricplus.screen.settings.settingrenderer.meta.TitleRenderer; @@ -72,11 +70,11 @@ public SlotList(MinecraftClient minecraftClient, int width, int height, int top, super(minecraftClient, width, height, top, bottom, entryHeight); if (SERVER_LIST == null) return; - for (BCVersion value : BCVersion.values()) { - final List servers = SERVER_LIST.serversOfVersion(value); + for (BCVersionCategory value : BCVersionCategory.values()) { + final List servers = SERVER_LIST.serversOfVersionCategory(value); if (servers.isEmpty()) continue; addEntry(new TitleRenderer(Text.literal(value.name()))); - for (BCServerInfo server : servers) { + for (BCServerInfoSpec server : servers) { addEntry(new ServerSlot(server)); } } @@ -94,9 +92,9 @@ protected int getScrollbarPositionX() { } public static class ServerSlot extends MappedSlotEntry { - private final BCServerInfo server; + private final BCServerInfoSpec server; - public ServerSlot(BCServerInfo server) { + public ServerSlot(BCServerInfoSpec server) { this.server = server; } @@ -107,7 +105,7 @@ public Text getNarration() { @Override public void mappedMouseClicked(double mouseX, double mouseY, int button) { - final ServerAddress serverAddress = ServerAddress.parse(server.host() + ":" + server.port()); + final ServerAddress serverAddress = ServerAddress.parse(server.socketAddress()); final ServerInfo entry = new ServerInfo(server.name(), serverAddress.getAddress(), false); ConnectScreen.connect(MinecraftClient.getInstance().currentScreen, MinecraftClient.getInstance(), serverAddress, entry, false); @@ -117,8 +115,7 @@ public void mappedMouseClicked(double mouseX, double mouseY, int button) { @Override public void mappedRender(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) { final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer; - context.drawCenteredTextWithShadow(textRenderer, server.name() + Formatting.DARK_GRAY + " [" + server.gameVersion() + "]", entryWidth / 2, entryHeight / 2 - textRenderer.fontHeight / 2, -1); - + context.drawCenteredTextWithShadow(textRenderer, server.name() + Formatting.DARK_GRAY + " [" + server.connectVersion() + "]", entryWidth / 2, entryHeight / 2 - textRenderer.fontHeight / 2, -1); if (server.onlineMode()) { context.drawTextWithShadow(textRenderer, Text.translatable("misc.viafabricplus.online").formatted(Formatting.GREEN), 1, 1, -1); } diff --git a/src/main/java/de/florianmichael/viafabricplus/screen/thirdparty/classicube/ClassiCubeLoginScreen.java b/src/main/java/de/florianmichael/viafabricplus/screen/thirdparty/classicube/ClassiCubeLoginScreen.java index acedb57cd..9f49616a1 100644 --- a/src/main/java/de/florianmichael/viafabricplus/screen/thirdparty/classicube/ClassiCubeLoginScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/screen/thirdparty/classicube/ClassiCubeLoginScreen.java @@ -20,7 +20,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import de.florianmichael.classic4j.ClassiCubeHandler; import de.florianmichael.classic4j.api.LoginProcessHandler; -import de.florianmichael.classic4j.model.classicube.highlevel.CCAccount; +import de.florianmichael.classic4j.model.classicube.account.CCAccount; import de.florianmichael.viafabricplus.screen.base.ProtocolSelectionScreen; import de.florianmichael.viafabricplus.definition.account.ClassiCubeAccountHandler; import de.florianmichael.viafabricplus.base.screen.VFPScreen; diff --git a/src/main/java/de/florianmichael/viafabricplus/screen/thirdparty/classicube/ClassiCubeMFAScreen.java b/src/main/java/de/florianmichael/viafabricplus/screen/thirdparty/classicube/ClassiCubeMFAScreen.java index c52052742..b41698f7c 100644 --- a/src/main/java/de/florianmichael/viafabricplus/screen/thirdparty/classicube/ClassiCubeMFAScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/screen/thirdparty/classicube/ClassiCubeMFAScreen.java @@ -20,8 +20,8 @@ import com.mojang.blaze3d.systems.RenderSystem; import de.florianmichael.classic4j.ClassiCubeHandler; import de.florianmichael.classic4j.api.LoginProcessHandler; -import de.florianmichael.classic4j.model.classicube.highlevel.CCAccount; -import de.florianmichael.classic4j.model.classicube.highlevel.CCError; +import de.florianmichael.classic4j.model.classicube.CCError; +import de.florianmichael.classic4j.model.classicube.account.CCAccount; import de.florianmichael.viafabricplus.definition.account.ClassiCubeAccountHandler; import de.florianmichael.viafabricplus.integration.Classic4JImpl; import de.florianmichael.viafabricplus.base.screen.VFPScreen; diff --git a/src/main/java/de/florianmichael/viafabricplus/screen/thirdparty/classicube/ClassiCubeServerListScreen.java b/src/main/java/de/florianmichael/viafabricplus/screen/thirdparty/classicube/ClassiCubeServerListScreen.java index 113d0ea45..189b0a52a 100644 --- a/src/main/java/de/florianmichael/viafabricplus/screen/thirdparty/classicube/ClassiCubeServerListScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/screen/thirdparty/classicube/ClassiCubeServerListScreen.java @@ -20,8 +20,8 @@ import com.mojang.blaze3d.systems.RenderSystem; import de.florianmichael.classic4j.ClassiCubeHandler; import de.florianmichael.classic4j.api.LoginProcessHandler; -import de.florianmichael.classic4j.model.classicube.CCServerInfo; -import de.florianmichael.classic4j.model.classicube.highlevel.CCAccount; +import de.florianmichael.classic4j.model.classicube.account.CCAccount; +import de.florianmichael.classic4j.model.classicube.server.CCServerInfo; import de.florianmichael.viafabricplus.definition.account.ClassiCubeAccountHandler; import de.florianmichael.viafabricplus.injection.access.IServerInfo; import de.florianmichael.viafabricplus.protocolhack.provider.vialegacy.ViaFabricPlusClassicMPPassProvider; diff --git a/src/main/java/de/florianmichael/viafabricplus/util/ChatUtil.java b/src/main/java/de/florianmichael/viafabricplus/util/ChatUtil.java index 8e8040e5c..ed6472e77 100644 --- a/src/main/java/de/florianmichael/viafabricplus/util/ChatUtil.java +++ b/src/main/java/de/florianmichael/viafabricplus/util/ChatUtil.java @@ -23,16 +23,21 @@ public class ChatUtil { public final static String PREFIX = Formatting.WHITE + "[" + Formatting.GOLD + "ViaFabricPlus" + Formatting.WHITE + "]"; + public final static Text PREFIX_TEXT = Text.literal("[").formatted(Formatting.WHITE).append(Text.literal("ViaFabricPlus").formatted(Formatting.GOLD)).append("]"); public static Text prefixText(final String message) { return prefixText(Text.literal(message)); } public static Text prefixText(final Text message) { - return Text.literal("").append(PREFIX).append(" " + message); + return Text.empty().append(PREFIX_TEXT).append(" ").append(message); } public static void sendPrefixedMessage(final String message) { MinecraftClient.getInstance().inGameHud.getChatHud().addMessage(prefixText(message)); } + + public static void sendPrefixedMessage(final Text message) { + MinecraftClient.getInstance().inGameHud.getChatHud().addMessage(prefixText(message)); + } } diff --git a/src/main/java/de/florianmichael/viafabricplus/util/FileSaver.java b/src/main/java/de/florianmichael/viafabricplus/util/FileSaver.java index 116186849..dd090f6d2 100644 --- a/src/main/java/de/florianmichael/viafabricplus/util/FileSaver.java +++ b/src/main/java/de/florianmichael/viafabricplus/util/FileSaver.java @@ -25,6 +25,7 @@ /** * This class can be used to save data to a file. */ +@SuppressWarnings("all") public abstract class FileSaver { private final File file; @@ -43,8 +44,8 @@ public FileSaver(final String name) { public void init() { if (file.exists()) { JsonObject parentNode = null; - try { - parentNode = ViaFabricPlus.GSON.fromJson(new FileReader(file), JsonObject.class).getAsJsonObject(); + try (final FileReader fr = new FileReader(file)) { + parentNode = ViaFabricPlus.GSON.fromJson(fr, JsonObject.class); } catch (Exception e) { e.printStackTrace(); } diff --git a/src/main/resources/assets/viafabricplus/lang/en_us.json b/src/main/resources/assets/viafabricplus/lang/en_us.json index 7c111a591..f192f0df1 100644 --- a/src/main/resources/assets/viafabricplus/lang/en_us.json +++ b/src/main/resources/assets/viafabricplus/lang/en_us.json @@ -46,6 +46,7 @@ "experimental.viafabricplus.chunkborderfix": "Fix Chunk borders", "experimental.viafabricplus.watermovement": "Water movement edge detection", + "experimental.viafabricplus.boatmovement": "Emulate boat movement and replace model", "debug.viafabricplus.sequence": "Disable sequencing", "debug.viafabricplus.merchant": "Smooth out merchant screens", @@ -79,6 +80,7 @@ "visual.viafabricplus.walkanimation": "Old walking animation", "visual.viafabricplus.sodium": "Fix Sodium Chunk renderer", "visual.viafabricplus.fontrendererbehaviour": "Change Font renderer behaviour", + "visual.viafabricplus.blockhitanimation": "Enable 1.7 Block hit animation", "bedrocklogin.viafabricplus.text": "Your browser should have opened.\nPlease enter the following Code: %s\nClosing this screen will cancel the process!", "bedrocklogin.viafabricplus.error": "An error has occurred! See the latest.log for more information,\nplease report the bug at: \nhttps://github.com/ViaVersion/ViaFabricPlus/issues", diff --git a/src/main/resources/assets/viafabricplus/lang/pl_pl.json b/src/main/resources/assets/viafabricplus/lang/pl_pl.json index 1c7a10c47..98e25b789 100644 --- a/src/main/resources/assets/viafabricplus/lang/pl_pl.json +++ b/src/main/resources/assets/viafabricplus/lang/pl_pl.json @@ -46,6 +46,7 @@ "experimental.viafabricplus.chunkborderfix": "Napraw granice chunków", "experimental.viafabricplus.watermovement": "Wykrywanie krawędzi ruchu wody", + "experimental.viafabricplus.boatmovement": "Emuluj poruszanie się łódek i zamień ich model", "debug.viafabricplus.sequence": "Wyłącz sekwencjonowanie", "debug.viafabricplus.merchant": "Wygładź ekrany kupców", @@ -79,6 +80,7 @@ "visual.viafabricplus.walkanimation": "Stara animacja chodzenia", "visual.viafabricplus.sodium": "Napraw renderowanie chunków sodium", "visual.viafabricplus.fontrendererbehaviour": "Zmień sposób działania renderowania czcionek", + "visual.viafabricplus.blockhitanimation": "Włącz animację uderzania bloków 1.7", "bedrocklogin.viafabricplus.text": "Powinna ci się otworzyć przeglądarka.\nProszę, wpisz ten kod: %s\nZamykanie tego ekranu będzie anulowało proces!", "bedrocklogin.viafabricplus.error": "Wystąpił błąd! Zobacz latest.log po więcej informacji.\nProszę, zgłoś ten problem tutaj:\nhttps://github.com/ViaVersion/ViaFabricPlus/issues", @@ -98,4 +100,4 @@ "classicube.viafabricplus.warning": "Ta funkcja będzie wysyłała zapytania api do ClassiCube api.", "betacraft.viafabricplus.warning": "Naciskanie tego przycisku wyśle zapytanie api do tego adresu: https://betacraft.uk/serverlist" -} +} \ No newline at end of file diff --git a/src/main/resources/assets/viafabricplus/lang/zh_cn.json b/src/main/resources/assets/viafabricplus/lang/zh_cn.json index 52493c730..65df36ddb 100644 --- a/src/main/resources/assets/viafabricplus/lang/zh_cn.json +++ b/src/main/resources/assets/viafabricplus/lang/zh_cn.json @@ -19,6 +19,10 @@ "misc.viafabricplus.serverversion": "服务器版本:%s", "misc.viafabricplus.auto": "自动", "misc.viafabricplus.addserverscreenbuttontitle": "更改当前服务器版本", + "misc.viafabricplus.all": "原版和模组", + "misc.viafabricplus.vanillaonly": "仅原版", + "misc.viafabricplus.kick": "踢出", + "misc.viafabricplus.cancelnotify": "取消和通知", "settings.viafabricplus.authentication": "身份与认证", "settings.viafabricplus.experimental": "实验性功能", @@ -35,12 +39,15 @@ "general.viafabricplus.creative": "从创造模式选项卡中移除不可用的物品", "general.viafabricplus.autodetect": "自动检测版本", "general.viafabricplus.advertised": "在服务器列表-延迟中显示连接所用版本/服务器版本", + "general.viafabricplus.multiplayerscreenbutton": "多人游戏界面的按钮位置", + "general.viafabricplus.ignoreerrors": "忽略数据包转换错误", "bedrock.viafabricplus.confirmtransfer": "显示“确认转移到其他服务器”提示", "bedrock.viafabricplus.authentication": "点此连接到基岩版账户", "experimental.viafabricplus.chunkborderfix": "修复区块边界", "experimental.viafabricplus.watermovement": "水中移动边缘检测", + "experimental.viafabricplus.boatmovement": "模拟 1.8 的船移动并替换模型", "debug.viafabricplus.sequence": "禁用排序", "debug.viafabricplus.merchant": "平滑商人屏幕", @@ -74,6 +81,7 @@ "visual.viafabricplus.walkanimation": "旧版行走动画", "visual.viafabricplus.sodium": "修复钠(Sodium)渲染器", "visual.viafabricplus.fontrendererbehaviour": "更改字体渲染器行为", + "visual.viafabricplus.blockhitanimation": "启用 1.7 的 Block hit 动画", "bedrocklogin.viafabricplus.text": "你的浏览器现在应该打开了。\n请输入这个代码:%s\n关闭这个屏幕等于取消操作!", "bedrocklogin.viafabricplus.error": "发生错误!详情请查看latest.log\n请到下面的链接反馈错误:\nhttps://github.com/ViaVersion/ViaFabricPlus/issues", diff --git a/src/main/resources/assets/viafabricplus/lang/zh_hk.json b/src/main/resources/assets/viafabricplus/lang/zh_hk.json new file mode 100644 index 000000000..38eab8ca5 --- /dev/null +++ b/src/main/resources/assets/viafabricplus/lang/zh_hk.json @@ -0,0 +1,106 @@ +{ + "misc.viafabricplus.settings": "設定", + "misc.viafabricplus.on": "開啟", + "misc.viafabricplus.off": "關閉", + "misc.viafabricplus.lt": "左上", + "misc.viafabricplus.rt": "右上", + "misc.viafabricplus.lb": "左下", + "misc.viafabricplus.rb": "右下", + "misc.viafabricplus.cancel": "取消", + "misc.viafabricplus.cancelreset": "返回並重置", + "misc.viafabricplus.logout": "登出", + "misc.viafabricplus.online": "線上模式", + "misc.viafabricplus.reset": "重置", + "misc.viafabricplus.copy": "複製程式碼", + "misc.viafabricplus.error": "出了些問題!請稍後再試", + "misc.viafabricplus.translate": "轉換為:%s", + "misc.viafabricplus.serverversion": "伺服器版本:%s", + "misc.viafabricplus.auto": "自動", + "misc.viafabricplus.addserverscreenbuttontitle": "設置此伺服器嘅版本", + "misc.viafabricplus.all": "原版和模組嘅", + "misc.viafabricplus.vanillaonly": "僅原版", + "misc.viafabricplus.kick": "踢出", + "misc.viafabricplus.cancelnotify": "取消和通知", + + "settings.viafabricplus.authentication": "驗證", + "settings.viafabricplus.experimental": "實驗性", + "settings.viafabricplus.visual": "視覺", + "settings.viafabricplus.debug": "調試", + "settings.viafabricplus.general": "常規", + "settings.viafabricplus.bedrock": "基岩版", + + "general.viafabricplus.secret": "顯示 “Super Secret Settings”(超級秘密設定)", + "general.viafabricplus.extrainformation": "在 \u00a76[調試]\u00a7r中顯示額外資訊", + "general.viafabricplus.classicloading": "在連接伺服器時使用舊版進度顯示", + "general.viafabricplus.main": "模組按鈕位置", + "general.viafabricplus.creative": "從創造模式物品欄內移除唔可用嘅物品", + "general.viafabricplus.protocolsync": "自動根據所選版本調整設定", + "general.viafabricplus.autodetect": "自動偵測版本", + "general.viafabricplus.advertised": "在多人遊戲介面顯示伺服器所需版本和實際版本", + "general.viafabricplus.multiplayerscreenbutton": "多人游戲界面嘅按鈕位置", + "general.viafabricplus.addserverscreenbutton": "伺服器界面按鈕位置", + "general.viafabricplus.ignoreerrors": "忽略數據包錯誤", + + "experimental.viafabricplus.chunkborderfix": "修復區塊邊界", + "experimental.viafabricplus.watermovement": "Water movement edge detection/\u00a78水中移動邊緣偵測\u00a7r", + "experimental.viafabricplus.boatmovement": "模擬 1.8 嘅船移動並替換模型", + + "debug.viafabricplus.sequence": "Disable sequencing/\u00a78禁用排序\u00a7r", + "debug.viafabricplus.merchant": "Smooth out merchant screens/\u00a78平滑螢幕\u00a7r", + "debug.viafabricplus.postfix": "同步執行輸入", + "debug.viafabricplus.sneakinstant": "瞬間潛行", + "debug.viafabricplus.inventory": "發送 “打開物品欄” 數據包", + "debug.viafabricplus.cooldown": "移除攻擊冷卻", + "debug.viafabricplus.idle": "發送 “空閒” 數據包", + "debug.viafabricplus.attribute": "替換屬性修飾符為舊版本樣式", + "debug.viafabricplus.replacesneak": "替換潛行樣式", + "debug.viafabricplus.longsneak": "Long sneaking/\u00a78保持潛行\u00a7r", + "debug.viafabricplus.legacypseeds": "老舊版本挖掘速度", + + "authentication.viafabricplus.betacraft": "使用 BetaCraft 身份驗證", + "authentication.viafabricplus.verify": "允許 ViaLegacy 調用 joinServer() 來驗證會話", + "authentication.viafabricplus.fail": "joinServer() 調用失敗時斷開連接", + "authentication.viafabricplus.classicube": "如果使用 ClassicCube MP Pass,則強制 CPE 版本", + "authentication.viafabricplus.spoof": "如果使用 ClassiCube ,則顯示為 ClassiCube 名稱", + "authentication.viafabricplus.skin": "允許 ViaLegacy 載入舊版本外觀", + "authentication.viafabricplus.bedrock": "點擊以設定基岩版帳戶", + "authentication.viafabricplus.error": "ViaFabricPlus 無法驗證你嘅會話!請登錄帳戶或在 ViaFabricPlus 設置中禁用 BetaCraft 身份驗證", + + "visual.viafabricplus.secure": "禁用安全聊天警告", + "visual.viafabricplus.indicator": "隱藏聊天簽名提示", + "visual.viafabricplus.jigsaw": "從\u00a7o拼圖方塊\u00a7r介面中移除新版本特性", + "visual.viafabricplus.stoneslab": "替換\u00a7o石化橡木半磚\u00a7r", + "visual.viafabricplus.armor": "模擬護甲值(護甲值唔顯示時開啟此選項)", + "visual.viafabricplus.command": "從\u00a7o指令方塊\u00a7r編輯介面中移除新版本特性", + "visual.viafabricplus.oof": "將受傷音效替換為舊版本嘅 “oof/噢!”", + "visual.viafabricplus.betahud": "移除新嘅 HUD 要素(包括饑餓值、護甲值)", + "visual.viafabricplus.classic": "將創造模式物品欄替換為舊版本樣式", + "visual.viafabricplus.walkanimation": "舊版行走動畫", + "visual.viafabricplus.sodium": "修復鈉(Sodium)渲染器", + "visual.viafabricplus.fontrendererbehaviour": "改變字體渲染嘅行爲", + "visual.viafabricplus.blockhitanimation": "啓用 1.7 Block hit 動畫", + + "bedrock.viafabricplus.confirmtransfer": "打開 GUI 以確認切換到其它伺服器", + "bedrock.viafabricplus.authentication": "點擊以設定基岩版帳戶", + + "bedrocklogin.viafabricplus.text": "你嘅瀏覽器現在應該打開了。\n請輸入這個程式碼:%s\n關閉這個螢幕等於取消操作!", + "bedrocklogin.viafabricplus.error": "發生錯誤!詳情請查看 latest.log\n請在這個連結回饋 BUG:\nhttps://github.com/ViaVersion/ViaFabricPlus/issues", + + "bedrockplay.viafabricplus.confirmtransfer": "你確認轉移至下個伺服器嗎?\n%s\n\n這將斷開與當前伺服器嘅連接並連接到新伺服器。.", + + "forceversion.viafabricplus.title": "請選擇連接這個伺服器要使用嘅版本", + + "classicube.viafabricplus.account": "你可以在這裡創建一個帳戶: https://www.classicube.net", + "classicube.viafabricplus.loading": "正在載入個人資訊和伺服器清單…", + "classicube.viafabricplus.error.token": "Token 唔正確。你嘅 ViaFabricPlus 是否已經過時?", + "classicube.viafabricplus.error.username": "無效嘅用戶名", + "classicube.viafabricplus.error.password": "無效嘅密碼", + "classicube.viafabricplus.error.verification": "用戶尚未驗證電子郵箱位址", + "classicube.viafabricplus.error.logincode": "已請求身份驗證。請查看你嘅電子郵箱!", + + "classicube.viafabricplus.warning": "該功能會向 ClassiCube API 發送請求", + + "betacraft.viafabricplus.warning": "點擊這個按鈕會向 “betacraft.uk/serverlist” 發送 API 請求", + + "modmenu.descriptionTranslation.viafabricplus": "Fabric mod to connect to EVERY Minecraft server version (Release, Beta, Alpha, Classic, Snapshots, Bedrock) with QoL fixes to the gameplay" +} diff --git a/src/main/resources/assets/viafabricplus/lang/zh_tw.json b/src/main/resources/assets/viafabricplus/lang/zh_tw.json index 7fa2e25b4..4ff6a8f05 100644 --- a/src/main/resources/assets/viafabricplus/lang/zh_tw.json +++ b/src/main/resources/assets/viafabricplus/lang/zh_tw.json @@ -15,12 +15,19 @@ "misc.viafabricplus.error": "出了些問題!請稍後再試", "misc.viafabricplus.translate": "轉換為:%s", "misc.viafabricplus.serverversion": "伺服器版本:%s", + "misc.viafabricplus.auto": "自動", + "misc.viafabricplus.addserverscreenbuttontitle": "設置此伺服器嘅版本", + "misc.viafabricplus.all": "原版和模組的", + "misc.viafabricplus.vanillaonly": "僅原版", + "misc.viafabricplus.kick": "踢出", + "misc.viafabricplus.cancelnotify": "取消和通知", "settings.viafabricplus.authentication": "驗證", "settings.viafabricplus.experimental": "實驗性", "settings.viafabricplus.visual": "視覺", "settings.viafabricplus.debug": "調試", "settings.viafabricplus.general": "常規", + "settings.viafabricplus.bedrock": "基岩版", "general.viafabricplus.secret": "顯示 “Super Secret Settings”(超級秘密設定)", "general.viafabricplus.extrainformation": "在 \u00a76[調試]\u00a7r中顯示額外資訊", @@ -30,9 +37,13 @@ "general.viafabricplus.protocolsync": "自動根據所選版本調整設定", "general.viafabricplus.autodetect": "自動偵測版本", "general.viafabricplus.advertised": "在多人遊戲介面顯示伺服器所需版本和實際版本", + "general.viafabricplus.multiplayerscreenbutton": "多人游戲界面嘅按鈕位置", + "general.viafabricplus.addserverscreenbutton": "伺服器界面按鈕位置", + "general.viafabricplus.ignoreerrors": "忽略數據包錯誤", "experimental.viafabricplus.chunkborderfix": "修復區塊邊界", "experimental.viafabricplus.watermovement": "Water movement edge detection/\u00a78水中移動邊緣偵測\u00a7r", + "experimental.viafabricplus.boatmovement": "模擬 1.8 嘅船移動並替換模型", "debug.viafabricplus.sequence": "Disable sequencing/\u00a78禁用排序\u00a7r", "debug.viafabricplus.merchant": "Smooth out merchant screens/\u00a78平滑螢幕\u00a7r", @@ -66,15 +77,21 @@ "visual.viafabricplus.classic": "將創造模式物品欄替換為舊版本樣式", "visual.viafabricplus.walkanimation": "舊版行走動畫", "visual.viafabricplus.sodium": "修復鈉(Sodium)渲染器", - + "visual.viafabricplus.fontrendererbehaviour": "改變字體渲染嘅行爲", + "visual.viafabricplus.blockhitanimation": "啓用 1.7 Block hit 動畫", + + "bedrock.viafabricplus.confirmtransfer": "打開 GUI 以確認切換到其它伺服器", + "bedrock.viafabricplus.authentication": "點擊以設定基岩版帳戶", + "bedrocklogin.viafabricplus.text": "你的瀏覽器現在應該打開了。\n請輸入這個程式碼:%s\n關閉這個螢幕等於取消操作!", "bedrocklogin.viafabricplus.error": "發生錯誤!詳情請查看 latest.log\n請在這個連結回饋 BUG:\nhttps://github.com/ViaVersion/ViaFabricPlus/issues", + + "bedrockplay.viafabricplus.confirmtransfer": "你確認轉移至下個伺服器嗎?\n%s\n\n這將斷開與當前伺服器嘅連接並連接到新伺服器。.", "forceversion.viafabricplus.title": "請選擇連接這個伺服器要使用的版本", "classicube.viafabricplus.account": "你可以在這裡創建一個帳戶: https://www.classicube.net", "classicube.viafabricplus.loading": "正在載入個人資訊和伺服器清單…", - "classicube.viafabricplus.error.token": "Token 不正確。你的 ViaFabricPlus 是否已經過時?", "classicube.viafabricplus.error.username": "無效的用戶名", "classicube.viafabricplus.error.password": "無效的密碼", @@ -83,5 +100,7 @@ "classicube.viafabricplus.warning": "該功能會向 ClassiCube API 發送請求", - "betacraft.viafabricplus.warning": "點擊這個按鈕會向 “betacraft.uk/serverlist” 發送 API 請求" + "betacraft.viafabricplus.warning": "點擊這個按鈕會向 “betacraft.uk/serverlist” 發送 API 請求", + + "modmenu.descriptionTranslation.viafabricplus": "Fabric mod to connect to EVERY Minecraft server version (Release, Beta, Alpha, Classic, Snapshots, Bedrock) with QoL fixes to the gameplay" } diff --git a/src/main/resources/assets/viafabricplus/textures/boat_1_8.png b/src/main/resources/assets/viafabricplus/textures/boat_1_8.png new file mode 100644 index 000000000..9b5896540 Binary files /dev/null and b/src/main/resources/assets/viafabricplus/textures/boat_1_8.png differ diff --git a/src/main/resources/viafabricplus.accesswidener b/src/main/resources/viafabricplus.accesswidener index 3e1d804da..234d1d31a 100644 --- a/src/main/resources/viafabricplus.accesswidener +++ b/src/main/resources/viafabricplus.accesswidener @@ -13,9 +13,12 @@ accessible field net/minecraft/network/ClientConnection LOCAL_CLIENT_IO_GROUP Ln accessible field net/minecraft/client/gui/screen/GameMenuScreen exitButton Lnet/minecraft/client/gui/widget/ButtonWidget; accessible field net/minecraft/client/font/FontStorage$GlyphPair MISSING Lnet/minecraft/client/font/FontStorage$GlyphPair; accessible field net/minecraft/client/network/AllowedAddressResolver addressResolver Lnet/minecraft/client/network/AddressResolver; +accessible field net/minecraft/entity/passive/AbstractHorseEntity lastAngryAnimationProgress F +accessible field net/minecraft/entity/vehicle/BoatEntity yawVelocity F accessible method net/minecraft/screen/GenericContainerScreenHandler (Lnet/minecraft/screen/ScreenHandlerType;ILnet/minecraft/entity/player/PlayerInventory;I)V accessible method net/minecraft/client/font/FontStorage$GlyphPair (Lnet/minecraft/client/font/Glyph;Lnet/minecraft/client/font/Glyph;)V +accessible method net/minecraft/entity/vehicle/BoatEntity getMaxPassengers ()I accessible class net/minecraft/client/gui/screen/GameModeSelectionScreen$GameModeSelection -accessible class net/minecraft/client/font/FontStorage$GlyphPair +accessible class net/minecraft/client/font/FontStorage$GlyphPair \ No newline at end of file diff --git a/src/main/resources/viafabricplus.mixins.json b/src/main/resources/viafabricplus.mixins.json index 19bc4cb19..460ad9ce3 100644 --- a/src/main/resources/viafabricplus.mixins.json +++ b/src/main/resources/viafabricplus.mixins.json @@ -22,6 +22,8 @@ "base.MixinServerInfo", "base.MixinSharedConstants", "classic4j.MixinCCAuthenticationResponse", + "compat.ipnext.MixinAutoRefillHandler_ItemSlotMonitor", + "compat.sodium.MixinChunkTracker", "fixes.authlib.MixinKeyPairResponse", "fixes.minecraft.MixinBipedEntityModel", "fixes.minecraft.MixinCamera", @@ -78,7 +80,9 @@ "fixes.minecraft.entity.MixinCreeperEntity", "fixes.minecraft.entity.MixinEntity", "fixes.minecraft.entity.MixinEntityIndex", + "fixes.minecraft.entity.MixinEntityModels", "fixes.minecraft.entity.MixinEntityPredicates", + "fixes.minecraft.entity.MixinEntityRenderDispatcher", "fixes.minecraft.entity.MixinItemEntity", "fixes.minecraft.entity.MixinLivingEntity", "fixes.minecraft.entity.MixinLockableContainerBlockEntity", @@ -130,7 +134,6 @@ "fixes.minecraft.screen.screenhandler.MixinBrewingStandScreenHandler_FuelSlot", "fixes.minecraft.screen.screenhandler.MixinPlayerScreenHandler", "fixes.minecraft.screen.screenhandler.MixinScreenHandler", - "compat.sodium.MixinChunkTracker", "fixes.viabedrock.MixinBedrockProtocol", "fixes.viabedrock.MixinJoinPackets", "fixes.vialegacy.MixinClassicProtocolExtension", @@ -140,7 +143,7 @@ "fixes.vialegacy.MixinProtocolc0_30toc0_30cpe", "fixes.vialegacy.MixinViaLegacyConfig", "fixes.viaversion.MixinCommonBoss", - "fixes.viaversion.MixinNBTType", + "fixes.viaversion.MixinNamedCompoundTagType", "fixes.viaversion.MixinProtocolVersion", "fixes.viaversion.protocol1_11to1_10.MixinEntityIdRewriter", "fixes.viaversion.protocol1_11to1_10.MixinProtocol1_11To1_10", @@ -167,9 +170,7 @@ "fixes.viaversion.protocol1_9to1_8.MixinEntityTracker1_9", "fixes.viaversion.protocol1_9to1_8.MixinMetadataRewriter1_9To1_8", "fixes.viaversion.protocol1_9to1_8.MixinViaIdleThread", - "compat.ipnext.MixinAutoRefillHandler_ItemSlotMonitor", "jsonwebtoken.MixinClasses", - "jsonwebtoken.MixinDefaultCompressionCodecResolver", "jsonwebtoken.MixinDefaultJwtParserBuilder" ], "injectors": {