mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Merge pull request #2010 from MellowArpeggiation/master
Fix fluidnet bugs
This commit is contained in:
commit
5e9399a696
@ -18,7 +18,7 @@ public interface IFluidStandardReceiver extends IFluidStandardReceiverMK2 {
|
|||||||
|
|
||||||
public default void subscribeToAllAround(FluidType type, World world, int x, int y, int z) {
|
public default void subscribeToAllAround(FluidType type, World world, int x, int y, int z) {
|
||||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||||
trySubscribe(type, world, x, y, z, dir);
|
trySubscribe(type, world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@ public interface IFluidStandardSenderMK2 extends IFluidProviderMK2 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(te instanceof IFluidReceiverMK2 && te != this) {
|
if(te != this && te instanceof IFluidReceiverMK2) {
|
||||||
IFluidReceiverMK2 rec = (IFluidReceiverMK2) te;
|
IFluidReceiverMK2 rec = (IFluidReceiverMK2) te;
|
||||||
if(rec.canConnect(type, dir.getOpposite())) {
|
if(rec.canConnect(type, dir.getOpposite())) {
|
||||||
long provides = Math.min(this.getFluidAvailable(type, pressure), this.getProviderSpeed(type, pressure));
|
long provides = Math.min(this.getFluidAvailable(type, pressure), this.getProviderSpeed(type, pressure));
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
package com.hbm.tileentity.machine.storage;
|
package com.hbm.tileentity.machine.storage;
|
||||||
|
|
||||||
import api.hbm.energymk2.IEnergyReceiverMK2.ConnectionPriority;
|
import api.hbm.energymk2.IEnergyReceiverMK2.ConnectionPriority;
|
||||||
|
import api.hbm.fluidmk2.FluidNode;
|
||||||
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
|
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.handler.CompatHandler;
|
import com.hbm.handler.CompatHandler;
|
||||||
import com.hbm.inventory.FluidContainerRegistry;
|
import com.hbm.inventory.FluidContainerRegistry;
|
||||||
@ -20,6 +23,8 @@ import com.hbm.tileentity.IFluidCopiable;
|
|||||||
import com.hbm.tileentity.IGUIProvider;
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
import com.hbm.tileentity.IPersistentNBT;
|
import com.hbm.tileentity.IPersistentNBT;
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
import com.hbm.tileentity.TileEntityMachineBase;
|
||||||
|
import com.hbm.uninos.UniNodespace;
|
||||||
|
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
import cpw.mods.fml.common.Optional;
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
@ -37,10 +42,13 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.EnumSkyBlock;
|
import net.minecraft.world.EnumSkyBlock;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "opencomputers")})
|
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "opencomputers")})
|
||||||
public class TileEntityBarrel extends TileEntityMachineBase implements SimpleComponent, IFluidStandardTransceiverMK2, IPersistentNBT, IGUIProvider, CompatHandler.OCComponent, IFluidCopiable {
|
public class TileEntityBarrel extends TileEntityMachineBase implements SimpleComponent, IFluidStandardTransceiverMK2, IPersistentNBT, IGUIProvider, CompatHandler.OCComponent, IFluidCopiable {
|
||||||
|
|
||||||
|
protected FluidNode node;
|
||||||
|
|
||||||
public FluidTank tank;
|
public FluidTank tank;
|
||||||
public short mode = 0;
|
public short mode = 0;
|
||||||
public static final short modes = 4;
|
public static final short modes = 4;
|
||||||
@ -91,9 +99,42 @@ public class TileEntityBarrel extends TileEntityMachineBase implements SimpleCom
|
|||||||
tank.loadTank(2, 3, slots);
|
tank.loadTank(2, 3, slots);
|
||||||
tank.unloadTank(4, 5, slots);
|
tank.unloadTank(4, 5, slots);
|
||||||
|
|
||||||
for(DirPos pos : getConPos()) {
|
// In buffer mode, acts like a pipe block, providing fluid to its own node
|
||||||
if(mode == 0 || mode == 1) this.trySubscribe(tank.getTankType(), worldObj, pos);
|
// otherwise, it is a regular providing/receiving machine, blocking further propagation
|
||||||
if(mode == 1 || mode == 2) this.tryProvide(tank, worldObj, pos);
|
if(mode == 1) {
|
||||||
|
if(this.node == null || this.node.expired) {
|
||||||
|
|
||||||
|
this.node = (FluidNode) UniNodespace.getNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider());
|
||||||
|
|
||||||
|
if(this.node == null || this.node.expired) {
|
||||||
|
this.node = this.createNode(tank.getTankType());
|
||||||
|
UniNodespace.createNode(worldObj, this.node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.tryProvide(tank, worldObj, xCoord, yCoord, zCoord, ForgeDirection.UNKNOWN);
|
||||||
|
if(node != null && node.hasValidNet()) node.net.addReceiver(this);
|
||||||
|
} else {
|
||||||
|
if(this.node != null) {
|
||||||
|
UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider());
|
||||||
|
this.node = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(DirPos pos : getConPos()) {
|
||||||
|
FluidNode dirNode = (FluidNode) UniNodespace.getNode(worldObj, pos.getX(), pos.getY(), pos.getZ(), tank.getTankType().getNetworkProvider());
|
||||||
|
|
||||||
|
if(mode == 2) {
|
||||||
|
tryProvide(tank, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||||
|
} else {
|
||||||
|
if(dirNode != null && dirNode.hasValidNet()) dirNode.net.removeProvider(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mode == 0) {
|
||||||
|
if(dirNode != null && dirNode.hasValidNet()) dirNode.net.addReceiver(this);
|
||||||
|
} else {
|
||||||
|
if(dirNode != null && dirNode.hasValidNet()) dirNode.net.removeReceiver(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tank.getFill() > 0) {
|
if(tank.getFill() > 0) {
|
||||||
@ -104,6 +145,30 @@ public class TileEntityBarrel extends TileEntityMachineBase implements SimpleCom
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected FluidNode createNode(FluidType type) {
|
||||||
|
DirPos[] conPos = getConPos();
|
||||||
|
|
||||||
|
HashSet<BlockPos> posSet = new HashSet<>();
|
||||||
|
posSet.add(new BlockPos(this));
|
||||||
|
for(DirPos pos : conPos) {
|
||||||
|
ForgeDirection dir = pos.getDir();
|
||||||
|
posSet.add(new BlockPos(pos.getX() - dir.offsetX, pos.getY() - dir.offsetY, pos.getZ() - dir.offsetZ));
|
||||||
|
}
|
||||||
|
|
||||||
|
return new FluidNode(type.getNetworkProvider(), posSet.toArray(new BlockPos[posSet.size()])).setConnections(conPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void invalidate() {
|
||||||
|
super.invalidate();
|
||||||
|
|
||||||
|
if(!worldObj.isRemote) {
|
||||||
|
if(this.node != null) {
|
||||||
|
UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void serialize(ByteBuf buf) {
|
public void serialize(ByteBuf buf) {
|
||||||
super.serialize(buf);
|
super.serialize(buf);
|
||||||
@ -220,6 +285,8 @@ public class TileEntityBarrel extends TileEntityMachineBase implements SimpleCom
|
|||||||
tank.writeToNBT(nbt, "tank");
|
tank.writeToNBT(nbt, "tank");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override public boolean canConnect(FluidType fluid, ForgeDirection dir) { return true; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidTank[] getSendingTanks() {
|
public FluidTank[] getSendingTanks() {
|
||||||
return (mode == 1 || mode == 2) ? new FluidTank[] {tank} : new FluidTank[0];
|
return (mode == 1 || mode == 2) ? new FluidTank[] {tank} : new FluidTank[0];
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import com.hbm.lib.Library;
|
|||||||
import com.hbm.tileentity.IGUIProvider;
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
import com.hbm.tileentity.IPersistentNBT;
|
import com.hbm.tileentity.IPersistentNBT;
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
import com.hbm.tileentity.TileEntityMachineBase;
|
||||||
|
import com.hbm.uninos.UniNodespace;
|
||||||
import com.hbm.util.CompatEnergyControl;
|
import com.hbm.util.CompatEnergyControl;
|
||||||
|
|
||||||
import cpw.mods.fml.common.Optional;
|
import cpw.mods.fml.common.Optional;
|
||||||
@ -170,24 +171,46 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
|
|||||||
|
|
||||||
int mode = this.getRelevantMode(false);
|
int mode = this.getRelevantMode(false);
|
||||||
|
|
||||||
if(this.node == null || this.node.expired) {
|
|
||||||
|
|
||||||
this.node = Nodespace.getNode(worldObj, xCoord, yCoord, zCoord);
|
|
||||||
|
|
||||||
if(this.node == null || this.node.expired) {
|
|
||||||
this.node = this.createNode();
|
|
||||||
Nodespace.createNode(worldObj, this.node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
long prevPower = this.power;
|
long prevPower = this.power;
|
||||||
|
|
||||||
power = Library.chargeItemsFromTE(slots, 1, power, getMaxPower());
|
power = Library.chargeItemsFromTE(slots, 1, power, getMaxPower());
|
||||||
|
|
||||||
if(mode == mode_output || mode == mode_buffer) {
|
// In buffer mode, becomes a cable block and provides power to itself
|
||||||
|
// otherwise, acts like a regular power providing/accepting machine
|
||||||
|
if(mode == mode_buffer) {
|
||||||
|
if(this.node == null || this.node.expired) {
|
||||||
|
|
||||||
|
this.node = (PowerNode) UniNodespace.getNode(worldObj, xCoord, yCoord, zCoord, Nodespace.THE_POWER_PROVIDER);
|
||||||
|
|
||||||
|
if(this.node == null || this.node.expired) {
|
||||||
|
this.node = this.createNode();
|
||||||
|
UniNodespace.createNode(worldObj, this.node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.tryProvide(worldObj, xCoord, yCoord, zCoord, ForgeDirection.UNKNOWN);
|
this.tryProvide(worldObj, xCoord, yCoord, zCoord, ForgeDirection.UNKNOWN);
|
||||||
|
if(node != null && node.hasValidNet()) node.net.addReceiver(this);
|
||||||
} else {
|
} else {
|
||||||
if(node != null && node.hasValidNet()) node.net.removeProvider(this);
|
if(this.node != null) {
|
||||||
|
UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, Nodespace.THE_POWER_PROVIDER);
|
||||||
|
this.node = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||||
|
PowerNode dirNode = (PowerNode) UniNodespace.getNode(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, Nodespace.THE_POWER_PROVIDER);
|
||||||
|
|
||||||
|
if(mode == mode_output) {
|
||||||
|
tryProvide(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
|
||||||
|
} else {
|
||||||
|
if(dirNode != null && dirNode.hasValidNet()) dirNode.net.removeProvider(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mode == mode_input) {
|
||||||
|
if(dirNode != null && dirNode.hasValidNet()) dirNode.net.addReceiver(this);
|
||||||
|
} else {
|
||||||
|
if(dirNode != null && dirNode.hasValidNet()) dirNode.net.removeReceiver(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
byte comp = this.getComparatorPower();
|
byte comp = this.getComparatorPower();
|
||||||
@ -195,12 +218,6 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
|
|||||||
this.markDirty();
|
this.markDirty();
|
||||||
this.lastRedstone = comp;
|
this.lastRedstone = comp;
|
||||||
|
|
||||||
if(mode == mode_input || mode == mode_buffer) {
|
|
||||||
if(node != null && node.hasValidNet()) node.net.addReceiver(this);
|
|
||||||
} else {
|
|
||||||
if(node != null && node.hasValidNet()) node.net.removeReceiver(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
power = Library.chargeTEFromItems(slots, 0, power, getMaxPower());
|
power = Library.chargeTEFromItems(slots, 0, power, getMaxPower());
|
||||||
|
|
||||||
long avg = (power + prevPower) / 2;
|
long avg = (power + prevPower) / 2;
|
||||||
@ -228,7 +245,7 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
|
|||||||
|
|
||||||
if(!worldObj.isRemote) {
|
if(!worldObj.isRemote) {
|
||||||
if(this.node != null) {
|
if(this.node != null) {
|
||||||
Nodespace.destroyNode(worldObj, xCoord, yCoord, zCoord);
|
UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, Nodespace.THE_POWER_PROVIDER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
package com.hbm.tileentity.machine.storage;
|
package com.hbm.tileentity.machine.storage;
|
||||||
|
|
||||||
import api.hbm.energymk2.IEnergyReceiverMK2.ConnectionPriority;
|
import api.hbm.energymk2.IEnergyReceiverMK2.ConnectionPriority;
|
||||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
import api.hbm.fluidmk2.FluidNode;
|
||||||
|
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||||
@ -22,8 +24,10 @@ import com.hbm.inventory.fluid.tank.FluidTank;
|
|||||||
import com.hbm.lib.Library;
|
import com.hbm.lib.Library;
|
||||||
import com.hbm.packet.PacketDispatcher;
|
import com.hbm.packet.PacketDispatcher;
|
||||||
import com.hbm.tileentity.*;
|
import com.hbm.tileentity.*;
|
||||||
|
import com.hbm.uninos.UniNodespace;
|
||||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||||
import com.hbm.util.ParticleUtil;
|
import com.hbm.util.ParticleUtil;
|
||||||
|
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
import cpw.mods.fml.common.Optional;
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
@ -45,17 +49,19 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "opencomputers")})
|
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "opencomputers")})
|
||||||
public class TileEntityMachineFluidTank extends TileEntityMachineBase implements SimpleComponent, OCComponent, IFluidStandardTransceiver, IPersistentNBT, IOverpressurable, IGUIProvider, IRepairable, IFluidCopiable {
|
public class TileEntityMachineFluidTank extends TileEntityMachineBase implements SimpleComponent, OCComponent, IFluidStandardTransceiverMK2, IPersistentNBT, IOverpressurable, IGUIProvider, IRepairable, IFluidCopiable {
|
||||||
|
|
||||||
|
protected FluidNode node;
|
||||||
|
|
||||||
public FluidTank tank;
|
public FluidTank tank;
|
||||||
public short mode = 0;
|
public short mode = 0;
|
||||||
public static final short modes = 4;
|
public static final short modes = 4;
|
||||||
public boolean hasExploded = false;
|
public boolean hasExploded = false;
|
||||||
protected boolean sendingBrake = false;
|
|
||||||
public boolean onFire = false;
|
public boolean onFire = false;
|
||||||
public byte lastRedstone = 0;
|
public byte lastRedstone = 0;
|
||||||
public Explosion lastExplosion = null;
|
public Explosion lastExplosion = null;
|
||||||
@ -107,15 +113,49 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
|||||||
this.markChanged();
|
this.markChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
for(DirPos pos : getConPos()) {
|
// In buffer mode, acts like a pipe block, providing fluid to its own node
|
||||||
if(mode == 0 || mode == 1) this.trySubscribe(tank.getTankType(), worldObj, pos);
|
// otherwise, it is a regular providing/receiving machine, blocking further propagation
|
||||||
if(mode == 1 || mode == 2) this.tryProvide(tank, worldObj, pos);
|
if(mode == 1) {
|
||||||
|
if(this.node == null || this.node.expired) {
|
||||||
|
|
||||||
|
this.node = (FluidNode) UniNodespace.getNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider());
|
||||||
|
|
||||||
|
if(this.node == null || this.node.expired) {
|
||||||
|
this.node = this.createNode(tank.getTankType());
|
||||||
|
UniNodespace.createNode(worldObj, this.node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.tryProvide(tank, worldObj, xCoord, yCoord, zCoord, ForgeDirection.UNKNOWN);
|
||||||
|
if(node != null && node.hasValidNet()) node.net.addReceiver(this);
|
||||||
|
} else {
|
||||||
|
if(this.node != null) {
|
||||||
|
UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider());
|
||||||
|
this.node = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(DirPos pos : getConPos()) {
|
||||||
|
FluidNode dirNode = (FluidNode) UniNodespace.getNode(worldObj, pos.getX(), pos.getY(), pos.getZ(), tank.getTankType().getNetworkProvider());
|
||||||
|
|
||||||
|
if(mode == 2) {
|
||||||
|
tryProvide(tank, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||||
|
} else {
|
||||||
|
if(dirNode != null && dirNode.hasValidNet()) dirNode.net.removeProvider(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mode == 0) {
|
||||||
|
if(dirNode != null && dirNode.hasValidNet()) dirNode.net.addReceiver(this);
|
||||||
|
} else {
|
||||||
|
if(dirNode != null && dirNode.hasValidNet()) dirNode.net.removeReceiver(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tank.loadTank(2, 3, slots);
|
tank.loadTank(2, 3, slots);
|
||||||
tank.setType(0, 1, slots);
|
tank.setType(0, 1, slots);
|
||||||
} else {
|
} else if(this.node != null) {
|
||||||
for(DirPos pos : getConPos()) this.tryUnsubscribe(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ());
|
UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider());
|
||||||
|
this.node = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte comp = this.getComparatorPower(); //comparator shit
|
byte comp = this.getComparatorPower(); //comparator shit
|
||||||
@ -166,6 +206,30 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected FluidNode createNode(FluidType type) {
|
||||||
|
DirPos[] conPos = getConPos();
|
||||||
|
|
||||||
|
HashSet<BlockPos> posSet = new HashSet<>();
|
||||||
|
posSet.add(new BlockPos(this));
|
||||||
|
for(DirPos pos : conPos) {
|
||||||
|
ForgeDirection dir = pos.getDir();
|
||||||
|
posSet.add(new BlockPos(pos.getX() - dir.offsetX, pos.getY() - dir.offsetY, pos.getZ() - dir.offsetZ));
|
||||||
|
}
|
||||||
|
|
||||||
|
return new FluidNode(type.getNetworkProvider(), posSet.toArray(new BlockPos[posSet.size()])).setConnections(conPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void invalidate() {
|
||||||
|
super.invalidate();
|
||||||
|
|
||||||
|
if(!worldObj.isRemote) {
|
||||||
|
if(this.node != null) {
|
||||||
|
UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void serialize(ByteBuf buf) {
|
public void serialize(ByteBuf buf) {
|
||||||
super.serialize(buf);
|
super.serialize(buf);
|
||||||
@ -362,6 +426,8 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
|||||||
this.onFire = data.getBoolean("onFire");
|
this.onFire = data.getBoolean("onFire");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override public boolean canConnect(FluidType fluid, ForgeDirection dir) { return true; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidTank[] getSendingTanks() {
|
public FluidTank[] getSendingTanks() {
|
||||||
if(this.hasExploded) return new FluidTank[0];
|
if(this.hasExploded) return new FluidTank[0];
|
||||||
@ -370,7 +436,7 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidTank[] getReceivingTanks() {
|
public FluidTank[] getReceivingTanks() {
|
||||||
if(this.hasExploded || this.sendingBrake) return new FluidTank[0];
|
if(this.hasExploded) return new FluidTank[0];
|
||||||
return (mode == 0 || mode == 1) ? new FluidTank[] {tank} : new FluidTank[0];
|
return (mode == 0 || mode == 1) ? new FluidTank[] {tank} : new FluidTank[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.hbm.tileentity.network;
|
package com.hbm.tileentity.network;
|
||||||
|
|
||||||
import api.hbm.energymk2.Nodespace;
|
import com.hbm.uninos.UniNodespace;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
@ -16,7 +17,7 @@ public class TileEntityFluidValve extends TileEntityPipeBaseNT {
|
|||||||
this.blockMetadata = -1; // delete cache
|
this.blockMetadata = -1; // delete cache
|
||||||
|
|
||||||
if(this.getBlockMetadata() == 0 && this.node != null) {
|
if(this.getBlockMetadata() == 0 && this.node != null) {
|
||||||
Nodespace.destroyNode(worldObj, xCoord, yCoord, zCoord);
|
UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, this.getType().getNetworkProvider());
|
||||||
this.node = null;
|
this.node = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user