From 2b4aeec1bb8f32f1bea15b250aa995a7ee244e4e Mon Sep 17 00:00:00 2001 From: Fox2Code Date: Sun, 26 May 2024 19:39:00 +0200 Subject: [PATCH] Update 1.2.46 --- .../client/mixins/MixinEntityWyvern.java | 17 +++++++++++++++++ .../client/mixins/MixinGuiEditSign.java | 16 ++++++++++++++++ .../client/mixins/MixinGuiMainMenu.java | 12 +++++++++++- .../resources/foxloader.client.mixins.json | 2 ++ gradle.properties | 2 +- .../fox2code/foxloader/loader/ServerMod.java | 1 - .../server/mixins/MixinEntityWyvern.java | 18 ++++++++++++++++++ .../resources/foxloader.server.mixins.json | 1 + 8 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 client/src/main/java/com/fox2code/foxloader/client/mixins/MixinEntityWyvern.java create mode 100644 client/src/main/java/com/fox2code/foxloader/client/mixins/MixinGuiEditSign.java create mode 100644 server/src/main/java/com/fox2code/foxloader/server/mixins/MixinEntityWyvern.java diff --git a/client/src/main/java/com/fox2code/foxloader/client/mixins/MixinEntityWyvern.java b/client/src/main/java/com/fox2code/foxloader/client/mixins/MixinEntityWyvern.java new file mode 100644 index 0000000..3bee9dd --- /dev/null +++ b/client/src/main/java/com/fox2code/foxloader/client/mixins/MixinEntityWyvern.java @@ -0,0 +1,17 @@ +package com.fox2code.foxloader.client.mixins; + +import net.minecraft.src.game.entity.monster.EntityWyvern; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(EntityWyvern.class) +public class MixinEntityWyvern { + @Inject(method = "isCourseTraversable", at = @At("HEAD"), cancellable = true) + public void hotfix_isCourseTraversable(double x, double y, double z, double xyzsqrt, CallbackInfoReturnable cir) { + if (xyzsqrt > Short.MAX_VALUE) { + cir.setReturnValue(Boolean.FALSE); + } + } +} diff --git a/client/src/main/java/com/fox2code/foxloader/client/mixins/MixinGuiEditSign.java b/client/src/main/java/com/fox2code/foxloader/client/mixins/MixinGuiEditSign.java new file mode 100644 index 0000000..680263b --- /dev/null +++ b/client/src/main/java/com/fox2code/foxloader/client/mixins/MixinGuiEditSign.java @@ -0,0 +1,16 @@ +package com.fox2code.foxloader.client.mixins; + +import net.minecraft.src.client.gui.GuiEditSign; +import net.minecraft.src.game.level.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(GuiEditSign.class) +public class MixinGuiEditSign { + @Redirect(method = "onGuiClosed", at = @At(value = "FIELD", + target = "Lnet/minecraft/src/game/level/World;multiplayerWorld:Z")) + public boolean hotfix_multiplayerWorld(World instance) { + return instance != null && instance.multiplayerWorld; + } +} diff --git a/client/src/main/java/com/fox2code/foxloader/client/mixins/MixinGuiMainMenu.java b/client/src/main/java/com/fox2code/foxloader/client/mixins/MixinGuiMainMenu.java index 004660d..5232941 100644 --- a/client/src/main/java/com/fox2code/foxloader/client/mixins/MixinGuiMainMenu.java +++ b/client/src/main/java/com/fox2code/foxloader/client/mixins/MixinGuiMainMenu.java @@ -10,13 +10,19 @@ import net.minecraft.src.client.Session; import net.minecraft.src.client.gui.*; 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.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import java.util.Objects; + @Mixin(GuiMainMenu.class) public abstract class MixinGuiMainMenu extends GuiScreen { + @Unique private String rainbowUserName; + @Unique private String username; + @Inject(method = "initGui", at = @At(value = "RETURN")) public void onInitGui(CallbackInfo ci) { this.controlList.add(new GuiUpdateButton(500, this.width - 62, 2, 60, 20, "Mods")); @@ -38,7 +44,11 @@ public void onActionPerformed(GuiButton var1, CallbackInfo ci) { public String onGetUsername(Session instance) { final String username = instance.username; if (ModLoader.Contributors.hasContributorName(username)) { - return ChatColors.RAINBOW + username; + if (!Objects.equals(this.username, username)) { + this.rainbowUserName = ChatColors.RAINBOW + username; + this.username = username; + } + return this.rainbowUserName; } return username; } diff --git a/client/src/main/resources/foxloader.client.mixins.json b/client/src/main/resources/foxloader.client.mixins.json index 8335e2b..4ebd172 100644 --- a/client/src/main/resources/foxloader.client.mixins.json +++ b/client/src/main/resources/foxloader.client.mixins.json @@ -18,10 +18,12 @@ "MixinEntityPlayer", "MixinEntityPlayerSP", "MixinEntityRenderer", + "MixinEntityWyvern", "MixinGameSettings", "MixinGuiConnecting", "MixinGuiContainer", "MixinGuiDebug", + "MixinGuiEditSign", "MixinGuiIngameMenu", "MixinGuiMainMenu", "MixinGuiScreen", diff --git a/gradle.properties b/gradle.properties index 742757f..472dece 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.parallel=true org.gradle.jvmargs=-Xmx1024m -XX:-UseGCOverheadLimit -Dfile.encoding=UTF-8 # FoxLoader properties -foxloader.version=1.2.45 +foxloader.version=1.2.46 foxloader.lastReIndevTransformerChanges=1.2.39 # https://www.jitpack.io/#com.fox2code/FoxLoader diff --git a/server/src/main/java/com/fox2code/foxloader/loader/ServerMod.java b/server/src/main/java/com/fox2code/foxloader/loader/ServerMod.java index 6535062..9b698f2 100644 --- a/server/src/main/java/com/fox2code/foxloader/loader/ServerMod.java +++ b/server/src/main/java/com/fox2code/foxloader/loader/ServerMod.java @@ -21,7 +21,6 @@ static EntityPlayerMP toEntityPlayerMP(NetworkPlayer networkPlayer) { return (EntityPlayerMP) networkPlayer; } - @SuppressWarnings("unchecked") static List getOnlinePlayers() { return getGameInstance().configManager.playerEntities; } diff --git a/server/src/main/java/com/fox2code/foxloader/server/mixins/MixinEntityWyvern.java b/server/src/main/java/com/fox2code/foxloader/server/mixins/MixinEntityWyvern.java new file mode 100644 index 0000000..9887e56 --- /dev/null +++ b/server/src/main/java/com/fox2code/foxloader/server/mixins/MixinEntityWyvern.java @@ -0,0 +1,18 @@ +package com.fox2code.foxloader.server.mixins; + + +import net.minecraft.src.game.entity.monster.EntityWyvern; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(EntityWyvern.class) +public class MixinEntityWyvern { + @Inject(method = "isCourseTraversable", at = @At("HEAD"), cancellable = true) + public void hotfix_isCourseTraversable(double x, double y, double z, double xyzsqrt, CallbackInfoReturnable cir) { + if (xyzsqrt > Short.MAX_VALUE) { + cir.setReturnValue(Boolean.FALSE); + } + } +} diff --git a/server/src/main/resources/foxloader.server.mixins.json b/server/src/main/resources/foxloader.server.mixins.json index 5072367..f0a49a5 100644 --- a/server/src/main/resources/foxloader.server.mixins.json +++ b/server/src/main/resources/foxloader.server.mixins.json @@ -13,6 +13,7 @@ "MixinEntityLiving", "MixinEntityPlayer", "MixinEntityPlayerMP", + "MixinEntityWyvern", "MixinItem", "MixinItemStack", "MixinMinecraftServer",