diff --git a/Common/src/main/java/at/petrak/hexcasting/api/item/IotaHolderItem.java b/Common/src/main/java/at/petrak/hexcasting/api/item/IotaHolderItem.java index 62f2aade..11e9bf70 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/item/IotaHolderItem.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/item/IotaHolderItem.java @@ -86,12 +86,18 @@ public interface IotaHolderItem { return HexIotaTypes.getColor(tag); } + /** + * Write {@code null} to indicate erasing + */ boolean canWrite(ItemStack stack, @Nullable Iota iota); + /** + * Write {@code null} to indicate erasing + */ void writeDatum(ItemStack stack, @Nullable Iota iota); static void appendHoverText(IotaHolderItem self, ItemStack stack, List components, - TooltipFlag flag) { + TooltipFlag flag) { var datumTag = self.readIotaTag(stack); if (datumTag != null) { var cmp = HexIotaTypes.getDisplay(datumTag); diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemSlate.java b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemSlate.java index c6faf57b..8d97a5da 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemSlate.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemSlate.java @@ -86,7 +86,10 @@ public class ItemSlate extends BlockItem implements IotaHolderItem { @Override public boolean canWrite(ItemStack stack, Iota datum) { - return datum instanceof PatternIota && !NBTHelper.hasCompound(stack, BlockEntitySlate.TAG_PATTERN); + var isWritten = NBTHelper.hasCompound(stack, "BlockEntityTag") + && stack.getTag().getCompound("BlockEntityTag").contains(BlockEntitySlate.TAG_PATTERN); + return (datum instanceof PatternIota && !isWritten) + || (datum == null && isWritten); } @Override