This commit is contained in:
petrak@ 2022-11-20 16:09:06 -06:00
parent c2edcd68c1
commit 3d56f0f826
2 changed files with 11 additions and 2 deletions

View file

@ -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<Component> components,
TooltipFlag flag) {
TooltipFlag flag) {
var datumTag = self.readIotaTag(stack);
if (datumTag != null) {
var cmp = HexIotaTypes.getDisplay(datumTag);

View file

@ -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