Attach serializer to object
This commit is contained in:
@@ -5,7 +5,6 @@ import javax.annotation.Nullable;
|
||||
import exopandora.worldhandler.builder.component.impl.ComponentTag;
|
||||
import exopandora.worldhandler.util.MutableStringTextComponent;
|
||||
import exopandora.worldhandler.util.SignText;
|
||||
import net.minecraft.nbt.StringNBT;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -23,7 +22,7 @@ public class BuilderSignEditor extends BuilderData
|
||||
|
||||
for(int x = 0; x < 4; x++)
|
||||
{
|
||||
this.sign[x] = this.registerNBTComponent(new ComponentTag<SignText>("Text" + (x + 1), new SignText(x), text -> StringNBT.valueOf(text.toString())));
|
||||
this.sign[x] = this.registerNBTComponent(new ComponentTag<SignText>("Text" + (x + 1), new SignText(x), SignText::toNBT));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package exopandora.worldhandler.util;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.nbt.StringNBT;
|
||||
import net.minecraft.util.text.event.ClickEvent;
|
||||
import net.minecraft.util.text.event.ClickEvent.Action;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@@ -61,6 +62,11 @@ public class SignText
|
||||
return this.text.getStyle().getClickEvent() != null && this.text.getStyle().getClickEvent().getAction() == Action.RUN_COMMAND && this.text.getStyle().getClickEvent().getValue() != null;
|
||||
}
|
||||
|
||||
public StringNBT toNBT()
|
||||
{
|
||||
return StringNBT.valueOf(this.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user