some more stuff idk idk idk
This commit is contained in:
parent
9b7b9cd368
commit
98689d2fa7
3 changed files with 38 additions and 9 deletions
|
@ -0,0 +1,28 @@
|
||||||
|
package land.chipmunk.chipmunkmod.mixin;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.*;
|
||||||
|
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;
|
||||||
|
|
||||||
|
import java.io.DataInput;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@Mixin(NbtIo.class)
|
||||||
|
public class NbtIoMixin {
|
||||||
|
@Inject(method = "read(Ljava/io/DataInput;ILnet/minecraft/nbt/NbtTagSizeTracker;)Lnet/minecraft/nbt/NbtElement;", at = @At("HEAD"), cancellable = true)
|
||||||
|
private static void read(DataInput input, int depth, NbtTagSizeTracker tracker, CallbackInfoReturnable<NbtElement> cir) {
|
||||||
|
try {
|
||||||
|
byte b = input.readByte();
|
||||||
|
if (b == 0) {
|
||||||
|
cir.setReturnValue(NbtEnd.INSTANCE);
|
||||||
|
}
|
||||||
|
|
||||||
|
NbtString.skip(input);
|
||||||
|
cir.setReturnValue(NbtTypes.byId(b).read(input, depth, tracker));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,18 +3,18 @@ package land.chipmunk.chipmunkmod.mixin;
|
||||||
import net.minecraft.util.StringHelper;
|
import net.minecraft.util.StringHelper;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
@Mixin(StringHelper.class)
|
@Mixin(StringHelper.class)
|
||||||
public class StringHelperMixin {
|
public class StringHelperMixin {
|
||||||
// totallynotskidded™ from meteor client
|
@Inject(method = "truncateChat", at = @At("HEAD"), cancellable = true)
|
||||||
@ModifyArg(method = "truncateChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/StringHelper;truncate(Ljava/lang/String;IZ)Ljava/lang/String;"))
|
private static void truncateChat (String text, CallbackInfoReturnable<String> cir) {
|
||||||
private static int truncateChat(int maxLength) {
|
cir.setReturnValue(text);
|
||||||
return Integer.MAX_VALUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ModifyArg(method = "stripTextFormat", at = @At(value = "INVOKE", target = "Ljava/util/regex/Matcher;replaceAll(Ljava/lang/String;)Ljava/lang/String;"))
|
@Inject(method = "stripTextFormat", at = @At("HEAD"), cancellable = true)
|
||||||
private static String stripTextFormat (String replacement) {
|
private static void stripTextFormat(String text, CallbackInfoReturnable<String> cir) {
|
||||||
return replacement;
|
cir.setReturnValue(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,8 @@
|
||||||
"MinecraftClientAccessor",
|
"MinecraftClientAccessor",
|
||||||
"LightmapTextureManagerMixin",
|
"LightmapTextureManagerMixin",
|
||||||
"DecoderHandlerMixin",
|
"DecoderHandlerMixin",
|
||||||
"StringHelperMixin"
|
"StringHelperMixin",
|
||||||
|
"NbtIoMixin"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
|
Loading…
Reference in a new issue