use of crazypants.enderio.powertools.machine.capbank.network.ICapBankNetwork in project EnderIO by SleepyTrousers.
the class PacketGuiChange method handleMessage.
@Override
@Nullable
protected IMessage handleMessage(TileCapBank te, PacketGuiChange message, MessageContext ctx) {
ICapBankNetwork net = te.getNetwork();
if (net == null) {
return null;
}
net.setMaxOutput(message.maxSend);
net.setMaxInput(message.maxRec);
net.setInputControlMode(message.inputMode);
net.setOutputControlMode(message.outputMode);
return null;
}
use of crazypants.enderio.powertools.machine.capbank.network.ICapBankNetwork in project EnderIO by SleepyTrousers.
the class FillGaugeBakery method calculateFillLevel.
private void calculateFillLevel() {
if (world != null && pos != null) {
TileEntity tileEntity = BlockEnder.getAnyTileEntitySafe(world, pos);
if (!(tileEntity instanceof TileCapBank)) {
localFillLevel = 0;
return;
}
ICapBankNetwork network = ((TileCapBank) tileEntity).getNetwork();
if (!(network instanceof CapBankClientNetwork)) {
localFillLevel = 0;
return;
}
((CapBankClientNetwork) network).requestPowerUpdate(((TileCapBank) tileEntity), 20);
double ratio = Math.min(((CapBankClientNetwork) network).getEnergyStoredRatio(), 1);
localFillLevel = Math.max(0, Math.min(ratio * (height * 16 - 6) - myOffset * 16, 13) + 3);
}
}
use of crazypants.enderio.powertools.machine.capbank.network.ICapBankNetwork in project EnderIO by SleepyTrousers.
the class BlockCapBank method getSelectedBoundingBox.
@Override
@SideOnly(Side.CLIENT)
@Deprecated
@Nonnull
public AxisAlignedBB getSelectedBoundingBox(@Nonnull IBlockState bs, @Nonnull World world, @Nonnull BlockPos pos) {
TileCapBank tr = getTileEntity(world, pos);
if (tr == null) {
return super.getSelectedBoundingBox(bs, world, pos);
}
ICapBankNetwork network = tr.getNetwork();
if (!tr.getType().isMultiblock() || network == null) {
return super.getSelectedBoundingBox(bs, world, pos);
}
Vector3d min = new Vector3d(Double.MAX_VALUE, Double.MAX_VALUE, Double.MAX_VALUE);
Vector3d max = new Vector3d(-Double.MAX_VALUE, -Double.MAX_VALUE, -Double.MAX_VALUE);
for (TileCapBank bc : network.getMembers()) {
int x = bc.getPos().getX();
int y = bc.getPos().getY();
int z = bc.getPos().getZ();
min.x = Math.min(min.x, x);
max.x = Math.max(max.x, x + 1);
min.y = Math.min(min.y, y);
max.y = Math.max(max.y, y + 1);
min.z = Math.min(min.z, z);
max.z = Math.max(max.z, z + 1);
}
return new AxisAlignedBB(min.x, min.y, min.z, max.x, max.y, max.z);
}
Aggregations