mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-10-26 19:37:39 +00:00
Fix command computers being exposed as peripherals
- Check whether the computer is a command computer before registering the capability. - Add tests to check what is/isn't a peripheral. See also #2020, where we forgot to register a peripheral on NeoForge 1.21.1. Fixes #2070.
This commit is contained in:
@@ -124,7 +124,7 @@ public class ForgeCommonHooks {
|
||||
@SubscribeEvent
|
||||
public static void onCapability(AttachCapabilitiesEvent<BlockEntity> event) {
|
||||
var blockEntity = event.getObject();
|
||||
if (blockEntity instanceof ComputerBlockEntity computer) {
|
||||
if (blockEntity instanceof ComputerBlockEntity computer && !computer.isAdminOnly()) {
|
||||
CapabilityProvider.attach(event, PERIPHERAL, CAPABILITY_PERIPHERAL, computer::peripheral);
|
||||
} else if (blockEntity instanceof TurtleBlockEntity turtle) {
|
||||
CapabilityProvider.attach(event, INVENTORY, ITEM_HANDLER, () -> new InvWrapper(turtle));
|
||||
|
||||
Reference in New Issue
Block a user