if(!(n instanceof AbstractTankConduit)) {
return false;
}
AbstractTankConduit neighbour = (AbstractTankConduit) n;
if(neighbour.getFluidType() == null || getFluidType() == null) {
FluidStack type = getFluidType();
type = type != null ? type : neighbour.getFluidType();
neighbour.setFluidTypeOnNetwork(neighbour, type);
setFluidTypeOnNetwork(this, type);
}
return ConduitUtil.joinConduits(this, faceHit);
} else if(containsExternalConnection(connDir)) {
// Toggle extraction mode
setConnectionMode(connDir, getNextConnectionMode(connDir));
} else if(containsConduitConnection(connDir)) {
FluidStack curFluidType = null;
if(getTankNetwork() != null) {
curFluidType = getTankNetwork().getFluidType();
}
ConduitUtil.disconectConduits(this, connDir);
setFluidType(curFluidType);
}
}
}
return true;
} else if(player.getCurrentEquippedItem().getItem() == Items.bucket) {
if(!getBundle().getEntity().getWorldObj().isRemote) {
long curTick = getBundle().getEntity().getWorldObj().getTotalWorldTime();
if(curTick - lastEmptyTick < 20) {
numEmptyEvents++;
} else {
numEmptyEvents = 1;
}
lastEmptyTick = curTick;
if(numEmptyEvents < 2) {
if(network.fluidTypeLocked) {
network.setFluidTypeLocked(false);
numEmptyEvents = 0;
player.addChatComponentMessage(new ChatComponentText(Lang.localize("itemLiquidConduit.unlockedType")));
}
} else if(network != null) {
network.setFluidType(null);
numEmptyEvents = 0;
}
}
return true;
} else {
FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(player.getCurrentEquippedItem());
if(fluid != null) {
if(!getBundle().getEntity().getWorldObj().isRemote) {
if(network != null
&& (network.getFluidType() == null || network.getTotalVolume() < 500 || LiquidConduitNetwork.areFluidsCompatable(getFluidType(), fluid))) {
network.setFluidType(fluid);