Skip to content

Commit

Permalink
fix entity attributes range (#486)
Browse files Browse the repository at this point in the history
  • Loading branch information
raylras authored Feb 7, 2025
1 parent 42fafa8 commit 62bf00c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,11 @@ public class FixesConfig {
@Config.RequiresMcRestart
public static boolean fixInventorySyncLag;

@Config.Comment("Prevent the client from crashing due to invalid entity attributes range (MC-150405)")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean fixEntityAttributesRange;

/* ====== Minecraft fixes end ===== */

// bukkit fixes
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ public enum Mixins {
TRANSPARENT_CHAT(new Builder("Transparent Chat").setPhase(Phase.EARLY)
.addMixinClasses("minecraft.MixinGuiNewChat_TransparentChat").setSide(Side.CLIENT)
.setApplyIf(() -> TweaksConfig.transparentChat).addTargetedMod(TargetedMod.VANILLA)),
FIX_ENTITY_ATTRIBUTES_RANGE(new Builder("Fix Entity Attributes Range").setPhase(Phase.EARLY)
.addMixinClasses("minecraft.MixinNetHandlerPlayClient_FixEntityAttributesRange").setSide(Side.CLIENT)
.setApplyIf(() -> FixesConfig.fixEntityAttributesRange).addTargetedMod(TargetedMod.VANILLA)),

// config handled in mixin due to server->client config sync
LONGER_MESSAGES_CLIENT(new Builder("Longer Messages Client Side").setPhase(Phase.EARLY)
.addMixinClasses("minecraft.MixinGuiChat_LongerMessages").setApplyIf(() -> true)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.mitchej123.hodgepodge.mixins.early.minecraft;

import net.minecraft.client.network.NetHandlerPlayClient;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;

@Mixin(NetHandlerPlayClient.class)
public class MixinNetHandlerPlayClient_FixEntityAttributesRange {

/**
* @author raylras
* @reason Prevent the client from crashing due to invalid entity attributes range.
*
* @see <a href="https://bugs.mojang.com/browse/MC-150405">MC-150405</a>
* @see <a href=
* "https://github.com/MinecraftForge/MinecraftForge/commit/05f4f5ec775fbba7cf5c0421041f417dd4c70a36">MinecraftForge
* Patch</a>
*/
@ModifyConstant(method = "handleEntityProperties", constant = @Constant(doubleValue = Double.MIN_NORMAL))
private static double hodgepodge$FixEntityAttributesRange(double original) {
return -Double.MAX_VALUE;
}
}

0 comments on commit 62bf00c

Please sign in to comment.