Package pneumaticCraft.api.tileentity

Examples of pneumaticCraft.api.tileentity.IAirHandler


            shouldRepeat = false;
            //Add up every volume and air.
            int totalVolume = getVolume();
            int totalAir = currentAir;
            for(Pair<ForgeDirection, IPneumaticMachine> entry : teList) {
                IAirHandler airHandler = entry.getValue().getAirHandler();
                totalVolume += airHandler.getVolume();
                totalAir += airHandler.getCurrentAir(entry.getKey().getOpposite());
            }
            //Only go push based, ignore any machines that have a higher pressure than this block.
            Iterator<Pair<ForgeDirection, IPneumaticMachine>> iterator = teList.iterator();
            while(iterator.hasNext()) {
                Pair<ForgeDirection, IPneumaticMachine> entry = iterator.next();
                IAirHandler airHandler = entry.getValue().getAirHandler();
                int totalMachineAir = (int)((long)totalAir * airHandler.getVolume() / totalVolume);//Calculate the total air the machine is going to get.
                int airDispersed = totalMachineAir - airHandler.getCurrentAir(entry.getKey().getOpposite());
                if(airDispersed < 0) {
                    iterator.remove();
                    shouldRepeat = true;
                    dispersion.clear();
                    break;
View Full Code Here


        return model;
    }

    @Override
    public int getMaxDispersion(){
        IAirHandler connectedHandler = null;
        for(Pair<ForgeDirection, IPneumaticMachine> entry : pressureTube.getAirHandler().getConnectedPneumatics()) {
            if(entry.getKey().equals(dir)) {
                connectedHandler = entry.getValue().getAirHandler();
                break;
            }
        }
        if(connectedHandler == null) return 0;
        int maxDispersion = (int)((getThreshold() - connectedHandler.getPressure(ForgeDirection.UNKNOWN)) * connectedHandler.getVolume());
        if(maxDispersion < 0) return 0;
        return maxDispersion;
    }
View Full Code Here

TOP

Related Classes of pneumaticCraft.api.tileentity.IAirHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.