Skip to content

Commit

Permalink
Mark command computers as onlyOpCanSetNbt
Browse files Browse the repository at this point in the history
This isn't required in vanilla, as the command computer is a
GameMasterBlock, and so isn't placeable in the first place.

*However*, this is a problem with Create contraptions — with those it's
possible to "place" a command computer complete with NBT. We override
onlyOpCanSetNbt to prevent this [^1].

[^1]: https://github.com/Creators-of-Create/Create/blob/7a7993deb89e432f8a4cce8a8d5f35f85f57bfed/src/main/java/com/simibubi/create/foundation/utility/NBTProcessors.java#L179
  • Loading branch information
SquidDev committed Jan 21, 2025
1 parent 55edced commit f212861
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -417,4 +417,9 @@ public Component getCustomName() {
public Component getDisplayName() {
return Nameable.super.getDisplayName();
}

@Override
public boolean onlyOpCanSetNbt() {
return getFamily() == ComputerFamily.COMMAND;
}
}

0 comments on commit f212861

Please sign in to comment.