Remove useless checks
This commit is contained in:
@@ -20,7 +20,7 @@ public class NetworkNodeListener {
|
|||||||
|
|
||||||
if (e.phase == TickEvent.Phase.END) {
|
if (e.phase == TickEvent.Phase.END) {
|
||||||
for (INetworkNode node : API.instance().getNetworkNodeManager(e.world).all()) {
|
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();
|
node.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public abstract class NetworkNode implements INetworkNode, INetworkNeighborhoodA
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void markDirty() {
|
public void markDirty() {
|
||||||
if (world != null && !world.isRemote) {
|
if (!world.isRemote) {
|
||||||
API.instance().getNetworkNodeManager(world).markForSaving();
|
API.instance().getNetworkNodeManager(world).markForSaving();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,20 +27,12 @@ public class NetworkNodeCrafter extends NetworkNode implements ICraftingPatternC
|
|||||||
private static final String NBT_TRIGGERED_AUTOCRAFTING = "TriggeredAutocrafting";
|
private static final String NBT_TRIGGERED_AUTOCRAFTING = "TriggeredAutocrafting";
|
||||||
private static final String NBT_BLOCKED = "Blocked";
|
private static final String NBT_BLOCKED = "Blocked";
|
||||||
|
|
||||||
private ItemHandlerBase patterns = new ItemHandlerBase(9, new ItemHandlerListenerNetworkNode(this), s -> {
|
private ItemHandlerBase patterns = new ItemHandlerBase(9, new ItemHandlerListenerNetworkNode(this), s -> s.getItem() instanceof ICraftingPatternProvider && ((ICraftingPatternProvider) s.getItem()).create(world, s, this).isValid()) {
|
||||||
// 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;
|
|
||||||
}) {
|
|
||||||
@Override
|
@Override
|
||||||
protected void onContentsChanged(int slot) {
|
protected void onContentsChanged(int slot) {
|
||||||
super.onContentsChanged(slot);
|
super.onContentsChanged(slot);
|
||||||
|
|
||||||
if (world != null && !world.isRemote) {
|
if (!world.isRemote) {
|
||||||
rebuildPatterns();
|
rebuildPatterns();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class NetworkNodeFluidInterface extends NetworkNode implements IComparabl
|
|||||||
protected void onContentsChanged() {
|
protected void onContentsChanged() {
|
||||||
super.onContentsChanged();
|
super.onContentsChanged();
|
||||||
|
|
||||||
if (world != null && !world.isRemote) {
|
if (!world.isRemote) {
|
||||||
((TileFluidInterface) world.getTileEntity(pos)).getDataManager().sendParameterToWatchers(TileFluidInterface.TANK_IN);
|
((TileFluidInterface) world.getTileEntity(pos)).getDataManager().sendParameterToWatchers(TileFluidInterface.TANK_IN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ public class NetworkNodeFluidInterface extends NetworkNode implements IComparabl
|
|||||||
protected void onContentsChanged() {
|
protected void onContentsChanged() {
|
||||||
super.onContentsChanged();
|
super.onContentsChanged();
|
||||||
|
|
||||||
if (world != null && !world.isRemote) {
|
if (!world.isRemote) {
|
||||||
((TileFluidInterface) world.getTileEntity(pos)).getDataManager().sendParameterToWatchers(TileFluidInterface.TANK_OUT);
|
((TileFluidInterface) world.getTileEntity(pos)).getDataManager().sendParameterToWatchers(TileFluidInterface.TANK_OUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class NetworkNodeSecurityManager extends NetworkNode implements ISecurity
|
|||||||
protected void onContentsChanged(int slot) {
|
protected void onContentsChanged(int slot) {
|
||||||
super.onContentsChanged(slot);
|
super.onContentsChanged(slot);
|
||||||
|
|
||||||
if (world != null && !world.isRemote) {
|
if (!world.isRemote) {
|
||||||
rebuildCards();
|
rebuildCards();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user