Search in sources :

Example 1 with ICapBankNetwork

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;
}
Also used : ICapBankNetwork(crazypants.enderio.powertools.machine.capbank.network.ICapBankNetwork) Nullable(javax.annotation.Nullable)

Example 2 with ICapBankNetwork

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);
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileCapBank(crazypants.enderio.powertools.machine.capbank.TileCapBank) CapBankClientNetwork(crazypants.enderio.powertools.machine.capbank.network.CapBankClientNetwork) ICapBankNetwork(crazypants.enderio.powertools.machine.capbank.network.ICapBankNetwork)

Example 3 with ICapBankNetwork

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);
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) Vector3d(com.enderio.core.common.vecmath.Vector3d) ICapBankNetwork(crazypants.enderio.powertools.machine.capbank.network.ICapBankNetwork) Nonnull(javax.annotation.Nonnull) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

ICapBankNetwork (crazypants.enderio.powertools.machine.capbank.network.ICapBankNetwork)3 Vector3d (com.enderio.core.common.vecmath.Vector3d)1 TileCapBank (crazypants.enderio.powertools.machine.capbank.TileCapBank)1 CapBankClientNetwork (crazypants.enderio.powertools.machine.capbank.network.CapBankClientNetwork)1 Nonnull (javax.annotation.Nonnull)1 Nullable (javax.annotation.Nullable)1 TileEntity (net.minecraft.tileentity.TileEntity)1 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1