fix sign getText on server

This commit is contained in:
dfsek 2021-05-04 15:04:53 -07:00
parent ecba6e0843
commit 4c77419dcd

View File

@ -6,6 +6,7 @@ import net.minecraft.block.entity.SignBlockEntity;
import net.minecraft.text.LiteralText; import net.minecraft.text.LiteralText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Implements; import org.spongepowered.asm.mixin.Implements;
import org.spongepowered.asm.mixin.Interface; import org.spongepowered.asm.mixin.Interface;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
@ -18,19 +19,20 @@ public abstract class SignBlockEntityMixin {
public abstract void setTextOnRow(int row, Text text); public abstract void setTextOnRow(int row, Text text);
@Shadow @Shadow
public abstract Text getTextOnRow(int row); @Final
private Text[] text;
public @NotNull String[] terra$getLines() { public @NotNull String[] terra$getLines() {
return new String[] { return new String[] {
getTextOnRow(0).asString(), terra$getLine(0),
getTextOnRow(1).asString(), terra$getLine(1),
getTextOnRow(2).asString(), terra$getLine(2),
getTextOnRow(3).asString() terra$getLine(3)
}; };
} }
public @NotNull String terra$getLine(int index) throws IndexOutOfBoundsException { public @NotNull String terra$getLine(int index) throws IndexOutOfBoundsException {
return getTextOnRow(index).asString(); return text[index].asString();
} }
public void terra$setLine(int index, @NotNull String line) throws IndexOutOfBoundsException { public void terra$setLine(int index, @NotNull String line) throws IndexOutOfBoundsException {