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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(tile instanceof INetworkNode) || (tile != null && tile.isInvalid())) {
|
if (!(tile instanceof INetworkNode)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -270,13 +270,35 @@ public class BlockCable extends BlockCoverable {
|
|||||||
if (getPlacementType() != null) {
|
if (getPlacementType() != null) {
|
||||||
((TileBase) world.getTileEntity(pos)).setDirection(state.getValue(DIRECTION));
|
((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
|
@Override
|
||||||
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
||||||
|
INetworkMaster network = null;
|
||||||
|
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
|
|
||||||
|
if (tile instanceof TileNode) {
|
||||||
|
network = ((TileNode) tile).getNetwork();
|
||||||
|
}
|
||||||
|
|
||||||
if (tile instanceof TileBase && ((TileBase) tile).getDrops() != null) {
|
if (tile instanceof TileBase && ((TileBase) tile).getDrops() != null) {
|
||||||
IItemHandler handler = ((TileBase) tile).getDrops();
|
IItemHandler handler = ((TileBase) tile).getDrops();
|
||||||
|
|
||||||
@@ -289,6 +311,10 @@ public class BlockCable extends BlockCoverable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
super.breakBlock(world, pos, state);
|
super.breakBlock(world, pos, state);
|
||||||
|
|
||||||
|
if (network != null) {
|
||||||
|
network.getNodeGraph().rebuild();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -102,6 +102,15 @@ public class BlockController extends BlockBase {
|
|||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
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
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block) {
|
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block) {
|
||||||
|
|||||||
@@ -1,11 +1,17 @@
|
|||||||
package com.raoulvdberge.refinedstorage.block;
|
package com.raoulvdberge.refinedstorage.block;
|
||||||
|
|
||||||
|
import com.raoulvdberge.refinedstorage.api.network.INetworkMaster;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileNode;
|
import com.raoulvdberge.refinedstorage.tile.TileNode;
|
||||||
import net.minecraft.block.properties.PropertyBool;
|
import net.minecraft.block.properties.PropertyBool;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
import net.minecraft.block.state.IBlockState;
|
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.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public abstract class BlockNode extends BlockBase {
|
public abstract class BlockNode extends BlockBase {
|
||||||
public static final PropertyBool CONNECTED = PropertyBool.create("connected");
|
public static final PropertyBool CONNECTED = PropertyBool.create("connected");
|
||||||
@@ -44,6 +50,42 @@ public abstract class BlockNode extends BlockBase {
|
|||||||
return super.getActualState(state, world, pos);
|
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() {
|
public boolean hasConnectivityState() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -327,10 +327,6 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
super.invalidate();
|
super.invalidate();
|
||||||
|
|
||||||
energyEU.invalidate();
|
energyEU.invalidate();
|
||||||
|
|
||||||
if (!worldObj.isRemote) {
|
|
||||||
onBreak();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -355,7 +351,7 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
energyEU.onChunkUnload();
|
energyEU.onChunkUnload();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onBreak() {
|
public void onDestroyed() {
|
||||||
nodeGraph.disconnectAll();
|
nodeGraph.disconnectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -241,13 +241,6 @@ public class TileDiskDrive extends TileNode implements IItemStorageProvider, IFl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void invalidate() {
|
|
||||||
onBreak();
|
|
||||||
|
|
||||||
super.invalidate();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConnectionChange(INetworkMaster network, boolean state) {
|
public void onConnectionChange(INetworkMaster network, boolean state) {
|
||||||
super.onConnectionChange(network, 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
|
@Override
|
||||||
public void onConnectionChange(INetworkMaster network, boolean state) {
|
public void onConnectionChange(INetworkMaster network, boolean state) {
|
||||||
super.onConnectionChange(network, state);
|
super.onConnectionChange(network, state);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.tile;
|
package com.raoulvdberge.refinedstorage.tile;
|
||||||
|
|
||||||
|
import com.raoulvdberge.refinedstorage.RSBlocks;
|
||||||
import mcmultipart.capabilities.ISlottedCapabilityProvider;
|
import mcmultipart.capabilities.ISlottedCapabilityProvider;
|
||||||
import mcmultipart.capabilities.MultipartCapabilityHelper;
|
import mcmultipart.capabilities.MultipartCapabilityHelper;
|
||||||
import mcmultipart.microblock.IMicroblock;
|
import mcmultipart.microblock.IMicroblock;
|
||||||
@@ -71,7 +72,7 @@ public abstract class TileMultipartNode extends TileNode implements IMicroblockC
|
|||||||
if (network != null) {
|
if (network != null) {
|
||||||
network.getNodeGraph().rebuild();
|
network.getNodeGraph().rebuild();
|
||||||
} else if (worldObj != null) {
|
} 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 INetworkMaster network;
|
||||||
|
|
||||||
protected boolean rebuildOnUpdateChange;
|
protected boolean rebuildOnUpdateChange;
|
||||||
private boolean rebuildNearbyGraph;
|
|
||||||
|
|
||||||
public TileNode() {
|
public TileNode() {
|
||||||
dataManager.addWatchedParameter(REDSTONE_MODE);
|
dataManager.addWatchedParameter(REDSTONE_MODE);
|
||||||
@@ -58,10 +57,6 @@ public abstract class TileNode extends TileBase implements INetworkNode, IRedsto
|
|||||||
}
|
}
|
||||||
|
|
||||||
networkPos = null;
|
networkPos = null;
|
||||||
} else if (rebuildNearbyGraph) {
|
|
||||||
rebuildNearbyGraph = false;
|
|
||||||
|
|
||||||
rebuildNearbyGraph();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (update != canUpdate() && network != null) {
|
if (update != canUpdate() && network != null) {
|
||||||
@@ -88,18 +83,6 @@ public abstract class TileNode extends TileBase implements INetworkNode, IRedsto
|
|||||||
super.update();
|
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
|
@Override
|
||||||
public void onConnected(INetworkMaster network) {
|
public void onConnected(INetworkMaster network) {
|
||||||
this.connected = true;
|
this.connected = true;
|
||||||
@@ -218,20 +201,4 @@ public abstract class TileNode extends TileBase implements INetworkNode, IRedsto
|
|||||||
public boolean hasConnectivityState() {
|
public boolean hasConnectivityState() {
|
||||||
return false;
|
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
|
@Override
|
||||||
public void onConnectionChange(INetworkMaster network, boolean state) {
|
public void onConnectionChange(INetworkMaster network, boolean state) {
|
||||||
super.onConnectionChange(network, state);
|
super.onConnectionChange(network, state);
|
||||||
|
|||||||
Reference in New Issue
Block a user