Skip to content

Commit

Permalink
move setConnected() back
Browse files Browse the repository at this point in the history
combine checks in `getController()`
  • Loading branch information
ghzdude committed Dec 8, 2023
1 parent 3e9f2d7 commit 7a762f3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,8 @@ public void setDisconnected() {
// use this to make sure controller is properly initialized
@Override
public IQuantumController getController() {
if (getWorld().isRemote) return null; // quick safety check
if (isConnected()) {
if (controller != null && controller.get() != null) return controller.get();
if (!getWorld().isRemote && isConnected()) {
if (controller.get() != null) return controller.get();
MetaTileEntity mte = GTUtility.getMetaTileEntity(getWorld(), controllerPos);
if (mte instanceof IQuantumController) {
controller = new WeakReference<>((IQuantumController) mte);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ public void rebuildNetwork() {
// valid chest/tank located, add it
storageInstances.put(pos, new WeakReference<>(storage));
storagePositions.add(pos);
storage.setConnected(this);
oldInstances.remove(pos);
oldPositions.remove(pos);
storage.setConnected(this);

// check against already check posses so we don't recheck a checked pos
for (EnumFacing facing : EnumFacing.VALUES) {
Expand Down

0 comments on commit 7a762f3

Please sign in to comment.