Reverted network changes that caused buggy behavior + reduced explosion radius
This commit is contained in:
@@ -3,6 +3,8 @@
|
|||||||
### 0.9.4
|
### 0.9.4
|
||||||
- Little fixes in German translation (ThexXTURBOXx)
|
- Little fixes in German translation (ThexXTURBOXx)
|
||||||
- Fixed mod not working without JEI (raoulvdberge)
|
- Fixed mod not working without JEI (raoulvdberge)
|
||||||
|
- Reverted network changes that caused buggy behavior (raoulvdberge)
|
||||||
|
- Reduced explosion radius when multiple controllers are connected to the same network (raoulvdberge)
|
||||||
|
|
||||||
### 0.9.3
|
### 0.9.3
|
||||||
- Updated German translation for Fluid Storage (0blu)
|
- Updated German translation for Fluid Storage (0blu)
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class NetworkNodeGraph implements INetworkNodeGraph {
|
|||||||
TileEntity tile = world.getTileEntity(currentPos);
|
TileEntity tile = world.getTileEntity(currentPos);
|
||||||
|
|
||||||
if (tile instanceof TileController && !controller.getPos().equals(currentPos)) {
|
if (tile instanceof TileController && !controller.getPos().equals(currentPos)) {
|
||||||
world.createExplosion(null, currentPos.getX(), currentPos.getY(), currentPos.getZ(), 3.5f, true);
|
world.createExplosion(null, currentPos.getX(), currentPos.getY(), currentPos.getZ(), 1.5f, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(tile instanceof INetworkNode)) {
|
if (!(tile instanceof INetworkNode)) {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import net.minecraftforge.common.MinecraftForge;
|
|||||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
@@ -65,7 +66,7 @@ public class CommonProxy {
|
|||||||
RefinedStorage.INSTANCE.network.registerMessage(MessageProcessingPatternEncoderClear.class, MessageProcessingPatternEncoderClear.class, id++, Side.SERVER);
|
RefinedStorage.INSTANCE.network.registerMessage(MessageProcessingPatternEncoderClear.class, MessageProcessingPatternEncoderClear.class, id++, Side.SERVER);
|
||||||
RefinedStorage.INSTANCE.network.registerMessage(MessageGridFilterUpdate.class, MessageGridFilterUpdate.class, id++, Side.SERVER);
|
RefinedStorage.INSTANCE.network.registerMessage(MessageGridFilterUpdate.class, MessageGridFilterUpdate.class, id++, Side.SERVER);
|
||||||
|
|
||||||
net.minecraftforge.fml.common.network.NetworkRegistry.INSTANCE.registerGuiHandler(RefinedStorage.INSTANCE, new GuiHandler());
|
NetworkRegistry.INSTANCE.registerGuiHandler(RefinedStorage.INSTANCE, new GuiHandler());
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.register(new ContainerListener());
|
MinecraftForge.EVENT_BUS.register(new ContainerListener());
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public class TileConstructor extends TileMultipartNode implements IComparable, I
|
|||||||
BlockPos front = pos.offset(getDirection());
|
BlockPos front = pos.offset(getDirection());
|
||||||
|
|
||||||
if (worldObj.isAirBlock(front) && block.getBlock().canPlaceBlockAt(worldObj, front)) {
|
if (worldObj.isAirBlock(front) && block.getBlock().canPlaceBlockAt(worldObj, front)) {
|
||||||
ItemStack took = getNetwork().extractItem(itemFilters.getStackInSlot(0), 1, compare);
|
ItemStack took = network.extractItem(itemFilters.getStackInSlot(0), 1, compare);
|
||||||
|
|
||||||
if (took != null) {
|
if (took != null) {
|
||||||
scheduler.resetSchedule();
|
scheduler.resetSchedule();
|
||||||
@@ -88,7 +88,7 @@ public class TileConstructor extends TileMultipartNode implements IComparable, I
|
|||||||
ItemStack craft = itemFilters.getStackInSlot(0);
|
ItemStack craft = itemFilters.getStackInSlot(0);
|
||||||
|
|
||||||
if (scheduler.canSchedule(compare, craft)) {
|
if (scheduler.canSchedule(compare, craft)) {
|
||||||
scheduler.schedule(getNetwork(), compare, craft);
|
scheduler.schedule(network, compare, craft);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -101,7 +101,7 @@ public class TileConstructor extends TileMultipartNode implements IComparable, I
|
|||||||
Block block = stack.getFluid().getBlock();
|
Block block = stack.getFluid().getBlock();
|
||||||
|
|
||||||
if (worldObj.isAirBlock(front) && block.canPlaceBlockAt(worldObj, front)) {
|
if (worldObj.isAirBlock(front) && block.canPlaceBlockAt(worldObj, front)) {
|
||||||
FluidStack took = getNetwork().extractFluid(stack, Fluid.BUCKET_VOLUME, compare);
|
FluidStack took = network.extractFluid(stack, Fluid.BUCKET_VOLUME, compare);
|
||||||
|
|
||||||
if (took != null) {
|
if (took != null) {
|
||||||
IBlockState state = block.getDefaultState();
|
IBlockState state = block.getDefaultState();
|
||||||
|
|||||||
@@ -360,8 +360,6 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
super.onChunkUnload();
|
super.onChunkUnload();
|
||||||
|
|
||||||
energyEU.onChunkUnload();
|
energyEU.onChunkUnload();
|
||||||
|
|
||||||
onDestroyed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDestroyed() {
|
public void onDestroyed() {
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ public class TileCrafter extends TileNode implements ICraftingPatternContainer {
|
|||||||
protected void onContentsChanged(int slot) {
|
protected void onContentsChanged(int slot) {
|
||||||
super.onContentsChanged(slot);
|
super.onContentsChanged(slot);
|
||||||
|
|
||||||
if (getNetwork() != null) {
|
if (network != null) {
|
||||||
getNetwork().rebuildPatterns();
|
network.rebuildPatterns();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class TileCraftingMonitor extends TileNode {
|
|||||||
@Override
|
@Override
|
||||||
public List<ClientCraftingTask> getValue(TileCraftingMonitor tile) {
|
public List<ClientCraftingTask> getValue(TileCraftingMonitor tile) {
|
||||||
if (tile.isConnected()) {
|
if (tile.isConnected()) {
|
||||||
List<ClientCraftingTask> tasks = tile.getNetwork().getCraftingTasks().stream().map(t -> new ClientCraftingTask(
|
List<ClientCraftingTask> tasks = tile.network.getCraftingTasks().stream().map(t -> new ClientCraftingTask(
|
||||||
t.getInfo(),
|
t.getInfo(),
|
||||||
t.getPattern().getOutputs()
|
t.getPattern().getOutputs()
|
||||||
)).collect(Collectors.toList());
|
)).collect(Collectors.toList());
|
||||||
|
|||||||
@@ -85,10 +85,10 @@ public class TileDestructor extends TileMultipartNode implements IComparable, IF
|
|||||||
for (ItemStack drop : drops) {
|
for (ItemStack drop : drops) {
|
||||||
// We check if the controller isn't null here because when a destructor faces a node and removes it
|
// We check if the controller isn't null here because when a destructor faces a node and removes it
|
||||||
// it will essentially remove this block itself from the network without knowing
|
// it will essentially remove this block itself from the network without knowing
|
||||||
if (getNetwork() == null) {
|
if (network == null) {
|
||||||
InventoryHelper.spawnItemStack(worldObj, front.getX(), front.getY(), front.getZ(), drop);
|
InventoryHelper.spawnItemStack(worldObj, front.getX(), front.getY(), front.getZ(), drop);
|
||||||
} else {
|
} else {
|
||||||
ItemStack remainder = getNetwork().insertItem(drop, drop.stackSize, false);
|
ItemStack remainder = network.insertItem(drop, drop.stackSize, false);
|
||||||
|
|
||||||
if (remainder != null) {
|
if (remainder != null) {
|
||||||
InventoryHelper.spawnItemStack(worldObj, front.getX(), front.getY(), front.getZ(), remainder);
|
InventoryHelper.spawnItemStack(worldObj, front.getX(), front.getY(), front.getZ(), remainder);
|
||||||
@@ -113,10 +113,10 @@ public class TileDestructor extends TileMultipartNode implements IComparable, IF
|
|||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
FluidStack stack = handler.drain(Fluid.BUCKET_VOLUME, false);
|
FluidStack stack = handler.drain(Fluid.BUCKET_VOLUME, false);
|
||||||
|
|
||||||
if (stack != null && IFilterable.canTakeFluids(fluidFilters, mode, compare, stack) && getNetwork().insertFluid(stack, stack.amount, true) == null) {
|
if (stack != null && IFilterable.canTakeFluids(fluidFilters, mode, compare, stack) && network.insertFluid(stack, stack.amount, true) == null) {
|
||||||
FluidStack drained = handler.drain(Fluid.BUCKET_VOLUME, true);
|
FluidStack drained = handler.drain(Fluid.BUCKET_VOLUME, true);
|
||||||
|
|
||||||
getNetwork().insertFluid(drained, drained.amount, false);
|
network.insertFluid(drained, drained.amount, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ public class TileDetector extends TileNode implements IComparable, IType {
|
|||||||
ItemStack slot = itemFilters.getStackInSlot(0);
|
ItemStack slot = itemFilters.getStackInSlot(0);
|
||||||
|
|
||||||
if (slot != null) {
|
if (slot != null) {
|
||||||
ItemStack stack = getNetwork().getItemStorage().get(slot, compare);
|
ItemStack stack = network.getItemStorage().get(slot, compare);
|
||||||
|
|
||||||
powered = isPowered(stack == null ? null : stack.stackSize);
|
powered = isPowered(stack == null ? null : stack.stackSize);
|
||||||
} else {
|
} else {
|
||||||
@@ -116,7 +116,7 @@ public class TileDetector extends TileNode implements IComparable, IType {
|
|||||||
FluidStack slot = fluidFilters.getFluids()[0];
|
FluidStack slot = fluidFilters.getFluids()[0];
|
||||||
|
|
||||||
if (slot != null) {
|
if (slot != null) {
|
||||||
FluidStack stack = getNetwork().getFluidStorage().get(slot, compare);
|
FluidStack stack = network.getFluidStorage().get(slot, compare);
|
||||||
|
|
||||||
powered = isPowered(stack == null ? null : stack.amount);
|
powered = isPowered(stack == null ? null : stack.amount);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -114,9 +114,9 @@ public class TileDiskDrive extends TileNode implements IItemStorageProvider, IFl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getNetwork() != null) {
|
if (network != null) {
|
||||||
getNetwork().getItemStorage().rebuild();
|
network.getItemStorage().rebuild();
|
||||||
getNetwork().getFluidStorage().rebuild();
|
network.getFluidStorage().rebuild();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public class TileExporter extends TileMultipartNode implements IComparable, ITyp
|
|||||||
ItemStack slot = itemFilters.getStackInSlot(i);
|
ItemStack slot = itemFilters.getStackInSlot(i);
|
||||||
|
|
||||||
if (slot != null) {
|
if (slot != null) {
|
||||||
ItemStack took = getNetwork().extractItem(slot, size, compare);
|
ItemStack took = network.extractItem(slot, size, compare);
|
||||||
|
|
||||||
if (took != null) {
|
if (took != null) {
|
||||||
scheduler.resetSchedule();
|
scheduler.resetSchedule();
|
||||||
@@ -74,11 +74,11 @@ public class TileExporter extends TileMultipartNode implements IComparable, ITyp
|
|||||||
ItemStack remainder = ItemHandlerHelper.insertItem(handler, took, false);
|
ItemStack remainder = ItemHandlerHelper.insertItem(handler, took, false);
|
||||||
|
|
||||||
if (remainder != null) {
|
if (remainder != null) {
|
||||||
getNetwork().insertItem(remainder, remainder.stackSize, false);
|
network.insertItem(remainder, remainder.stackSize, false);
|
||||||
}
|
}
|
||||||
} else if (upgrades.hasUpgrade(ItemUpgrade.TYPE_CRAFTING)) {
|
} else if (upgrades.hasUpgrade(ItemUpgrade.TYPE_CRAFTING)) {
|
||||||
if (scheduler.canSchedule(compare, slot)) {
|
if (scheduler.canSchedule(compare, slot)) {
|
||||||
scheduler.schedule(getNetwork(), compare, slot);
|
scheduler.schedule(network, compare, slot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -90,13 +90,13 @@ public class TileExporter extends TileMultipartNode implements IComparable, ITyp
|
|||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
for (FluidStack stack : fluidFilters.getFluids()) {
|
for (FluidStack stack : fluidFilters.getFluids()) {
|
||||||
if (stack != null) {
|
if (stack != null) {
|
||||||
FluidStack took = getNetwork().extractFluid(stack, Fluid.BUCKET_VOLUME, compare);
|
FluidStack took = network.extractFluid(stack, Fluid.BUCKET_VOLUME, compare);
|
||||||
|
|
||||||
if (took != null) {
|
if (took != null) {
|
||||||
int remainder = Fluid.BUCKET_VOLUME - handler.fill(took, true);
|
int remainder = Fluid.BUCKET_VOLUME - handler.fill(took, true);
|
||||||
|
|
||||||
if (remainder > 0) {
|
if (remainder > 0) {
|
||||||
getNetwork().insertFluid(took, remainder, false);
|
network.insertFluid(took, remainder, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ public class TileFluidInterface extends TileNode implements IComparable {
|
|||||||
FluidStack drained = tankIn.drainInternal(Fluid.BUCKET_VOLUME, true);
|
FluidStack drained = tankIn.drainInternal(Fluid.BUCKET_VOLUME, true);
|
||||||
|
|
||||||
if (drained != null) {
|
if (drained != null) {
|
||||||
FluidStack remainder = getNetwork().insertFluid(drained, drained.amount, false);
|
FluidStack remainder = network.insertFluid(drained, drained.amount, false);
|
||||||
|
|
||||||
if (remainder != null) {
|
if (remainder != null) {
|
||||||
tankIn.fillInternal(remainder, true);
|
tankIn.fillInternal(remainder, true);
|
||||||
@@ -116,16 +116,16 @@ public class TileFluidInterface extends TileNode implements IComparable {
|
|||||||
FluidStack remainder = tankOut.drainInternal(Fluid.BUCKET_VOLUME, true);
|
FluidStack remainder = tankOut.drainInternal(Fluid.BUCKET_VOLUME, true);
|
||||||
|
|
||||||
if (remainder != null) {
|
if (remainder != null) {
|
||||||
getNetwork().insertFluid(remainder, remainder.amount, false);
|
network.insertFluid(remainder, remainder.amount, false);
|
||||||
}
|
}
|
||||||
} else if (stack != null) {
|
} else if (stack != null) {
|
||||||
FluidStack result = getNetwork().extractFluid(stack, Fluid.BUCKET_VOLUME, compare);
|
FluidStack result = network.extractFluid(stack, Fluid.BUCKET_VOLUME, compare);
|
||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
int remainder = Fluid.BUCKET_VOLUME - tankOut.fillInternal(result, true);
|
int remainder = Fluid.BUCKET_VOLUME - tankOut.fillInternal(result, true);
|
||||||
|
|
||||||
if (remainder > 0) {
|
if (remainder > 0) {
|
||||||
getNetwork().insertFluid(stack, remainder, false);
|
network.insertFluid(stack, remainder, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,8 +93,8 @@ public class TileFluidStorage extends TileNode implements IFluidStorageProvider,
|
|||||||
if (storage == null && storageTag != null) {
|
if (storage == null && storageTag != null) {
|
||||||
storage = new FluidStorage();
|
storage = new FluidStorage();
|
||||||
|
|
||||||
if (getNetwork() != null) {
|
if (network != null) {
|
||||||
getNetwork().getFluidStorage().rebuild();
|
network.getFluidStorage().rebuild();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,8 +79,8 @@ public class TileImporter extends TileMultipartNode implements IComparable, IFil
|
|||||||
|
|
||||||
ItemStack result = handler.extractItem(currentSlot, quantity, true);
|
ItemStack result = handler.extractItem(currentSlot, quantity, true);
|
||||||
|
|
||||||
if (result != null && getNetwork().insertItem(result, result.stackSize, true) == null) {
|
if (result != null && network.insertItem(result, result.stackSize, true) == null) {
|
||||||
getNetwork().insertItem(result, result.stackSize, false);
|
network.insertItem(result, result.stackSize, false);
|
||||||
|
|
||||||
handler.extractItem(currentSlot, quantity, false);
|
handler.extractItem(currentSlot, quantity, false);
|
||||||
} else {
|
} else {
|
||||||
@@ -94,10 +94,10 @@ public class TileImporter extends TileMultipartNode implements IComparable, IFil
|
|||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
FluidStack stack = handler.drain(Fluid.BUCKET_VOLUME, false);
|
FluidStack stack = handler.drain(Fluid.BUCKET_VOLUME, false);
|
||||||
|
|
||||||
if (stack != null && IFilterable.canTakeFluids(fluidFilters, mode, compare, stack) && getNetwork().insertFluid(stack, stack.amount, true) == null) {
|
if (stack != null && IFilterable.canTakeFluids(fluidFilters, mode, compare, stack) && network.insertFluid(stack, stack.amount, true) == null) {
|
||||||
FluidStack drain = handler.drain(Fluid.BUCKET_VOLUME, true);
|
FluidStack drain = handler.drain(Fluid.BUCKET_VOLUME, true);
|
||||||
|
|
||||||
getNetwork().insertFluid(drain, drain.amount, false);
|
network.insertFluid(drain, drain.amount, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class TileInterface extends TileNode implements IComparable {
|
|||||||
} else if (ticks % upgrades.getSpeed() == 0) {
|
} else if (ticks % upgrades.getSpeed() == 0) {
|
||||||
int size = Math.min(slot.stackSize, upgrades.hasUpgrade(ItemUpgrade.TYPE_STACK) ? 64 : 1);
|
int size = Math.min(slot.stackSize, upgrades.hasUpgrade(ItemUpgrade.TYPE_STACK) ? 64 : 1);
|
||||||
|
|
||||||
ItemStack remainder = getNetwork().insertItem(slot, size, false);
|
ItemStack remainder = network.insertItem(slot, size, false);
|
||||||
|
|
||||||
if (remainder == null) {
|
if (remainder == null) {
|
||||||
importItems.extractItem(currentSlot, size, false);
|
importItems.extractItem(currentSlot, size, false);
|
||||||
@@ -65,13 +65,13 @@ public class TileInterface extends TileNode implements IComparable {
|
|||||||
|
|
||||||
if (wanted == null) {
|
if (wanted == null) {
|
||||||
if (got != null) {
|
if (got != null) {
|
||||||
exportItems.setStackInSlot(i, getNetwork().insertItem(got, got.stackSize, false));
|
exportItems.setStackInSlot(i, network.insertItem(got, got.stackSize, false));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int delta = got == null ? wanted.stackSize : (wanted.stackSize - got.stackSize);
|
int delta = got == null ? wanted.stackSize : (wanted.stackSize - got.stackSize);
|
||||||
|
|
||||||
if (delta > 0) {
|
if (delta > 0) {
|
||||||
ItemStack result = getNetwork().extractItem(wanted, delta, compare);
|
ItemStack result = network.extractItem(wanted, delta, compare);
|
||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
if (got == null) {
|
if (got == null) {
|
||||||
@@ -81,7 +81,7 @@ public class TileInterface extends TileNode implements IComparable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (delta < 0) {
|
} else if (delta < 0) {
|
||||||
ItemStack remainder = getNetwork().insertItem(got, Math.abs(delta), false);
|
ItemStack remainder = network.insertItem(got, Math.abs(delta), false);
|
||||||
|
|
||||||
if (remainder == null) {
|
if (remainder == null) {
|
||||||
exportItems.extractItem(i, Math.abs(delta), false);
|
exportItems.extractItem(i, Math.abs(delta), false);
|
||||||
|
|||||||
@@ -70,8 +70,8 @@ public abstract class TileMultipartNode extends TileNode implements IMicroblockC
|
|||||||
public void onMicroblocksChanged() {
|
public void onMicroblocksChanged() {
|
||||||
markDirty();
|
markDirty();
|
||||||
|
|
||||||
if (getNetwork() != null) {
|
if (network != null) {
|
||||||
NetworkUtils.rebuildGraph(getNetwork());
|
NetworkUtils.rebuildGraph(network);
|
||||||
} else if (worldObj != null) {
|
} else if (worldObj != null) {
|
||||||
RefinedStorageBlocks.CABLE.attemptConnect(worldObj, pos);
|
RefinedStorageBlocks.CABLE.attemptConnect(worldObj, pos);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ public class TileNetworkTransmitter extends TileNode {
|
|||||||
protected void onContentsChanged(int slot) {
|
protected void onContentsChanged(int slot) {
|
||||||
super.onContentsChanged(slot);
|
super.onContentsChanged(slot);
|
||||||
|
|
||||||
if (getNetwork() != null) {
|
if (network != null) {
|
||||||
NetworkUtils.rebuildGraph(getNetwork());
|
NetworkUtils.rebuildGraph(network);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -64,8 +64,8 @@ public class TileNetworkTransmitter extends TileNode {
|
|||||||
receiverDimension = ItemNetworkCard.getDimension(card);
|
receiverDimension = ItemNetworkCard.getDimension(card);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getNetwork() != null) {
|
if (network != null) {
|
||||||
NetworkUtils.rebuildGraph(getNetwork());
|
NetworkUtils.rebuildGraph(network);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,8 +19,9 @@ public abstract class TileNode extends TileBase implements INetworkNode, IRedsto
|
|||||||
private RedstoneMode redstoneMode = RedstoneMode.IGNORE;
|
private RedstoneMode redstoneMode = RedstoneMode.IGNORE;
|
||||||
private boolean active;
|
private boolean active;
|
||||||
private boolean update;
|
private boolean update;
|
||||||
private boolean connected;
|
|
||||||
private INetworkMaster network;
|
protected boolean connected;
|
||||||
|
protected INetworkMaster network;
|
||||||
|
|
||||||
protected boolean rebuildOnUpdateChange;
|
protected boolean rebuildOnUpdateChange;
|
||||||
|
|
||||||
@@ -40,13 +41,13 @@ public abstract class TileNode extends TileBase implements INetworkNode, IRedsto
|
|||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
if (!worldObj.isRemote) {
|
if (!worldObj.isRemote) {
|
||||||
if (update != canUpdate() && getNetwork() != null) {
|
if (update != canUpdate() && network != null) {
|
||||||
update = canUpdate();
|
update = canUpdate();
|
||||||
|
|
||||||
onConnectionChange(getNetwork(), update);
|
onConnectionChange(network, update);
|
||||||
|
|
||||||
if (rebuildOnUpdateChange) {
|
if (rebuildOnUpdateChange) {
|
||||||
NetworkUtils.rebuildGraph(getNetwork());
|
NetworkUtils.rebuildGraph(network);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -93,8 +93,8 @@ public class TileStorage extends TileNode implements IItemStorageProvider, IStor
|
|||||||
if (storage == null && storageTag != null) {
|
if (storage == null && storageTag != null) {
|
||||||
storage = new ItemStorage();
|
storage = new ItemStorage();
|
||||||
|
|
||||||
if (getNetwork() != null) {
|
if (network != null) {
|
||||||
getNetwork().getItemStorage().rebuild();
|
network.getItemStorage().rebuild();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ public class TileExternalStorage extends TileMultipartNode implements IItemStora
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
if (!worldObj.isRemote && getNetwork() != null) {
|
if (!worldObj.isRemote && network != null) {
|
||||||
boolean itemChangeDetected = false, fluidChangeDetected = false;
|
boolean itemChangeDetected = false, fluidChangeDetected = false;
|
||||||
|
|
||||||
for (ItemStorageExternal storage : itemStorages) {
|
for (ItemStorageExternal storage : itemStorages) {
|
||||||
@@ -139,17 +139,17 @@ public class TileExternalStorage extends TileMultipartNode implements IItemStora
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (itemChangeDetected) {
|
if (itemChangeDetected) {
|
||||||
getNetwork().getItemStorage().rebuild();
|
network.getItemStorage().rebuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fluidChangeDetected) {
|
if (fluidChangeDetected) {
|
||||||
getNetwork().getFluidStorage().rebuild();
|
network.getFluidStorage().rebuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getFacingTile() instanceof IDrawerGroup && lastDrawerCount != ((IDrawerGroup) getFacingTile()).getDrawerCount()) {
|
if (getFacingTile() instanceof IDrawerGroup && lastDrawerCount != ((IDrawerGroup) getFacingTile()).getDrawerCount()) {
|
||||||
lastDrawerCount = ((IDrawerGroup) getFacingTile()).getDrawerCount();
|
lastDrawerCount = ((IDrawerGroup) getFacingTile()).getDrawerCount();
|
||||||
|
|
||||||
updateStorage(getNetwork());
|
updateStorage(network);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -188,27 +188,27 @@ public class TileGrid extends TileNode implements IGrid {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockPos getNetworkPosition() {
|
public BlockPos getNetworkPosition() {
|
||||||
return getNetwork() != null ? getNetwork().getPosition() : null;
|
return network != null ? network.getPosition() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onGridOpened(EntityPlayer player) {
|
public void onGridOpened(EntityPlayer player) {
|
||||||
if (isConnected()) {
|
if (isConnected()) {
|
||||||
if (getType() == EnumGridType.FLUID) {
|
if (getType() == EnumGridType.FLUID) {
|
||||||
getNetwork().sendFluidStorageToClient((EntityPlayerMP) player);
|
network.sendFluidStorageToClient((EntityPlayerMP) player);
|
||||||
} else {
|
} else {
|
||||||
getNetwork().sendItemStorageToClient((EntityPlayerMP) player);
|
network.sendItemStorageToClient((EntityPlayerMP) player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IItemGridHandler getItemHandler() {
|
public IItemGridHandler getItemHandler() {
|
||||||
return getNetwork() != null ? getNetwork().getItemGridHandler() : null;
|
return network != null ? network.getItemGridHandler() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFluidGridHandler getFluidHandler() {
|
public IFluidGridHandler getFluidHandler() {
|
||||||
return getNetwork() != null ? getNetwork().getFluidGridHandler() : null;
|
return network != null ? network.getFluidGridHandler() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -263,7 +263,7 @@ public class TileGrid extends TileNode implements IGrid {
|
|||||||
} else {
|
} else {
|
||||||
if (slot != null) {
|
if (slot != null) {
|
||||||
if (slot.stackSize == 1 && isConnected()) {
|
if (slot.stackSize == 1 && isConnected()) {
|
||||||
matrix.setInventorySlotContents(i, NetworkUtils.extractItem(getNetwork(), slot, 1));
|
matrix.setInventorySlotContents(i, NetworkUtils.extractItem(network, slot, 1));
|
||||||
} else {
|
} else {
|
||||||
matrix.decrStackSize(i, 1);
|
matrix.decrStackSize(i, 1);
|
||||||
}
|
}
|
||||||
@@ -340,10 +340,10 @@ public class TileGrid extends TileNode implements IGrid {
|
|||||||
|
|
||||||
if (slot != null) {
|
if (slot != null) {
|
||||||
if (getType() == EnumGridType.CRAFTING) {
|
if (getType() == EnumGridType.CRAFTING) {
|
||||||
if (getNetwork().insertItem(slot, slot.stackSize, true) != null) {
|
if (network.insertItem(slot, slot.stackSize, true) != null) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
getNetwork().insertItem(slot, slot.stackSize, false);
|
network.insertItem(slot, slot.stackSize, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,7 +357,7 @@ public class TileGrid extends TileNode implements IGrid {
|
|||||||
|
|
||||||
if (getType() == EnumGridType.CRAFTING) {
|
if (getType() == EnumGridType.CRAFTING) {
|
||||||
for (ItemStack possibility : possibilities) {
|
for (ItemStack possibility : possibilities) {
|
||||||
ItemStack took = NetworkUtils.extractItem(getNetwork(), possibility, 1);
|
ItemStack took = NetworkUtils.extractItem(network, possibility, 1);
|
||||||
|
|
||||||
if (took != null) {
|
if (took != null) {
|
||||||
matrix.setInventorySlotContents(i, took);
|
matrix.setInventorySlotContents(i, took);
|
||||||
|
|||||||
Reference in New Issue
Block a user