fix extra crash
i did how blackilykat did it lol
This commit is contained in:
parent
02488b4289
commit
7afcc606fe
2 changed files with 28 additions and 1 deletions
26
src/main/java/land/chipmunk/chipmunkmod/mixin/TextMixin.java
Normal file
26
src/main/java/land/chipmunk/chipmunkmod/mixin/TextMixin.java
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
package land.chipmunk.chipmunkmod.mixin;
|
||||||
|
|
||||||
|
import net.minecraft.text.StringVisitable;
|
||||||
|
import net.minecraft.text.Style;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
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 org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Mixin(Text.class)
|
||||||
|
public interface TextMixin {
|
||||||
|
@Inject(method = "visit(Lnet/minecraft/text/StringVisitable$StyledVisitor;Lnet/minecraft/text/Style;)Ljava/util/Optional;", at = @At(value = "INVOKE", target = "Lnet/minecraft/text/Text;visit(Lnet/minecraft/text/StringVisitable$StyledVisitor;Lnet/minecraft/text/Style;)Ljava/util/Optional;"), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD)
|
||||||
|
private <T> void visit (StringVisitable.StyledVisitor<T> styledVisitor, Style style, CallbackInfoReturnable<Optional<T>> cir, Style style2, Optional optional, Iterator var5, Text text) {
|
||||||
|
if (text == null) cir.setReturnValue(Optional.empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "visit(Lnet/minecraft/text/StringVisitable$Visitor;)Ljava/util/Optional;", at = @At(value = "INVOKE", target = "Lnet/minecraft/text/Text;visit(Lnet/minecraft/text/StringVisitable$Visitor;)Ljava/util/Optional;"), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD)
|
||||||
|
private <T> void visit (StringVisitable.Visitor<T> visitor, CallbackInfoReturnable<Optional<T>> cir, Optional optional, Iterator var3, Text text) {
|
||||||
|
if (text == null) cir.setReturnValue(Optional.empty());
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,7 +20,8 @@
|
||||||
"KeyboardInputMixin",
|
"KeyboardInputMixin",
|
||||||
"ElderGuardianAppearanceParticleMixin",
|
"ElderGuardianAppearanceParticleMixin",
|
||||||
"IdentifierMixin",
|
"IdentifierMixin",
|
||||||
"DecoratedPotBlockEntitySherdsMixin"
|
"DecoratedPotBlockEntitySherdsMixin",
|
||||||
|
"TextMixin"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
|
Loading…
Reference in a new issue