Move getBlock dep
This commit is contained in:
@@ -26,10 +26,6 @@ public abstract class BlockNode extends BlockBase {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasConnectivityState() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer.Builder createBlockStateBuilder() {
|
protected BlockStateContainer.Builder createBlockStateBuilder() {
|
||||||
BlockStateContainer.Builder builder = super.createBlockStateBuilder();
|
BlockStateContainer.Builder builder = super.createBlockStateBuilder();
|
||||||
@@ -90,4 +86,8 @@ public abstract class BlockNode extends BlockBase {
|
|||||||
NetworkUtils.rebuildGraph(network);
|
NetworkUtils.rebuildGraph(network);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasConnectivityState() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,6 +98,11 @@ public class TileCrafter extends TileNode implements ICraftingPatternContainer {
|
|||||||
return new CombinedInvWrapper(patterns, upgrades);
|
return new CombinedInvWrapper(patterns, upgrades);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasConnectivityState() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
||||||
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY && facing != getDirection()) {
|
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY && facing != getDirection()) {
|
||||||
|
|||||||
@@ -39,4 +39,9 @@ public class TileCraftingMonitor extends TileNode {
|
|||||||
@Override
|
@Override
|
||||||
public void updateNode() {
|
public void updateNode() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasConnectivityState() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,6 +137,16 @@ public class TileFluidInterface extends TileNode implements IComparable {
|
|||||||
return RefinedStorage.INSTANCE.fluidInterfaceUsage;
|
return RefinedStorage.INSTANCE.fluidInterfaceUsage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCompare() {
|
||||||
|
return compare;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCompare(int compare) {
|
||||||
|
this.compare = compare;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound write(NBTTagCompound tag) {
|
public NBTTagCompound write(NBTTagCompound tag) {
|
||||||
super.write(tag);
|
super.write(tag);
|
||||||
@@ -186,6 +196,11 @@ public class TileFluidInterface extends TileNode implements IComparable {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasConnectivityState() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
|
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
|
||||||
return capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
|
return capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
|
||||||
@@ -199,14 +214,4 @@ public class TileFluidInterface extends TileNode implements IComparable {
|
|||||||
|
|
||||||
return super.getCapability(capability, facing);
|
return super.getCapability(capability, facing);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getCompare() {
|
|
||||||
return compare;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setCompare(int compare) {
|
|
||||||
this.compare = compare;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,6 +154,11 @@ public class TileInterface extends TileNode implements IComparable {
|
|||||||
return new CombinedInvWrapper(importItems, exportItems, upgrades);
|
return new CombinedInvWrapper(importItems, exportItems, upgrades);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasConnectivityState() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
||||||
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
||||||
|
|||||||
@@ -17,4 +17,9 @@ public class TileNetworkReceiver extends TileNode {
|
|||||||
public void setRedstoneMode(RedstoneMode mode) {
|
public void setRedstoneMode(RedstoneMode mode) {
|
||||||
// NO OP
|
// NO OP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasConnectivityState() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,4 +148,9 @@ public class TileNetworkTransmitter extends TileNode {
|
|||||||
public boolean isDimensionSupported() {
|
public boolean isDimensionSupported() {
|
||||||
return isSameDimension() || upgrades.hasUpgrade(ItemUpgrade.TYPE_INTERDIMENSIONAL);
|
return isSameDimension() || upgrades.hasUpgrade(ItemUpgrade.TYPE_INTERDIMENSIONAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasConnectivityState() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package refinedstorage.tile;
|
package refinedstorage.tile;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@@ -8,7 +7,6 @@ import net.minecraft.world.World;
|
|||||||
import refinedstorage.api.network.INetworkMaster;
|
import refinedstorage.api.network.INetworkMaster;
|
||||||
import refinedstorage.api.network.INetworkNode;
|
import refinedstorage.api.network.INetworkNode;
|
||||||
import refinedstorage.api.network.NetworkUtils;
|
import refinedstorage.api.network.NetworkUtils;
|
||||||
import refinedstorage.block.BlockNode;
|
|
||||||
import refinedstorage.tile.config.IRedstoneConfigurable;
|
import refinedstorage.tile.config.IRedstoneConfigurable;
|
||||||
import refinedstorage.tile.config.RedstoneMode;
|
import refinedstorage.tile.config.RedstoneMode;
|
||||||
import refinedstorage.tile.data.TileDataParameter;
|
import refinedstorage.tile.data.TileDataParameter;
|
||||||
@@ -39,12 +37,6 @@ public abstract class TileNode extends TileBase implements INetworkNode, IRedsto
|
|||||||
return isConnected() && canUpdate();
|
return isConnected() && canUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canSendConnectivityUpdate() {
|
|
||||||
Block block = getBlockType();
|
|
||||||
|
|
||||||
return block instanceof BlockNode ? ((BlockNode) block).hasConnectivityState() : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
if (!worldObj.isRemote) {
|
if (!worldObj.isRemote) {
|
||||||
@@ -58,7 +50,7 @@ public abstract class TileNode extends TileBase implements INetworkNode, IRedsto
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (active != isActive() && canSendConnectivityUpdate()) {
|
if (active != isActive() && hasConnectivityState()) {
|
||||||
updateBlock();
|
updateBlock();
|
||||||
|
|
||||||
active = isActive();
|
active = isActive();
|
||||||
@@ -155,7 +147,7 @@ public abstract class TileNode extends TileBase implements INetworkNode, IRedsto
|
|||||||
public NBTTagCompound writeUpdate(NBTTagCompound tag) {
|
public NBTTagCompound writeUpdate(NBTTagCompound tag) {
|
||||||
super.writeUpdate(tag);
|
super.writeUpdate(tag);
|
||||||
|
|
||||||
if (canSendConnectivityUpdate()) {
|
if (hasConnectivityState()) {
|
||||||
tag.setBoolean(NBT_CONNECTED, isActive());
|
tag.setBoolean(NBT_CONNECTED, isActive());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,10 +155,14 @@ public abstract class TileNode extends TileBase implements INetworkNode, IRedsto
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void readUpdate(NBTTagCompound tag) {
|
public void readUpdate(NBTTagCompound tag) {
|
||||||
if (canSendConnectivityUpdate()) {
|
if (hasConnectivityState()) {
|
||||||
connected = tag.getBoolean(NBT_CONNECTED);
|
connected = tag.getBoolean(NBT_CONNECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
super.readUpdate(tag);
|
super.readUpdate(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasConnectivityState() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,4 +24,9 @@ public class TileRelay extends TileNode {
|
|||||||
public boolean canConduct(EnumFacing direction) {
|
public boolean canConduct(EnumFacing direction) {
|
||||||
return canUpdate();
|
return canUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasConnectivityState() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,6 +78,11 @@ public class TileWirelessTransmitter extends TileNode implements IWirelessTransm
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasConnectivityState() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
||||||
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
||||||
|
|||||||
@@ -418,6 +418,11 @@ public class TileGrid extends TileNode implements IGrid {
|
|||||||
return REDSTONE_MODE;
|
return REDSTONE_MODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasConnectivityState() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void read(NBTTagCompound tag) {
|
public void read(NBTTagCompound tag) {
|
||||||
super.read(tag);
|
super.read(tag);
|
||||||
|
|||||||
Reference in New Issue
Block a user