Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void inputEnergy()
- {
- for(EnumFacing dir : EnumFacing.values())
- {
- TileEntity tile = world.getTileEntity(pos.offset(dir));
- if(tile == null)
- {
- continue;
- }
- IEnergyStorage energyCapability = tile.getCapability(CapabilityEnergy.ENERGY, null);
- if(energyCapability == null)
- {
- continue;
- }
- int otherEnergy = energyCapability.getEnergyStored();
- int otherEnergyCap = energyCapability.getMaxEnergyStored();
- if(energy <= (capacity - maxInput) && otherEnergy >= maxInput)
- {
- energyCapability.receiveEnergy(maxInput, false);
- energy += maxInput;
- }
- if(energy > (capacity - maxInput) && otherEnergy < maxInput)
- {
- energyCapability.receiveEnergy(otherEnergy, false);
- energy += otherEnergy;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement