Create: Diesel Generators

Create: Diesel Generators

3M Downloads

[1.20] Large pumps unable to extract oil when arm long enough and pump strength >= 1000

YukkuriC opened this issue ยท 3 comments

commented

https://github.com/george8188625/Create-Diesel-Generators/blob/1.20.1/src/main/java/com/jesz/createdieselgenerators/content/pumpjack/PumpjackHoleBlockEntity.java#L182

            if (tank.getPrimaryHandler().getFluidAmount() + subtractedAmount >= tank.getPrimaryHandler().getCapacity())
                return;

when subtractedAmount is large enough and clamped to 1000, the left part is always not-smaller than the right part, which is 1000 according to

        tank = SmartFluidTankBehaviour.single(this, 1000);

the overflow logic should't be brutely returned like this

commented

in the next version the oil chunks are gonna be saved in millibuckets so this whole problem is gonna disappear

commented

well... it could
one simple way fixing this issue is by changing >= to >, another by slightly increasing the size of the cache tank (1001 for example)
the pump strength of those monstrous pumpjacks will be limited to 1000 each, but better than nothing

commented

or let's just ignore the 1B/pump limit

            var subtractedAmountRaw = (int) (100 * Math.abs((float) headPos / (float) bearingPos)) * (isCrankLarge ? 2 : 1);
            while (storedOilAmount < subtractedAmountRaw && amount > 0){
                amount--;
                sd.setChunkAmount(chunkPos, amount);
                oilAmount = amount;
                storedOilAmount += 1000;
            }
            int subtractedAmount = Mth.clamp(subtractedAmountRaw, 0, storedOilAmount);

            if (tank.getPrimaryHandler().getFluidAmount() + subtractedAmount > tank.getPrimaryHandler().getCapacity())
                return;

with

    @Override
    public void addBehaviours(List<BlockEntityBehaviour> behaviours) {
        tank = SmartFluidTankBehaviour.single(this, 10000);
        behaviours.add(tank);
    }