Merge branch 'master' of https://bitbucket.org/AlgorithmX2/appliedenergistics2 into rv1
This commit is contained in:
@@ -277,13 +277,15 @@ public class BlockCableBus extends AEBaseBlock
|
|||||||
private ICableBusContainer cb(IBlockAccess w, int x, int y, int z)
|
private ICableBusContainer cb(IBlockAccess w, int x, int y, int z)
|
||||||
{
|
{
|
||||||
TileEntity te = w.getTileEntity( x, y, z );
|
TileEntity te = w.getTileEntity( x, y, z );
|
||||||
|
ICableBusContainer out = null;
|
||||||
|
|
||||||
if ( te instanceof TileCableBus )
|
if ( te instanceof TileCableBus )
|
||||||
return ((TileCableBus) te).cb;
|
out = ((TileCableBus) te).cb;
|
||||||
|
|
||||||
if ( AppEng.instance.isIntegrationEnabled( "FMP" ) )
|
else if ( AppEng.instance.isIntegrationEnabled( "FMP" ) )
|
||||||
return ((IFMP) AppEng.instance.getIntegration( "FMP" )).getCableContainer( te );
|
out = ((IFMP) AppEng.instance.getIntegration( "FMP" )).getCableContainer( te );
|
||||||
|
|
||||||
return nullCB;
|
return out == null ? nullCB : out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package appeng.client.gui;
|
package appeng.client.gui;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.DecimalFormat;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
@@ -24,7 +23,6 @@ import org.lwjgl.input.Mouse;
|
|||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
import org.lwjgl.opengl.GL12;
|
import org.lwjgl.opengl.GL12;
|
||||||
|
|
||||||
import appeng.api.config.PowerUnits;
|
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.client.gui.widgets.GuiScrollbar;
|
import appeng.client.gui.widgets.GuiScrollbar;
|
||||||
import appeng.client.gui.widgets.ITooltip;
|
import appeng.client.gui.widgets.ITooltip;
|
||||||
@@ -43,7 +41,6 @@ import appeng.container.slot.SlotInaccessable;
|
|||||||
import appeng.container.slot.SlotOutput;
|
import appeng.container.slot.SlotOutput;
|
||||||
import appeng.container.slot.SlotPatternTerm;
|
import appeng.container.slot.SlotPatternTerm;
|
||||||
import appeng.container.slot.SlotRestrictedInput;
|
import appeng.container.slot.SlotRestrictedInput;
|
||||||
import appeng.core.AEConfig;
|
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
import appeng.core.sync.network.NetworkHandler;
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
@@ -60,39 +57,6 @@ public abstract class AEBaseGui extends GuiContainer
|
|||||||
protected List<InternalSlotME> meSlots = new LinkedList<InternalSlotME>();
|
protected List<InternalSlotME> meSlots = new LinkedList<InternalSlotME>();
|
||||||
protected GuiScrollbar myScrollBar = null;
|
protected GuiScrollbar myScrollBar = null;
|
||||||
|
|
||||||
protected String formatPowerLong(long n, boolean isRate)
|
|
||||||
{
|
|
||||||
double p = ((double) n) / 100;
|
|
||||||
|
|
||||||
PowerUnits displayUnits = AEConfig.instance.selectedPowerUnit();
|
|
||||||
p = PowerUnits.AE.convertTo( displayUnits, p );
|
|
||||||
|
|
||||||
int offset = 0;
|
|
||||||
String Lvl = "";
|
|
||||||
String preFixes[] = new String[] { "k", "M", "G", "T", "P", "T", "P", "E", "Z", "Y" };
|
|
||||||
String unitName = displayUnits.name();
|
|
||||||
|
|
||||||
if ( displayUnits == PowerUnits.WA )
|
|
||||||
unitName = "J";
|
|
||||||
|
|
||||||
if ( displayUnits == PowerUnits.KJ )
|
|
||||||
{
|
|
||||||
Lvl = preFixes[offset];
|
|
||||||
unitName = "J";
|
|
||||||
offset++;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (p > 1000 && offset < preFixes.length)
|
|
||||||
{
|
|
||||||
p /= 1000;
|
|
||||||
Lvl = preFixes[offset];
|
|
||||||
offset++;
|
|
||||||
}
|
|
||||||
|
|
||||||
DecimalFormat df = new DecimalFormat( "#.##" );
|
|
||||||
return df.format( p ) + " " + Lvl + unitName + (isRate ? "/t" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
public AEBaseGui(Container container) {
|
public AEBaseGui(Container container) {
|
||||||
super( container );
|
super( container );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,11 +139,11 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
|
|||||||
|
|
||||||
fontRendererObj.drawString( GuiText.NetworkDetails.getLocal(), 8, 6, 4210752 );
|
fontRendererObj.drawString( GuiText.NetworkDetails.getLocal(), 8, 6, 4210752 );
|
||||||
|
|
||||||
fontRendererObj.drawString( GuiText.StoredPower.getLocal() + ": " + formatPowerLong( ns.currentPower, false ), 13, 16, 4210752 );
|
fontRendererObj.drawString( GuiText.StoredPower.getLocal() + ": " + Platform.formatPowerLong( ns.currentPower, false ), 13, 16, 4210752 );
|
||||||
fontRendererObj.drawString( GuiText.MaxPower.getLocal() + ": " + formatPowerLong( ns.maxPower, false ), 13, 26, 4210752 );
|
fontRendererObj.drawString( GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong( ns.maxPower, false ), 13, 26, 4210752 );
|
||||||
|
|
||||||
fontRendererObj.drawString( GuiText.PowerInputRate.getLocal() + ": " + formatPowerLong( ns.avgAddition, true ), 13, 143 - 10, 4210752 );
|
fontRendererObj.drawString( GuiText.PowerInputRate.getLocal() + ": " + Platform.formatPowerLong( ns.avgAddition, true ), 13, 143 - 10, 4210752 );
|
||||||
fontRendererObj.drawString( GuiText.PowerUsageRate.getLocal() + ": " + formatPowerLong( ns.powerUsage, true ), 13, 143 - 20, 4210752 );
|
fontRendererObj.drawString( GuiText.PowerUsageRate.getLocal() + ": " + Platform.formatPowerLong( ns.powerUsage, true ), 13, 143 - 20, 4210752 );
|
||||||
|
|
||||||
int sectionLength = 30;
|
int sectionLength = 30;
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
|
|||||||
|
|
||||||
ToolTip = ToolTip + ("\n" + GuiText.Installed.getLocal() + ": " + (refStack.getStackSize()));
|
ToolTip = ToolTip + ("\n" + GuiText.Installed.getLocal() + ": " + (refStack.getStackSize()));
|
||||||
if ( refStack.getCountRequestable() > 0 )
|
if ( refStack.getCountRequestable() > 0 )
|
||||||
ToolTip = ToolTip + ("\n" + GuiText.EnergyDrain.getLocal() + ": " + formatPowerLong( refStack.getCountRequestable(), true ));
|
ToolTip = ToolTip + ("\n" + GuiText.EnergyDrain.getLocal() + ": " + Platform.formatPowerLong( refStack.getCountRequestable(), true ));
|
||||||
|
|
||||||
toolPosX = x * sectionLength + xo + sectionLength - 8;
|
toolPosX = x * sectionLength + xo + sectionLength - 8;
|
||||||
toolPosY = y * 18 + yo;
|
toolPosY = y * 18 + yo;
|
||||||
@@ -267,7 +267,7 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
|
|||||||
currenttip.remove( 1 );
|
currenttip.remove( 1 );
|
||||||
|
|
||||||
currenttip.add( GuiText.Installed.getLocal() + ": " + (myStack.getStackSize()) );
|
currenttip.add( GuiText.Installed.getLocal() + ": " + (myStack.getStackSize()) );
|
||||||
currenttip.add( GuiText.EnergyDrain.getLocal() + ": " + formatPowerLong( myStack.getCountRequestable(), true ) );
|
currenttip.add( GuiText.EnergyDrain.getLocal() + ": " + Platform.formatPowerLong( myStack.getCountRequestable(), true ) );
|
||||||
|
|
||||||
drawTooltip( x, y, 0, join( currenttip, "\n" ) );
|
drawTooltip( x, y, 0, join( currenttip, "\n" ) );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import appeng.container.implementations.ContainerSpatialIOPort;
|
|||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
import appeng.core.localization.GuiText;
|
import appeng.core.localization.GuiText;
|
||||||
import appeng.tile.spatial.TileSpatialIOPort;
|
import appeng.tile.spatial.TileSpatialIOPort;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
|
||||||
public class GuiSpatialIOPort extends AEBaseGui
|
public class GuiSpatialIOPort extends AEBaseGui
|
||||||
{
|
{
|
||||||
@@ -58,9 +59,9 @@ public class GuiSpatialIOPort extends AEBaseGui
|
|||||||
@Override
|
@Override
|
||||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||||
{
|
{
|
||||||
fontRendererObj.drawString( GuiText.StoredPower.getLocal() + ": " + formatPowerLong( csiop.currentPower, false ), 13, 21, 4210752 );
|
fontRendererObj.drawString( GuiText.StoredPower.getLocal() + ": " + Platform.formatPowerLong( csiop.currentPower, false ), 13, 21, 4210752 );
|
||||||
fontRendererObj.drawString( GuiText.MaxPower.getLocal() + ": " + formatPowerLong( csiop.maxPower, false ), 13, 31, 4210752 );
|
fontRendererObj.drawString( GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong( csiop.maxPower, false ), 13, 31, 4210752 );
|
||||||
fontRendererObj.drawString( GuiText.RequiredPower.getLocal() + ": " + formatPowerLong( csiop.reqPower, false ), 13, 78, 4210752 );
|
fontRendererObj.drawString( GuiText.RequiredPower.getLocal() + ": " + Platform.formatPowerLong( csiop.reqPower, false ), 13, 78, 4210752 );
|
||||||
fontRendererObj.drawString( GuiText.Efficiency.getLocal() + ": " + (((float) csiop.eff) / 100) + "%", 13, 88, 4210752 );
|
fontRendererObj.drawString( GuiText.Efficiency.getLocal() + ": " + (((float) csiop.eff) / 100) + "%", 13, 88, 4210752 );
|
||||||
|
|
||||||
fontRendererObj.drawString( getGuiDisplayName( GuiText.SpatialIOPort.getLocal() ), 8, 6, 4210752 );
|
fontRendererObj.drawString( getGuiDisplayName( GuiText.SpatialIOPort.getLocal() ), 8, 6, 4210752 );
|
||||||
|
|||||||
@@ -895,9 +895,14 @@ public abstract class AEBaseContainer extends Container
|
|||||||
long maxSize = ais.getItemStack().getMaxStackSize();
|
long maxSize = ais.getItemStack().getMaxStackSize();
|
||||||
ais.setStackSize( maxSize );
|
ais.setStackSize( maxSize );
|
||||||
ais = cellInv.extractItems( ais, Actionable.SIMULATE, mySrc );
|
ais = cellInv.extractItems( ais, Actionable.SIMULATE, mySrc );
|
||||||
long stackSize = Math.min( maxSize, ais.getStackSize() );
|
|
||||||
ais.setStackSize( (stackSize + 1) >> 1 );
|
if ( ais != null )
|
||||||
ais = Platform.poweredExtraction( powerSrc, cellInv, ais, mySrc );
|
{
|
||||||
|
long stackSize = Math.min( maxSize, ais.getStackSize() );
|
||||||
|
ais.setStackSize( (stackSize + 1) >> 1 );
|
||||||
|
ais = Platform.poweredExtraction( powerSrc, cellInv, ais, mySrc );
|
||||||
|
}
|
||||||
|
|
||||||
if ( ais != null )
|
if ( ais != null )
|
||||||
player.inventory.setItemStack( ais.getItemStack() );
|
player.inventory.setItemStack( ais.getItemStack() );
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
import appeng.api.networking.security.BaseActionSource;
|
||||||
import appeng.api.storage.IExternalStorageHandler;
|
import appeng.api.storage.IExternalStorageHandler;
|
||||||
import appeng.api.storage.IExternalStorageRegistry;
|
import appeng.api.storage.IExternalStorageRegistry;
|
||||||
import appeng.api.storage.StorageChannel;
|
import appeng.api.storage.StorageChannel;
|
||||||
@@ -21,15 +22,15 @@ public class ExternalStorageRegistry implements IExternalStorageRegistry
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IExternalStorageHandler getHandler(TileEntity te, ForgeDirection d, StorageChannel chan)
|
public IExternalStorageHandler getHandler(TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource mySrc)
|
||||||
{
|
{
|
||||||
for (IExternalStorageHandler x : Handlers)
|
for (IExternalStorageHandler x : Handlers)
|
||||||
{
|
{
|
||||||
if ( x.canHandle( te, d, chan ) )
|
if ( x.canHandle( te, d, chan, mySrc ) )
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( lastHandler.canHandle( te, d, chan ) )
|
if ( lastHandler.canHandle( te, d, chan, mySrc ) )
|
||||||
return lastHandler;
|
return lastHandler;
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class ExternalIInv implements IExternalStorageHandler
|
|||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel channel)
|
public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource mySrc)
|
||||||
{
|
{
|
||||||
return channel == StorageChannel.ITEMS && te instanceof IInventory;
|
return channel == StorageChannel.ITEMS && te instanceof IInventory;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public class BCPipeHandler implements IExternalStorageHandler
|
|||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel chan)
|
public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource mySrc)
|
||||||
{
|
{
|
||||||
return chan == StorageChannel.ITEMS && BC.instance.isPipe( te, d );
|
return chan == StorageChannel.ITEMS && BC.instance.isPipe( te, d );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import mcp.mobius.waila.api.IWailaDataProvider;
|
|||||||
import mcp.mobius.waila.api.IWailaRegistrar;
|
import mcp.mobius.waila.api.IWailaRegistrar;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
@@ -25,6 +26,8 @@ import appeng.core.AppEng;
|
|||||||
import appeng.core.localization.WailaText;
|
import appeng.core.localization.WailaText;
|
||||||
import appeng.integration.BaseModule;
|
import appeng.integration.BaseModule;
|
||||||
import appeng.tile.misc.TileCharger;
|
import appeng.tile.misc.TileCharger;
|
||||||
|
import appeng.tile.networking.TileEnergyCell;
|
||||||
|
import appeng.util.Platform;
|
||||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||||
|
|
||||||
public class Waila extends BaseModule implements IWailaDataProvider
|
public class Waila extends BaseModule implements IWailaDataProvider
|
||||||
@@ -90,6 +93,18 @@ public class Waila extends BaseModule implements IWailaDataProvider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ThingOfInterest instanceof TileEnergyCell )
|
||||||
|
{
|
||||||
|
NBTTagCompound c = accessor.getNBTData();
|
||||||
|
if ( c != null )
|
||||||
|
{
|
||||||
|
TileEnergyCell tec = (TileEnergyCell) ThingOfInterest;
|
||||||
|
long power = (long) (100 * c.getDouble( "internalCurrentPower" ));
|
||||||
|
currenttip.add( WailaText.Contains + ": " + Platform.formatPowerLong( power, false ) + " / "
|
||||||
|
+ Platform.formatPowerLong( (long) (100 * tec.getAEMaxPower()), false ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( ThingOfInterest instanceof IPartStorageMonitor )
|
if ( ThingOfInterest instanceof IPartStorageMonitor )
|
||||||
{
|
{
|
||||||
IPartStorageMonitor psm = (IPartStorageMonitor) ThingOfInterest;
|
IPartStorageMonitor psm = (IPartStorageMonitor) ThingOfInterest;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class FactorizationHandler implements IExternalStorageHandler
|
|||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel chan)
|
public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource mySrc)
|
||||||
{
|
{
|
||||||
return chan == StorageChannel.ITEMS && FZ.instance.isBarrel( te );
|
return chan == StorageChannel.ITEMS && FZ.instance.isBarrel( te );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class MFRDSUHandler implements IExternalStorageHandler
|
|||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel chan)
|
public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource mySrc)
|
||||||
{
|
{
|
||||||
return chan == StorageChannel.ITEMS && DSU.instance.isDSU( te );
|
return chan == StorageChannel.ITEMS && DSU.instance.isDSU( te );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,10 +16,10 @@ public class AEExternalHandler implements IExternalStorageHandler
|
|||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel channel)
|
public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource mySrc)
|
||||||
{
|
{
|
||||||
if ( channel == StorageChannel.ITEMS && te instanceof ITileStorageMonitorable )
|
if ( channel == StorageChannel.ITEMS && te instanceof ITileStorageMonitorable )
|
||||||
return true;
|
return ((ITileStorageMonitorable) te).getMonitorable( d, mySrc ) != null;
|
||||||
|
|
||||||
return te instanceof TileCondenser;
|
return te instanceof TileCondenser;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,25 +170,28 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
|
|||||||
is.stackSize = 1;
|
is.stackSize = 1;
|
||||||
|
|
||||||
IPart bp = bi.createPartFromItemStack( is );
|
IPart bp = bi.createPartFromItemStack( is );
|
||||||
if ( bp instanceof IPartCable )
|
if ( bp != null )
|
||||||
{
|
{
|
||||||
boolean canPlace = true;
|
if ( bp instanceof IPartCable )
|
||||||
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS)
|
{
|
||||||
if ( getPart( d ) != null && !getPart( d ).canBePlacedOn( ((IPartCable) bp).supportsBuses() ) )
|
boolean canPlace = true;
|
||||||
canPlace = false;
|
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS)
|
||||||
|
if ( getPart( d ) != null && !getPart( d ).canBePlacedOn( ((IPartCable) bp).supportsBuses() ) )
|
||||||
|
canPlace = false;
|
||||||
|
|
||||||
if ( !canPlace )
|
if ( !canPlace )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return getPart( ForgeDirection.UNKNOWN ) == null;
|
return getPart( ForgeDirection.UNKNOWN ) == null;
|
||||||
}
|
}
|
||||||
else if ( !(bp instanceof IPartCable) && side != ForgeDirection.UNKNOWN )
|
else if ( !(bp instanceof IPartCable) && side != ForgeDirection.UNKNOWN )
|
||||||
{
|
{
|
||||||
IPart cable = getPart( ForgeDirection.UNKNOWN );
|
IPart cable = getPart( ForgeDirection.UNKNOWN );
|
||||||
if ( cable != null && !bp.canBePlacedOn( ((IPartCable) cable).supportsBuses() ) )
|
if ( cable != null && !bp.canBePlacedOn( ((IPartCable) cable).supportsBuses() ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return getPart( side ) == null;
|
return getPart( side ) == null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -701,7 +704,7 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
|
|||||||
p.readFromNBT( extra );
|
p.readFromNBT( extra );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw new RuntimeException( "Invalid NBT For CableBus Container." );
|
throw new RuntimeException( "Invalid NBT For CableBus Container: " + iss.getItem().getClass().getName() + " is not a valid part." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
|||||||
monitor = null;
|
monitor = null;
|
||||||
if ( target != null )
|
if ( target != null )
|
||||||
{
|
{
|
||||||
IExternalStorageHandler esh = AEApi.instance().registries().externalStorage().getHandler( target, side.getOpposite(), StorageChannel.ITEMS );
|
IExternalStorageHandler esh = AEApi.instance().registries().externalStorage().getHandler( target, side.getOpposite(), StorageChannel.ITEMS, mySrc );
|
||||||
if ( esh != null )
|
if ( esh != null )
|
||||||
{
|
{
|
||||||
IMEInventory inv = esh.getInventory( target, side.getOpposite(), StorageChannel.ITEMS, mySrc );
|
IMEInventory inv = esh.getInventory( target, side.getOpposite(), StorageChannel.ITEMS, mySrc );
|
||||||
|
|||||||
+34
-11
@@ -78,6 +78,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
|||||||
|
|
||||||
static final int sides[] = new int[] { 0 };
|
static final int sides[] = new int[] { 0 };
|
||||||
static final int front[] = new int[] { 1 };
|
static final int front[] = new int[] { 1 };
|
||||||
|
static final int noslots[] = new int[] {};
|
||||||
|
|
||||||
AppEngInternalInventory inv = new AppEngInternalInventory( this, 2 );
|
AppEngInternalInventory inv = new AppEngInternalInventory( this, 2 );
|
||||||
BaseActionSource mySrc = new MachineSource( this );
|
BaseActionSource mySrc = new MachineSource( this );
|
||||||
@@ -473,31 +474,53 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
|||||||
@Override
|
@Override
|
||||||
public boolean canExtractItem(int i, ItemStack itemstack, int j)
|
public boolean canExtractItem(int i, ItemStack itemstack, int j)
|
||||||
{
|
{
|
||||||
return false;
|
return i == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInsertItem(int i, ItemStack itemstack, int j)
|
public boolean canInsertItem(int i, ItemStack itemstack, int j)
|
||||||
{
|
{
|
||||||
try
|
if ( i == 1 )
|
||||||
{
|
{
|
||||||
IMEInventory<IAEItemStack> cell = getHandler( StorageChannel.ITEMS );
|
if ( AEApi.instance().registries().cell().getCellInventory( itemstack, StorageChannel.ITEMS ) != null )
|
||||||
IAEItemStack returns = cell.injectItems( AEApi.instance().storage().createItemStack( inv.getStackInSlot( 0 ) ), Actionable.SIMULATE, mySrc );
|
return true;
|
||||||
return returns == null || returns.getStackSize() != itemstack.stackSize;
|
if ( AEApi.instance().registries().cell().getCellInventory( itemstack, StorageChannel.FLUIDS ) != null )
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
catch (ChestNoHandler t)
|
else
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
IMEInventory<IAEItemStack> cell = getHandler( StorageChannel.ITEMS );
|
||||||
|
IAEItemStack returns = cell.injectItems( AEApi.instance().storage().createItemStack( inv.getStackInSlot( 0 ) ), Actionable.SIMULATE, mySrc );
|
||||||
|
return returns == null || returns.getStackSize() != itemstack.stackSize;
|
||||||
|
}
|
||||||
|
catch (ChestNoHandler t)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int[] getAccessibleSlotsBySide(ForgeDirection side)
|
public int[] getAccessibleSlotsBySide(ForgeDirection side)
|
||||||
{
|
{
|
||||||
if ( side == getForward() )
|
if ( ForgeDirection.SOUTH == side )
|
||||||
return front;
|
return front;
|
||||||
return sides;
|
|
||||||
|
if ( gridProxy.isActive() )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if ( getHandler( StorageChannel.ITEMS ) != null )
|
||||||
|
return sides;
|
||||||
|
}
|
||||||
|
catch (ChestNoHandler e)
|
||||||
|
{
|
||||||
|
// nope!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return noslots;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -652,7 +675,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
|||||||
{
|
{
|
||||||
IMEInventoryHandler h = getHandler( StorageChannel.FLUIDS );
|
IMEInventoryHandler h = getHandler( StorageChannel.FLUIDS );
|
||||||
if ( h.getChannel() == StorageChannel.FLUIDS )
|
if ( h.getChannel() == StorageChannel.FLUIDS )
|
||||||
return new FluidTankInfo[] { new FluidTankInfo( null ) }; // eh?
|
return new FluidTankInfo[] { new FluidTankInfo( null, 1 ) }; // eh?
|
||||||
}
|
}
|
||||||
catch (ChestNoHandler e)
|
catch (ChestNoHandler e)
|
||||||
{
|
{
|
||||||
@@ -708,7 +731,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
|||||||
@Override
|
@Override
|
||||||
public IStorageMonitorable getMonitorable(ForgeDirection side, BaseActionSource src)
|
public IStorageMonitorable getMonitorable(ForgeDirection side, BaseActionSource src)
|
||||||
{
|
{
|
||||||
if ( Platform.canAccess( gridProxy, src ) )
|
if ( Platform.canAccess( gridProxy, src ) && side != getForward() )
|
||||||
return this;
|
return this;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package appeng.util;
|
package appeng.util;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.text.DecimalFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
@@ -52,6 +53,7 @@ import appeng.api.config.AccessRestriction;
|
|||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.config.FuzzyMode;
|
import appeng.api.config.FuzzyMode;
|
||||||
import appeng.api.config.PowerMultiplier;
|
import appeng.api.config.PowerMultiplier;
|
||||||
|
import appeng.api.config.PowerUnits;
|
||||||
import appeng.api.config.SearchBoxMode;
|
import appeng.api.config.SearchBoxMode;
|
||||||
import appeng.api.config.SecurityPermissions;
|
import appeng.api.config.SecurityPermissions;
|
||||||
import appeng.api.config.SortOrder;
|
import appeng.api.config.SortOrder;
|
||||||
@@ -78,6 +80,7 @@ import appeng.api.storage.data.IAEStack;
|
|||||||
import appeng.api.storage.data.IAETagCompound;
|
import appeng.api.storage.data.IAETagCompound;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
import appeng.api.util.AEItemDefinition;
|
import appeng.api.util.AEItemDefinition;
|
||||||
|
import appeng.core.AEConfig;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
@@ -127,6 +130,46 @@ public class Platform
|
|||||||
return rdnSrc.nextFloat();
|
return rdnSrc.nextFloat();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This displays the value for encoded longs ( double *100 )
|
||||||
|
*
|
||||||
|
* @param n
|
||||||
|
* @param isRate
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String formatPowerLong(long n, boolean isRate)
|
||||||
|
{
|
||||||
|
double p = ((double) n) / 100;
|
||||||
|
|
||||||
|
PowerUnits displayUnits = AEConfig.instance.selectedPowerUnit();
|
||||||
|
p = PowerUnits.AE.convertTo( displayUnits, p );
|
||||||
|
|
||||||
|
int offset = 0;
|
||||||
|
String Lvl = "";
|
||||||
|
String preFixes[] = new String[] { "k", "M", "G", "T", "P", "T", "P", "E", "Z", "Y" };
|
||||||
|
String unitName = displayUnits.name();
|
||||||
|
|
||||||
|
if ( displayUnits == PowerUnits.WA )
|
||||||
|
unitName = "J";
|
||||||
|
|
||||||
|
if ( displayUnits == PowerUnits.KJ )
|
||||||
|
{
|
||||||
|
Lvl = preFixes[offset];
|
||||||
|
unitName = "J";
|
||||||
|
offset++;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (p > 1000 && offset < preFixes.length)
|
||||||
|
{
|
||||||
|
p /= 1000;
|
||||||
|
Lvl = preFixes[offset];
|
||||||
|
offset++;
|
||||||
|
}
|
||||||
|
|
||||||
|
DecimalFormat df = new DecimalFormat( "#.##" );
|
||||||
|
return df.format( p ) + " " + Lvl + unitName + (isRate ? "/t" : "");
|
||||||
|
}
|
||||||
|
|
||||||
public static ForgeDirection crossProduct(ForgeDirection forward, ForgeDirection up)
|
public static ForgeDirection crossProduct(ForgeDirection forward, ForgeDirection up)
|
||||||
{
|
{
|
||||||
int west_x = forward.offsetY * up.offsetZ - forward.offsetZ * up.offsetY;
|
int west_x = forward.offsetY * up.offsetZ - forward.offsetZ * up.offsetY;
|
||||||
|
|||||||
Reference in New Issue
Block a user