diff options
| author | ohowe <42757516+carelesshippo@users.noreply.github.com> | 2021-06-02 11:55:36 -0600 |
|---|---|---|
| committer | ohowe <42757516+carelesshippo@users.noreply.github.com> | 2021-06-02 11:55:36 -0600 |
| commit | eeb5c45d71997cb259fc35330490a19db7865603 (patch) | |
| tree | 65771b27ed837896fa3140dec1af78306accebcd /src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinItemStack.java | |
| parent | 4d9e538ced80728bca74491698347333f515bfcc (diff) | |
| parent | 1b172089ce502803f7644611afd618ce00dcb860 (diff) | |
| download | notenoughupdates-eeb5c45d71997cb259fc35330490a19db7865603.tar.gz notenoughupdates-eeb5c45d71997cb259fc35330490a19db7865603.tar.bz2 notenoughupdates-eeb5c45d71997cb259fc35330490a19db7865603.zip | |
Merge branch 'Moulberry:master' into master
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinItemStack.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinItemStack.java | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinItemStack.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinItemStack.java index 4a7f0f5b..52c96c16 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinItemStack.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinItemStack.java @@ -11,6 +11,9 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + @Mixin({ItemStack.class}) public class MixinItemStack { @@ -37,25 +40,13 @@ public class MixinItemStack { if(data != null && data.customName != null) { String customName = data.customName; if(customName != null && !customName.equals("")) { - String prefix = EnumChatFormatting.RESET.toString(); - if (stackTagCompound != null && stackTagCompound.hasKey("display", 10)) { - NBTTagCompound nbttagcompound = stackTagCompound.getCompoundTag("display"); - - if (nbttagcompound.hasKey("Name", 8)) { - String name = nbttagcompound.getString("Name"); - char[] chars = name.toCharArray(); + customName = Utils.chromaStringByColourCode(customName); - int i; - for(i=0; i<chars.length; i+=2) { - if(chars[i] != '\u00a7'){ - break; - } - } - - prefix = name.substring(0, i); - } + if(data.customNamePrefix != null) { + customName = data.customNamePrefix + customName; } - returnable.setReturnValue(prefix+customName); + + returnable.setReturnValue(customName); } } } catch(Exception e) { } |
