diff options
author | RoseGoldIsntGay <yoavkau@gmail.com> | 2022-02-05 19:00:17 +0200 |
---|---|---|
committer | RoseGoldIsntGay <yoavkau@gmail.com> | 2022-02-05 19:00:17 +0200 |
commit | 5e484b169e736408ada925d9cdcea9ac6df7374a (patch) | |
tree | d43c997cf821910a53a918f39ea6b51096a0b485 /src/main/java/rosegoldaddons/mixins/MixinRendererLivingEntity.java | |
parent | 20894963147ef84a7ad7d578191de69a856f6403 (diff) | |
download | RGA-5e484b169e736408ada925d9cdcea9ac6df7374a.tar.gz RGA-5e484b169e736408ada925d9cdcea9ac6df7374a.tar.bz2 RGA-5e484b169e736408ada925d9cdcea9ac6df7374a.zip |
2.7.3
lag fixed (real) and other stuff
Diffstat (limited to 'src/main/java/rosegoldaddons/mixins/MixinRendererLivingEntity.java')
-rw-r--r-- | src/main/java/rosegoldaddons/mixins/MixinRendererLivingEntity.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/main/java/rosegoldaddons/mixins/MixinRendererLivingEntity.java b/src/main/java/rosegoldaddons/mixins/MixinRendererLivingEntity.java index 25f1a2e..dc06069 100644 --- a/src/main/java/rosegoldaddons/mixins/MixinRendererLivingEntity.java +++ b/src/main/java/rosegoldaddons/mixins/MixinRendererLivingEntity.java @@ -8,6 +8,7 @@ import net.minecraft.util.StringUtils; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.apache.commons.codec.digest.DigestUtils; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -29,13 +30,17 @@ public abstract class MixinRendererLivingEntity { ci.cancel(); } + /* @Redirect(method = "renderName(Lnet/minecraft/entity/EntityLivingBase;DDD)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/IChatComponent;getFormattedText()Ljava/lang/String;")) public String redirectGetFormattedText(IChatComponent instance) { + if(!Main.configFile.customNames) return instance.getFormattedText(); if (Main.init && Main.configFile.alchsleep == 63 && Main.configFile.skiblock == 263) return instance.getFormattedText(); String unformatted = stripString(instance.getUnformattedText()).replace(":"," ").replace("'"," "); String[] words = unformatted.split(" "); String[] formatteds = instance.getUnformattedText().replace(":"," ").replace("'"," ").split(" "); for(String word : words) { + if (Main.hashedCache.contains(word)) continue; + if(word.equals("")) continue; if (Main.nameCache.containsKey(word)) { String[] replaces = Main.nameCache.get(word).split(" "); for(String replace : replaces) { @@ -45,11 +50,18 @@ public abstract class MixinRendererLivingEntity { } String color = getColorBeforeIndex(instance.getUnformattedText(), instance.getUnformattedText().indexOf(word)); return instance.getUnformattedText().replace(word, Main.nameCache.get(word) + color); + } else { + String hashed = DigestUtils.sha256Hex(word + word); + if (Main.names.containsKey(hashed)) { + Main.nameCache.put(word, Main.names.get(hashed)); + } else { + Main.hashedCache.add(word); + } } } return instance.getFormattedText(); } - + */ private String getColorBeforeIndex(String str, int index) { String lastColor = ""; |