use of crazypants.enderio.base.conduit.IServerConduit in project EnderIO by SleepyTrousers.
the class AbstractConduit method onAfterRemovedFromBundle.
@Override
public void onAfterRemovedFromBundle() {
TileEntity te = getBundle().getEntity();
World world = te.getWorld();
for (EnumFacing dir : conduitConnections) {
IConduit neighbour = ConduitUtil.getConduit(world, te, dir, getBaseConduitType());
if (neighbour instanceof IServerConduit) {
((IServerConduit) neighbour).conduitConnectionRemoved(dir.getOpposite());
((IServerConduit) neighbour).connectionsChanged();
}
}
conduitConnections.clear();
if (!externalConnections.isEmpty()) {
world.notifyNeighborsOfStateChange(te.getPos(), te.getBlockType(), true);
}
externalConnections.clear();
IConduitNetwork<?, ?> network = getNetwork();
if (network != null) {
network.destroyNetwork();
}
connectionsChanged();
}
use of crazypants.enderio.base.conduit.IServerConduit in project EnderIO by SleepyTrousers.
the class AdvancedLiquidConduitNetwork method updateActiveState.
private void updateActiveState() {
boolean isActive = tank.containsValidLiquid() && !tank.isEmpty();
if (!isActive) {
if (!fluidTypeLocked && liquidType != null) {
ticksEmpty++;
if (ticksEmpty > 40) {
setFluidType(null);
ticksEmpty = 0;
for (IServerConduit con : getConduits()) {
con.setActive(false);
}
lastSyncedActive = false;
}
}
return;
}
ticksEmpty = 0;
if (!lastSyncedActive) {
for (IServerConduit con : getConduits()) {
con.setActive(true);
}
lastSyncedActive = true;
}
}
use of crazypants.enderio.base.conduit.IServerConduit in project EnderIO by SleepyTrousers.
the class ItemConduitProbe method copyPasteSettings.
public static boolean copyPasteSettings(@Nonnull EntityPlayer player, @Nonnull ItemStack stack, @Nonnull IConduitBundle bundle, @Nonnull EnumFacing dir) {
if (player.world.isRemote) {
return true;
}
boolean isCopy = player.isSneaking();
boolean clearedData = false;
if (!isCopy && !stack.hasTagCompound()) {
return false;
}
boolean performedAction = false;
Collection<IServerConduit> conduits = bundle.getServerConduits();
for (IServerConduit conduit : conduits) {
if (conduit.getExternalConnections().contains(dir)) {
if (isCopy && !clearedData) {
clearedData = true;
}
if (isCopy) {
NBTTagCompound nbt = new NBTTagCompound();
performedAction |= conduit.writeConnectionSettingsToNBT(dir, nbt);
stack.setTagCompound(nbt);
} else {
NBTTagCompound nbt = stack.getTagCompound();
performedAction |= nbt != null && conduit.readConduitSettingsFromNBT(dir, nbt);
}
}
}
if (isCopy && performedAction) {
player.sendStatusMessage(Lang.GUI_PROBE_COPIED.toChatServer(), true);
}
return performedAction;
}
use of crazypants.enderio.base.conduit.IServerConduit in project EnderIO by SleepyTrousers.
the class AbstractConduit method onAddedToBundle.
@Override
public void onAddedToBundle() {
TileEntity te = bundle.getEntity();
World world = te.getWorld();
conduitConnections.clear();
for (EnumFacing dir : EnumFacing.VALUES) {
IConduit neighbour = ConduitUtil.getConduit(world, te, dir, getBaseConduitType());
if (neighbour instanceof IServerConduit && ((IServerConduit) neighbour).canConnectToConduit(dir.getOpposite(), this)) {
conduitConnections.add(dir);
((IServerConduit) neighbour).conduitConnectionAdded(dir.getOpposite());
((IServerConduit) neighbour).connectionsChanged();
}
}
externalConnections.clear();
for (EnumFacing dir : EnumFacing.VALUES) {
if (!containsConduitConnection(dir) && canConnectToExternal(dir, false)) {
externalConnectionAdded(dir);
}
}
connectionsChanged();
}
use of crazypants.enderio.base.conduit.IServerConduit in project EnderIO by SleepyTrousers.
the class ConduitHandler method store.
@Override
public boolean store(@Nonnull Registry registry, @Nonnull Set<NBTAction> phase, @Nonnull NBTTagCompound nbt, @Nonnull String name, @Nonnull IConduit object) throws IllegalArgumentException, IllegalAccessException, InstantiationException, NoHandlerFoundException {
if (object instanceof IServerConduit) {
NBTTagCompound root = new NBTTagCompound();
ConduitUtil.writeToNBT((IServerConduit) object, root);
nbt.setTag(name, root);
} else {
Log.error("Logic error: Attempting to store client conduit procy as NBT for phase(S) " + phase);
}
return true;
}
Aggregations