Remove useless checks

This commit is contained in:
raoulvdberge
2017-05-25 02:29:29 +02:00
parent 5af81e2bfe
commit 8cb37727e5
5 changed files with 7 additions and 15 deletions

View File

@@ -20,7 +20,7 @@ public class NetworkNodeListener {
if (e.phase == TickEvent.Phase.END) {
for (INetworkNode node : API.instance().getNetworkNodeManager(e.world).all()) {
if (node.getWorld() != null && e.world.isBlockLoaded(node.getPos())) {
if (e.world.isBlockLoaded(node.getPos())) {
node.update();
}
}

View File

@@ -75,7 +75,7 @@ public abstract class NetworkNode implements INetworkNode, INetworkNeighborhoodA
@Override
public void markDirty() {
if (world != null && !world.isRemote) {
if (!world.isRemote) {
API.instance().getNetworkNodeManager(world).markForSaving();
}
}

View File

@@ -27,20 +27,12 @@ public class NetworkNodeCrafter extends NetworkNode implements ICraftingPatternC
private static final String NBT_TRIGGERED_AUTOCRAFTING = "TriggeredAutocrafting";
private static final String NBT_BLOCKED = "Blocked";
private ItemHandlerBase patterns = new ItemHandlerBase(9, new ItemHandlerListenerNetworkNode(this), s -> {
// We can only validate the crafting pattern if the world exists.
// If the world doesn't exist, this is probably called while reading and in that case it doesn't matter.
if (world != null) {
return s.getItem() instanceof ICraftingPatternProvider && ((ICraftingPatternProvider) s.getItem()).create(world, s, this).isValid();
}
return true;
}) {
private ItemHandlerBase patterns = new ItemHandlerBase(9, new ItemHandlerListenerNetworkNode(this), s -> s.getItem() instanceof ICraftingPatternProvider && ((ICraftingPatternProvider) s.getItem()).create(world, s, this).isValid()) {
@Override
protected void onContentsChanged(int slot) {
super.onContentsChanged(slot);
if (world != null && !world.isRemote) {
if (!world.isRemote) {
rebuildPatterns();
}

View File

@@ -34,7 +34,7 @@ public class NetworkNodeFluidInterface extends NetworkNode implements IComparabl
protected void onContentsChanged() {
super.onContentsChanged();
if (world != null && !world.isRemote) {
if (!world.isRemote) {
((TileFluidInterface) world.getTileEntity(pos)).getDataManager().sendParameterToWatchers(TileFluidInterface.TANK_IN);
}
@@ -47,7 +47,7 @@ public class NetworkNodeFluidInterface extends NetworkNode implements IComparabl
protected void onContentsChanged() {
super.onContentsChanged();
if (world != null && !world.isRemote) {
if (!world.isRemote) {
((TileFluidInterface) world.getTileEntity(pos)).getDataManager().sendParameterToWatchers(TileFluidInterface.TANK_OUT);
}

View File

@@ -36,7 +36,7 @@ public class NetworkNodeSecurityManager extends NetworkNode implements ISecurity
protected void onContentsChanged(int slot) {
super.onContentsChanged(slot);
if (world != null && !world.isRemote) {
if (!world.isRemote) {
rebuildCards();
}