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 super T>) 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