diff --git a/src/main/java/li/cil/oc2/api/bus/DeviceBusController.java b/src/main/java/li/cil/oc2/api/bus/DeviceBusController.java
index b87c801d..023ba6c4 100644
--- a/src/main/java/li/cil/oc2/api/bus/DeviceBusController.java
+++ b/src/main/java/li/cil/oc2/api/bus/DeviceBusController.java
@@ -11,14 +11,20 @@ import java.util.UUID;
* {@link DeviceBusElement#addController(DeviceBusController)}.
*
* This interface is usually provided by VM containers and used to collect connected
- * {@link Device}s by aggregating the devices that were added to the device bus elements
- * via {@link DeviceBus#addDevice(Device)}.
+ * {@link Device}s by aggregating the devices made available by {@link DeviceBusElement}s
+ * via {@link DeviceBusElement#getLocalDevices()}.
*
* The only way for {@link DeviceBusElement}s to be added to a bus is for a
* {@link DeviceBusController} to detect them during a scan.
*
- * This interface is only of relevance when implementing a VM container or a bus element,
- * i.e. something that acts as a "cable" or otherwise extends the bus itself.
+ * This interface is only of relevance when implementing
+ *
+ * - a VM container, in which case an implementation
+ * of this interface must be used to control the bus for that container, or
+ * - a bus element, which must call {@link #scheduleBusScan()} when the observable structure
+ * of the bus has changed (neighbors connected/disconnected) and must call {@link #scanDevices()}
+ * when the local list of devices has changed.
+ *
*
* @see DeviceBusElement
*/
diff --git a/src/main/java/li/cil/oc2/api/bus/DeviceBusElement.java b/src/main/java/li/cil/oc2/api/bus/DeviceBusElement.java
index ef2971d6..daa89be4 100644
--- a/src/main/java/li/cil/oc2/api/bus/DeviceBusElement.java
+++ b/src/main/java/li/cil/oc2/api/bus/DeviceBusElement.java
@@ -17,8 +17,13 @@ import java.util.UUID;
* When discovered during a scan, the controller will then use the devices
* connected to this element.
*
- * This interface is only relevant when implementing it, e.g. to provide a custom
- * "cable" or other means to extend a bus.
+ * This interface is relevant when implementing means to extend the bus, e.g.
+ * to provide a custom cable implementation or some kind of a device container.
+ *
+ * Implementations must call {@link #scheduleScan()} when they become
+ * invalid, e.g. due to being in a chunk that is being unloaded or the block
+ * they are defined by being destroyed or the block face they were available
+ * through no longer offering the element.
*/
public interface DeviceBusElement extends DeviceBus {
/**
@@ -26,7 +31,8 @@ public interface DeviceBusElement extends DeviceBus {
*
* This will be called by {@link DeviceBusController}s when scanning.
*
- * Bus elements can be have multiple controllers at the same time.
+ * Bus elements can be have multiple controllers at the same time. This is used
+ * by controllers to detect each other on the bus.
*
* When {@link #scheduleScan()} is called, {@link DeviceBusController#scheduleBusScan()}
* must be called for each registered controller.
@@ -104,7 +110,7 @@ public interface DeviceBusElement extends DeviceBus {
* any connected item devices.
*
* Block devices that require a running amount of energy should use regular means of having
- * energy injected into them. The device bus is not intended nor communicated as something
+ * energy injected into them. The device bus is not intended for nor communicated as something
* that transfers power.
*
* @return the complexity of this bus element.
diff --git a/src/main/java/li/cil/oc2/api/bus/device/provider/ItemDeviceProvider.java b/src/main/java/li/cil/oc2/api/bus/device/provider/ItemDeviceProvider.java
index bb79c5ba..a3156ba9 100644
--- a/src/main/java/li/cil/oc2/api/bus/device/provider/ItemDeviceProvider.java
+++ b/src/main/java/li/cil/oc2/api/bus/device/provider/ItemDeviceProvider.java
@@ -47,6 +47,14 @@ public interface ItemDeviceProvider extends IForgeRegistryEntry getDevice(ItemDeviceQuery query);
+ /**
+ * Get the type of a device that would be obtained from {@link #getDevice(ItemDeviceQuery)}
+ * if called with the same query. The device type controls which slot devices may be
+ * inserted in in item device containers.
+ *
+ * @param query the query describing the object to get the {@link DeviceType} for.
+ * @return the device type for the specified type, if available.
+ */
default Optional getDeviceType(final ItemDeviceQuery query) {
return Optional.of(DeviceTypes.CARD);
}
diff --git a/src/main/java/li/cil/oc2/api/bus/device/rpc/RPCMethod.java b/src/main/java/li/cil/oc2/api/bus/device/rpc/RPCMethod.java
index ce380713..8b0f2de5 100644
--- a/src/main/java/li/cil/oc2/api/bus/device/rpc/RPCMethod.java
+++ b/src/main/java/li/cil/oc2/api/bus/device/rpc/RPCMethod.java
@@ -9,8 +9,8 @@ import java.util.Optional;
/**
* Represents a single method that can be exposed by a {@link RPCDevice}.
*
- * The easiest and hence recommended way of implementing this interface is to use
- * the {@link ObjectDevice} class.
+ * The easiest and hence recommended way of generating an implementation of this
+ * interface is to use the {@link ObjectDevice} class.
*
* Method parameters are serialized and deserialized using Gson. When using custom
* parameter types it may be necessary to register a custom type adapter for them
diff --git a/src/main/java/li/cil/oc2/api/bus/device/vm/event/VMInitializationException.java b/src/main/java/li/cil/oc2/api/bus/device/vm/event/VMInitializationException.java
index 762f955f..bbd3ea3e 100644
--- a/src/main/java/li/cil/oc2/api/bus/device/vm/event/VMInitializationException.java
+++ b/src/main/java/li/cil/oc2/api/bus/device/vm/event/VMInitializationException.java
@@ -4,9 +4,14 @@ import net.minecraft.util.text.ITextComponent;
import java.util.Optional;
+/**
+ * May be fired by devices while handling {@link VMInitializingEvent} to indicate that initialization failed.
+ */
public final class VMInitializationException extends RuntimeException {
private final ITextComponent message;
+ ///////////////////////////////////////////////////////////////
+
public VMInitializationException(final ITextComponent message) {
this.message = message;
}
@@ -15,6 +20,15 @@ public final class VMInitializationException extends RuntimeException {
this.message = null;
}
+ ///////////////////////////////////////////////////////////////
+
+ /**
+ * The error message indicating why initialization failed.
+ *
+ * This should be a human readable message, as it may be displayed to the user.
+ *
+ * @return the error message.
+ */
public Optional getErrorMessage() {
return Optional.ofNullable(message);
}
diff --git a/src/main/java/li/cil/oc2/api/bus/device/vm/event/VMInitializingEvent.java b/src/main/java/li/cil/oc2/api/bus/device/vm/event/VMInitializingEvent.java
index df68e3eb..737d6d76 100644
--- a/src/main/java/li/cil/oc2/api/bus/device/vm/event/VMInitializingEvent.java
+++ b/src/main/java/li/cil/oc2/api/bus/device/vm/event/VMInitializingEvent.java
@@ -19,7 +19,7 @@ import li.cil.oc2.api.bus.device.vm.context.VMContext;
*
* This is invoked from the worker thread running the VM.
*/
-public final class VMInitializingEvent extends VMLifecycleEvent {
+public final class VMInitializingEvent {
private final long programStartAddress;
///////////////////////////////////////////////////////////////
diff --git a/src/main/java/li/cil/oc2/api/bus/device/vm/event/VMLifecycleEvent.java b/src/main/java/li/cil/oc2/api/bus/device/vm/event/VMLifecycleEvent.java
deleted file mode 100644
index 46d10cb2..00000000
--- a/src/main/java/li/cil/oc2/api/bus/device/vm/event/VMLifecycleEvent.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package li.cil.oc2.api.bus.device.vm.event;
-
-public class VMLifecycleEvent {
-}
diff --git a/src/main/java/li/cil/oc2/api/bus/device/vm/event/VMPausingEvent.java b/src/main/java/li/cil/oc2/api/bus/device/vm/event/VMPausingEvent.java
index 572e97f3..6407c1d5 100644
--- a/src/main/java/li/cil/oc2/api/bus/device/vm/event/VMPausingEvent.java
+++ b/src/main/java/li/cil/oc2/api/bus/device/vm/event/VMPausingEvent.java
@@ -8,5 +8,5 @@ package li.cil.oc2.api.bus.device.vm.event;
* if such interactions may modify VM state, to prevent corrupting data being
* serialized asynchronously.
*/
-public final class VMPausingEvent extends VMLifecycleEvent {
+public final class VMPausingEvent {
}
diff --git a/src/main/java/li/cil/oc2/api/bus/device/vm/event/VMResumedRunningEvent.java b/src/main/java/li/cil/oc2/api/bus/device/vm/event/VMResumedRunningEvent.java
index 7a8ebe36..06b46f0c 100644
--- a/src/main/java/li/cil/oc2/api/bus/device/vm/event/VMResumedRunningEvent.java
+++ b/src/main/java/li/cil/oc2/api/bus/device/vm/event/VMResumedRunningEvent.java
@@ -10,5 +10,5 @@ package li.cil.oc2.api.bus.device.vm.event;
* Typically this is used in combination with {@link VMPausingEvent}, to re-enable external
* interactions after VM state is guaranteed to be safe to modify again.
*/
-public final class VMResumedRunningEvent extends VMLifecycleEvent {
+public final class VMResumedRunningEvent {
}
diff --git a/src/main/java/li/cil/oc2/api/bus/device/vm/event/VMResumingRunningEvent.java b/src/main/java/li/cil/oc2/api/bus/device/vm/event/VMResumingRunningEvent.java
index 4b9280df..970d251d 100644
--- a/src/main/java/li/cil/oc2/api/bus/device/vm/event/VMResumingRunningEvent.java
+++ b/src/main/java/li/cil/oc2/api/bus/device/vm/event/VMResumingRunningEvent.java
@@ -12,5 +12,5 @@ import li.cil.oc2.api.bus.device.vm.context.VMContext;
* from a saved state as well as when continuing to run after being paused for
* a save. It is intended for awaiting asynchronous load and store operations.
*/
-public final class VMResumingRunningEvent extends VMLifecycleEvent {
+public final class VMResumingRunningEvent {
}
diff --git a/src/main/java/li/cil/oc2/client/gui/util/GuiUtils.java b/src/main/java/li/cil/oc2/client/gui/util/GuiUtils.java
index e1120b18..5f6b601b 100644
--- a/src/main/java/li/cil/oc2/client/gui/util/GuiUtils.java
+++ b/src/main/java/li/cil/oc2/client/gui/util/GuiUtils.java
@@ -21,6 +21,8 @@ public final class GuiUtils {
private static final int DEVICE_INFO_ICON_SIZE = 28;
private static final int RELATIVE_ICON_POSITION = (SLOT_SIZE - DEVICE_INFO_ICON_SIZE) / 2;
+ ///////////////////////////////////////////////////////////////////
+
public static void renderMissingDeviceInfoIcon(final MatrixStack matrixStack, final ContainerScreen screen, final DeviceType type, final ResourceLocation icon) {
findFirstSlotOfTypeIfAllSlotsOfTypeEmpty(screen.getMenu(), type).ifPresent(slot -> {
screen.getMinecraft().getTextureManager().bind(icon);
@@ -55,6 +57,8 @@ public final class GuiUtils {
});
}
+ ///////////////////////////////////////////////////////////////////
+
private static Optional findFirstSlotOfTypeIfAllSlotsOfTypeEmpty(final Container container, final DeviceType type) {
TypedSlotItemHandler firstSlot = null;
for (final Slot slot : container.slots) {
diff --git a/src/main/java/li/cil/oc2/client/gui/widget/ImageButton.java b/src/main/java/li/cil/oc2/client/gui/widget/ImageButton.java
index a6281755..bf2a1f82 100644
--- a/src/main/java/li/cil/oc2/client/gui/widget/ImageButton.java
+++ b/src/main/java/li/cil/oc2/client/gui/widget/ImageButton.java
@@ -19,6 +19,8 @@ public abstract class ImageButton extends AbstractButton {
private static final long PRESS_DURATION = 200;
private static final long TOOLTIP_DELAY = 250;
+ ///////////////////////////////////////////////////////////////////
+
private final Screen parent;
private final List extends ITextComponent> tooltip;
private final Sprite baseImage;
@@ -26,6 +28,8 @@ public abstract class ImageButton extends AbstractButton {
private long lastPressedAt;
private long hoveringStartedAt;
+ ///////////////////////////////////////////////////////////////////
+
public ImageButton(final Screen parent,
final int x, final int y,
final int width, final int height,
@@ -44,6 +48,8 @@ public abstract class ImageButton extends AbstractButton {
this.pressedImage = pressedImage;
}
+ ///////////////////////////////////////////////////////////////////
+
@Override
public void onPress() {
lastPressedAt = System.currentTimeMillis();
diff --git a/src/main/java/li/cil/oc2/client/gui/widget/Sprite.java b/src/main/java/li/cil/oc2/client/gui/widget/Sprite.java
index 15622add..cf174a45 100644
--- a/src/main/java/li/cil/oc2/client/gui/widget/Sprite.java
+++ b/src/main/java/li/cil/oc2/client/gui/widget/Sprite.java
@@ -11,6 +11,8 @@ public final class Sprite extends AbstractGui {
public final int width, height;
public final int u0, v0;
+ ///////////////////////////////////////////////////////////////////
+
public Sprite(final ResourceLocation atlas, final int textureSize, final int width, final int height, final int u0, final int v0) {
this.image = atlas;
this.textureSize = textureSize;
@@ -20,6 +22,8 @@ public final class Sprite extends AbstractGui {
this.v0 = v0;
}
+ ///////////////////////////////////////////////////////////////////
+
public void draw(final MatrixStack stack, final int x, final int y) {
Minecraft.getInstance().getTextureManager().bind(image);
blit(stack, x, y, u0, v0, width, height, textureSize, textureSize);
diff --git a/src/main/java/li/cil/oc2/client/gui/widget/ToggleImageButton.java b/src/main/java/li/cil/oc2/client/gui/widget/ToggleImageButton.java
index ab647563..dce7aaf5 100644
--- a/src/main/java/li/cil/oc2/client/gui/widget/ToggleImageButton.java
+++ b/src/main/java/li/cil/oc2/client/gui/widget/ToggleImageButton.java
@@ -19,6 +19,8 @@ public abstract class ToggleImageButton extends AbstractButton {
private static final long PRESS_DURATION = 200;
private static final long TOOLTIP_DELAY = 250;
+ ///////////////////////////////////////////////////////////////////
+
private final Screen parent;
private final List extends ITextComponent> tooltip;
private final Sprite baseImage;
@@ -28,6 +30,8 @@ public abstract class ToggleImageButton extends AbstractButton {
private long lastPressedAt;
private long hoveringStartedAt;
+ ///////////////////////////////////////////////////////////////////
+
public ToggleImageButton(
final Screen parent,
final int x, final int y,
@@ -49,6 +53,8 @@ public abstract class ToggleImageButton extends AbstractButton {
this.activeImage = activeImage;
}
+ ///////////////////////////////////////////////////////////////////
+
@Override
public void onPress() {
lastPressedAt = System.currentTimeMillis();
diff --git a/src/main/java/li/cil/oc2/client/model/BusCableBakedModel.java b/src/main/java/li/cil/oc2/client/model/BusCableBakedModel.java
index 27eb1615..0a54d8f8 100644
--- a/src/main/java/li/cil/oc2/client/model/BusCableBakedModel.java
+++ b/src/main/java/li/cil/oc2/client/model/BusCableBakedModel.java
@@ -22,17 +22,20 @@ import java.util.List;
import java.util.Random;
public final class BusCableBakedModel implements IDynamicBakedModel {
-
private final IBakedModel proxy;
private final IBakedModel[] straightModelByAxis;
private final IBakedModel[] supportModelByFace;
+ ///////////////////////////////////////////////////////////////////
+
public BusCableBakedModel(final IBakedModel proxy, final IBakedModel[] straightModelByAxis, final IBakedModel[] supportModelByFace) {
this.proxy = proxy;
this.straightModelByAxis = straightModelByAxis;
this.supportModelByFace = supportModelByFace;
}
+ ///////////////////////////////////////////////////////////////////
+
@Override
public List getQuads(@Nullable final BlockState state, @Nullable final Direction side, final Random rand, final IModelData extraData) {
if (state == null || !state.getValue(BusCableBlock.HAS_CABLE)) {
diff --git a/src/main/java/li/cil/oc2/client/model/BusCableModel.java b/src/main/java/li/cil/oc2/client/model/BusCableModel.java
index 99ddc3b1..83ab9644 100644
--- a/src/main/java/li/cil/oc2/client/model/BusCableModel.java
+++ b/src/main/java/li/cil/oc2/client/model/BusCableModel.java
@@ -21,12 +21,18 @@ public final class BusCableModel implements IModelGeometry {
private static final ResourceLocation BUS_CABLE_STRAIGHT_MODEL = new ResourceLocation(API.MOD_ID, "block/cable_straight");
private static final ResourceLocation BUS_CABLE_SUPPORT_MODEL = new ResourceLocation(API.MOD_ID, "block/cable_support");
+ ///////////////////////////////////////////////////////////////////
+
private final ModelLoaderRegistry.VanillaProxy proxy;
+ ///////////////////////////////////////////////////////////////////
+
public BusCableModel(final ModelLoaderRegistry.VanillaProxy proxy) {
this.proxy = proxy;
}
+ ///////////////////////////////////////////////////////////////////
+
@Override
public IBakedModel bake(final IModelConfiguration owner, final ModelBakery bakery, final Function spriteGetter, final IModelTransform modelTransform, final ItemOverrideList overrides, final ResourceLocation modelLocation) {
final IBakedModel bakedBaseModel = proxy.bake(owner, bakery, spriteGetter, modelTransform, overrides, modelLocation);
diff --git a/src/main/java/li/cil/oc2/client/renderer/entity/RobotEntityRenderer.java b/src/main/java/li/cil/oc2/client/renderer/entity/RobotEntityRenderer.java
index 2a961fb8..86e3f40c 100644
--- a/src/main/java/li/cil/oc2/client/renderer/entity/RobotEntityRenderer.java
+++ b/src/main/java/li/cil/oc2/client/renderer/entity/RobotEntityRenderer.java
@@ -48,10 +48,5 @@ public final class RobotEntityRenderer extends EntityRenderer {
model.renderToBuffer(matrixStack, builder, packedLight, OverlayTexture.NO_OVERLAY, 1, 1, 1, 1);
matrixStack.popPose();
-
-// final RayTraceResult hit = Minecraft.getInstance().objectMouseOver;
-// if (hit instanceof EntityRayTraceResult && entity == ((EntityRayTraceResult) hit).getEntity()) {
-// super.renderName(entity, new StringTextComponent("hi"), matrixStack, buffer, packedLight);
-// }
}
}
diff --git a/src/main/java/li/cil/oc2/common/bus/device/block/package-info.java b/src/main/java/li/cil/oc2/common/bus/device/block/package-info.java
deleted file mode 100644
index afe248e1..00000000
--- a/src/main/java/li/cil/oc2/common/bus/device/block/package-info.java
+++ /dev/null
@@ -1,7 +0,0 @@
-@ParametersAreNonnullByDefault
-@MethodsReturnNonnullByDefault
-package li.cil.oc2.common.bus.device.block;
-
-import mcp.MethodsReturnNonnullByDefault;
-
-import javax.annotation.ParametersAreNonnullByDefault;
\ No newline at end of file
diff --git a/src/main/java/li/cil/oc2/common/bus/device/item/NetworkInterfaceCardItemDevice.java b/src/main/java/li/cil/oc2/common/bus/device/item/NetworkInterfaceCardItemDevice.java
index 4daba0ac..25932b8d 100644
--- a/src/main/java/li/cil/oc2/common/bus/device/item/NetworkInterfaceCardItemDevice.java
+++ b/src/main/java/li/cil/oc2/common/bus/device/item/NetworkInterfaceCardItemDevice.java
@@ -22,6 +22,7 @@ import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.common.util.LazyOptional;
+import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@SuppressWarnings("UnstableApiUsage")
@@ -48,6 +49,7 @@ public final class NetworkInterfaceCardItemDevice extends IdentityProxy LazyOptional getCapability(final Capability cap, @Nullable final Direction side) {
if (cap == Capabilities.NETWORK_INTERFACE && side != null) {
diff --git a/src/main/java/li/cil/oc2/common/energy/EnergyStorageItemStack.java b/src/main/java/li/cil/oc2/common/energy/EnergyStorageItemStack.java
index d5e5c8e6..b86c468d 100644
--- a/src/main/java/li/cil/oc2/common/energy/EnergyStorageItemStack.java
+++ b/src/main/java/li/cil/oc2/common/energy/EnergyStorageItemStack.java
@@ -9,6 +9,7 @@ import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.IEnergyStorage;
+import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public final class EnergyStorageItemStack implements IEnergyStorage, ICapabilityProvider {
@@ -61,6 +62,7 @@ public final class EnergyStorageItemStack implements IEnergyStorage, ICapability
return true;
}
+ @Nonnull
@Override
public LazyOptional getCapability(final Capability capability, @Nullable final Direction side) {
if (Capabilities.ENERGY_STORAGE != null && capability != null) {
diff --git a/src/main/java/li/cil/oc2/common/entity/RobotEntity.java b/src/main/java/li/cil/oc2/common/entity/RobotEntity.java
index 7e773f2f..f2f361db 100644
--- a/src/main/java/li/cil/oc2/common/entity/RobotEntity.java
+++ b/src/main/java/li/cil/oc2/common/entity/RobotEntity.java
@@ -73,6 +73,7 @@ import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.network.NetworkHooks;
import net.minecraftforge.items.ItemStackHandler;
+import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.nio.ByteBuffer;
import java.util.*;
@@ -165,6 +166,7 @@ public final class RobotEntity extends Entity implements Robot {
getEntityData().set(SELECTED_SLOT, (byte) MathHelper.clamp(value, 0, INVENTORY_SIZE - 1));
}
+ @Nonnull
@Override
public LazyOptional getCapability(final Capability capability, @Nullable final Direction side) {
if (capability == Capabilities.ITEM_HANDLER) {
@@ -311,7 +313,7 @@ public final class RobotEntity extends Entity implements Robot {
}
@Override
- public IPacket> getAddEntityPacket() {
+ public IPacket> getAddEntityPacket() {
return NetworkHooks.getEntitySpawningPacket(this);
}
diff --git a/src/main/java/li/cil/oc2/common/item/MemoryItem.java b/src/main/java/li/cil/oc2/common/item/MemoryItem.java
index 35471d48..7c66d368 100644
--- a/src/main/java/li/cil/oc2/common/item/MemoryItem.java
+++ b/src/main/java/li/cil/oc2/common/item/MemoryItem.java
@@ -11,5 +11,4 @@ public final class MemoryItem extends AbstractStorageItem {
protected String getOrCreateDescriptionId() {
return "item.oc2.memory";
}
-
}
diff --git a/src/main/java/li/cil/oc2/common/tileentity/AbstractTileEntity.java b/src/main/java/li/cil/oc2/common/tileentity/AbstractTileEntity.java
index d24da42d..fa394409 100644
--- a/src/main/java/li/cil/oc2/common/tileentity/AbstractTileEntity.java
+++ b/src/main/java/li/cil/oc2/common/tileentity/AbstractTileEntity.java
@@ -8,6 +8,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
+import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.HashMap;
@@ -26,6 +27,7 @@ public abstract class AbstractTileEntity extends TileEntity {
///////////////////////////////////////////////////////////////////
+ @Nonnull
@Override
public LazyOptional getCapability(final Capability capability, @Nullable final Direction side) {
if (isRemoved()) {
diff --git a/src/main/java/li/cil/oc2/common/tileentity/ComputerTileEntity.java b/src/main/java/li/cil/oc2/common/tileentity/ComputerTileEntity.java
index f519d0b0..f31b882b 100644
--- a/src/main/java/li/cil/oc2/common/tileentity/ComputerTileEntity.java
+++ b/src/main/java/li/cil/oc2/common/tileentity/ComputerTileEntity.java
@@ -41,12 +41,12 @@ import net.minecraft.util.Direction;
import net.minecraft.util.IIntArray;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;
-import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fml.network.NetworkHooks;
+import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable;
import java.nio.ByteBuffer;
@@ -186,6 +186,7 @@ public final class ComputerTileEntity extends AbstractTileEntity implements ITic
virtualMachine.busController.scheduleBusScan();
}
+ @NotNull
@Override
public LazyOptional getCapability(final Capability capability, @Nullable final Direction side) {
if (isRemoved()) {
@@ -371,6 +372,8 @@ public final class ComputerTileEntity extends AbstractTileEntity implements ITic
@Override
public Optional>> getNeighbors() {
return super.getNeighbors().map(neighbors -> {
+ // If we have valid neighbors (complete bus) also add a connection to the bus
+ // element hosting our item devices.
final ArrayList> list = new ArrayList<>(neighbors);
list.add(LazyOptional.of(() -> deviceItems.busElement));
return list;