More compile things
This commit is contained in:
@@ -20,13 +20,13 @@ package appeng.parts.p2p;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
|
||||
import appeng.api.config.PowerUnits;
|
||||
@@ -68,17 +68,18 @@ public class PartP2PFEPower extends PartP2PTunnel<PartP2PFEPower>
|
||||
|
||||
private IEnergyStorage getAttachedEnergyStorage()
|
||||
{
|
||||
LazyOptional<IEnergyStorage> energyStorageOpt = LazyOptional.empty();
|
||||
if( this.isActive() )
|
||||
{
|
||||
final TileEntity self = this.getTile();
|
||||
final TileEntity te = self.getWorld().getTileEntity( self.getPos().offset( this.getSide().getFacing() ) );
|
||||
|
||||
if( te != null && te.hasCapability( Capabilities.FORGE_ENERGY, this.getSide().getOpposite().getFacing() ) )
|
||||
if( te != null )
|
||||
{
|
||||
return te.getCapability( Capabilities.FORGE_ENERGY, this.getSide().getOpposite().getFacing() );
|
||||
energyStorageOpt = te.getCapability( Capabilities.FORGE_ENERGY, this.getSide().getOpposite().getFacing() );
|
||||
}
|
||||
}
|
||||
return NULL_ENERGY_STORAGE;
|
||||
return energyStorageOpt.orElse( NULL_ENERGY_STORAGE );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -206,6 +207,7 @@ public class PartP2PFEPower extends PartP2PTunnel<PartP2PFEPower>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class OutputEnergyStorage implements IEnergyStorage
|
||||
{
|
||||
@Override
|
||||
@@ -252,6 +254,7 @@ public class PartP2PFEPower extends PartP2PTunnel<PartP2PFEPower>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class NullEnergyStorage implements IEnergyStorage
|
||||
{
|
||||
|
||||
@@ -290,6 +293,5 @@ public class PartP2PFEPower extends PartP2PTunnel<PartP2PFEPower>
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,12 +25,12 @@ import java.util.Deque;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.FluidTankProperties;
|
||||
@@ -194,10 +194,10 @@ public class PartP2PFluids extends PartP2PTunnel<PartP2PFluids> implements IFlui
|
||||
throw new IllegalStateException( "Invalid Recursion detected." );
|
||||
}
|
||||
|
||||
return Math.min( resource.amount, requestTotal );
|
||||
return Math.min( resource.getAmount(), requestTotal );
|
||||
}
|
||||
|
||||
int available = resource.amount;
|
||||
int available = resource.getAmount();
|
||||
|
||||
i = list.iterator();
|
||||
int used = 0;
|
||||
@@ -207,10 +207,10 @@ public class PartP2PFluids extends PartP2PTunnel<PartP2PFluids> implements IFlui
|
||||
final PartP2PFluids l = i.next();
|
||||
|
||||
final FluidStack insert = resource.copy();
|
||||
insert.amount = (int) Math.ceil( insert.amount * ( (double) l.tmpUsed / (double) requestTotal ) );
|
||||
if( insert.amount > available )
|
||||
insert.setAmount( (int) Math.ceil( insert.getAmount() * ( (double) l.tmpUsed / (double) requestTotal ) ) );
|
||||
if( insert.getAmount() > available )
|
||||
{
|
||||
insert.amount = available;
|
||||
insert.setAmount( available );
|
||||
}
|
||||
|
||||
final IFluidHandler tank = l.getTarget();
|
||||
@@ -223,7 +223,7 @@ public class PartP2PFluids extends PartP2PTunnel<PartP2PFluids> implements IFlui
|
||||
l.tmpUsed = 0;
|
||||
}
|
||||
|
||||
available -= insert.amount;
|
||||
available -= insert.getAmount();
|
||||
used += l.tmpUsed;
|
||||
}
|
||||
|
||||
@@ -306,4 +306,4 @@ public class PartP2PFluids extends PartP2PTunnel<PartP2PFluids> implements IFlui
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.Api;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.cache.P2PCache;
|
||||
import appeng.me.cache.helpers.TunnelCollection;
|
||||
|
||||
@@ -42,6 +42,7 @@ import appeng.api.parts.IPartModel;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.settings.TickRates;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.items.parts.PartModels;
|
||||
|
||||
Reference in New Issue
Block a user