Revert "Correctly save stuff, should work for Funky Locomotion integration"
This reverts commit f6b983f0b4.
This commit is contained in:
@@ -80,7 +80,7 @@ public class NetworkNodeGraph implements INetworkNodeGraph {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(tile instanceof INetworkNode) || (tile != null && tile.isInvalid())) {
|
||||
if (!(tile instanceof INetworkNode)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -270,13 +270,35 @@ public class BlockCable extends BlockCoverable {
|
||||
if (getPlacementType() != null) {
|
||||
((TileBase) world.getTileEntity(pos)).setDirection(state.getValue(DIRECTION));
|
||||
}
|
||||
|
||||
attemptConnect(world, pos);
|
||||
}
|
||||
|
||||
public void attemptConnect(World world, BlockPos pos) {
|
||||
if (!world.isRemote) {
|
||||
for (EnumFacing facing : EnumFacing.VALUES) {
|
||||
TileEntity tile = world.getTileEntity(pos.offset(facing));
|
||||
|
||||
if (tile instanceof TileNode && ((TileNode) tile).isConnected()) {
|
||||
((TileNode) tile).getNetwork().getNodeGraph().rebuild();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
||||
INetworkMaster network = null;
|
||||
|
||||
if (!world.isRemote) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if (tile instanceof TileNode) {
|
||||
network = ((TileNode) tile).getNetwork();
|
||||
}
|
||||
|
||||
if (tile instanceof TileBase && ((TileBase) tile).getDrops() != null) {
|
||||
IItemHandler handler = ((TileBase) tile).getDrops();
|
||||
|
||||
@@ -289,6 +311,10 @@ public class BlockCable extends BlockCoverable {
|
||||
}
|
||||
|
||||
super.breakBlock(world, pos, state);
|
||||
|
||||
if (network != null) {
|
||||
network.getNodeGraph().rebuild();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -102,6 +102,15 @@ public class BlockController extends BlockBase {
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
||||
if (!world.isRemote) {
|
||||
((TileController) world.getTileEntity(pos)).onDestroyed();
|
||||
}
|
||||
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block) {
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
package com.raoulvdberge.refinedstorage.block;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.api.network.INetworkMaster;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileNode;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class BlockNode extends BlockBase {
|
||||
public static final PropertyBool CONNECTED = PropertyBool.create("connected");
|
||||
@@ -44,6 +50,42 @@ public abstract class BlockNode extends BlockBase {
|
||||
return super.getActualState(state, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
|
||||
if (!world.isRemote) {
|
||||
for (EnumFacing facing : EnumFacing.VALUES) {
|
||||
TileEntity tile = world.getTileEntity(pos.offset(facing));
|
||||
|
||||
if (tile instanceof TileNode && ((TileNode) tile).isConnected()) {
|
||||
((TileNode) tile).getNetwork().getNodeGraph().rebuild();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
||||
INetworkMaster network = null;
|
||||
|
||||
if (!world.isRemote) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if (tile instanceof TileNode) {
|
||||
network = ((TileNode) tile).getNetwork();
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(world, pos, state);
|
||||
|
||||
if (network != null) {
|
||||
network.getNodeGraph().rebuild();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasConnectivityState() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -327,10 +327,6 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
||||
super.invalidate();
|
||||
|
||||
energyEU.invalidate();
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
onBreak();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -355,7 +351,7 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
||||
energyEU.onChunkUnload();
|
||||
}
|
||||
|
||||
public void onBreak() {
|
||||
public void onDestroyed() {
|
||||
nodeGraph.disconnectAll();
|
||||
}
|
||||
|
||||
|
||||
@@ -241,13 +241,6 @@ public class TileDiskDrive extends TileNode implements IItemStorageProvider, IFl
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
onBreak();
|
||||
|
||||
super.invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectionChange(INetworkMaster network, boolean state) {
|
||||
super.onConnectionChange(network, state);
|
||||
|
||||
@@ -613,11 +613,4 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
onBreak();
|
||||
|
||||
super.invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,13 +124,6 @@ public class TileFluidStorage extends TileNode implements IFluidStorageProvider,
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
onBreak();
|
||||
|
||||
super.invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectionChange(INetworkMaster network, boolean state) {
|
||||
super.onConnectionChange(network, state);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.raoulvdberge.refinedstorage.tile;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RSBlocks;
|
||||
import mcmultipart.capabilities.ISlottedCapabilityProvider;
|
||||
import mcmultipart.capabilities.MultipartCapabilityHelper;
|
||||
import mcmultipart.microblock.IMicroblock;
|
||||
@@ -71,7 +72,7 @@ public abstract class TileMultipartNode extends TileNode implements IMicroblockC
|
||||
if (network != null) {
|
||||
network.getNodeGraph().rebuild();
|
||||
} else if (worldObj != null) {
|
||||
rebuildNearbyGraph();
|
||||
RSBlocks.CABLE.attemptConnect(worldObj, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ public abstract class TileNode extends TileBase implements INetworkNode, IRedsto
|
||||
protected INetworkMaster network;
|
||||
|
||||
protected boolean rebuildOnUpdateChange;
|
||||
private boolean rebuildNearbyGraph;
|
||||
|
||||
public TileNode() {
|
||||
dataManager.addWatchedParameter(REDSTONE_MODE);
|
||||
@@ -58,10 +57,6 @@ public abstract class TileNode extends TileBase implements INetworkNode, IRedsto
|
||||
}
|
||||
|
||||
networkPos = null;
|
||||
} else if (rebuildNearbyGraph) {
|
||||
rebuildNearbyGraph = false;
|
||||
|
||||
rebuildNearbyGraph();
|
||||
}
|
||||
|
||||
if (update != canUpdate() && network != null) {
|
||||
@@ -88,18 +83,6 @@ public abstract class TileNode extends TileBase implements INetworkNode, IRedsto
|
||||
super.update();
|
||||
}
|
||||
|
||||
protected void rebuildNearbyGraph() {
|
||||
for (EnumFacing facing : EnumFacing.VALUES) {
|
||||
TileEntity tile = worldObj.getTileEntity(pos.offset(facing));
|
||||
|
||||
if (tile instanceof TileNode && ((TileNode) tile).isConnected()) {
|
||||
((TileNode) tile).getNetwork().getNodeGraph().rebuild();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnected(INetworkMaster network) {
|
||||
this.connected = true;
|
||||
@@ -218,20 +201,4 @@ public abstract class TileNode extends TileBase implements INetworkNode, IRedsto
|
||||
public boolean hasConnectivityState() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
|
||||
if (!worldObj.isRemote && network != null) {
|
||||
network.getNodeGraph().rebuild();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
super.validate();
|
||||
|
||||
rebuildNearbyGraph = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,13 +125,6 @@ public class TileStorage extends TileNode implements IItemStorageProvider, IStor
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
onBreak();
|
||||
|
||||
super.invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectionChange(INetworkMaster network, boolean state) {
|
||||
super.onConnectionChange(network, state);
|
||||
|
||||
Reference in New Issue
Block a user