BuildCraft|Core

BuildCraft|Core

7M Downloads

IPipeTransportPowerHook useless until nextPowerQuery can be accessed

Flow86 opened this issue ยท 0 comments

commented

Hi,

the IPipeTransportPowerHook can't be useds to adjust power requests (requestEnergy override) anymore, since "nextPowerQuery" in PipeTransportPower is set to private.

from my iron power pipe code:

    @Override
    public float receiveEnergy(ForgeDirection from, float val) {
        int metadata = container.getBlockMetadata();

        if (metadata != from.ordinal() && val > 0.0) {
            transport.internalNextPower[from.ordinal()] += val;

            if (transport.internalNextPower[from.ordinal()] > transport.maxPower) {
                val = transport.internalNextPower[from.ordinal()] - transport.maxPower;
                transport.internalNextPower[from.ordinal()] = transport.maxPower;
            }
        }
        return val;
    }

    @Override
    public void requestEnergy(ForgeDirection from, float amount) {
        int metadata = container.getBlockMetadata();

        if (metadata == from.ordinal()) {
            transport.nextPowerQuery[from.ordinal()] += amount; // <<<<<< here
        }
    }

either requestEnergy should return "float" - which will be set in nextPowerQuery[from] then, or make it public again.

from PipeTransportPower:

    public void requestEnergy(ForgeDirection from, float amount) {
        step();
        if (this.container.pipe instanceof IPipeTransportPowerHook) {
            ((IPipeTransportPowerHook) this.container.pipe).requestEnergy(from, amount);
        } else {
            nextPowerQuery[from.ordinal()] += amount;
        }
    }

currently "nextPowerQuery" can't never be set if the power transport hook is used, so no power is requested