Err too much.
This commit is contained in:
parent
5652ec30ec
commit
834e9c04c5
|
@ -27,6 +27,7 @@ import appeng.api.implementations.IMemoryCard;
|
|||
import appeng.api.implementations.MemoryCardMessages;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.networking.BlockCableBus;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.BlockRenderInfo;
|
||||
import appeng.client.render.WorldRender;
|
||||
|
@ -631,7 +632,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
|
|||
return false;
|
||||
}
|
||||
|
||||
if ( is.getItem() instanceof IMemoryCard )
|
||||
if ( is.getItem() instanceof IMemoryCard && !(this instanceof BlockCableBus) )
|
||||
{
|
||||
IMemoryCard memc = (IMemoryCard) is.getItem();
|
||||
if ( player.isSneaking() )
|
||||
|
|
|
@ -11,6 +11,7 @@ import appeng.api.AEApi;
|
|||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.api.implementations.IAEItemPowerStorage;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEItemPowerStorage
|
||||
|
@ -34,7 +35,7 @@ public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEIte
|
|||
|
||||
double percent = internalCurrentPower / internalMaxPower;
|
||||
|
||||
lines.add( Platform.gui_localize( "Stored Energy" ) + ":" + MessageFormat.format( " {0,number,#} ", internalCurrentPower )
|
||||
lines.add( GuiText.StoredEnergy.getLocal() + ":" + MessageFormat.format( " {0,number,#} ", internalCurrentPower )
|
||||
+ Platform.gui_localize( PowerUnits.AE.unlocalizedName ) + " - "
|
||||
+ MessageFormat.format( " {0,number,#.##%} ", percent ) );
|
||||
|
||||
|
|
40
block/misc/BlockCellWorkbench.java
Normal file
40
block/misc/BlockCellWorkbench.java
Normal file
|
@ -0,0 +1,40 @@
|
|||
package appeng.block.misc;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.misc.TileCellWorkbench;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class BlockCellWorkbench extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockCellWorkbench() {
|
||||
super( BlockCellWorkbench.class, Material.iron );
|
||||
setfeature( EnumSet.of( AEFeature.StorageCells ) );
|
||||
setTileEntiy( TileCellWorkbench.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if ( p.isSneaking() )
|
||||
return false;
|
||||
|
||||
TileCellWorkbench tg = getTileEntity( w, x, y, z );
|
||||
if ( tg != null )
|
||||
{
|
||||
if ( Platform.isServer() )
|
||||
Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_CELLWORKBENCH );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -18,6 +18,7 @@ import net.minecraft.util.Vec3;
|
|||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.api.parts.PartItemStack;
|
||||
import appeng.api.parts.SelectedPart;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
|
@ -25,15 +26,19 @@ import appeng.client.render.blocks.RendererCableBus;
|
|||
import appeng.client.texture.CableBusTextures;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.integration.abstraction.IFMP;
|
||||
import appeng.parts.CableBusContainer;
|
||||
import appeng.parts.ICableBusContainer;
|
||||
import appeng.parts.NullCableBusContainer;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
|
||||
public class BlockCableBus extends AEBaseBlock
|
||||
{
|
||||
|
||||
static private ICableBusContainer nullCB = new NullCableBusContainer();
|
||||
|
||||
public BlockCableBus() {
|
||||
super( BlockCableBus.class, Material.glass );
|
||||
setfeature( EnumSet.of( AEFeature.Core ) );
|
||||
|
@ -44,14 +49,7 @@ public class BlockCableBus extends AEBaseBlock
|
|||
@Override
|
||||
public boolean isLadder(World world, int x, int y, int z, EntityLivingBase entity)
|
||||
{
|
||||
try
|
||||
{
|
||||
return cb( world, x, y, z ).isLadder( entity );
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
}
|
||||
return false;
|
||||
return cb( world, x, y, z ).isLadder( entity );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -70,18 +68,13 @@ public class BlockCableBus extends AEBaseBlock
|
|||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random r)
|
||||
{
|
||||
CableBusContainer cb = cb( world, x, y, z );
|
||||
if ( cb != null )
|
||||
cb.randomDisplayTick( world, x, y, z, r );
|
||||
cb( world, x, y, z ).randomDisplayTick( world, x, y, z, r );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
CableBusContainer cb = cb( world, x, y, z );
|
||||
if ( cb != null )
|
||||
return cb.getLightValue();
|
||||
return 0;
|
||||
return cb( world, x, y, z ).getLightValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -89,13 +82,12 @@ public class BlockCableBus extends AEBaseBlock
|
|||
{
|
||||
Vec3 v3 = target.hitVec.addVector( -x, -y, -z );
|
||||
SelectedPart sp = cb( world, x, y, z ).selectPart( v3 );
|
||||
if ( sp != null )
|
||||
{
|
||||
if ( sp.part != null )
|
||||
return sp.part.getItemStack( false );
|
||||
if ( sp.facade != null )
|
||||
return sp.facade.getItemStack();
|
||||
}
|
||||
|
||||
if ( sp.part != null )
|
||||
return sp.part.getItemStack( PartItemStack.Break );
|
||||
else if ( sp.facade != null )
|
||||
return sp.facade.getItemStack();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -130,21 +122,10 @@ public class BlockCableBus extends AEBaseBlock
|
|||
Icon i = super.getIcon( direction, metadata );
|
||||
if ( i != null )
|
||||
return i;
|
||||
|
||||
return CableBusTextures.getMissing();
|
||||
}
|
||||
|
||||
private CableBusContainer cb(IBlockAccess w, int x, int y, int z)
|
||||
{
|
||||
TileEntity te = w.getBlockTileEntity( x, y, z );
|
||||
if ( te instanceof TileCableBus )
|
||||
return ((TileCableBus) te).cb;
|
||||
|
||||
if ( AppEng.instance.isIntegrationEnabled( "FMP" ) )
|
||||
return ((IFMP) AppEng.instance.getIntegration( "FMP" )).getCableContainer( te );
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BaseBlockRender> getRenderer()
|
||||
{
|
||||
|
@ -234,6 +215,19 @@ public class BlockCableBus extends AEBaseBlock
|
|||
public void setupTile()
|
||||
{
|
||||
setTileEntiy( Api.instance.partHelper.getCombinedInstance( TileCableBus.class.getName() ) );
|
||||
CommonHelper.proxy.bindTileEntitySpecialRenderer( getTileEntityClass(), this );
|
||||
}
|
||||
|
||||
private ICableBusContainer cb(IBlockAccess w, int x, int y, int z)
|
||||
{
|
||||
TileEntity te = w.getBlockTileEntity( x, y, z );
|
||||
if ( te instanceof TileCableBus )
|
||||
return ((TileCableBus) te).cb;
|
||||
|
||||
if ( AppEng.instance.isIntegrationEnabled( "FMP" ) )
|
||||
return ((IFMP) AppEng.instance.getIntegration( "FMP" )).getCableContainer( te );
|
||||
|
||||
return nullCB;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,13 +1,23 @@
|
|||
package appeng.block.qnb;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderQNB;
|
||||
import appeng.client.render.effects.EnergyFx;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.qnb.TileQuantumBridge;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class BlockQuantumLinkChamber extends AEBaseBlock
|
||||
{
|
||||
|
@ -22,10 +32,57 @@ public class BlockQuantumLinkChamber extends AEBaseBlock
|
|||
isFullSize = isOpaque = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World w, int bx, int by, int bz, Random r)
|
||||
{
|
||||
TileQuantumBridge bridge = getTileEntity( w, bx, by, bz );
|
||||
if ( bridge != null )
|
||||
{
|
||||
if ( bridge.hasQES() )
|
||||
{
|
||||
float x = (float) (((Platform.getRandomInt() % 100) * 0.01) - 0.5) * 0.7f;
|
||||
float y = (float) (((Platform.getRandomInt() % 100) * 0.01) - 0.5) * 0.7f;
|
||||
float z = (float) (((Platform.getRandomInt() % 100) * 0.01) - 0.5) * 0.7f;
|
||||
|
||||
EnergyFx fx = new EnergyFx( w, bx + x + 0.5, by + y + 0.5, bz + z + 0.5, Item.diamond );
|
||||
|
||||
fx.motionX = -x * 0.1;
|
||||
fx.motionY = -y * 0.1;
|
||||
fx.motionZ = -z * 0.1;
|
||||
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect( (EntityFX) fx );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World w, int x, int y, int z, int pointlessnumber)
|
||||
{
|
||||
TileQuantumBridge bridge = getTileEntity( w, x, y, z );
|
||||
if ( bridge != null )
|
||||
bridge.neighborUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BaseBlockRender> getRenderer()
|
||||
{
|
||||
return RenderQNB.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if ( p.isSneaking() )
|
||||
return false;
|
||||
|
||||
TileQuantumBridge tg = getTileEntity( w, x, y, z );
|
||||
if ( tg != null )
|
||||
{
|
||||
if ( Platform.isServer() )
|
||||
Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_QNB );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package appeng.block.qnb;
|
|||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.World;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderQNB;
|
||||
|
@ -22,6 +23,14 @@ public class BlockQuantumRing extends AEBaseBlock
|
|||
isFullSize = isOpaque = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World w, int x, int y, int z, int pointlessnumber)
|
||||
{
|
||||
TileQuantumBridge bridge = getTileEntity( w, x, y, z );
|
||||
if ( bridge != null )
|
||||
bridge.neighborUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BaseBlockRender> getRenderer()
|
||||
{
|
||||
|
|
27
block/solids/BlockFluix.java
Normal file
27
block/solids/BlockFluix.java
Normal file
|
@ -0,0 +1,27 @@
|
|||
package appeng.block.solids;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.LocationRotation;
|
||||
|
||||
public class BlockFluix extends AEBaseBlock implements IOrientableBlock
|
||||
{
|
||||
|
||||
public BlockFluix() {
|
||||
super( BlockFluix.class, Material.rock );
|
||||
setfeature( EnumSet.of( AEFeature.DecorativeQuartzBlocks ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOrientable getOrientable(final IBlockAccess w, final int x, final int y, final int z)
|
||||
{
|
||||
return new LocationRotation( w, x, y, z );
|
||||
}
|
||||
|
||||
}
|
|
@ -11,7 +11,6 @@ import appeng.client.render.BaseBlockRender;
|
|||
import appeng.client.render.blocks.RenderDrive;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.misc.TileInterface;
|
||||
import appeng.tile.storage.TileDrive;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
@ -36,7 +35,7 @@ public class BlockDrive extends AEBaseBlock
|
|||
if ( p.isSneaking() )
|
||||
return false;
|
||||
|
||||
TileInterface tg = getTileEntity( w, x, y, z );
|
||||
TileDrive tg = getTileEntity( w, x, y, z );
|
||||
if ( tg != null )
|
||||
{
|
||||
if ( Platform.isServer() )
|
||||
|
|
|
@ -3,9 +3,14 @@ package appeng.block.storage;
|
|||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.storage.TileIOPort;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class BlockIOPort extends AEBaseBlock
|
||||
{
|
||||
|
@ -16,4 +21,27 @@ public class BlockIOPort extends AEBaseBlock
|
|||
setTileEntiy( TileIOPort.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onNeighborBlockChange(World w, int x, int y, int z, int junk)
|
||||
{
|
||||
TileIOPort te = getTileEntity( w, x, y, z );
|
||||
if ( te != null )
|
||||
te.updateRedstoneState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if ( p.isSneaking() )
|
||||
return false;
|
||||
|
||||
TileIOPort tg = getTileEntity( w, x, y, z );
|
||||
if ( tg != null )
|
||||
{
|
||||
if ( Platform.isServer() )
|
||||
Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_IOPORT );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ public class ClientHelper extends ServerHelper
|
|||
public void bindTileEntitySpecialRenderer(Class tile, AEBaseBlock blk)
|
||||
{
|
||||
BaseBlockRender bbr = blk.getRendererInstance().rendererInstance;
|
||||
if ( bbr.hasTESR )
|
||||
if ( bbr.hasTESR && tile != null )
|
||||
ClientRegistry.bindTileEntitySpecialRenderer( tile, new TESRWrapper( bbr ) );
|
||||
}
|
||||
|
||||
|
|
167
client/gui/implementations/GuiCellWorkbench.java
Normal file
167
client/gui/implementations/GuiCellWorkbench.java
Normal file
|
@ -0,0 +1,167 @@
|
|||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import appeng.api.config.ActionItems;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.implementations.IUpgradeModule;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.container.implementations.ContainerCellWorkbench;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.tile.misc.TileCellWorkbench;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
|
||||
public class GuiCellWorkbench extends GuiUpgradeable
|
||||
{
|
||||
|
||||
ContainerCellWorkbench ccwb;
|
||||
TileCellWorkbench tcw;
|
||||
|
||||
GuiImgButton clear;
|
||||
GuiImgButton partition;
|
||||
|
||||
public GuiCellWorkbench(InventoryPlayer inventoryPlayer, TileCellWorkbench te) {
|
||||
super( new ContainerCellWorkbench( inventoryPlayer, te ) );
|
||||
ccwb = (ContainerCellWorkbench) inventorySlots;
|
||||
ySize = 251;
|
||||
tcw = te;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean drawUpgrades()
|
||||
{
|
||||
return ccwb.availableUpgrades() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
handleButtonVisiblity();
|
||||
|
||||
bindTexture( getBackground() );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, 211 - 34, ySize );
|
||||
if ( drawUpgrades() )
|
||||
{
|
||||
if ( ccwb.availableUpgrades() <= 8 )
|
||||
{
|
||||
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 7 + ccwb.availableUpgrades() * 18 );
|
||||
this.drawTexturedModalRect( offsetX + 177, offsetY + (7 + (ccwb.availableUpgrades()) * 18), 177, 151, 35, 7 );
|
||||
}
|
||||
else if ( ccwb.availableUpgrades() <= 16 )
|
||||
{
|
||||
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 7 + 8 * 18 );
|
||||
this.drawTexturedModalRect( offsetX + 177, offsetY + (7 + (8) * 18), 177, 151, 35, 7 );
|
||||
|
||||
int dx = ccwb.availableUpgrades() - 8;
|
||||
this.drawTexturedModalRect( offsetX + 177 + 27, offsetY, 186, 0, 35 - 8, 7 + dx * 18 );
|
||||
if ( dx == 8 )
|
||||
this.drawTexturedModalRect( offsetX + 177 + 27, offsetY + (7 + (dx) * 18), 186, 151, 35 - 8, 7 );
|
||||
else
|
||||
this.drawTexturedModalRect( offsetX + 177 + 27 + 4, offsetY + (7 + (dx) * 18), 186 + 4, 151, 35 - 8, 7 );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 7 + 8 * 18 );
|
||||
this.drawTexturedModalRect( offsetX + 177, offsetY + (7 + (8) * 18), 177, 151, 35, 7 );
|
||||
|
||||
this.drawTexturedModalRect( offsetX + 177 + 27, offsetY, 186, 0, 35 - 8, 7 + 8 * 18 );
|
||||
this.drawTexturedModalRect( offsetX + 177 + 27, offsetY + (7 + (8) * 18), 186, 151, 35 - 8, 7 );
|
||||
|
||||
int dx = ccwb.availableUpgrades() - 16;
|
||||
this.drawTexturedModalRect( offsetX + 177 + 27 + 18, offsetY, 186, 0, 35 - 8, 7 + dx * 18 );
|
||||
if ( dx == 8 )
|
||||
this.drawTexturedModalRect( offsetX + 177 + 27 + 18, offsetY + (7 + (dx) * 18), 186, 151, 35 - 8, 7 );
|
||||
else
|
||||
this.drawTexturedModalRect( offsetX + 177 + 27 + 18 + 4, offsetY + (7 + (dx) * 18), 186 + 4, 151, 35 - 8, 7 );
|
||||
}
|
||||
}
|
||||
if ( hasToolbox() )
|
||||
this.drawTexturedModalRect( offsetX + 178, offsetY + ySize - 90, 178, 161, 68, 68 );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( btn == partition )
|
||||
{
|
||||
PacketDispatcher.sendPacketToServer( (new PacketValueConfig( "CellWorkbench.Action", "Partition" )).getPacket() );
|
||||
}
|
||||
else if ( btn == clear )
|
||||
{
|
||||
PacketDispatcher.sendPacketToServer( (new PacketValueConfig( "CellWorkbench.Action", "Clear" )).getPacket() );
|
||||
}
|
||||
else if ( btn == fuzzyMode )
|
||||
{
|
||||
boolean backwards = Mouse.isButtonDown( 1 );
|
||||
|
||||
FuzzyMode fz = (FuzzyMode) fuzzyMode.getCurrentValue();
|
||||
fz = Platform.rotateEnum( fz, backwards, Settings.FUZZY_MODE.getPossibleValues() );
|
||||
|
||||
PacketDispatcher.sendPacketToServer( (new PacketValueConfig( "CellWorkbench.Fuzzy", fz.name() )).getPacket() );
|
||||
}
|
||||
else
|
||||
super.actionPerformed( btn );
|
||||
}
|
||||
catch (IOException err)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addButtons()
|
||||
{
|
||||
clear = new GuiImgButton( this.guiLeft - 18, guiTop + 8, Settings.ACTIONS, ActionItems.CLOSE );
|
||||
partition = new GuiImgButton( this.guiLeft - 18, guiTop + 28, Settings.ACTIONS, ActionItems.WRENCH );
|
||||
fuzzyMode = new GuiImgButton( this.guiLeft - 18, guiTop + 48, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
|
||||
|
||||
buttonList.add( fuzzyMode );
|
||||
buttonList.add( partition );
|
||||
buttonList.add( clear );
|
||||
}
|
||||
|
||||
protected void handleButtonVisiblity()
|
||||
{
|
||||
boolean hasFuzzy = false;
|
||||
IInventory inv = ccwb.getCellUpgradeInventory();
|
||||
for (int x = 0; x < inv.getSizeInventory(); x++)
|
||||
{
|
||||
ItemStack is = inv.getStackInSlot( x );
|
||||
if ( is != null && is.getItem() instanceof IUpgradeModule )
|
||||
{
|
||||
if ( ((IUpgradeModule) is.getItem()).getType( is ) == Upgrades.FUZZY )
|
||||
hasFuzzy = true;
|
||||
}
|
||||
}
|
||||
fuzzyMode.setVisibility( hasFuzzy );
|
||||
}
|
||||
|
||||
protected String getBackground()
|
||||
{
|
||||
return "guis/cellworkbench.png";
|
||||
}
|
||||
|
||||
protected GuiText getName()
|
||||
{
|
||||
return GuiText.CellWorkbench;
|
||||
}
|
||||
}
|
95
client/gui/implementations/GuiIOPort.java
Normal file
95
client/gui/implementations/GuiIOPort.java
Normal file
|
@ -0,0 +1,95 @@
|
|||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.FullnessMode;
|
||||
import appeng.api.config.OperationMode;
|
||||
import appeng.api.config.RedstoneMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.container.implementations.ContainerIOPort;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.packets.PacketConfigButton;
|
||||
import appeng.tile.storage.TileIOPort;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
|
||||
public class GuiIOPort extends GuiUpgradeable
|
||||
{
|
||||
|
||||
GuiImgButton fullMode;
|
||||
GuiImgButton operationMode;
|
||||
|
||||
public GuiIOPort(InventoryPlayer inventoryPlayer, TileIOPort te) {
|
||||
super( new ContainerIOPort( inventoryPlayer, te ) );
|
||||
this.ySize = 166;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
super.drawBG( offsetX, offsetY, mouseX, mouseY );
|
||||
this.drawItem( offsetX + 66 - 8, offsetY + 17, AEApi.instance().items().itemCell1k.stack( 1 ) );
|
||||
this.drawItem( offsetX + 94 + 8, offsetY + 17, AEApi.instance().blocks().blockDrive.stack( 1 ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRenderer.drawString( GuiText.IOPort.getLocal(), 8, 6, 4210752 );
|
||||
fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
|
||||
if ( redstoneMode != null )
|
||||
redstoneMode.set( cvb.rsMode );
|
||||
|
||||
if ( operationMode != null )
|
||||
operationMode.set( ((ContainerIOPort) cvb).opMode );
|
||||
|
||||
if ( fullMode != null )
|
||||
fullMode.set( ((ContainerIOPort) cvb).fMode );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addButtons()
|
||||
{
|
||||
redstoneMode = new GuiImgButton( this.guiLeft - 18, guiTop + 28, Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
|
||||
fullMode = new GuiImgButton( this.guiLeft - 18, guiTop + 8, Settings.FULLNESS_MODE, FullnessMode.EMPTY );
|
||||
operationMode = new GuiImgButton( this.guiLeft + 80, guiTop + 17, Settings.OPERATION_MODE, OperationMode.EMPTY );
|
||||
|
||||
buttonList.add( operationMode );
|
||||
buttonList.add( redstoneMode );
|
||||
buttonList.add( fullMode );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
boolean backwards = Mouse.isButtonDown( 1 );
|
||||
|
||||
try
|
||||
{
|
||||
if ( btn == fullMode )
|
||||
PacketDispatcher.sendPacketToServer( (new PacketConfigButton( fullMode.getSetting(), backwards )).getPacket() );
|
||||
|
||||
if ( btn == operationMode )
|
||||
PacketDispatcher.sendPacketToServer( (new PacketConfigButton( operationMode.getSetting(), backwards )).getPacket() );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected String getBackground()
|
||||
{
|
||||
return "guis/ioport.png";
|
||||
}
|
||||
|
||||
}
|
|
@ -15,7 +15,7 @@ import appeng.core.sync.packets.PacketValueConfig;
|
|||
import appeng.parts.automation.PartLevelEmitter;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
|
||||
public class GuiLevelEmitter extends GuiBus
|
||||
public class GuiLevelEmitter extends GuiUpgradeable
|
||||
{
|
||||
|
||||
GuiTextField level;
|
||||
|
@ -28,7 +28,7 @@ public class GuiLevelEmitter extends GuiBus
|
|||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
level = new GuiTextField( this.fontRenderer, this.guiLeft + 10, this.guiTop + 43, 59, this.fontRenderer.FONT_HEIGHT );
|
||||
level = new GuiTextField( this.fontRenderer, this.guiLeft + 44, this.guiTop + 43, 59, this.fontRenderer.FONT_HEIGHT );
|
||||
level.setEnableBackgroundDrawing( false );
|
||||
level.setMaxStringLength( 16 );
|
||||
level.setTextColor( 0xFFFFFF );
|
||||
|
@ -40,8 +40,8 @@ public class GuiLevelEmitter extends GuiBus
|
|||
@Override
|
||||
protected void addButtons()
|
||||
{
|
||||
redstoneMode = new GuiImgButton( 122 + guiLeft, 31 + guiTop, Settings.REDSTONE_EMITTER, RedstoneMode.IGNORE );
|
||||
fuzzyMode = new GuiImgButton( 122 + guiLeft, 49 + guiTop, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
|
||||
redstoneMode = new GuiImgButton( this.guiLeft - 18, guiTop + 8, Settings.REDSTONE_EMITTER, RedstoneMode.IGNORE );
|
||||
fuzzyMode = new GuiImgButton( this.guiLeft - 18, guiTop + 28, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
|
||||
|
||||
buttonList.add( redstoneMode );
|
||||
buttonList.add( fuzzyMode );
|
||||
|
|
|
@ -18,6 +18,7 @@ import appeng.container.implementations.ContainerMEMonitorable;
|
|||
import appeng.container.slot.AppEngSlot;
|
||||
import appeng.core.Configuration;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.helpers.ICellItemViewer;
|
||||
import appeng.parts.reporting.PartTerminal;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
@ -29,6 +30,7 @@ public class GuiMEMonitorable extends AEBaseMEGui
|
|||
|
||||
GuiText myName;
|
||||
int rows = 0;
|
||||
int maxRows = Integer.MAX_VALUE;
|
||||
|
||||
public GuiMEMonitorable(InventoryPlayer inventoryPlayer, IStorageMonitorable te) {
|
||||
super( new ContainerMEMonitorable( inventoryPlayer, null ) );
|
||||
|
@ -37,6 +39,8 @@ public class GuiMEMonitorable extends AEBaseMEGui
|
|||
xSize = 195;
|
||||
ySize = 204;
|
||||
|
||||
if ( te instanceof ICellItemViewer )
|
||||
myName = GuiText.PortableCell;
|
||||
if ( te instanceof IMEChest )
|
||||
myName = GuiText.Chest;
|
||||
else if ( te instanceof PartTerminal )
|
||||
|
@ -65,7 +69,14 @@ public class GuiMEMonitorable extends AEBaseMEGui
|
|||
int NEI = 0;
|
||||
int top = 4;
|
||||
int extraSpace = height - 114 - NEI - top;
|
||||
int moveDown = 0;
|
||||
|
||||
rows = (int) Math.floor( extraSpace / 18 );
|
||||
if ( rows > maxRows )
|
||||
{
|
||||
top += (rows - maxRows) * 18 / 2;
|
||||
rows = maxRows;
|
||||
}
|
||||
|
||||
meSlots.clear();
|
||||
for (int y = 0; y < rows; y++)
|
||||
|
@ -101,7 +112,7 @@ public class GuiMEMonitorable extends AEBaseMEGui
|
|||
{
|
||||
if ( s instanceof AppEngSlot )
|
||||
{
|
||||
((AppEngSlot) s).yDisplayPosition = ((AppEngSlot) s).defY + ySize - 78 - guiTop;
|
||||
((AppEngSlot) s).yDisplayPosition = ((AppEngSlot) s).defY + ySize - 78 - 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
14
client/gui/implementations/GuiMEPortableCell.java
Normal file
14
client/gui/implementations/GuiMEPortableCell.java
Normal file
|
@ -0,0 +1,14 @@
|
|||
package appeng.client.gui.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.helpers.ICellItemViewer;
|
||||
|
||||
public class GuiMEPortableCell extends GuiMEMonitorable
|
||||
{
|
||||
|
||||
public GuiMEPortableCell(InventoryPlayer inventoryPlayer, ICellItemViewer te) {
|
||||
super( inventoryPlayer, te );
|
||||
maxRows = 3;
|
||||
}
|
||||
|
||||
}
|
|
@ -24,7 +24,7 @@ public class GuiNetworkStatus extends AEBaseGui
|
|||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRenderer.drawString( GuiText.NetworkStatus.getLocal(), 8, 6, 4210752 );
|
||||
fontRenderer.drawString( GuiText.NetworkDetails.getLocal(), 8, 6, 4210752 );
|
||||
fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
}
|
||||
|
||||
|
|
31
client/gui/implementations/GuiQNB.java
Normal file
31
client/gui/implementations/GuiQNB.java
Normal file
|
@ -0,0 +1,31 @@
|
|||
package appeng.client.gui.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.container.implementations.ContainerQNB;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.tile.qnb.TileQuantumBridge;
|
||||
|
||||
public class GuiQNB extends AEBaseGui
|
||||
{
|
||||
|
||||
public GuiQNB(InventoryPlayer inventoryPlayer, TileQuantumBridge te) {
|
||||
super( new ContainerQNB( inventoryPlayer, te ) );
|
||||
this.ySize = 166;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
bindTexture( "guis/chest.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRenderer.drawString( GuiText.QuantumLinkChamber.getLocal(), 8, 6, 4210752 );
|
||||
fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
}
|
||||
|
||||
}
|
|
@ -14,28 +14,28 @@ import appeng.api.config.Upgrades;
|
|||
import appeng.api.implementations.IBusCommon;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.container.implementations.ContainerBus;
|
||||
import appeng.container.implementations.ContainerUpgradeable;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.packets.PacketConfigButton;
|
||||
import appeng.parts.automation.PartImportBus;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
|
||||
public class GuiBus extends AEBaseGui
|
||||
public class GuiUpgradeable extends AEBaseGui
|
||||
{
|
||||
|
||||
ContainerBus cvb;
|
||||
ContainerUpgradeable cvb;
|
||||
IBusCommon bc;
|
||||
|
||||
GuiImgButton redstoneMode;
|
||||
GuiImgButton fuzzyMode;
|
||||
|
||||
public GuiBus(InventoryPlayer inventoryPlayer, IBusCommon te) {
|
||||
this( new ContainerBus( inventoryPlayer, te ) );
|
||||
public GuiUpgradeable(InventoryPlayer inventoryPlayer, IBusCommon te) {
|
||||
this( new ContainerUpgradeable( inventoryPlayer, te ) );
|
||||
}
|
||||
|
||||
public GuiBus(ContainerBus te) {
|
||||
public GuiUpgradeable(ContainerUpgradeable te) {
|
||||
super( te );
|
||||
cvb = (ContainerBus) te;
|
||||
cvb = (ContainerUpgradeable) te;
|
||||
|
||||
bc = (IBusCommon) te.getTarget();
|
||||
this.xSize = hasToolbox() ? 246 : 211;
|
||||
|
@ -58,12 +58,21 @@ public class GuiBus extends AEBaseGui
|
|||
buttonList.add( fuzzyMode );
|
||||
}
|
||||
|
||||
protected void mouseClicked(int par1, int par2, int par3)
|
||||
protected void mouseClicked(int xCoord, int yCoord, int btn)
|
||||
{
|
||||
if ( par3 == 1 )
|
||||
super.mouseClicked( par1, par2, 0 );
|
||||
else
|
||||
super.mouseClicked( par1, par2, par3 );
|
||||
if ( btn == 1 )
|
||||
{
|
||||
for (Object o : this.buttonList)
|
||||
{
|
||||
GuiButton guibutton = (GuiButton) o;
|
||||
if ( guibutton.mousePressed( this.mc, xCoord, yCoord ) )
|
||||
{
|
||||
super.mouseClicked( xCoord, yCoord, 0 );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
super.mouseClicked( xCoord, yCoord, btn );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -88,9 +97,9 @@ public class GuiBus extends AEBaseGui
|
|||
}
|
||||
}
|
||||
|
||||
private boolean hasToolbox()
|
||||
protected boolean hasToolbox()
|
||||
{
|
||||
return ((ContainerBus) inventorySlots).hasToolbox();
|
||||
return ((ContainerUpgradeable) inventorySlots).hasToolbox();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -99,10 +108,16 @@ public class GuiBus extends AEBaseGui
|
|||
handleButtonVisiblity();
|
||||
|
||||
bindTexture( getBackground() );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize - 34, ySize );
|
||||
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 86 );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, 211 - 34, ySize );
|
||||
if ( drawUpgrades() )
|
||||
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 10 + cvb.availableUpgrades() * 18 );
|
||||
if ( hasToolbox() )
|
||||
this.drawTexturedModalRect( offsetX + 178, offsetY + 94, 178, 94, 68, 68 );
|
||||
this.drawTexturedModalRect( offsetX + 178, offsetY + ySize - 90, 178, ySize - 90, 68, 68 );
|
||||
}
|
||||
|
||||
protected boolean drawUpgrades()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getBackground()
|
||||
|
@ -112,8 +127,10 @@ public class GuiBus extends AEBaseGui
|
|||
|
||||
protected void handleButtonVisiblity()
|
||||
{
|
||||
redstoneMode.setVisibility( bc.getInstalledUpgrades( Upgrades.REDSTONE ) > 0 );
|
||||
fuzzyMode.setVisibility( bc.getInstalledUpgrades( Upgrades.FUZZY ) > 0 );
|
||||
if ( redstoneMode != null )
|
||||
redstoneMode.setVisibility( bc.getInstalledUpgrades( Upgrades.REDSTONE ) > 0 );
|
||||
if ( fuzzyMode != null )
|
||||
fuzzyMode.setVisibility( bc.getInstalledUpgrades( Upgrades.FUZZY ) > 0 );
|
||||
}
|
||||
|
||||
@Override
|
|
@ -28,6 +28,8 @@ public class GuiProgressBar extends GuiButton implements ITooltip
|
|||
|
||||
public GuiProgressBar(String string, int posX, int posY, int u, int y, int _width, int _height, Direction dir) {
|
||||
super( posX, posY, _width, "" );
|
||||
this.xPosition = posX;
|
||||
this.yPosition = posY;
|
||||
texture = new ResourceLocation( "appliedenergistics2", "textures/" + string );
|
||||
width = _width;
|
||||
height = _height;
|
||||
|
|
|
@ -9,9 +9,9 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.parts.IPartItem;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IFacadePart;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartItem;
|
||||
import appeng.client.ClientHelper;
|
||||
import appeng.facade.IFacadeItem;
|
||||
import appeng.util.Platform;
|
||||
|
@ -69,6 +69,10 @@ public class BusRenderer implements IItemRenderer
|
|||
BusRenderHelper.instance.setInvColor( 0xffffff );
|
||||
renderer.blockAccess = ClientHelper.proxy.getWorld();
|
||||
|
||||
BusRenderHelper.instance.ax = ForgeDirection.EAST;
|
||||
BusRenderHelper.instance.ay = ForgeDirection.UP;
|
||||
BusRenderHelper.instance.az = ForgeDirection.SOUTH;
|
||||
|
||||
if ( item.getItem() instanceof IFacadeItem )
|
||||
{
|
||||
IFacadeItem fi = (IFacadeItem) item.getItem();
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
package appeng.client.render.blocks;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
|
||||
public class RenderCable extends BaseBlockRender
|
||||
{
|
||||
|
||||
public void renderCableAt(double Thickness, IBlockAccess world, int x, int y, int z, AEBaseBlock block, RenderBlocks renderer, Icon texture, double pull,
|
||||
EnumSet<ForgeDirection> connections)
|
||||
{
|
||||
|
||||
if ( connections.contains( ForgeDirection.UNKNOWN ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - Thickness, 0.5D - Thickness, 0.5D - Thickness, 0.5D + Thickness, 0.5D + Thickness, 0.5D + Thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if ( connections.contains( ForgeDirection.WEST ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.0D, 0.5D - Thickness, 0.5D - Thickness, 0.5D - Thickness - pull, 0.5D + Thickness, 0.5D + Thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if ( connections.contains( ForgeDirection.EAST ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D + Thickness + pull, 0.5D - Thickness, 0.5D - Thickness, 1.0D, 0.5D + Thickness, 0.5D + Thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if ( connections.contains( ForgeDirection.NORTH ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - Thickness, 0.5D - Thickness, 0.0D, 0.5D + Thickness, 0.5D + Thickness, 0.5D - Thickness - pull );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if ( connections.contains( ForgeDirection.SOUTH ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - Thickness, 0.5D - Thickness, 0.5D + Thickness + pull, 0.5D + Thickness, 0.5D + Thickness, 1.0D );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if ( connections.contains( ForgeDirection.DOWN ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - Thickness, 0.0D, 0.5D - Thickness, 0.5D + Thickness, 0.5D - Thickness - pull, 0.5D + Thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if ( connections.contains( ForgeDirection.UP ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - Thickness, 0.5D + Thickness + pull, 0.5D - Thickness, 0.5D + Thickness, 1.0D, 0.5D + Thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -4,17 +4,71 @@ import java.util.EnumSet;
|
|||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.util.AEItemDefinition;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraTextures;
|
||||
import appeng.tile.qnb.TileQuantumBridge;
|
||||
|
||||
public class RenderQNB extends RenderCable
|
||||
public class RenderQNB extends BaseBlockRender
|
||||
{
|
||||
|
||||
public void renderCableAt(double Thickness, IBlockAccess world, int x, int y, int z, AEBaseBlock block, RenderBlocks renderer, Icon texture, double pull,
|
||||
EnumSet<ForgeDirection> connections)
|
||||
{
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture );
|
||||
|
||||
if ( connections.contains( ForgeDirection.UNKNOWN ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - Thickness, 0.5D - Thickness, 0.5D - Thickness, 0.5D + Thickness, 0.5D + Thickness, 0.5D + Thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if ( connections.contains( ForgeDirection.WEST ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.0D, 0.5D - Thickness, 0.5D - Thickness, 0.5D - Thickness - pull, 0.5D + Thickness, 0.5D + Thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if ( connections.contains( ForgeDirection.EAST ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D + Thickness + pull, 0.5D - Thickness, 0.5D - Thickness, 1.0D, 0.5D + Thickness, 0.5D + Thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if ( connections.contains( ForgeDirection.NORTH ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - Thickness, 0.5D - Thickness, 0.0D, 0.5D + Thickness, 0.5D + Thickness, 0.5D - Thickness - pull );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if ( connections.contains( ForgeDirection.SOUTH ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - Thickness, 0.5D - Thickness, 0.5D + Thickness + pull, 0.5D + Thickness, 0.5D + Thickness, 1.0D );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if ( connections.contains( ForgeDirection.DOWN ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - Thickness, 0.0D, 0.5D - Thickness, 0.5D + Thickness, 0.5D - Thickness - pull, 0.5D + Thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if ( connections.contains( ForgeDirection.UP ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - Thickness, 0.5D + Thickness + pull, 0.5D - Thickness, 0.5D + Thickness, 1.0D, 0.5D + Thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock block, ItemStack item, RenderBlocks renderer)
|
||||
{
|
||||
|
@ -38,10 +92,15 @@ public class RenderQNB extends RenderCable
|
|||
{
|
||||
if ( tqb.isFormed() )
|
||||
{
|
||||
EnumSet<ForgeDirection> sides = EnumSet.allOf( ForgeDirection.class );
|
||||
renderCableAt( 0.11D, world, x, y, z, block, renderer, block.getIcon( 0, 0 ), 0.141D, sides );
|
||||
renderCableAt( 0.188D, world, x, y, z, block, renderer, block.getIcon( 0, 0 ), 0.1875D,
|
||||
EnumSet.complementOf( EnumSet.of( ForgeDirection.UNKNOWN ) ) );
|
||||
AEItemDefinition cabldef = AEApi.instance().parts().partCableGlass;
|
||||
Item cable = cabldef.item();
|
||||
|
||||
AEItemDefinition ccabldef = AEApi.instance().parts().partCableCovered;
|
||||
Item ccable = ccabldef.item();
|
||||
|
||||
EnumSet<ForgeDirection> sides = tqb.getConnections();
|
||||
renderCableAt( 0.11D, world, x, y, z, block, renderer, cable.getIconIndex( cabldef.stack( 1 ) ), 0.141D, sides );
|
||||
renderCableAt( 0.188D, world, x, y, z, block, renderer, ccable.getIconIndex( ccabldef.stack( 1 ) ), 0.1875D, tqb.getConnections() );
|
||||
}
|
||||
|
||||
float px = 2.0f / 16.0f;
|
||||
|
@ -63,8 +122,10 @@ public class RenderQNB extends RenderCable
|
|||
{
|
||||
// renderCableAt(0.11D, world, x, y, z, block, modelId, renderer,
|
||||
// AppEngTextureRegistry.Blocks.MECable.get(), true, 0.0D);
|
||||
renderCableAt( 0.188D, world, x, y, z, block, renderer, ExtraTextures.BlockInterfaceAlternate.getIcon(), 0.05D,
|
||||
EnumSet.complementOf( EnumSet.of( ForgeDirection.UNKNOWN ) ) );
|
||||
AEItemDefinition ccabldef = AEApi.instance().parts().partCableCovered;
|
||||
Item ccable = ccabldef.item();
|
||||
|
||||
renderCableAt( 0.188D, world, x, y, z, block, renderer, ccable.getIconIndex( ccabldef.stack( 1 ) ), 0.05D, tqb.getConnections() );
|
||||
|
||||
float px = 4.0f / 16.0f;
|
||||
float maxpx = 12.0f / 16.0f;
|
||||
|
@ -83,7 +144,7 @@ public class RenderQNB extends RenderCable
|
|||
Tessellator.instance.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
|
||||
Tessellator.instance.setBrightness( bn << 20 | bn << 4 );
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
renderFace( x, y, z, block, block.getIcon( 0, 0 ), renderer, side );
|
||||
renderFace( x, y, z, block, ExtraTextures.BlockQRingCornerLight.getIcon(), renderer, side );
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -110,7 +171,7 @@ public class RenderQNB extends RenderCable
|
|||
Tessellator.instance.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
|
||||
Tessellator.instance.setBrightness( bn << 20 | bn << 4 );
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
renderFace( x, y, z, block, block.getIcon( 0, 0 ), renderer, side );
|
||||
renderFace( x, y, z, block, ExtraTextures.BlockQRingEdgeLight.getIcon(), renderer, side );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -118,5 +179,4 @@ public class RenderQNB extends RenderCable
|
|||
renderer.renderAllFaces = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package appeng.client.render.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
@ -8,12 +10,23 @@ import appeng.api.AEApi;
|
|||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraTextures;
|
||||
import appeng.client.texture.OffsetIcon;
|
||||
|
||||
public class RenderQuartzGlass extends BaseBlockRender
|
||||
{
|
||||
|
||||
static byte offsets[][][];
|
||||
|
||||
public RenderQuartzGlass() {
|
||||
super( false, 0 );
|
||||
if ( offsets == null )
|
||||
{
|
||||
Random r = new Random( 924 );
|
||||
offsets = new byte[10][10][10];
|
||||
for (int x = 0; x < 10; x++)
|
||||
for (int y = 0; y < 10; y++)
|
||||
r.nextBytes( offsets[x][y] );
|
||||
}
|
||||
}
|
||||
|
||||
boolean isFlush(AEBaseBlock imb, IBlockAccess world, int x, int y, int z)
|
||||
|
@ -113,7 +126,29 @@ public class RenderQuartzGlass extends BaseBlockRender
|
|||
{
|
||||
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
||||
|
||||
renderer.overrideBlockTexture = imb.getIcon( 0, 0 );
|
||||
int cx = Math.abs( x % 10 );
|
||||
int cy = Math.abs( y % 10 );
|
||||
int cz = Math.abs( z % 10 );
|
||||
|
||||
int u = offsets[cx][cy][cz] % 4;
|
||||
int v = offsets[9 - cx][9 - cy][9 - cz] % 4;
|
||||
|
||||
switch (Math.abs( (offsets[cx][cy][cz] + (x + y + z)) % 4 ))
|
||||
{
|
||||
case 0:
|
||||
renderer.overrideBlockTexture = new OffsetIcon( imb.getIcon( 0, 0 ), u / 2, v / 2 );
|
||||
break;
|
||||
case 1:
|
||||
renderer.overrideBlockTexture = new OffsetIcon( ExtraTextures.BlockQuartzGlassB.getIcon(), u / 2, v / 2 );
|
||||
break;
|
||||
case 2:
|
||||
renderer.overrideBlockTexture = new OffsetIcon( ExtraTextures.BlockQuartzGlassC.getIcon(), u, v );
|
||||
break;
|
||||
case 3:
|
||||
renderer.overrideBlockTexture = new OffsetIcon( ExtraTextures.BlockQuartzGlassD.getIcon(), u, v );
|
||||
break;
|
||||
}
|
||||
|
||||
boolean result = renderer.renderStandardBlock( imb, x, y, z );
|
||||
|
||||
renderer.overrideBlockTexture = null;
|
||||
|
|
88
client/render/effects/EnergyFx.java
Normal file
88
client/render/effects/EnergyFx.java
Normal file
|
@ -0,0 +1,88 @@
|
|||
package appeng.client.render.effects;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EntityBreakingFX;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.client.texture.ExtraTextures;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class EnergyFx extends EntityBreakingFX
|
||||
{
|
||||
|
||||
private Icon particleTextureIndex;
|
||||
|
||||
public EnergyFx(World par1World, double par2, double par4, double par6, Item par8Item) {
|
||||
super( par1World, par2, par4, par6, par8Item );
|
||||
particleGravity = 0;
|
||||
this.particleBlue = 255;
|
||||
this.particleGreen = 255;
|
||||
this.particleRed = 255;
|
||||
this.particleAlpha = 1.4f;
|
||||
this.particleScale = 3.5f;
|
||||
this.particleTextureIndex = ExtraTextures.BlockEnergyParticle.getIcon();
|
||||
}
|
||||
|
||||
public void fromItem(ForgeDirection d)
|
||||
{
|
||||
this.posX += 0.2 * d.offsetX;
|
||||
this.posY += 0.2 * d.offsetY;
|
||||
this.posZ += 0.2 * d.offsetZ;
|
||||
this.particleScale *= 0.8f;
|
||||
}
|
||||
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
this.particleScale *= 0.89f;
|
||||
this.particleAlpha *= 0.89f;
|
||||
}
|
||||
|
||||
public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
|
||||
{
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture( TextureMap.locationBlocksTexture );
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
|
||||
GL11.glDepthMask( false );
|
||||
GL11.glEnable( GL11.GL_BLEND );
|
||||
GL11.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );
|
||||
GL11.glAlphaFunc( GL11.GL_GREATER, 0.003921569F );
|
||||
|
||||
float f6 = this.particleTextureIndex.getMinU();
|
||||
float f7 = this.particleTextureIndex.getMaxU();
|
||||
float f8 = this.particleTextureIndex.getMinV();
|
||||
float f9 = this.particleTextureIndex.getMaxV();
|
||||
float f10 = 0.1F * this.particleScale;
|
||||
|
||||
float f11 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) par2 - interpPosX);
|
||||
float f12 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) par2 - interpPosY);
|
||||
float f13 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) par2 - interpPosZ);
|
||||
float f14 = 1.0F;
|
||||
|
||||
par1Tessellator.setColorRGBA_F( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha );
|
||||
par1Tessellator.addVertexWithUV( (double) (f11 - par3 * f10 - par6 * f10), (double) (f12 - par4 * f10), (double) (f13 - par5 * f10 - par7 * f10),
|
||||
(double) f7, (double) f9 );
|
||||
par1Tessellator.addVertexWithUV( (double) (f11 - par3 * f10 + par6 * f10), (double) (f12 + par4 * f10), (double) (f13 - par5 * f10 + par7 * f10),
|
||||
(double) f7, (double) f8 );
|
||||
par1Tessellator.addVertexWithUV( (double) (f11 + par3 * f10 + par6 * f10), (double) (f12 + par4 * f10), (double) (f13 + par5 * f10 + par7 * f10),
|
||||
(double) f6, (double) f8 );
|
||||
par1Tessellator.addVertexWithUV( (double) (f11 + par3 * f10 - par6 * f10), (double) (f12 - par4 * f10), (double) (f13 + par5 * f10 - par7 * f10),
|
||||
(double) f6, (double) f9 );
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
|
@ -50,6 +50,11 @@ public enum CableBusTextures
|
|||
"MECable_Purple"), MECable_Red("MECable_Red"), MECable_White("MECable_White"), MECable_Yellow("MECable_Yellow"), MECable_Black("MECable_Black"), MECable_Blue(
|
||||
"MECable_Blue"), MECable_Brown("MECable_Brown"), MECable_Cyan("MECable_Cyan"),
|
||||
|
||||
MEDense_Black("MEDense_Black"), MEDense_Blue("MEDense_Blue"), MEDense_Brown("MEDense_Brown"), MEDense_Cyan("MEDense_Cyan"), MEDense_Gray("MEDense_Gray"), MEDense_Green(
|
||||
"MEDense_Green"), MEDense_LightBlue("MEDense_LightBlue"), MEDense_LightGrey("MEDense_LightGrey"), MEDense_Lime("MEDense_Lime"), MEDense_Magenta(
|
||||
"MEDense_Magenta"), MEDense_Orange("MEDense_Orange"), MEDense_Pink("MEDense_Pink"), MEDense_Purple("MEDense_Purple"), MEDense_Red("MEDense_Red"), MEDense_White(
|
||||
"MEDense_White"), MEDense_Yellow("MEDense_Yellow"),
|
||||
|
||||
MESmart_Black("MESmart_Black"), MESmart_Blue("MESmart_Blue"), MESmart_Brown("MESmart_Brown"), MESmart_Cyan("MESmart_Cyan"), MESmart_Gray("MESmart_Gray"), MESmart_Green(
|
||||
"MESmart_Green"), MESmart_LightBlue("MESmart_LightBlue"), MESmart_LightGrey("MESmart_LightGrey"), MESmart_Lime("MESmart_Lime"), MESmart_Magenta(
|
||||
"MESmart_Magenta"), MESmart_Orange("MESmart_Orange"), MESmart_Pink("MESmart_Pink"), MESmart_Purple("MESmart_Purple"), MESmart_Red("MESmart_Red"), MESmart_White(
|
||||
|
|
|
@ -32,6 +32,8 @@ public enum ExtraTextures
|
|||
|
||||
GlassFrame("BlockQuartzGlassFrame"),
|
||||
|
||||
BlockQRingCornerLight("BlockQRingCornerLight"), BlockQRingEdgeLight("BlockQRingEdgeLight"),
|
||||
|
||||
MEDenseEnergyCell0("BlockDenseEnergyCell0"), MEDenseEnergyCell1("BlockDenseEnergyCell1"), MEDenseEnergyCell2("BlockDenseEnergyCell2"), MEDenseEnergyCell3(
|
||||
"BlockDenseEnergyCell3"), MEDenseEnergyCell4("BlockDenseEnergyCell4"), MEDenseEnergyCell5("BlockDenseEnergyCell5"), MEDenseEnergyCell6(
|
||||
"BlockDenseEnergyCell6"), MEDenseEnergyCell7("BlockDenseEnergyCell7"),
|
||||
|
@ -44,6 +46,8 @@ public enum ExtraTextures
|
|||
BlockSpatialPylonC("BlockSpatialPylon_spanned"), BlockSpatialPylonC_dim("BlockSpatialPylon_spanned_dim"), BlockSpatialPylonC_red(
|
||||
"BlockSpatialPylon_spanned_red"),
|
||||
|
||||
BlockQuartzGlassB("BlockQuartzGlassB"), BlockQuartzGlassC("BlockQuartzGlassC"), BlockQuartzGlassD("BlockQuartzGlassD"),
|
||||
|
||||
BlockSpatialPylonE("BlockSpatialPylon_end"), BlockSpatialPylonE_dim("BlockSpatialPylon_end_dim"), BlockSpatialPylonE_red("BlockSpatialPylon_end_red");
|
||||
|
||||
final private String name;
|
||||
|
|
|
@ -66,6 +66,11 @@ public abstract class AEBaseContainer extends Container
|
|||
return ((AppEngSlot) s).isDraggable;
|
||||
}
|
||||
|
||||
public InventoryPlayer getPlayerInv()
|
||||
{
|
||||
return invPlayer;
|
||||
}
|
||||
|
||||
public TileEntity getTileEntity()
|
||||
{
|
||||
return tileEntity;
|
||||
|
|
290
container/implementations/ContainerCellWorkbench.java
Normal file
290
container/implementations/ContainerCellWorkbench.java
Normal file
|
@ -0,0 +1,290 @@
|
|||
package appeng.container.implementations;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.storage.ICellWorkbenchItem;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.slot.OptionalSlotRestrictedInput;
|
||||
import appeng.container.slot.SlotFakeTypeOnly;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.container.slot.SlotRestrictedInput.PlaceableItemType;
|
||||
import appeng.tile.inventory.AppEngNullInventory;
|
||||
import appeng.tile.misc.TileCellWorkbench;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.ItemList;
|
||||
import appeng.util.iterators.NullIterator;
|
||||
|
||||
public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
{
|
||||
|
||||
TileCellWorkbench workBench;
|
||||
AppEngNullInventory ni = new AppEngNullInventory();
|
||||
|
||||
public IInventory getCellUpgradeInventory()
|
||||
{
|
||||
IInventory ri = workBench.getCellUpgradeInventory();
|
||||
return ri == null ? ni : ri;
|
||||
}
|
||||
|
||||
public void setFuzzy(FuzzyMode valueOf)
|
||||
{
|
||||
ICellWorkbenchItem cwi = workBench.getCell();
|
||||
if ( cwi != null )
|
||||
cwi.setFuzzyMode( workBench.getInventoryByName( "cell" ).getStackInSlot( 0 ), valueOf );
|
||||
}
|
||||
|
||||
private FuzzyMode getFuzzyMode()
|
||||
{
|
||||
ICellWorkbenchItem cwi = workBench.getCell();
|
||||
if ( cwi != null )
|
||||
return cwi.getFuzzyMode( workBench.getInventoryByName( "cell" ).getStackInSlot( 0 ) );
|
||||
return FuzzyMode.IGNORE_ALL;
|
||||
}
|
||||
|
||||
class Upgrades implements IInventory
|
||||
{
|
||||
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
{
|
||||
return getCellUpgradeInventory().getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i)
|
||||
{
|
||||
return getCellUpgradeInventory().getStackInSlot( i );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j)
|
||||
{
|
||||
IInventory inv = getCellUpgradeInventory();
|
||||
ItemStack is = inv.decrStackSize( i, j );
|
||||
inv.onInventoryChanged();
|
||||
return is;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i)
|
||||
{
|
||||
IInventory inv = getCellUpgradeInventory();
|
||||
ItemStack is = inv.getStackInSlotOnClosing( i );
|
||||
inv.onInventoryChanged();
|
||||
return is;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack)
|
||||
{
|
||||
IInventory inv = getCellUpgradeInventory();
|
||||
inv.setInventorySlotContents( i, itemstack );
|
||||
inv.onInventoryChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInvName()
|
||||
{
|
||||
return "Upgrades";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvNameLocalized()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInventoryChanged()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openChest()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeChest()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack)
|
||||
{
|
||||
return getCellUpgradeInventory().isItemValidForSlot( i, itemstack );
|
||||
}
|
||||
};
|
||||
|
||||
IInventory UpgradeInventoryWrapper;
|
||||
|
||||
ItemStack prevStack = null;
|
||||
int lastUpgrades = 0;
|
||||
|
||||
public ContainerCellWorkbench(InventoryPlayer ip, TileCellWorkbench te) {
|
||||
super( ip, te );
|
||||
workBench = te;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getHeight()
|
||||
{
|
||||
return 251;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int availableUpgrades()
|
||||
{
|
||||
ItemStack is = workBench.getInventoryByName( "cell" ).getStackInSlot( 0 );
|
||||
if ( prevStack != is )
|
||||
{
|
||||
prevStack = is;
|
||||
return lastUpgrades = getCellUpgradeInventory().getSizeInventory();
|
||||
}
|
||||
return lastUpgrades;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlotEnabled(int idx)
|
||||
{
|
||||
return idx < availableUpgrades();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupConfig()
|
||||
{
|
||||
int x = 8;
|
||||
int y = 29;
|
||||
int offset = 0;
|
||||
|
||||
IInventory cell = myte.getInventoryByName( "cell" );
|
||||
addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.WORKBENCH_CELL, cell, 0, 152, 8 ) );
|
||||
|
||||
IInventory inv = myte.getInventoryByName( "config" );
|
||||
UpgradeInventoryWrapper = new Upgrades();// Platform.isServer() ? new Upgrades() : new AppEngInternalInventory(
|
||||
// null, 3 * 8 );
|
||||
|
||||
for (int w = 0; w < 7; w++)
|
||||
for (int z = 0; z < 9; z++)
|
||||
addSlotToContainer( new SlotFakeTypeOnly( inv, offset++, x + z * 18, y + w * 18 ) );
|
||||
|
||||
for (int zz = 0; zz < 3; zz++)
|
||||
for (int z = 0; z < 8; z++)
|
||||
{
|
||||
int iSLot = zz * 8 + z;
|
||||
addSlotToContainer( new OptionalSlotRestrictedInput( PlaceableItemType.UPGRADES, UpgradeInventoryWrapper, this, iSLot, 187 + zz * 18,
|
||||
8 + 18 * z, iSLot ) );
|
||||
}
|
||||
/*
|
||||
* if ( supportCapacity() ) { for (int w = 0; w < 2; w++) for (int z = 0; z < 9; z++) addSlotToContainer( new
|
||||
* OptionalSlotFakeTypeOnly( inv, this, offset++, x, y, z, w, 1 ) );
|
||||
*
|
||||
* for (int w = 0; w < 2; w++) for (int z = 0; z < 9; z++) addSlotToContainer( new OptionalSlotFakeTypeOnly(
|
||||
* inv, this, offset++, x, y, z, w + 2, 2 ) );
|
||||
*
|
||||
* for (int w = 0; w < 2; w++) for (int z = 0; z < 9; z++) addSlotToContainer( new OptionalSlotFakeTypeOnly(
|
||||
* inv, this, offset++, x, y, z, w + 4, 3 ) ); }
|
||||
*/
|
||||
}
|
||||
|
||||
ItemStack LastCell;
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
ItemStack is = workBench.getInventoryByName( "cell" ).getStackInSlot( 0 );
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
for (int i = 0; i < this.crafters.size(); ++i)
|
||||
{
|
||||
ICrafting icrafting = (ICrafting) this.crafters.get( i );
|
||||
|
||||
if ( this.fzMode != getFuzzyMode() )
|
||||
{
|
||||
icrafting.sendProgressBarUpdate( this, 1, (int) getFuzzyMode().ordinal() );
|
||||
}
|
||||
|
||||
if ( prevStack != is )
|
||||
{
|
||||
// if the bars changed an item was probably made, so just send shit!
|
||||
for (Object s : inventorySlots)
|
||||
{
|
||||
if ( s instanceof OptionalSlotRestrictedInput )
|
||||
{
|
||||
OptionalSlotRestrictedInput sri = (OptionalSlotRestrictedInput) s;
|
||||
icrafting.sendSlotContents( this, sri.slotNumber, sri.getStack() );
|
||||
}
|
||||
}
|
||||
((EntityPlayerMP) icrafting).playerInventoryBeingManipulated = false;
|
||||
}
|
||||
}
|
||||
|
||||
this.fzMode = (FuzzyMode) getFuzzyMode();
|
||||
}
|
||||
|
||||
prevStack = is;
|
||||
standardDetectAndSendChanges();
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
IInventory inv = myte.getInventoryByName( "config" );
|
||||
for (int x = 0; x < inv.getSizeInventory(); x++)
|
||||
inv.setInventorySlotContents( x, null );
|
||||
detectAndSendChanges();
|
||||
}
|
||||
|
||||
public void partition()
|
||||
{
|
||||
IInventory inv = myte.getInventoryByName( "config" );
|
||||
|
||||
IMEInventory<IAEItemStack> cellInv = AEApi.instance().registries().cell()
|
||||
.getCellInventory( myte.getInventoryByName( "cell" ).getStackInSlot( 0 ), StorageChannel.ITEMS );
|
||||
|
||||
Iterator<IAEItemStack> i = new NullIterator<IAEItemStack>();
|
||||
if ( cellInv != null )
|
||||
{
|
||||
IItemList<IAEItemStack> list = cellInv.getAvailableItems( new ItemList() );
|
||||
i = list.iterator();
|
||||
}
|
||||
|
||||
for (int x = 0; x < inv.getSizeInventory(); x++)
|
||||
{
|
||||
if ( i.hasNext() )
|
||||
{
|
||||
ItemStack g = i.next().getItemStack();
|
||||
g.stackSize = 1;
|
||||
inv.setInventorySlotContents( x, g );
|
||||
}
|
||||
else
|
||||
inv.setInventorySlotContents( x, null );
|
||||
}
|
||||
|
||||
detectAndSendChanges();
|
||||
}
|
||||
|
||||
}
|
|
@ -6,11 +6,11 @@ import net.minecraft.inventory.ICrafting;
|
|||
import appeng.api.config.CondenserOuput;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.SlotOutput;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.container.slot.SlotRestrictedInput.PlaceableItemType;
|
||||
import appeng.tile.misc.TileCondenser;
|
||||
import appeng.util.Platform;
|
||||
import buildcraft.core.gui.slots.SlotOutput;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -24,7 +24,7 @@ public class ContainerCondenser extends AEBaseContainer
|
|||
myte = te;
|
||||
|
||||
addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.TRASH, te, 0, 51, 52 ) );
|
||||
addSlotToContainer( new SlotOutput( te, 1, 105, 52 ) );
|
||||
addSlotToContainer( new SlotOutput( te, 1, 105, 52, 15 + 16 * 8 ) );
|
||||
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.STORAGE_COMPONENT, te.getInternalInventory(), 2, 101, 26 )).setStackLimit( 1 ) );
|
||||
|
||||
bindPlayerInventory( ip, 0, 197 - /* height of playerinventory */82 );
|
||||
|
|
115
container/implementations/ContainerIOPort.java
Normal file
115
container/implementations/ContainerIOPort.java
Normal file
|
@ -0,0 +1,115 @@
|
|||
package appeng.container.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import appeng.api.config.FullnessMode;
|
||||
import appeng.api.config.OperationMode;
|
||||
import appeng.api.config.RedstoneMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.container.slot.SlotOutput;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.container.slot.SlotRestrictedInput.PlaceableItemType;
|
||||
import appeng.tile.storage.TileIOPort;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ContainerIOPort extends ContainerUpgradeable
|
||||
{
|
||||
|
||||
TileIOPort ioPort;
|
||||
public OperationMode opMode = OperationMode.EMPTY;
|
||||
public FullnessMode fMode = FullnessMode.EMPTY;
|
||||
|
||||
public ContainerIOPort(InventoryPlayer ip, TileIOPort te) {
|
||||
super( ip, te );
|
||||
ioPort = te;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getHeight()
|
||||
{
|
||||
return 166;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int availableUpgrades()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean supportCapacity()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupConfig()
|
||||
{
|
||||
int offx = 19;
|
||||
int offy = 17;
|
||||
|
||||
IInventory cells = myte.getInventoryByName( "cells" );
|
||||
|
||||
for (int y = 0; y < 3; y++)
|
||||
for (int x = 0; x < 2; x++)
|
||||
addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.STORAGE_CELLS, cells, x + y * 2, offx + x * 18, offy + y * 18 ) );
|
||||
|
||||
offx = 122;
|
||||
offy = 17;
|
||||
for (int y = 0; y < 3; y++)
|
||||
for (int x = 0; x < 2; x++)
|
||||
addSlotToContainer( new SlotOutput( cells, 6 + x + y * 2, offx + x * 18, offy + y * 18, PlaceableItemType.STORAGE_CELLS.icon ) );
|
||||
|
||||
IInventory upgrades = myte.getInventoryByName( "upgrades" );
|
||||
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 0, 187, 8 + 18 * 0 )).setNotDraggable() );
|
||||
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 1, 187, 8 + 18 * 1 )).setNotDraggable() );
|
||||
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2 )).setNotDraggable() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
for (int i = 0; i < this.crafters.size(); ++i)
|
||||
{
|
||||
ICrafting icrafting = (ICrafting) this.crafters.get( i );
|
||||
|
||||
if ( this.rsMode != this.myte.getConfigManager().getSetting( Settings.REDSTONE_CONTROLLED ) )
|
||||
{
|
||||
icrafting.sendProgressBarUpdate( this, 0, (int) this.myte.getConfigManager().getSetting( Settings.REDSTONE_CONTROLLED ).ordinal() );
|
||||
}
|
||||
|
||||
if ( this.fMode != this.myte.getConfigManager().getSetting( Settings.FULLNESS_MODE ) )
|
||||
{
|
||||
icrafting.sendProgressBarUpdate( this, 2, (int) this.myte.getConfigManager().getSetting( Settings.FULLNESS_MODE ).ordinal() );
|
||||
}
|
||||
|
||||
if ( this.opMode != this.myte.getConfigManager().getSetting( Settings.OPERATION_MODE ) )
|
||||
{
|
||||
icrafting.sendProgressBarUpdate( this, 3, (int) this.myte.getConfigManager().getSetting( Settings.OPERATION_MODE ).ordinal() );
|
||||
}
|
||||
}
|
||||
|
||||
this.opMode = (OperationMode) myte.getConfigManager().getSetting( Settings.OPERATION_MODE );
|
||||
this.fMode = (FullnessMode) this.myte.getConfigManager().getSetting( Settings.FULLNESS_MODE );
|
||||
this.rsMode = (RedstoneMode) this.myte.getConfigManager().getSetting( Settings.REDSTONE_CONTROLLED );
|
||||
}
|
||||
|
||||
standardDetectAndSendChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(int idx, int value)
|
||||
{
|
||||
super.updateProgressBar( idx, value );
|
||||
|
||||
if ( idx == 2 )
|
||||
this.fMode = FullnessMode.values()[value];
|
||||
|
||||
if ( idx == 3 )
|
||||
this.opMode = OperationMode.values()[value];
|
||||
}
|
||||
|
||||
}
|
|
@ -4,15 +4,19 @@ import net.minecraft.client.gui.GuiTextField;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.RedstoneMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.container.slot.SlotFakeTypeOnly;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.container.slot.SlotRestrictedInput.PlaceableItemType;
|
||||
import appeng.parts.automation.PartLevelEmitter;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ContainerLevelEmitter extends ContainerBus
|
||||
public class ContainerLevelEmitter extends ContainerUpgradeable
|
||||
{
|
||||
|
||||
PartLevelEmitter lvlEmitter;
|
||||
|
@ -33,7 +37,7 @@ public class ContainerLevelEmitter extends ContainerBus
|
|||
}
|
||||
|
||||
@Override
|
||||
protected int availableUpgrades()
|
||||
public int availableUpgrades()
|
||||
{
|
||||
|
||||
return 1;
|
||||
|
@ -53,6 +57,26 @@ public class ContainerLevelEmitter extends ContainerBus
|
|||
EmitterValue = newValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupConfig()
|
||||
{
|
||||
int x = 80 + 34;
|
||||
int y = 40;
|
||||
|
||||
IInventory upgrades = myte.getInventoryByName( "upgrades" );
|
||||
if ( availableUpgrades() > 0 )
|
||||
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 0, 187, 8 + 18 * 0 )).setNotDraggable() );
|
||||
if ( availableUpgrades() > 1 )
|
||||
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 1, 187, 8 + 18 * 1 )).setNotDraggable() );
|
||||
if ( availableUpgrades() > 2 )
|
||||
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2 )).setNotDraggable() );
|
||||
if ( availableUpgrades() > 3 )
|
||||
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3 )).setNotDraggable() );
|
||||
|
||||
IInventory inv = myte.getInventoryByName( "config" );
|
||||
addSlotToContainer( new SlotFakeTypeOnly( inv, 0, x, y ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
|
|
|
@ -22,6 +22,7 @@ import appeng.api.storage.data.IAEItemStack;
|
|||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.core.sync.packets.PacketMEInventoryUpdate;
|
||||
import appeng.helpers.ICellItemViewer;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.ItemList;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
|
@ -42,7 +43,10 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IMEMonito
|
|||
monitor.addListener( this, null );
|
||||
|
||||
cellInv = monitor;
|
||||
if ( montiorable instanceof IMEChest )
|
||||
|
||||
if ( montiorable instanceof ICellItemViewer )
|
||||
powerSrc = (ICellItemViewer) montiorable;
|
||||
else if ( montiorable instanceof IMEChest )
|
||||
powerSrc = (IMEChest) montiorable;
|
||||
else if ( montiorable instanceof IGridHost )
|
||||
{
|
||||
|
@ -120,8 +124,18 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IMEMonito
|
|||
PacketMEInventoryUpdate piu = new PacketMEInventoryUpdate();
|
||||
IItemList<IAEItemStack> monitorCache = monitor.getStorageList();
|
||||
|
||||
int items = 0;
|
||||
for (IAEItemStack send : monitorCache)
|
||||
{
|
||||
if ( items > 2000 )
|
||||
{
|
||||
items = 0;
|
||||
Packet p = piu.getPacket();
|
||||
PacketDispatcher.sendPacketToPlayer( p, (Player) c );
|
||||
piu = new PacketMEInventoryUpdate();
|
||||
}
|
||||
|
||||
items++;
|
||||
piu.appendItem( send );
|
||||
}
|
||||
|
||||
|
|
50
container/implementations/ContainerMEPortableCell.java
Normal file
50
container/implementations/ContainerMEPortableCell.java
Normal file
|
@ -0,0 +1,50 @@
|
|||
package appeng.container.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.helpers.ICellItemViewer;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ContainerMEPortableCell extends ContainerMEMonitorable
|
||||
{
|
||||
|
||||
ICellItemViewer civ;
|
||||
|
||||
public ContainerMEPortableCell(InventoryPlayer ip, ICellItemViewer montiorable) {
|
||||
super( ip, (IStorageMonitorable) montiorable );
|
||||
civ = montiorable;
|
||||
}
|
||||
|
||||
int ticks = 0;
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
ItemStack currentItem = getPlayerInv().getCurrentItem();
|
||||
|
||||
if ( currentItem != civ.getItemStack() )
|
||||
{
|
||||
if ( currentItem != null )
|
||||
{
|
||||
if ( Platform.isSameItem( civ.getItemStack(), currentItem ) )
|
||||
getPlayerInv().setInventorySlotContents( getPlayerInv().currentItem, civ.getItemStack() );
|
||||
else
|
||||
getPlayerInv().player.closeScreen();
|
||||
}
|
||||
else
|
||||
getPlayerInv().player.closeScreen();
|
||||
}
|
||||
|
||||
// drain 1 ae t
|
||||
ticks++;
|
||||
if ( ticks > 10 )
|
||||
{
|
||||
civ.extractAEPower( 0.5 * (double) ticks, Actionable.MODULATE, PowerMultiplier.CONFIG );
|
||||
ticks = 0;
|
||||
}
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
}
|
23
container/implementations/ContainerQNB.java
Normal file
23
container/implementations/ContainerQNB.java
Normal file
|
@ -0,0 +1,23 @@
|
|||
package appeng.container.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.container.slot.SlotRestrictedInput.PlaceableItemType;
|
||||
import appeng.tile.qnb.TileQuantumBridge;
|
||||
|
||||
public class ContainerQNB extends AEBaseContainer
|
||||
{
|
||||
|
||||
TileQuantumBridge myte;
|
||||
|
||||
public ContainerQNB(InventoryPlayer ip, TileQuantumBridge te) {
|
||||
super( ip, te, null );
|
||||
myte = te;
|
||||
|
||||
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.QE_SINGULARTIY, te, 0, 80, 37 )).setStackLimit( 1 ) );
|
||||
|
||||
bindPlayerInventory( ip, 0, 166 - /* height of playerinventory */82 );
|
||||
}
|
||||
|
||||
}
|
|
@ -22,16 +22,34 @@ import appeng.util.Platform;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ContainerBus extends AEBaseContainer implements IOptionalSlotHost
|
||||
public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSlotHost
|
||||
{
|
||||
|
||||
IBusCommon myte;
|
||||
IInventory toolbox = new AppEngInternalInventory( null, 9 );
|
||||
|
||||
public ContainerBus(InventoryPlayer ip, IBusCommon te) {
|
||||
public ContainerUpgradeable(InventoryPlayer ip, IBusCommon te) {
|
||||
super( ip, (TileEntity) (te instanceof TileEntity ? te : null), (IPart) (te instanceof IPart ? te : null) );
|
||||
myte = te;
|
||||
|
||||
if ( hasToolbox() )
|
||||
{
|
||||
for (int v = 0; v < 3; v++)
|
||||
for (int u = 0; u < 3; u++)
|
||||
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, toolbox, u + v * 3, 186 + u * 18, getHeight() - 82 + v * 18 ))
|
||||
.setPlayerSide() );
|
||||
}
|
||||
|
||||
setupConfig();
|
||||
|
||||
bindPlayerInventory( ip, 0, getHeight() - /* height of playerinventory */82 );
|
||||
}
|
||||
|
||||
protected void setupConfig()
|
||||
{
|
||||
int x = 80;
|
||||
int y = 40;
|
||||
|
||||
IInventory upgrades = myte.getInventoryByName( "upgrades" );
|
||||
if ( availableUpgrades() > 0 )
|
||||
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 0, 187, 8 + 18 * 0 )).setNotDraggable() );
|
||||
|
@ -42,16 +60,6 @@ public class ContainerBus extends AEBaseContainer implements IOptionalSlotHost
|
|||
if ( availableUpgrades() > 3 )
|
||||
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3 )).setNotDraggable() );
|
||||
|
||||
if ( hasToolbox() )
|
||||
{
|
||||
for (int v = 0; v < 3; v++)
|
||||
for (int u = 0; u < 3; u++)
|
||||
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, toolbox, u + v * 3, 186 + u * 18, 102 + v * 18 )).setPlayerSide() );
|
||||
}
|
||||
|
||||
int x = 80;
|
||||
int y = 40;
|
||||
|
||||
IInventory inv = myte.getInventoryByName( "config" );
|
||||
addSlotToContainer( new SlotFakeTypeOnly( inv, 0, x, y ) );
|
||||
|
||||
|
@ -67,8 +75,6 @@ public class ContainerBus extends AEBaseContainer implements IOptionalSlotHost
|
|||
addSlotToContainer( new OptionalSlotFakeTypeOnly( inv, this, 7, x, y, -1, 1, 2 ) );
|
||||
addSlotToContainer( new OptionalSlotFakeTypeOnly( inv, this, 8, x, y, 1, 1, 2 ) );
|
||||
}
|
||||
|
||||
bindPlayerInventory( ip, 0, getHeight() - /* height of playerinventory */82 );
|
||||
}
|
||||
|
||||
protected int getHeight()
|
||||
|
@ -76,7 +82,7 @@ public class ContainerBus extends AEBaseContainer implements IOptionalSlotHost
|
|||
return 184;
|
||||
}
|
||||
|
||||
protected int availableUpgrades()
|
||||
public int availableUpgrades()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
@ -151,7 +157,7 @@ public class ContainerBus extends AEBaseContainer implements IOptionalSlotHost
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlotEnabled(int idx, OptionalSlotFake osf)
|
||||
public boolean isSlotEnabled(int idx)
|
||||
{
|
||||
int upgrades = myte.getInstalledUpgrades( Upgrades.CAPACITY );
|
||||
|
|
@ -70,6 +70,9 @@ public class AppEngSlot extends Slot
|
|||
if ( !isEnabled() )
|
||||
return null;
|
||||
|
||||
if ( inventory.getSizeInventory() <= getSlotIndex() )
|
||||
return null;
|
||||
|
||||
if ( isDisplay )
|
||||
{
|
||||
isDisplay = false;
|
||||
|
|
|
@ -3,6 +3,6 @@ package appeng.container.slot;
|
|||
public interface IOptionalSlotHost
|
||||
{
|
||||
|
||||
boolean isSlotEnabled(int idx, OptionalSlotFake osf);
|
||||
boolean isSlotEnabled(int idx);
|
||||
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public class OptionalSlotFake extends SlotFake
|
|||
if ( host == null )
|
||||
return false;
|
||||
|
||||
return host.isSlotEnabled( groupNum, this );
|
||||
return host.isSlotEnabled( groupNum );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
26
container/slot/OptionalSlotNormal.java
Normal file
26
container/slot/OptionalSlotNormal.java
Normal file
|
@ -0,0 +1,26 @@
|
|||
package appeng.container.slot;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
public class OptionalSlotNormal extends AppEngSlot
|
||||
{
|
||||
|
||||
final int groupNum;
|
||||
IOptionalSlotHost host;
|
||||
|
||||
public OptionalSlotNormal(IInventory inv, IOptionalSlotHost containerBus, int slot, int xPos, int yPos, int groupNum) {
|
||||
super( inv, slot, xPos, yPos );
|
||||
this.groupNum = groupNum;
|
||||
host = containerBus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled()
|
||||
{
|
||||
if ( host == null )
|
||||
return false;
|
||||
|
||||
return host.isSlotEnabled( groupNum );
|
||||
}
|
||||
|
||||
}
|
26
container/slot/OptionalSlotRestrictedInput.java
Normal file
26
container/slot/OptionalSlotRestrictedInput.java
Normal file
|
@ -0,0 +1,26 @@
|
|||
package appeng.container.slot;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
public class OptionalSlotRestrictedInput extends SlotRestrictedInput
|
||||
{
|
||||
|
||||
final int groupNum;
|
||||
IOptionalSlotHost host;
|
||||
|
||||
public OptionalSlotRestrictedInput(PlaceableItemType valid, IInventory i, IOptionalSlotHost host, int slotnum, int x, int y, int grpNum) {
|
||||
super( valid, i, slotnum, x, y );
|
||||
this.groupNum = grpNum;
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled()
|
||||
{
|
||||
if ( host == null )
|
||||
return false;
|
||||
|
||||
return host.isSlotEnabled( groupNum );
|
||||
}
|
||||
|
||||
}
|
|
@ -12,6 +12,7 @@ import appeng.api.implementations.ICraftingPatternItem;
|
|||
import appeng.api.implementations.ISpatialStorageCell;
|
||||
import appeng.api.implementations.IStorageComponent;
|
||||
import appeng.api.implementations.IUpgradeModule;
|
||||
import appeng.api.storage.ICellWorkbenchItem;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class SlotRestrictedInput extends AppEngSlot
|
||||
|
@ -21,7 +22,7 @@ public class SlotRestrictedInput extends AppEngSlot
|
|||
{
|
||||
STORAGE_CELLS(15), ORE(1 * 16 + 15), STORAGE_COMPONENT(3 * 16 + 15), WIRELESS_TERMINAL(4 * 16 + 15), TRASH(5 * 16 + 15), VALID_ENCODED_PATTERN_W_OUPUT(
|
||||
7 * 16 + 15), ENCODED_PATTERN_W_OUTPUT(7 * 16 + 15), ENCODED_PATTERN(7 * 16 + 15), BLANK_PATTERN(8 * 16 + 15), POWERED_TOOL(9 * 16 + 15), RANGE_BOOSTER(
|
||||
6 * 16 + 15), QE_SINGULARTIY(10 * 16 + 15), SPATIAL_STORAGE_CELLS(11 * 16 + 15), FUEL(12 * 16 + 15), UPGRADES(13 * 16 + 15);
|
||||
6 * 16 + 15), QE_SINGULARTIY(10 * 16 + 15), SPATIAL_STORAGE_CELLS(11 * 16 + 15), FUEL(12 * 16 + 15), UPGRADES(13 * 16 + 15), WORKBENCH_CELL(15);
|
||||
|
||||
public final int icon;
|
||||
|
||||
|
@ -126,6 +127,8 @@ public class SlotRestrictedInput extends AppEngSlot
|
|||
return i.getItem() instanceof ISpatialStorageCell && ((ISpatialStorageCell) i.getItem()).isSpatialStorage( i );
|
||||
case STORAGE_CELLS:
|
||||
return AEApi.instance().registries().cell().isCellHandled( i );
|
||||
case WORKBENCH_CELL:
|
||||
return i != null && i.getItem() instanceof ICellWorkbenchItem && ((ICellWorkbenchItem) i.getItem()).isEditable( i );
|
||||
case STORAGE_COMPONENT:
|
||||
boolean isComp = i.getItem() instanceof IStorageComponent && ((IStorageComponent) i.getItem()).isStorageComponent( i );
|
||||
return isComp;
|
||||
|
|
|
@ -22,6 +22,8 @@ public class Configuration extends net.minecraftforge.common.Configuration imple
|
|||
|
||||
public static Configuration instance;
|
||||
|
||||
public static float TunnelPowerLoss = 0.05f;
|
||||
|
||||
public String latestVersion = VERSION;
|
||||
public long latestTimeStamp = 0;
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraftforge.common.ChestGenHooks;
|
|||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.definitions.Blocks;
|
||||
import appeng.api.definitions.Items;
|
||||
import appeng.api.definitions.Materials;
|
||||
|
@ -30,12 +31,12 @@ import appeng.block.mac.BlockContainmentWall;
|
|||
import appeng.block.mac.BlockCraftingAccelerator;
|
||||
import appeng.block.mac.BlockHeatVent;
|
||||
import appeng.block.mac.BlockPatternProvider;
|
||||
import appeng.block.misc.BlockCellWorkbench;
|
||||
import appeng.block.misc.BlockCharger;
|
||||
import appeng.block.misc.BlockCondenser;
|
||||
import appeng.block.misc.BlockInscriber;
|
||||
import appeng.block.misc.BlockInterface;
|
||||
import appeng.block.misc.BlockNetworkEmitter;
|
||||
import appeng.block.misc.BlockCellWorkbench;
|
||||
import appeng.block.misc.BlockQuartzCrystalizer;
|
||||
import appeng.block.misc.BlockQuartzTorch;
|
||||
import appeng.block.misc.BlockTinyTNT;
|
||||
|
@ -49,6 +50,7 @@ import appeng.block.networking.BlockEnergyCell;
|
|||
import appeng.block.networking.BlockWireless;
|
||||
import appeng.block.qnb.BlockQuantumLinkChamber;
|
||||
import appeng.block.qnb.BlockQuantumRing;
|
||||
import appeng.block.solids.BlockFluix;
|
||||
import appeng.block.solids.BlockMatrixFrame;
|
||||
import appeng.block.solids.BlockQuartz;
|
||||
import appeng.block.solids.BlockQuartzChiseled;
|
||||
|
@ -71,6 +73,8 @@ import appeng.core.features.registries.entries.CreativeCellHandler;
|
|||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.localization.PlayerMessages;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.debug.BlockChunkloader;
|
||||
import appeng.debug.BlockItemGen;
|
||||
import appeng.debug.ToolDebugCard;
|
||||
import appeng.debug.ToolReplicatorCard;
|
||||
import appeng.helpers.AETrading;
|
||||
|
@ -90,6 +94,8 @@ import appeng.items.tools.ToolMemoryCard;
|
|||
import appeng.items.tools.powered.ToolChargedStaff;
|
||||
import appeng.items.tools.powered.ToolEntropyManipulator;
|
||||
import appeng.items.tools.powered.ToolMassCannon;
|
||||
import appeng.items.tools.powered.ToolNetworkTool;
|
||||
import appeng.items.tools.powered.ToolPortableCell;
|
||||
import appeng.items.tools.powered.ToolWirelessTerminal;
|
||||
import appeng.items.tools.quartz.ToolQuartzAxe;
|
||||
import appeng.items.tools.quartz.ToolQuartzCuttingKnife;
|
||||
|
@ -137,10 +143,10 @@ public class Registration
|
|||
{
|
||||
MinecraftForge.EVENT_BUS.register( OreDictionaryHandler.instance );
|
||||
|
||||
Items items = AEApi.instance().items();
|
||||
Materials materials = AEApi.instance().materials();
|
||||
Parts parts = AEApi.instance().parts();
|
||||
Blocks blocks = AEApi.instance().blocks();
|
||||
Items items = appeng.core.Api.instance.items();
|
||||
Materials materials = appeng.core.Api.instance.materials();
|
||||
Parts parts = appeng.core.Api.instance.parts();
|
||||
Blocks blocks = appeng.core.Api.instance.blocks();
|
||||
|
||||
AEItemDefinition materialItem = (AEFeatureHandler) addFeature( ItemMaterial.class );
|
||||
|
||||
|
@ -197,6 +203,8 @@ public class Registration
|
|||
blocks.blockQuartzOreCharged = addFeature( OreQuartzCharged.class );
|
||||
blocks.blockMatrixFrame = addFeature( BlockMatrixFrame.class );
|
||||
blocks.blockQuartz = addFeature( BlockQuartz.class );
|
||||
blocks.blockFluix = addFeature( BlockFluix.class );
|
||||
|
||||
blocks.blockQuartzGlass = addFeature( BlockQuartzGlass.class );
|
||||
blocks.blockQuartzVibrantGlass = addFeature( BlockQuartzLamp.class );
|
||||
blocks.blockQuartzPiller = addFeature( BlockQuartzPillar.class );
|
||||
|
@ -228,7 +236,7 @@ public class Registration
|
|||
blocks.blockDrive = addFeature( BlockDrive.class );
|
||||
blocks.blockChest = addFeature( BlockChest.class );
|
||||
blocks.blockInterface = addFeature( BlockInterface.class );
|
||||
blocks.blockPartitioner = addFeature( BlockCellWorkbench.class );
|
||||
blocks.blockCellWorkbench = addFeature( BlockCellWorkbench.class );
|
||||
blocks.blockIOPort = addFeature( BlockIOPort.class );
|
||||
blocks.blockCondenser = addFeature( BlockCondenser.class );
|
||||
blocks.blockEnergyAcceptor = addFeature( BlockEnergyAcceptor.class );
|
||||
|
@ -272,11 +280,15 @@ public class Registration
|
|||
items.itemChargedStaff = addFeature( ToolChargedStaff.class );
|
||||
items.itemEntropyManipulator = addFeature( ToolEntropyManipulator.class );
|
||||
items.itemWirelessTerminal = addFeature( ToolWirelessTerminal.class );
|
||||
items.itemNetworkTool = addFeature( ToolNetworkTool.class );
|
||||
items.itemPortableCell = addFeature( ToolPortableCell.class );
|
||||
|
||||
items.itemFacade = addFeature( ItemFacade.class );
|
||||
|
||||
addFeature( ToolDebugCard.class );
|
||||
addFeature( ToolReplicatorCard.class );
|
||||
addFeature( BlockItemGen.class );
|
||||
addFeature( BlockChunkloader.class );
|
||||
}
|
||||
|
||||
private AEItemDefinition addFeature(Class c, Object... Args)
|
||||
|
@ -394,8 +406,9 @@ public class Registration
|
|||
AEApi.instance().registries().cell().addCellHandler( new BasicCellHandler() );
|
||||
AEApi.instance().registries().cell().addCellHandler( new CreativeCellHandler() );
|
||||
|
||||
NetworkRegistry.instance().registerGuiHandler( AppEng.instance, GuiBridge.GUI_Handler );
|
||||
AEApi.instance().registries().matterCannon().registerAmmo( AEApi.instance().materials().materialMatterBall.stack( 1 ), 32.0 );
|
||||
|
||||
NetworkRegistry.instance().registerGuiHandler( AppEng.instance, GuiBridge.GUI_Handler );
|
||||
}
|
||||
|
||||
public void PostInit(FMLPostInitializationEvent event)
|
||||
|
@ -407,6 +420,48 @@ public class Registration
|
|||
Api.instance.partHelper.initFMPSupport();
|
||||
((BlockCableBus) AEApi.instance().blocks().blockMultiPart.block()).setupTile();
|
||||
|
||||
// IO PORT!
|
||||
Upgrades.SPEED.registerItem( AEApi.instance().blocks().blockIOPort.stack( 1 ), 3 );
|
||||
Upgrades.REDSTONE.registerItem( AEApi.instance().blocks().blockIOPort.stack( 1 ), 1 );
|
||||
|
||||
// partLevelEmitter
|
||||
Upgrades.FUZZY.registerItem( AEApi.instance().parts().partLevelEmitter.stack( 1 ), 1 );
|
||||
|
||||
// partImportBus
|
||||
Upgrades.FUZZY.registerItem( AEApi.instance().parts().partImportBus.stack( 1 ), 1 );
|
||||
Upgrades.REDSTONE.registerItem( AEApi.instance().parts().partImportBus.stack( 1 ), 1 );
|
||||
Upgrades.CAPACITY.registerItem( AEApi.instance().parts().partImportBus.stack( 1 ), 2 );
|
||||
Upgrades.SPEED.registerItem( AEApi.instance().parts().partImportBus.stack( 1 ), 4 );
|
||||
|
||||
// partExportBus
|
||||
Upgrades.FUZZY.registerItem( AEApi.instance().parts().partExportBus.stack( 1 ), 1 );
|
||||
Upgrades.REDSTONE.registerItem( AEApi.instance().parts().partExportBus.stack( 1 ), 1 );
|
||||
Upgrades.CAPACITY.registerItem( AEApi.instance().parts().partExportBus.stack( 1 ), 2 );
|
||||
Upgrades.SPEED.registerItem( AEApi.instance().parts().partExportBus.stack( 1 ), 4 );
|
||||
|
||||
// blockCellWorkbench
|
||||
Upgrades.FUZZY.registerItem( AEApi.instance().items().itemCell1k.stack( 1 ), 1 );
|
||||
Upgrades.INVERTER.registerItem( AEApi.instance().items().itemCell1k.stack( 1 ), 1 );
|
||||
|
||||
Upgrades.FUZZY.registerItem( AEApi.instance().items().itemCell4k.stack( 1 ), 1 );
|
||||
Upgrades.INVERTER.registerItem( AEApi.instance().items().itemCell4k.stack( 1 ), 1 );
|
||||
|
||||
Upgrades.FUZZY.registerItem( AEApi.instance().items().itemCell16k.stack( 1 ), 1 );
|
||||
Upgrades.INVERTER.registerItem( AEApi.instance().items().itemCell16k.stack( 1 ), 1 );
|
||||
|
||||
Upgrades.FUZZY.registerItem( AEApi.instance().items().itemCell64k.stack( 1 ), 1 );
|
||||
Upgrades.INVERTER.registerItem( AEApi.instance().items().itemCell64k.stack( 1 ), 1 );
|
||||
|
||||
// partStorageBus
|
||||
Upgrades.FUZZY.registerItem( AEApi.instance().parts().partStorageBus.stack( 1 ), 1 );
|
||||
Upgrades.INVERTER.registerItem( AEApi.instance().parts().partStorageBus.stack( 1 ), 1 );
|
||||
Upgrades.CAPACITY.registerItem( AEApi.instance().parts().partStorageBus.stack( 1 ), 3 );
|
||||
|
||||
// matter cannon
|
||||
Upgrades.FUZZY.registerItem( AEApi.instance().items().itemMassCannon.stack( 1 ), 1 );
|
||||
Upgrades.INVERTER.registerItem( AEApi.instance().items().itemMassCannon.stack( 1 ), 1 );
|
||||
Upgrades.SPEED.registerItem( AEApi.instance().items().itemMassCannon.stack( 1 ), 4 );
|
||||
|
||||
if ( Configuration.instance.isFeatureEnabled( AEFeature.ChestLoot ) )
|
||||
{
|
||||
ChestGenHooks d = ChestGenHooks.getInfo( ChestGenHooks.MINESHAFT_CORRIDOR );
|
||||
|
|
|
@ -22,8 +22,8 @@ import org.objectweb.asm.tree.ClassNode;
|
|||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
|
||||
import appeng.api.parts.IPartItem;
|
||||
import appeng.api.parts.IPartHelper;
|
||||
import appeng.api.parts.IPartItem;
|
||||
import appeng.api.parts.LayerBase;
|
||||
import appeng.client.render.BusRenderer;
|
||||
import appeng.core.AELog;
|
||||
|
|
|
@ -33,15 +33,18 @@ public enum AEFeature
|
|||
LevelEmiter("NetworkBuses"), CraftingTerminal("NetworkBuses"), StorageMonitor("NetworkBuses"), P2PTunnel("NetworkBuses"), FormationPlane("NetworkBuses"), AnnihilationPlane(
|
||||
"NetworkBuses"), ImportBus("NetworkBuses"), ExportBus("NetworkBuses"), StorageBus("NetworkBuses"), PartConversionMonitor("NetworkBuses"),
|
||||
|
||||
StorageCells("Storage"), MEChest("Storage"), MEDrive("Storage"), IOPort("Storage"),
|
||||
StorageCells("Storage"), PortableCell("PortableCell"), MEChest("Storage"), MEDrive("Storage"), IOPort("Storage"),
|
||||
|
||||
NetworkTool("NetworkTool"),
|
||||
|
||||
DenseEnergyCells("HigherCapacity"), DenseCables("HigherCapacity"),
|
||||
|
||||
P2PTunnelME("P2PTunnels"), P2PTunnelItems("P2PTunnels"), P2PTunnelRedstone("P2PTunnels"), P2PTunnelEU("P2PTunnels"), P2PTunnelMJ("P2PTunnels"), P2PTunnelLiquids("P2PTunnels"),
|
||||
P2PTunnelME("P2PTunnels"), P2PTunnelItems("P2PTunnels"), P2PTunnelRedstone("P2PTunnels"), P2PTunnelEU("P2PTunnels"), P2PTunnelMJ("P2PTunnels"), P2PTunnelLiquids(
|
||||
"P2PTunnels"),
|
||||
|
||||
MassCannonBlockDamage("BlockFeatures"), TinyTNTBlockDamage("BlockFeatures"), Facades("Facades"),
|
||||
|
||||
DuplicateItems("Misc", false), Profiler("Services"), VersionChecker("Services"), Debug("Misc"), Creative("Misc");
|
||||
DuplicateItems("Misc", false), Profiler("Services"), VersionChecker("Services"), Debug("Misc", false), Creative("Misc");
|
||||
|
||||
String Category;
|
||||
boolean visible = true;
|
||||
|
|
|
@ -53,6 +53,9 @@ public class AEFeatureHandler implements AEItemDefinition
|
|||
{
|
||||
// simple hack to allow me to do get nice names for these without
|
||||
// mode code outside of AEBaseItem
|
||||
if ( subname.startsWith( "P2PTunnel" ) )
|
||||
return "ItemPart.P2PTunnel";
|
||||
|
||||
if ( subname.equals( "CertusQuartzTools" ) )
|
||||
return name.replace( "Quartz", "CertusQuartz" );
|
||||
if ( subname.equals( "NetherQuartzTools" ) )
|
||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import appeng.api.util.AEItemDefinition;
|
||||
import appeng.core.AELog;
|
||||
|
||||
public class DamagedItemDefinition implements AEItemDefinition
|
||||
{
|
||||
|
@ -22,6 +23,7 @@ public class DamagedItemDefinition implements AEItemDefinition
|
|||
{
|
||||
baseItem = is.getItem();
|
||||
damage = is.getItemDamage();
|
||||
AELog.localization( "item", is.getUnlocalizedName() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,7 +51,7 @@ public class DamagedItemDefinition implements AEItemDefinition
|
|||
if ( baseItem == null )
|
||||
return null;
|
||||
|
||||
return new ItemStack( baseItem, 1, damage );
|
||||
return new ItemStack( baseItem, stackSize, damage );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,6 +2,7 @@ package appeng.core.features.registries;
|
|||
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import appeng.api.events.LocatableEventAnnounce;
|
||||
import appeng.api.events.LocatableEventAnnounce.LocatableEvent;
|
||||
|
@ -23,7 +24,8 @@ public class LocateableRegistry implements ILocateableRegistry
|
|||
if ( e.change == LocatableEvent.Register )
|
||||
{
|
||||
set.put( e.target.getLocatableSerial(), e.target );
|
||||
} else if ( e.change == LocatableEvent.Unregister )
|
||||
}
|
||||
else if ( e.change == LocatableEvent.Unregister )
|
||||
{
|
||||
set.remove( e.target.getLocatableSerial() );
|
||||
}
|
||||
|
@ -31,6 +33,7 @@ public class LocateableRegistry implements ILocateableRegistry
|
|||
|
||||
public LocateableRegistry() {
|
||||
set = new HashMap();
|
||||
MinecraftForge.EVENT_BUS.register( this );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
126
core/features/registries/MatterCannonAmmoRegistry.java
Normal file
126
core/features/registries/MatterCannonAmmoRegistry.java
Normal file
|
@ -0,0 +1,126 @@
|
|||
package appeng.core.features.registries;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.features.IMatterCannonAmmoRegistry;
|
||||
import appeng.recipes.ores.IOreListener;
|
||||
import appeng.recipes.ores.OreDictionaryHandler;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class MatterCannonAmmoRegistry implements IOreListener, IMatterCannonAmmoRegistry
|
||||
{
|
||||
|
||||
private HashMap<ItemStack, Double> DamageModifiers = new HashMap<ItemStack, Double>();
|
||||
|
||||
@Override
|
||||
public void registerAmmo(ItemStack ammo, double weight)
|
||||
{
|
||||
DamageModifiers.put( ammo, weight );
|
||||
}
|
||||
|
||||
private void considerItem(String ore, ItemStack item, String Name, double weight)
|
||||
{
|
||||
if ( ore.equals( "berry" + Name ) || ore.equals( "nugget" + Name ) )
|
||||
{
|
||||
registerAmmo( item, weight );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void oreRegistered(String Name, ItemStack item)
|
||||
{
|
||||
if ( !(Name.startsWith( "berry" ) || Name.startsWith( "nugget" )) )
|
||||
return;
|
||||
|
||||
// addNugget( "Cobble", 18 ); // ?
|
||||
considerItem( Name, item, "MeatRaw", 32 );
|
||||
considerItem( Name, item, "MeatCooked", 32 );
|
||||
considerItem( Name, item, "Meat", 32 );
|
||||
considerItem( Name, item, "Chicken", 32 );
|
||||
considerItem( Name, item, "Beef", 32 );
|
||||
considerItem( Name, item, "Sheep", 32 );
|
||||
considerItem( Name, item, "Fish", 32 );
|
||||
|
||||
// real world...
|
||||
considerItem( Name, item, "Lithium", 6.941 );
|
||||
considerItem( Name, item, "Beryllium", 9.0122 );
|
||||
considerItem( Name, item, "Boron", 10.811 );
|
||||
considerItem( Name, item, "Carbon", 12.0107 );
|
||||
considerItem( Name, item, "Coal", 12.0107 );
|
||||
considerItem( Name, item, "Charcoal", 12.0107 );
|
||||
considerItem( Name, item, "Sodium", 22.9897 );
|
||||
considerItem( Name, item, "Magnesium", 24.305 );
|
||||
considerItem( Name, item, "Aluminum", 26.9815 );
|
||||
considerItem( Name, item, "Silicon", 28.0855 );
|
||||
considerItem( Name, item, "Phosphorus", 30.9738 );
|
||||
considerItem( Name, item, "Sulfur", 32.065 );
|
||||
considerItem( Name, item, "Potassium", 39.0983 );
|
||||
considerItem( Name, item, "Calcium", 40.078 );
|
||||
considerItem( Name, item, "Scandium", 44.9559 );
|
||||
considerItem( Name, item, "Titanium", 47.867 );
|
||||
considerItem( Name, item, "Vanadium", 50.9415 );
|
||||
considerItem( Name, item, "Manganese", 54.938 );
|
||||
considerItem( Name, item, "Iron", 55.845 );
|
||||
considerItem( Name, item, "Nickel", 58.6934 );
|
||||
considerItem( Name, item, "Cobalt", 58.9332 );
|
||||
considerItem( Name, item, "Copper", 63.546 );
|
||||
considerItem( Name, item, "Zinc", 65.39 );
|
||||
considerItem( Name, item, "Gallium", 69.723 );
|
||||
considerItem( Name, item, "Germanium", 72.64 );
|
||||
considerItem( Name, item, "Bromine", 79.904 );
|
||||
considerItem( Name, item, "Krypton", 83.8 );
|
||||
considerItem( Name, item, "Rubidium", 85.4678 );
|
||||
considerItem( Name, item, "Strontium", 87.62 );
|
||||
considerItem( Name, item, "Yttrium", 88.9059 );
|
||||
considerItem( Name, item, "Zirconiumm", 91.224 );
|
||||
considerItem( Name, item, "Niobiumm", 92.9064 );
|
||||
considerItem( Name, item, "Technetium", 98 );
|
||||
considerItem( Name, item, "Ruthenium", 101.07 );
|
||||
considerItem( Name, item, "Rhodium", 102.9055 );
|
||||
considerItem( Name, item, "Palladium", 106.42 );
|
||||
considerItem( Name, item, "Silver", 107.8682 );
|
||||
considerItem( Name, item, "Cadmium", 112.411 );
|
||||
considerItem( Name, item, "Indium", 114.818 );
|
||||
considerItem( Name, item, "Tin", 118.71 );
|
||||
considerItem( Name, item, "Antimony", 121.76 );
|
||||
considerItem( Name, item, "Iodine", 126.9045 );
|
||||
considerItem( Name, item, "Tellurium", 127.6 );
|
||||
considerItem( Name, item, "Xenon", 131.293 );
|
||||
considerItem( Name, item, "Cesium", 132.9055 );
|
||||
considerItem( Name, item, "Barium", 137.327 );
|
||||
considerItem( Name, item, "Lanthanum", 138.9055 );
|
||||
considerItem( Name, item, "Cerium", 140.116 );
|
||||
considerItem( Name, item, "Tantalum", 180.9479 );
|
||||
considerItem( Name, item, "Tungsten", 183.84 );
|
||||
considerItem( Name, item, "Osmium", 190.23 );
|
||||
considerItem( Name, item, "Iridium", 192.217 );
|
||||
considerItem( Name, item, "Platinum", 195.078 );
|
||||
considerItem( Name, item, "Lead", 207.2 );
|
||||
considerItem( Name, item, "Bismuth", 208.9804 );
|
||||
considerItem( Name, item, "Uranium", 238.0289 );
|
||||
considerItem( Name, item, "Plutonium", 244 );
|
||||
|
||||
// TE stuff...
|
||||
considerItem( Name, item, "Invar", (58.6934 + 55.845 + 55.845) / 3.0 );
|
||||
considerItem( Name, item, "Electrum", (107.8682 + 196.96655) / 2.0 );
|
||||
}
|
||||
|
||||
public MatterCannonAmmoRegistry() {
|
||||
OreDictionaryHandler.instance.observe( this );
|
||||
registerAmmo( new ItemStack( Item.goldNugget ), 196.96655 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getPenetration(ItemStack is)
|
||||
{
|
||||
for (ItemStack o : DamageModifiers.keySet())
|
||||
{
|
||||
if ( Platform.isSameItem( o, is ) )
|
||||
return DamageModifiers.get( o ).floatValue();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
|
@ -2,6 +2,7 @@ package appeng.core.features.registries;
|
|||
|
||||
import appeng.api.features.IGrinderRegistry;
|
||||
import appeng.api.features.ILocateableRegistry;
|
||||
import appeng.api.features.IMatterCannonAmmoRegistry;
|
||||
import appeng.api.features.IP2PTunnelRegistry;
|
||||
import appeng.api.features.IRegistryContainer;
|
||||
import appeng.api.features.ISpecialComparisonRegistry;
|
||||
|
@ -23,6 +24,7 @@ public class RegistryContainer implements IRegistryContainer
|
|||
private GridCacheRegistry GridCacheRegistry = new GridCacheRegistry();
|
||||
private P2PTunnelRegistry P2PRegistry = new P2PTunnelRegistry();
|
||||
private MovableTileRegistry MoveableReg = new MovableTileRegistry();
|
||||
private MatterCannonAmmoRegistry matterCannonReg = new MatterCannonAmmoRegistry();
|
||||
|
||||
@Override
|
||||
public IWirelessTermRegistery wireless()
|
||||
|
@ -78,4 +80,10 @@ public class RegistryContainer implements IRegistryContainer
|
|||
return P2PRegistry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMatterCannonAmmoRegistry matterCannon()
|
||||
{
|
||||
return matterCannonReg;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import appeng.api.storage.StorageChannel;
|
|||
import appeng.client.texture.ExtraTextures;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.me.storage.CellInventory;
|
||||
import appeng.me.storage.CellInventoryHandler;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
@ -46,7 +47,12 @@ public class BasicCellHandler implements ICellHandler
|
|||
@Override
|
||||
public int getStatusForCell(ItemStack is, IMEInventory handler)
|
||||
{
|
||||
return 1;
|
||||
if ( handler instanceof CellInventoryHandler )
|
||||
{
|
||||
CellInventoryHandler ci = (CellInventoryHandler) handler;
|
||||
return ci.getCellInv().getStatusForCell();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,27 +7,27 @@ public enum GuiText
|
|||
{
|
||||
inventory("container"), // mc's default Inventory localization.
|
||||
|
||||
Chest, StoredEnergy, Of, Condenser, Drive, GrindStone, VibrationChamber, SpatialIOPort, NetworkStatus, LevelEmitter, Terminal, Interface, Config, StoredItems, Patterns, ImportBus, ExportBus, CellWorkbench;
|
||||
Chest, StoredEnergy, Of, Condenser, Drive, GrindStone, VibrationChamber, SpatialIOPort, LevelEmitter, Terminal, Interface, Config, StoredItems, Patterns, ImportBus, ExportBus, CellWorkbench, NetworkDetails, StorageCells, IOBuses, IOPort, BytesUsed, Types, QuantumLinkChamber, PortableCell;
|
||||
|
||||
String root;
|
||||
|
||||
GuiText() {
|
||||
root = "gui.appliedenergistics2";
|
||||
AELog.localization( "gui", getName() );
|
||||
AELog.localization( "gui", getUnlocalized() );
|
||||
}
|
||||
|
||||
GuiText(String r) {
|
||||
root = r;
|
||||
}
|
||||
|
||||
private String getName()
|
||||
public String getUnlocalized()
|
||||
{
|
||||
return root + "." + toString();
|
||||
}
|
||||
|
||||
public String getLocal()
|
||||
{
|
||||
return StatCollector.translateToLocal( getName() );
|
||||
return StatCollector.translateToLocal( getUnlocalized() );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import appeng.core.AELog;
|
|||
|
||||
public enum PlayerMessages
|
||||
{
|
||||
ChestCannotReadStorageCell, InvalidMachine, LoadedSettings, SavedSettings, MachineNotPowered;
|
||||
ChestCannotReadStorageCell, InvalidMachine, LoadedSettings, SavedSettings, MachineNotPowered, isNowLocked, isNowUnlocked, AmmoDepleted;
|
||||
|
||||
private PlayerMessages() {
|
||||
AELog.localization( "chat", getName() );
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.lang.reflect.Constructor;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
@ -14,24 +15,31 @@ import appeng.api.parts.IPartHost;
|
|||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.client.gui.GuiNull;
|
||||
import appeng.container.ContainerNull;
|
||||
import appeng.container.implementations.ContainerBus;
|
||||
import appeng.container.implementations.ContainerCellWorkBench;
|
||||
import appeng.container.implementations.ContainerCellWorkbench;
|
||||
import appeng.container.implementations.ContainerChest;
|
||||
import appeng.container.implementations.ContainerCondenser;
|
||||
import appeng.container.implementations.ContainerDrive;
|
||||
import appeng.container.implementations.ContainerGrinder;
|
||||
import appeng.container.implementations.ContainerIOPort;
|
||||
import appeng.container.implementations.ContainerInterface;
|
||||
import appeng.container.implementations.ContainerLevelEmitter;
|
||||
import appeng.container.implementations.ContainerMEMonitorable;
|
||||
import appeng.container.implementations.ContainerMEPortableCell;
|
||||
import appeng.container.implementations.ContainerQNB;
|
||||
import appeng.container.implementations.ContainerUpgradeable;
|
||||
import appeng.container.implementations.ContainerVibrationChamber;
|
||||
import appeng.helpers.ICellItemViewer;
|
||||
import appeng.helpers.IGuiItem;
|
||||
import appeng.helpers.IInterfaceHost;
|
||||
import appeng.parts.automation.PartLevelEmitter;
|
||||
import appeng.tile.grindstone.TileGrinder;
|
||||
import appeng.tile.misc.TileCellWorkbench;
|
||||
import appeng.tile.misc.TileCondenser;
|
||||
import appeng.tile.misc.TileVibrationChamber;
|
||||
import appeng.tile.qnb.TileQuantumBridge;
|
||||
import appeng.tile.storage.TileChest;
|
||||
import appeng.tile.storage.TileDrive;
|
||||
import appeng.tile.storage.TileIOPort;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
@ -40,30 +48,37 @@ public enum GuiBridge implements IGuiHandler
|
|||
{
|
||||
GUI_Handler(),
|
||||
|
||||
GUI_GRINDER(ContainerGrinder.class, TileGrinder.class),
|
||||
GUI_GRINDER(ContainerGrinder.class, TileGrinder.class, false),
|
||||
|
||||
GUI_CHEST(ContainerChest.class, TileChest.class),
|
||||
GUI_QNB(ContainerQNB.class, TileQuantumBridge.class, false),
|
||||
|
||||
GUI_ME(ContainerMEMonitorable.class, IStorageMonitorable.class),
|
||||
GUI_CHEST(ContainerChest.class, TileChest.class, false),
|
||||
|
||||
GUI_DRIVE(ContainerDrive.class, TileDrive.class),
|
||||
GUI_ME(ContainerMEMonitorable.class, IStorageMonitorable.class, false),
|
||||
|
||||
GUI_VIBRATIONCHAMBER(ContainerVibrationChamber.class, TileVibrationChamber.class),
|
||||
GUI_PORTABLE_CELL(ContainerMEPortableCell.class, ICellItemViewer.class, true),
|
||||
|
||||
GUI_CONDENSER(ContainerCondenser.class, TileCondenser.class),
|
||||
GUI_DRIVE(ContainerDrive.class, TileDrive.class, false),
|
||||
|
||||
GUI_INTERFACE(ContainerInterface.class, IInterfaceHost.class),
|
||||
GUI_VIBRATIONCHAMBER(ContainerVibrationChamber.class, TileVibrationChamber.class, false),
|
||||
|
||||
GUI_BUS(ContainerBus.class, IBusCommon.class),
|
||||
GUI_CONDENSER(ContainerCondenser.class, TileCondenser.class, false),
|
||||
|
||||
GUI_INTERFACE(ContainerInterface.class, IInterfaceHost.class, false),
|
||||
|
||||
GUI_BUS(ContainerUpgradeable.class, IBusCommon.class, false),
|
||||
|
||||
GUI_IOPORT(ContainerIOPort.class, TileIOPort.class, false),
|
||||
|
||||
// extends (Container/Gui) + Bus
|
||||
GUI_LEVELEMITTER(ContainerLevelEmitter.class, PartLevelEmitter.class),
|
||||
GUI_LEVELEMITTER(ContainerLevelEmitter.class, PartLevelEmitter.class, false),
|
||||
|
||||
GUI_CELLWORKBENCH(ContainerCellWorkBench.class, TileCellWorkbench.class);
|
||||
GUI_CELLWORKBENCH(ContainerCellWorkbench.class, TileCellWorkbench.class, false);
|
||||
|
||||
private Class Tile;
|
||||
private Class Gui;
|
||||
private Class Container;
|
||||
private boolean isItem;
|
||||
|
||||
private GuiBridge() {
|
||||
Tile = null;
|
||||
|
@ -95,8 +110,9 @@ public enum GuiBridge implements IGuiHandler
|
|||
getGui();
|
||||
}
|
||||
|
||||
private GuiBridge(Class _Container, Class _Tile) {
|
||||
private GuiBridge(Class _Container, Class _Tile, boolean isItem) {
|
||||
Container = _Container;
|
||||
this.isItem = isItem;
|
||||
Tile = _Tile;
|
||||
getGui();
|
||||
}
|
||||
|
@ -145,43 +161,73 @@ public enum GuiBridge implements IGuiHandler
|
|||
ForgeDirection side = ForgeDirection.getOrientation( ID_ORDINAL & 0x07 );
|
||||
GuiBridge ID = values()[ID_ORDINAL >> 3];
|
||||
|
||||
TileEntity TE = w.getBlockTileEntity( x, y, z );
|
||||
|
||||
if ( TE instanceof IPartHost )
|
||||
if ( ID.isItem() )
|
||||
{
|
||||
((IPartHost) TE).getPart( side );
|
||||
IPart part = ((IPartHost) TE).getPart( side );
|
||||
if ( ID.CorrectTileOrPart( part ) )
|
||||
return ID.ConstructContainer( player.inventory, side, part );
|
||||
ItemStack it = player.inventory.getCurrentItem();
|
||||
if ( it != null && it.getItem() instanceof IGuiItem )
|
||||
{
|
||||
Object myItem = ((IGuiItem) it.getItem()).getGuiObject( it );
|
||||
if ( ID.CorrectTileOrPart( myItem ) )
|
||||
return ID.ConstructContainer( player.inventory, side, myItem );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ID.CorrectTileOrPart( TE ) )
|
||||
return ID.ConstructContainer( player.inventory, side, TE );
|
||||
TileEntity TE = w.getBlockTileEntity( x, y, z );
|
||||
if ( TE instanceof IPartHost )
|
||||
{
|
||||
((IPartHost) TE).getPart( side );
|
||||
IPart part = ((IPartHost) TE).getPart( side );
|
||||
if ( ID.CorrectTileOrPart( part ) )
|
||||
return ID.ConstructContainer( player.inventory, side, part );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ID.CorrectTileOrPart( TE ) )
|
||||
return ID.ConstructContainer( player.inventory, side, TE );
|
||||
}
|
||||
}
|
||||
|
||||
return new ContainerNull();
|
||||
}
|
||||
|
||||
private boolean isItem()
|
||||
{
|
||||
return isItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID_ORDINAL, EntityPlayer player, World w, int x, int y, int z)
|
||||
{
|
||||
ForgeDirection side = ForgeDirection.getOrientation( ID_ORDINAL & 0x07 );
|
||||
GuiBridge ID = values()[ID_ORDINAL >> 3];
|
||||
|
||||
TileEntity TE = w.getBlockTileEntity( x, y, z );
|
||||
|
||||
if ( TE instanceof IPartHost )
|
||||
if ( ID.isItem() )
|
||||
{
|
||||
((IPartHost) TE).getPart( side );
|
||||
IPart part = ((IPartHost) TE).getPart( side );
|
||||
if ( ID.CorrectTileOrPart( part ) )
|
||||
return ID.ConstructGui( player.inventory, side, part );
|
||||
ItemStack it = player.inventory.getCurrentItem();
|
||||
if ( it != null && it.getItem() instanceof IGuiItem )
|
||||
{
|
||||
Object myItem = ((IGuiItem) it.getItem()).getGuiObject( it );
|
||||
if ( ID.CorrectTileOrPart( myItem ) )
|
||||
return ID.ConstructGui( player.inventory, side, myItem );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ID.CorrectTileOrPart( TE ) )
|
||||
return ID.ConstructGui( player.inventory, side, TE );
|
||||
TileEntity TE = w.getBlockTileEntity( x, y, z );
|
||||
|
||||
if ( TE instanceof IPartHost )
|
||||
{
|
||||
((IPartHost) TE).getPart( side );
|
||||
IPart part = ((IPartHost) TE).getPart( side );
|
||||
if ( ID.CorrectTileOrPart( part ) )
|
||||
return ID.ConstructGui( player.inventory, side, part );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ID.CorrectTileOrPart( TE ) )
|
||||
return ID.ConstructGui( player.inventory, side, TE );
|
||||
}
|
||||
}
|
||||
|
||||
return new GuiNull( new ContainerNull() );
|
||||
|
|
|
@ -8,6 +8,8 @@ import java.io.IOException;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.container.implementations.ContainerCellWorkbench;
|
||||
import appeng.container.implementations.ContainerLevelEmitter;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
|
||||
|
@ -34,6 +36,25 @@ public class PacketValueConfig extends AppEngPacket
|
|||
lvc.setLevel( Integer.parseInt( Value ), player );
|
||||
return;
|
||||
}
|
||||
else if ( Name.startsWith( "CellWorkbench." ) && c instanceof ContainerCellWorkbench )
|
||||
{
|
||||
ContainerCellWorkbench ccw = (ContainerCellWorkbench) c;
|
||||
if ( Name.equals( "CellWorkbench.Action" ) )
|
||||
{
|
||||
if ( Value.equals( "Partition" ) )
|
||||
{
|
||||
ccw.partition();
|
||||
}
|
||||
else if ( Value.equals( "Clear" ) )
|
||||
{
|
||||
ccw.clear();
|
||||
}
|
||||
}
|
||||
else if ( Name.equals( "CellWorkbench.Fuzzy" ) )
|
||||
{
|
||||
ccw.setFuzzy( FuzzyMode.valueOf( Value ) );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
30
debug/BlockChunkloader.java
Normal file
30
debug/BlockChunkloader.java
Normal file
|
@ -0,0 +1,30 @@
|
|||
package appeng.debug;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager.LoadingCallback;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.features.AEFeature;
|
||||
|
||||
public class BlockChunkloader extends AEBaseBlock implements LoadingCallback
|
||||
{
|
||||
|
||||
public BlockChunkloader() {
|
||||
super( BlockChunkloader.class, Material.iron );
|
||||
setfeature( EnumSet.of( AEFeature.Debug, AEFeature.Creative ) );
|
||||
setTileEntiy( TileChunkLoader.class );
|
||||
ForgeChunkManager.setForcedChunkLoadingCallback( AppEng.instance, this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ticketsLoaded(List<Ticket> tickets, World world)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
18
debug/BlockItemGen.java
Normal file
18
debug/BlockItemGen.java
Normal file
|
@ -0,0 +1,18 @@
|
|||
package appeng.debug;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
|
||||
public class BlockItemGen extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockItemGen() {
|
||||
super( BlockItemGen.class, Material.iron );
|
||||
setfeature( EnumSet.of( AEFeature.Debug, AEFeature.Creative ) );
|
||||
setTileEntiy( TileItemGen.class );
|
||||
}
|
||||
|
||||
}
|
83
debug/TileChunkLoader.java
Normal file
83
debug/TileChunkLoader.java
Normal file
|
@ -0,0 +1,83 @@
|
|||
package appeng.debug;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Type;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.events.AETileEventHandler;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
||||
public class TileChunkLoader extends AEBaseTile
|
||||
{
|
||||
|
||||
boolean requestTicket = true;
|
||||
Ticket ct;
|
||||
|
||||
class ChunkLoaderHandler extends AETileEventHandler
|
||||
{
|
||||
|
||||
public ChunkLoaderHandler() {
|
||||
super( EnumSet.of( TileEventType.TICK ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Tick()
|
||||
{
|
||||
if ( requestTicket )
|
||||
{
|
||||
requestTicket = false;
|
||||
initTicket();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public TileChunkLoader() {
|
||||
addNewHandler( new ChunkLoaderHandler() );
|
||||
}
|
||||
|
||||
void initTicket()
|
||||
{
|
||||
if ( Platform.isClient() )
|
||||
return;
|
||||
|
||||
ct = ForgeChunkManager.requestTicket( AppEng.instance, worldObj, Type.NORMAL );
|
||||
|
||||
if ( ct == null )
|
||||
{
|
||||
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
|
||||
if ( server != null )
|
||||
{
|
||||
List<EntityPlayerMP> pl = server.getConfigurationManager().playerEntityList;
|
||||
for (EntityPlayerMP p : pl)
|
||||
{
|
||||
p.addChatMessage( "Can't chunk load.." );
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
AELog.info( "New Ticket " + ct.toString() );
|
||||
ForgeChunkManager.forceChunk( ct, new ChunkCoordIntPair( xCoord >> 4, zCoord >> 4 ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate()
|
||||
{
|
||||
if ( Platform.isClient() )
|
||||
return;
|
||||
|
||||
AELog.info( "Released Ticket " + ct.toString() );
|
||||
ForgeChunkManager.releaseTicket( ct );
|
||||
}
|
||||
}
|
124
debug/TileItemGen.java
Normal file
124
debug/TileItemGen.java
Normal file
|
@ -0,0 +1,124 @@
|
|||
package appeng.debug;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
public class TileItemGen extends AEBaseTile implements IInventory
|
||||
{
|
||||
|
||||
public static Queue<ItemStack> possibleItems = new LinkedList();
|
||||
|
||||
public TileItemGen() {
|
||||
if ( possibleItems.isEmpty() )
|
||||
{
|
||||
for (int x = 0; x < Item.itemsList.length; x++)
|
||||
{
|
||||
Item mi = Item.itemsList[x];
|
||||
if ( mi != null )
|
||||
{
|
||||
if ( mi.isDamageable() )
|
||||
{
|
||||
for (int dmg = 0; dmg < mi.getMaxDamage(); dmg++)
|
||||
possibleItems.add( new ItemStack( mi, 1, dmg ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
List<ItemStack> list = new ArrayList<ItemStack>();
|
||||
mi.getSubItems( x, mi.getCreativeTab(), list );
|
||||
possibleItems.addAll( list );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i)
|
||||
{
|
||||
return getRandomItem();
|
||||
}
|
||||
|
||||
private ItemStack getRandomItem()
|
||||
{
|
||||
return possibleItems.peek();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j)
|
||||
{
|
||||
ItemStack a = possibleItems.poll();
|
||||
ItemStack out = a.copy();
|
||||
possibleItems.add( a );
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack)
|
||||
{
|
||||
ItemStack a = possibleItems.poll();
|
||||
possibleItems.add( a );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInvName()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvNameLocalized()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openChest()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeChest()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,6 @@ import appeng.core.features.AEFeature;
|
|||
import appeng.helpers.TickHandler;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.me.Grid;
|
||||
import appeng.me.GridCacheWrapper;
|
||||
import appeng.me.GridNode;
|
||||
import appeng.me.cache.TickManagerCache;
|
||||
import appeng.util.Platform;
|
||||
|
@ -30,7 +29,7 @@ public class ToolDebugCard extends AEBaseItem
|
|||
|
||||
public ToolDebugCard() {
|
||||
super( ToolDebugCard.class );
|
||||
setfeature( EnumSet.of( AEFeature.Creative ) );
|
||||
setfeature( EnumSet.of( AEFeature.Debug, AEFeature.Creative ) );
|
||||
}
|
||||
|
||||
public String timeMeasurement(long nanos)
|
||||
|
@ -57,11 +56,6 @@ public class ToolDebugCard extends AEBaseItem
|
|||
{
|
||||
TickManagerCache tmc = (TickManagerCache) g.getCache( ITickManager.class );
|
||||
|
||||
for (GridCacheWrapper w : g.getCacheWrappers())
|
||||
{
|
||||
totalOver5Ticks += w.LastFiveTicksTime;
|
||||
}
|
||||
|
||||
grids++;
|
||||
for (IGridNode n : g.getNodes())
|
||||
{
|
||||
|
@ -87,12 +81,6 @@ public class ToolDebugCard extends AEBaseItem
|
|||
outputMsg( player, "This Node: " + node.toString() );
|
||||
outputMsg( player, "Center Node: " + center.toString() );
|
||||
|
||||
for (GridCacheWrapper w : g.getCacheWrappers())
|
||||
{
|
||||
outputMsg( player, w.getName() + "Tick: " + timeMeasurement( w.LastFiveTicksTime / 5 ) + ", Add: "
|
||||
+ timeMeasurement( w.LastFiveAddNode / 5 ) + ", Rmv: " + timeMeasurement( w.LastFiveRemoveTime / 5 ) );
|
||||
}
|
||||
|
||||
TickManagerCache tmc = (TickManagerCache) g.getCache( ITickManager.class );
|
||||
for (Class c : g.getMachineClasses())
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@ public class ToolReplicatorCard extends AEBaseItem
|
|||
|
||||
public ToolReplicatorCard() {
|
||||
super( ToolReplicatorCard.class );
|
||||
setfeature( EnumSet.of( AEFeature.Creative ) );
|
||||
setfeature( EnumSet.of( AEFeature.Debug, AEFeature.Creative ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -110,7 +110,7 @@ public class ToolReplicatorCard extends AEBaseItem
|
|||
TileEntity nte = blk.createTileEntity( world, meta );
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
ote.writeToNBT( data );
|
||||
nte.readFromNBT( data );
|
||||
nte.readFromNBT( (NBTTagCompound) data.copy() );
|
||||
world.setBlockTileEntity( i + rel_x, j + rel_y, k + rel_z, nte );
|
||||
}
|
||||
world.markBlockForUpdate( i + rel_x, j + rel_y, k + rel_z );
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package appeng.helpers;
|
||||
|
||||
import powercrystals.minefactoryreloaded.api.rednet.IConnectableRedNet;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import cpw.mods.fml.common.Optional.Interface;
|
||||
|
||||
public interface AEMultiTile extends IGridHost, IPartHost
|
||||
@Interface(iface = "powercrystals.minefactoryreloaded.api.rednet.IConnectableRedNet", modid = "MineFactoryReloaded")
|
||||
public interface AEMultiTile extends IGridHost, IPartHost, IConnectableRedNet
|
||||
{
|
||||
|
||||
}
|
||||
|
|
53
helpers/CellItemViewer.java
Normal file
53
helpers/CellItemViewer.java
Normal file
|
@ -0,0 +1,53 @@
|
|||
package appeng.helpers;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.implementations.IAEItemPowerStorage;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.MEMonitorHandler;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.me.storage.CellInventory;
|
||||
|
||||
public class CellItemViewer extends MEMonitorHandler<IAEItemStack> implements ICellItemViewer
|
||||
{
|
||||
|
||||
private ItemStack target;
|
||||
private IAEItemPowerStorage ips;
|
||||
|
||||
public CellItemViewer(ItemStack is) {
|
||||
super( CellInventory.getCell( is ) );
|
||||
ips = (IAEItemPowerStorage) is.getItem();
|
||||
target = is;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack()
|
||||
{
|
||||
return target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double extractAEPower(double amt, Actionable mode, PowerMultiplier usePowerMultiplier)
|
||||
{
|
||||
amt = usePowerMultiplier.multiply( amt );
|
||||
|
||||
if ( mode == Actionable.SIMULATE )
|
||||
return usePowerMultiplier.divide( Math.min( amt, ips.getAECurrentPower( getItemStack() ) ) );
|
||||
|
||||
return usePowerMultiplier.divide( ips.extractAEPower( getItemStack(), amt ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEItemStack> getItemInventory()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,447 +1,447 @@
|
|||
package appeng.helpers;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.implementations.ISegmentedInventory;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.MachineSource;
|
||||
import appeng.api.networking.ticking.IGridTickable;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.helpers.AENetworkProxy;
|
||||
import appeng.me.storage.MEMonitorIInventory;
|
||||
import appeng.me.storage.MEMonitorPassthu;
|
||||
import appeng.me.storage.NullInventory;
|
||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.tile.inventory.IAEAppEngInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.inv.AdaptorIInventory;
|
||||
import appeng.util.inv.IInventoryDestination;
|
||||
import appeng.util.inv.WrapperInvSlot;
|
||||
|
||||
public class DualityInterface implements IGridTickable, ISegmentedInventory, IStorageMonitorable, IInventoryDestination, IAEAppEngInventory
|
||||
{
|
||||
|
||||
final int sides[] = new int[] { 0, 1, 2, 3, 4, 5, 6, 7 };
|
||||
final IAEItemStack requireWork[] = new IAEItemStack[] { null, null, null, null, null, null, null, null };
|
||||
|
||||
boolean hasConfig = false;
|
||||
AENetworkProxy gridProxy;
|
||||
IInterfaceHost iHost;
|
||||
BaseActionSource mySrc;
|
||||
|
||||
public DualityInterface(AENetworkProxy prox, IInterfaceHost ih) {
|
||||
gridProxy = prox;
|
||||
iHost = ih;
|
||||
mySrc = fluids.changeSource = items.changeSource = new MachineSource( iHost );
|
||||
}
|
||||
|
||||
private void readConfig()
|
||||
{
|
||||
boolean hadConfig = hasConfig;
|
||||
|
||||
hasConfig = false;
|
||||
|
||||
for (ItemStack p : config)
|
||||
{
|
||||
if ( p != null )
|
||||
{
|
||||
hasConfig = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
boolean had = hasWorkToDo();
|
||||
|
||||
for (int x = 0; x < 8; x++)
|
||||
updatePlan( x );
|
||||
|
||||
boolean has = hasWorkToDo();
|
||||
|
||||
if ( had != has )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( has )
|
||||
gridProxy.getTick().wakeDevice( gridProxy.getNode() );
|
||||
else
|
||||
gridProxy.getTick().sleepDevice( gridProxy.getNode() );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
// :P
|
||||
}
|
||||
}
|
||||
|
||||
TileEntity te = iHost.getTileEntity();
|
||||
if ( hadConfig != hasConfig && te != null && te.worldObj != null )
|
||||
{
|
||||
te.worldObj.notifyBlocksOfNeighborChange( te.xCoord, te.yCoord, te.zCoord, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound data)
|
||||
{
|
||||
config.writeToNBT( data, "config" );
|
||||
patterns.writeToNBT( data, "patterns" );
|
||||
storage.writeToNBT( data, "storage" );
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound data)
|
||||
{
|
||||
config.readFromNBT( data, "config" );
|
||||
patterns.readFromNBT( data, "patterns" );
|
||||
storage.readFromNBT( data, "storage" );
|
||||
readConfig();
|
||||
}
|
||||
|
||||
AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 8 );
|
||||
AppEngInternalInventory storage = new AppEngInternalInventory( this, 8 );
|
||||
AppEngInternalInventory patterns = new AppEngInternalInventory( this, 9 );
|
||||
|
||||
WrapperInvSlot slotInv = new WrapperInvSlot( storage );
|
||||
InventoryAdaptor adaptor = new AdaptorIInventory( slotInv );
|
||||
|
||||
IMEInventory<IAEItemStack> destination;
|
||||
private boolean isWorking = false;
|
||||
|
||||
@Override
|
||||
public boolean canInsert(ItemStack stack)
|
||||
{
|
||||
IAEItemStack out = destination.injectItems( AEApi.instance().storage().createItemStack( stack ), Actionable.SIMULATE );
|
||||
if ( out == null )
|
||||
return true;
|
||||
return out.getStackSize() != stack.stackSize;
|
||||
// ItemStack after = adaptor.simulateAdd( stack );
|
||||
// if ( after == null )
|
||||
// return true;
|
||||
// return after.stackSize != stack.stackSize;
|
||||
}
|
||||
|
||||
private void updatePlan(int slot)
|
||||
{
|
||||
IAEItemStack req = config.getAEStackInSlot( slot );
|
||||
ItemStack Stored = storage.getStackInSlot( slot );
|
||||
|
||||
if ( req == null && Stored != null )
|
||||
{
|
||||
IAEItemStack work = AEApi.instance().storage().createItemStack( Stored );
|
||||
requireWork[slot] = work.setStackSize( -work.getStackSize() );
|
||||
return;
|
||||
}
|
||||
else if ( req != null )
|
||||
{
|
||||
if ( Stored == null ) // need to add stuff!
|
||||
{
|
||||
requireWork[slot] = req.copy();
|
||||
return;
|
||||
}
|
||||
else if ( req.isSameType( Stored ) ) // same type ( qty diffrent? )!
|
||||
{
|
||||
if ( req.getStackSize() != Stored.stackSize )
|
||||
{
|
||||
requireWork[slot] = req.copy();
|
||||
requireWork[slot].setStackSize( req.getStackSize() - Stored.stackSize );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if ( Stored != null ) // dispose!
|
||||
{
|
||||
IAEItemStack work = AEApi.instance().storage().createItemStack( Stored );
|
||||
requireWork[slot] = work.setStackSize( -work.getStackSize() );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// else
|
||||
|
||||
requireWork[slot] = null;
|
||||
}
|
||||
|
||||
static private boolean interfaceRequest = false;
|
||||
|
||||
class InterfaceInventory extends MEMonitorIInventory
|
||||
{
|
||||
|
||||
public InterfaceInventory(DualityInterface tileInterface) {
|
||||
super( tileInterface.storage, ForgeDirection.UP );
|
||||
mySource = new MachineSource( iHost );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectItems(IAEItemStack input, Actionable type)
|
||||
{
|
||||
if ( interfaceRequest )
|
||||
return input;
|
||||
|
||||
return super.injectItems( input, type );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack extractItems(IAEItemStack request, Actionable type)
|
||||
{
|
||||
if ( interfaceRequest )
|
||||
return null;
|
||||
|
||||
return super.extractItems( request, type );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
private boolean usePlan(int x, IAEItemStack itemStack)
|
||||
{
|
||||
boolean changed = false;
|
||||
slotInv.setSlot( x );
|
||||
interfaceRequest = isWorking = true;
|
||||
|
||||
try
|
||||
{
|
||||
destination = gridProxy.getStorage().getItemInventory();
|
||||
IEnergySource src = gridProxy.getEnergy();
|
||||
|
||||
if ( itemStack.getStackSize() > 0 )
|
||||
{
|
||||
IAEItemStack aquired = Platform.poweredExtraction( src, destination, itemStack, mySrc );
|
||||
if ( aquired != null )
|
||||
{
|
||||
changed = true;
|
||||
ItemStack issue = adaptor.addItems( aquired.getItemStack() );
|
||||
if ( issue != null )
|
||||
throw new RuntimeException( "bad attempt at managining inventory. ( addItems )" );
|
||||
}
|
||||
}
|
||||
else if ( itemStack.getStackSize() < 0 )
|
||||
{
|
||||
IAEItemStack toStore = itemStack.copy();
|
||||
toStore.setStackSize( -toStore.getStackSize() );
|
||||
|
||||
long diff = toStore.getStackSize();
|
||||
|
||||
toStore = Platform.poweredInsert( src, destination, toStore, mySrc );
|
||||
|
||||
if ( toStore != null )
|
||||
diff -= toStore.getStackSize();
|
||||
|
||||
if ( diff != 0 )
|
||||
{
|
||||
// extract items!
|
||||
changed = true;
|
||||
ItemStack removed = adaptor.removeItems( (int) diff, null, null );
|
||||
if ( removed == null )
|
||||
throw new RuntimeException( "bad attempt at managining inventory. ( addItems )" );
|
||||
else if ( removed.stackSize != diff )
|
||||
throw new RuntimeException( "bad attempt at managining inventory. ( addItems )" );
|
||||
}
|
||||
}
|
||||
// else wtf?
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
// :P
|
||||
}
|
||||
|
||||
if ( changed )
|
||||
updatePlan( x );
|
||||
|
||||
interfaceRequest = isWorking = false;
|
||||
return changed;
|
||||
}
|
||||
|
||||
public IInventory getConfig()
|
||||
{
|
||||
return config;
|
||||
}
|
||||
|
||||
public IInventory getPatterns()
|
||||
{
|
||||
return patterns;
|
||||
}
|
||||
|
||||
MEMonitorPassthu<IAEItemStack> items = new MEMonitorPassthu<IAEItemStack>( new NullInventory() );
|
||||
MEMonitorPassthu<IAEFluidStack> fluids = new MEMonitorPassthu<IAEFluidStack>( new NullInventory() );
|
||||
|
||||
public void gridChanged()
|
||||
{
|
||||
try
|
||||
{
|
||||
items.setInternal( gridProxy.getStorage().getItemInventory() );
|
||||
fluids.setInternal( gridProxy.getStorage().getFluidInventory() );
|
||||
}
|
||||
catch (GridAccessException gae)
|
||||
{
|
||||
items.setInternal( new NullInventory() );
|
||||
fluids.setInternal( new NullInventory() );
|
||||
}
|
||||
|
||||
TileEntity te = iHost.getTileEntity();
|
||||
te.worldObj.notifyBlocksOfNeighborChange( te.xCoord, te.yCoord, te.zCoord, 0 );
|
||||
}
|
||||
|
||||
public AECableType getCableConnectionType(ForgeDirection dir)
|
||||
{
|
||||
return AECableType.SMART;
|
||||
}
|
||||
|
||||
public DimensionalCoord getLocation()
|
||||
{
|
||||
return new DimensionalCoord( iHost.getTileEntity() );
|
||||
}
|
||||
|
||||
public IInventory getInternalInventory()
|
||||
{
|
||||
return storage;
|
||||
}
|
||||
|
||||
public void onInventoryChanged()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added)
|
||||
{
|
||||
if ( isWorking )
|
||||
return;
|
||||
|
||||
if ( inv == config )
|
||||
readConfig();
|
||||
else if ( inv == patterns )
|
||||
{
|
||||
|
||||
}
|
||||
else if ( inv == storage && slot >= 0 )
|
||||
{
|
||||
boolean had = hasWorkToDo();
|
||||
|
||||
updatePlan( slot );
|
||||
|
||||
boolean now = hasWorkToDo();
|
||||
|
||||
if ( had != now )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( now )
|
||||
gridProxy.getTick().wakeDevice( gridProxy.getNode() );
|
||||
else
|
||||
gridProxy.getTick().sleepDevice( gridProxy.getNode() );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
// :P
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasWorkToDo()
|
||||
{
|
||||
return requireWork[0] != null || requireWork[1] != null || requireWork[2] != null || requireWork[3] != null || requireWork[4] != null
|
||||
|| requireWork[5] != null || requireWork[6] != null || requireWork[7] != null;
|
||||
}
|
||||
|
||||
private boolean updateStorage()
|
||||
{
|
||||
boolean didSomething = false;
|
||||
|
||||
for (int x = 0; x < 8; x++)
|
||||
{
|
||||
if ( requireWork[x] != null )
|
||||
{
|
||||
didSomething = usePlan( x, requireWork[x] ) || didSomething;
|
||||
}
|
||||
}
|
||||
|
||||
return didSomething;
|
||||
}
|
||||
|
||||
public boolean hasConfig()
|
||||
{
|
||||
return hasConfig;
|
||||
}
|
||||
|
||||
public int[] getAccessibleSlotsFromSide(int side)
|
||||
{
|
||||
return sides;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickingRequest getTickingRequest(IGridNode node)
|
||||
{
|
||||
return new TickingRequest( 5, 120, !hasWorkToDo(), false );
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall)
|
||||
{
|
||||
boolean couldDoWork = updateStorage();
|
||||
return hasWorkToDo() ? (couldDoWork ? TickRateModulation.URGENT : TickRateModulation.SLOWER) : TickRateModulation.SLEEP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEItemStack> getItemInventory()
|
||||
{
|
||||
if ( hasConfig() )
|
||||
return new InterfaceInventory( this );
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory()
|
||||
{
|
||||
if ( hasConfig() )
|
||||
return null;
|
||||
|
||||
return fluids;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventoryByName(String name)
|
||||
{
|
||||
if ( name.equals( "storage" ) )
|
||||
return storage;
|
||||
|
||||
if ( name.equals( "patterns" ) )
|
||||
return patterns;
|
||||
|
||||
if ( name.equals( "config" ) )
|
||||
return config;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public IInventory getStorage()
|
||||
{
|
||||
return storage;
|
||||
}
|
||||
|
||||
public TileEntity getTile()
|
||||
{
|
||||
return (TileEntity) (iHost instanceof TileEntity ? iHost : null);
|
||||
}
|
||||
|
||||
public IPart getPart()
|
||||
{
|
||||
return (IPart) (iHost instanceof IPart ? iHost : null);
|
||||
}
|
||||
|
||||
}
|
||||
package appeng.helpers;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.implementations.ISegmentedInventory;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.MachineSource;
|
||||
import appeng.api.networking.ticking.IGridTickable;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.helpers.AENetworkProxy;
|
||||
import appeng.me.storage.MEMonitorIInventory;
|
||||
import appeng.me.storage.MEMonitorPassthu;
|
||||
import appeng.me.storage.NullInventory;
|
||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.tile.inventory.IAEAppEngInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.inv.AdaptorIInventory;
|
||||
import appeng.util.inv.IInventoryDestination;
|
||||
import appeng.util.inv.WrapperInvSlot;
|
||||
|
||||
public class DualityInterface implements IGridTickable, ISegmentedInventory, IStorageMonitorable, IInventoryDestination, IAEAppEngInventory
|
||||
{
|
||||
|
||||
final int sides[] = new int[] { 0, 1, 2, 3, 4, 5, 6, 7 };
|
||||
final IAEItemStack requireWork[] = new IAEItemStack[] { null, null, null, null, null, null, null, null };
|
||||
|
||||
boolean hasConfig = false;
|
||||
AENetworkProxy gridProxy;
|
||||
IInterfaceHost iHost;
|
||||
BaseActionSource mySrc;
|
||||
|
||||
public DualityInterface(AENetworkProxy prox, IInterfaceHost ih) {
|
||||
gridProxy = prox;
|
||||
iHost = ih;
|
||||
mySrc = fluids.changeSource = items.changeSource = new MachineSource( iHost );
|
||||
}
|
||||
|
||||
private void readConfig()
|
||||
{
|
||||
boolean hadConfig = hasConfig;
|
||||
|
||||
hasConfig = false;
|
||||
|
||||
for (ItemStack p : config)
|
||||
{
|
||||
if ( p != null )
|
||||
{
|
||||
hasConfig = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
boolean had = hasWorkToDo();
|
||||
|
||||
for (int x = 0; x < 8; x++)
|
||||
updatePlan( x );
|
||||
|
||||
boolean has = hasWorkToDo();
|
||||
|
||||
if ( had != has )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( has )
|
||||
gridProxy.getTick().wakeDevice( gridProxy.getNode() );
|
||||
else
|
||||
gridProxy.getTick().sleepDevice( gridProxy.getNode() );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
// :P
|
||||
}
|
||||
}
|
||||
|
||||
TileEntity te = iHost.getTileEntity();
|
||||
if ( hadConfig != hasConfig && te != null && te.worldObj != null )
|
||||
{
|
||||
te.worldObj.notifyBlocksOfNeighborChange( te.xCoord, te.yCoord, te.zCoord, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound data)
|
||||
{
|
||||
config.writeToNBT( data, "config" );
|
||||
patterns.writeToNBT( data, "patterns" );
|
||||
storage.writeToNBT( data, "storage" );
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound data)
|
||||
{
|
||||
config.readFromNBT( data, "config" );
|
||||
patterns.readFromNBT( data, "patterns" );
|
||||
storage.readFromNBT( data, "storage" );
|
||||
readConfig();
|
||||
}
|
||||
|
||||
AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 8 );
|
||||
AppEngInternalInventory storage = new AppEngInternalInventory( this, 8 );
|
||||
AppEngInternalInventory patterns = new AppEngInternalInventory( this, 9 );
|
||||
|
||||
WrapperInvSlot slotInv = new WrapperInvSlot( storage );
|
||||
InventoryAdaptor adaptor = new AdaptorIInventory( slotInv );
|
||||
|
||||
IMEInventory<IAEItemStack> destination;
|
||||
private boolean isWorking = false;
|
||||
|
||||
@Override
|
||||
public boolean canInsert(ItemStack stack)
|
||||
{
|
||||
IAEItemStack out = destination.injectItems( AEApi.instance().storage().createItemStack( stack ), Actionable.SIMULATE, null );
|
||||
if ( out == null )
|
||||
return true;
|
||||
return out.getStackSize() != stack.stackSize;
|
||||
// ItemStack after = adaptor.simulateAdd( stack );
|
||||
// if ( after == null )
|
||||
// return true;
|
||||
// return after.stackSize != stack.stackSize;
|
||||
}
|
||||
|
||||
private void updatePlan(int slot)
|
||||
{
|
||||
IAEItemStack req = config.getAEStackInSlot( slot );
|
||||
ItemStack Stored = storage.getStackInSlot( slot );
|
||||
|
||||
if ( req == null && Stored != null )
|
||||
{
|
||||
IAEItemStack work = AEApi.instance().storage().createItemStack( Stored );
|
||||
requireWork[slot] = work.setStackSize( -work.getStackSize() );
|
||||
return;
|
||||
}
|
||||
else if ( req != null )
|
||||
{
|
||||
if ( Stored == null ) // need to add stuff!
|
||||
{
|
||||
requireWork[slot] = req.copy();
|
||||
return;
|
||||
}
|
||||
else if ( req.isSameType( Stored ) ) // same type ( qty diffrent? )!
|
||||
{
|
||||
if ( req.getStackSize() != Stored.stackSize )
|
||||
{
|
||||
requireWork[slot] = req.copy();
|
||||
requireWork[slot].setStackSize( req.getStackSize() - Stored.stackSize );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if ( Stored != null ) // dispose!
|
||||
{
|
||||
IAEItemStack work = AEApi.instance().storage().createItemStack( Stored );
|
||||
requireWork[slot] = work.setStackSize( -work.getStackSize() );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// else
|
||||
|
||||
requireWork[slot] = null;
|
||||
}
|
||||
|
||||
static private boolean interfaceRequest = false;
|
||||
|
||||
class InterfaceInventory extends MEMonitorIInventory
|
||||
{
|
||||
|
||||
public InterfaceInventory(DualityInterface tileInterface) {
|
||||
super( tileInterface.storage, ForgeDirection.UP );
|
||||
mySource = new MachineSource( iHost );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectItems(IAEItemStack input, Actionable type, BaseActionSource src)
|
||||
{
|
||||
if ( interfaceRequest )
|
||||
return input;
|
||||
|
||||
return super.injectItems( input, type, src );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack extractItems(IAEItemStack request, Actionable type, BaseActionSource src)
|
||||
{
|
||||
if ( interfaceRequest )
|
||||
return null;
|
||||
|
||||
return super.extractItems( request, type, src );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
private boolean usePlan(int x, IAEItemStack itemStack)
|
||||
{
|
||||
boolean changed = false;
|
||||
slotInv.setSlot( x );
|
||||
interfaceRequest = isWorking = true;
|
||||
|
||||
try
|
||||
{
|
||||
destination = gridProxy.getStorage().getItemInventory();
|
||||
IEnergySource src = gridProxy.getEnergy();
|
||||
|
||||
if ( itemStack.getStackSize() > 0 )
|
||||
{
|
||||
IAEItemStack aquired = Platform.poweredExtraction( src, destination, itemStack, mySrc );
|
||||
if ( aquired != null )
|
||||
{
|
||||
changed = true;
|
||||
ItemStack issue = adaptor.addItems( aquired.getItemStack() );
|
||||
if ( issue != null )
|
||||
throw new RuntimeException( "bad attempt at managining inventory. ( addItems )" );
|
||||
}
|
||||
}
|
||||
else if ( itemStack.getStackSize() < 0 )
|
||||
{
|
||||
IAEItemStack toStore = itemStack.copy();
|
||||
toStore.setStackSize( -toStore.getStackSize() );
|
||||
|
||||
long diff = toStore.getStackSize();
|
||||
|
||||
toStore = Platform.poweredInsert( src, destination, toStore, mySrc );
|
||||
|
||||
if ( toStore != null )
|
||||
diff -= toStore.getStackSize();
|
||||
|
||||
if ( diff != 0 )
|
||||
{
|
||||
// extract items!
|
||||
changed = true;
|
||||
ItemStack removed = adaptor.removeItems( (int) diff, null, null );
|
||||
if ( removed == null )
|
||||
throw new RuntimeException( "bad attempt at managining inventory. ( addItems )" );
|
||||
else if ( removed.stackSize != diff )
|
||||
throw new RuntimeException( "bad attempt at managining inventory. ( addItems )" );
|
||||
}
|
||||
}
|
||||
// else wtf?
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
// :P
|
||||
}
|
||||
|
||||
if ( changed )
|
||||
updatePlan( x );
|
||||
|
||||
interfaceRequest = isWorking = false;
|
||||
return changed;
|
||||
}
|
||||
|
||||
public IInventory getConfig()
|
||||
{
|
||||
return config;
|
||||
}
|
||||
|
||||
public IInventory getPatterns()
|
||||
{
|
||||
return patterns;
|
||||
}
|
||||
|
||||
MEMonitorPassthu<IAEItemStack> items = new MEMonitorPassthu<IAEItemStack>( new NullInventory() );
|
||||
MEMonitorPassthu<IAEFluidStack> fluids = new MEMonitorPassthu<IAEFluidStack>( new NullInventory() );
|
||||
|
||||
public void gridChanged()
|
||||
{
|
||||
try
|
||||
{
|
||||
items.setInternal( gridProxy.getStorage().getItemInventory() );
|
||||
fluids.setInternal( gridProxy.getStorage().getFluidInventory() );
|
||||
}
|
||||
catch (GridAccessException gae)
|
||||
{
|
||||
items.setInternal( new NullInventory() );
|
||||
fluids.setInternal( new NullInventory() );
|
||||
}
|
||||
|
||||
TileEntity te = iHost.getTileEntity();
|
||||
te.worldObj.notifyBlocksOfNeighborChange( te.xCoord, te.yCoord, te.zCoord, 0 );
|
||||
}
|
||||
|
||||
public AECableType getCableConnectionType(ForgeDirection dir)
|
||||
{
|
||||
return AECableType.SMART;
|
||||
}
|
||||
|
||||
public DimensionalCoord getLocation()
|
||||
{
|
||||
return new DimensionalCoord( iHost.getTileEntity() );
|
||||
}
|
||||
|
||||
public IInventory getInternalInventory()
|
||||
{
|
||||
return storage;
|
||||
}
|
||||
|
||||
public void onInventoryChanged()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added)
|
||||
{
|
||||
if ( isWorking )
|
||||
return;
|
||||
|
||||
if ( inv == config )
|
||||
readConfig();
|
||||
else if ( inv == patterns )
|
||||
{
|
||||
|
||||
}
|
||||
else if ( inv == storage && slot >= 0 )
|
||||
{
|
||||
boolean had = hasWorkToDo();
|
||||
|
||||
updatePlan( slot );
|
||||
|
||||
boolean now = hasWorkToDo();
|
||||
|
||||
if ( had != now )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( now )
|
||||
gridProxy.getTick().wakeDevice( gridProxy.getNode() );
|
||||
else
|
||||
gridProxy.getTick().sleepDevice( gridProxy.getNode() );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
// :P
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasWorkToDo()
|
||||
{
|
||||
return requireWork[0] != null || requireWork[1] != null || requireWork[2] != null || requireWork[3] != null || requireWork[4] != null
|
||||
|| requireWork[5] != null || requireWork[6] != null || requireWork[7] != null;
|
||||
}
|
||||
|
||||
private boolean updateStorage()
|
||||
{
|
||||
boolean didSomething = false;
|
||||
|
||||
for (int x = 0; x < 8; x++)
|
||||
{
|
||||
if ( requireWork[x] != null )
|
||||
{
|
||||
didSomething = usePlan( x, requireWork[x] ) || didSomething;
|
||||
}
|
||||
}
|
||||
|
||||
return didSomething;
|
||||
}
|
||||
|
||||
public boolean hasConfig()
|
||||
{
|
||||
return hasConfig;
|
||||
}
|
||||
|
||||
public int[] getAccessibleSlotsFromSide(int side)
|
||||
{
|
||||
return sides;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickingRequest getTickingRequest(IGridNode node)
|
||||
{
|
||||
return new TickingRequest( 5, 120, !hasWorkToDo(), false );
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall)
|
||||
{
|
||||
boolean couldDoWork = updateStorage();
|
||||
return hasWorkToDo() ? (couldDoWork ? TickRateModulation.URGENT : TickRateModulation.SLOWER) : TickRateModulation.SLEEP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEItemStack> getItemInventory()
|
||||
{
|
||||
if ( hasConfig() )
|
||||
return new InterfaceInventory( this );
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory()
|
||||
{
|
||||
if ( hasConfig() )
|
||||
return null;
|
||||
|
||||
return fluids;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventoryByName(String name)
|
||||
{
|
||||
if ( name.equals( "storage" ) )
|
||||
return storage;
|
||||
|
||||
if ( name.equals( "patterns" ) )
|
||||
return patterns;
|
||||
|
||||
if ( name.equals( "config" ) )
|
||||
return config;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public IInventory getStorage()
|
||||
{
|
||||
return storage;
|
||||
}
|
||||
|
||||
public TileEntity getTile()
|
||||
{
|
||||
return (TileEntity) (iHost instanceof TileEntity ? iHost : null);
|
||||
}
|
||||
|
||||
public IPart getPart()
|
||||
{
|
||||
return (IPart) (iHost instanceof IPart ? iHost : null);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
14
helpers/ICellItemViewer.java
Normal file
14
helpers/ICellItemViewer.java
Normal file
|
@ -0,0 +1,14 @@
|
|||
package appeng.helpers;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
|
||||
public interface ICellItemViewer extends IStorageMonitorable, IMEMonitor<IAEItemStack>, IEnergySource
|
||||
{
|
||||
|
||||
public ItemStack getItemStack();
|
||||
|
||||
}
|
10
helpers/IGuiItem.java
Normal file
10
helpers/IGuiItem.java
Normal file
|
@ -0,0 +1,10 @@
|
|||
package appeng.helpers;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IGuiItem
|
||||
{
|
||||
|
||||
Object getGuiObject(ItemStack is);
|
||||
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
package appeng.helpers;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import appeng.api.networking.IGridHost;
|
||||
|
||||
public interface IInterfaceHost extends IGridHost
|
||||
{
|
||||
|
||||
DualityInterface getInterfaceDuality();
|
||||
|
||||
TileEntity getTileEntity();
|
||||
}
|
||||
package appeng.helpers;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import appeng.api.networking.IGridHost;
|
||||
|
||||
public interface IInterfaceHost extends IGridHost
|
||||
{
|
||||
|
||||
DualityInterface getInterfaceDuality();
|
||||
|
||||
TileEntity getTileEntity();
|
||||
}
|
||||
|
|
|
@ -20,8 +20,10 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
|||
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.parts.IFacadePart;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.parts.IPartItem;
|
||||
import appeng.api.parts.PartItemStack;
|
||||
import appeng.api.parts.SelectedPart;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.sync.packets.PacketPartPlacement;
|
||||
|
@ -67,10 +69,7 @@ public class PartPlacement
|
|||
|
||||
ForgeDirection side = ForgeDirection.getOrientation( face );
|
||||
|
||||
if ( held == null )
|
||||
return false;
|
||||
|
||||
if ( Platform.isWrench( player, held, x, y, z ) )
|
||||
if ( held != null && Platform.isWrench( player, held, x, y, z ) && player.isSneaking() )
|
||||
{
|
||||
int block = world.getBlockId( x, y, z );
|
||||
TileEntity tile = world.getBlockTileEntity( x, y, z );
|
||||
|
@ -92,7 +91,7 @@ public class PartPlacement
|
|||
|
||||
if ( sp.part != null )
|
||||
{
|
||||
is.add( sp.part.getItemStack( true ) );
|
||||
is.add( sp.part.getItemStack( PartItemStack.Wrench ) );
|
||||
sp.part.getDrops( is, true );
|
||||
host.removePart( sp.side );
|
||||
}
|
||||
|
@ -132,51 +131,86 @@ public class PartPlacement
|
|||
if ( tile instanceof IPartHost )
|
||||
host = (IPartHost) tile;
|
||||
|
||||
IFacadePart fp = isFacade( held, side );
|
||||
if ( fp != null )
|
||||
if ( held != null )
|
||||
{
|
||||
if ( host != null )
|
||||
IFacadePart fp = isFacade( held, side );
|
||||
if ( fp != null )
|
||||
{
|
||||
if ( !world.isRemote )
|
||||
if ( host != null )
|
||||
{
|
||||
if ( host.getPart( ForgeDirection.UNKNOWN ) == null )
|
||||
return false;
|
||||
if ( !world.isRemote )
|
||||
{
|
||||
if ( host.getPart( ForgeDirection.UNKNOWN ) == null )
|
||||
return false;
|
||||
|
||||
if ( host.getFacadeContainer().addFacade( fp ) )
|
||||
{
|
||||
host.markForUpdate();
|
||||
if ( !player.capabilities.isCreativeMode )
|
||||
if ( host.getFacadeContainer().addFacade( fp ) )
|
||||
{
|
||||
held.stackSize--;
|
||||
if ( held.stackSize == 0 )
|
||||
host.markForUpdate();
|
||||
if ( !player.capabilities.isCreativeMode )
|
||||
{
|
||||
player.inventory.mainInventory[player.inventory.currentItem] = null;
|
||||
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( player, held ) );
|
||||
held.stackSize--;
|
||||
if ( held.stackSize == 0 )
|
||||
{
|
||||
player.inventory.mainInventory[player.inventory.currentItem] = null;
|
||||
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( player, held ) );
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.swingItem();
|
||||
try
|
||||
{
|
||||
PacketDispatcher.sendPacketToServer( (new PacketPartPlacement( x, y, z, face )).getPacket() );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.swingItem();
|
||||
try
|
||||
{
|
||||
PacketDispatcher.sendPacketToServer( (new PacketPartPlacement( x, y, z, face )).getPacket() );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( host == null && tile != null && AppEng.instance.isIntegrationEnabled( "FMP" ) )
|
||||
host = ((IFMP) AppEng.instance.getIntegration( "FMP" )).getOrCreateHost( tile );
|
||||
|
||||
if ( !(held.getItem() instanceof IPartItem) )
|
||||
// if ( held == null )
|
||||
{
|
||||
int block = world.getBlockId( x, y, z );
|
||||
if ( host != null && player.isSneaking() && Block.blocksList[block] != null )
|
||||
{
|
||||
LookDirection dir = Platform.getPlayerRay( player );
|
||||
MovingObjectPosition mop = Block.blocksList[block].collisionRayTrace( world, x, y, z, dir.a, dir.b );
|
||||
if ( mop != null )
|
||||
{
|
||||
mop.hitVec = mop.hitVec.addVector( -mop.blockX, -mop.blockY, -mop.blockZ );
|
||||
SelectedPart sPart = host.selectPart( mop.hitVec );
|
||||
if ( sPart != null && sPart.part != null )
|
||||
if ( sPart.part.onShiftActivate( player, mop.hitVec ) )
|
||||
{
|
||||
if ( world.isRemote )
|
||||
{
|
||||
try
|
||||
{
|
||||
PacketDispatcher.sendPacketToServer( (new PacketPartPlacement( x, y, z, face )).getPacket() );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( held == null || !(held.getItem() instanceof IPartItem) )
|
||||
return false;
|
||||
|
||||
int te_x = x;
|
||||
|
@ -234,6 +268,8 @@ public class PartPlacement
|
|||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( host == null )
|
||||
|
@ -256,16 +292,21 @@ public class PartPlacement
|
|||
host = ((IFMP) AppEng.instance.getIntegration( "FMP" )).getOrCreateHost( tile );
|
||||
|
||||
if ( (blkID == 0 || Block.blocksList[blkID].isBlockReplaceable( world, te_x, te_y, te_z ) || host != null) && offset != ForgeDirection.UNKNOWN )
|
||||
return place( held, te_x, te_y, te_z, side.getOpposite().ordinal(), player, world, pass == PlaceType.INTERACT_FIRST_PASS ? PlaceType.INTERACT_SECOND_PASS
|
||||
: PlaceType.PLACE_ITEM, depth + 1 );
|
||||
return place( held, te_x, te_y, te_z, side.getOpposite().ordinal(), player, world,
|
||||
pass == PlaceType.INTERACT_FIRST_PASS ? PlaceType.INTERACT_SECOND_PASS : PlaceType.PLACE_ITEM, depth + 1 );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( !world.isRemote )
|
||||
{
|
||||
if ( host.addPart( held, side ) != null )
|
||||
ForgeDirection mySide = host.addPart( held, side );
|
||||
if ( mySide != null )
|
||||
{
|
||||
IPart newlyPlacedPart = host.getPart( mySide );
|
||||
if ( newlyPlacedPart != null )
|
||||
newlyPlacedPart.onPlacement( player, held, side );
|
||||
|
||||
StepSound ss = AEApi.instance().blocks().blockMultiPart.block().stepSound;
|
||||
world.playSoundEffect( 0.5 + x, 0.5 + y, 0.5 + z, ss.getPlaceSound(), (ss.getVolume() + 1.0F) / 2.0F, ss.getPitch() * 0.8F );
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ public class TickHandler implements ITickHandler
|
|||
@Override
|
||||
public EnumSet<TickType> ticks()
|
||||
{
|
||||
return EnumSet.of( TickType.WORLD );
|
||||
return EnumSet.of( TickType.SERVER );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,22 +1,11 @@
|
|||
package appeng.integration.abstraction;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public interface IIC2
|
||||
{
|
||||
|
||||
boolean canUse(ItemStack i, int powerusage);
|
||||
|
||||
boolean use(ItemStack i, int powerusage, EntityPlayer p);
|
||||
|
||||
int discharge(ItemStack i, int powerusage, int tier, boolean ignoreTransferLimit, boolean simulate);
|
||||
|
||||
void addCompressorRecipe(ItemStack dustRecipe, ItemStack matQuartz);
|
||||
|
||||
void addMaceratorRecipe(ItemStack itemStack, ItemStack matFlour);
|
||||
|
||||
void addToEnergyNet(TileEntity appEngTile);
|
||||
|
||||
void removeFromEnergyNet(TileEntity appEngTile);
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package appeng.integration.abstraction;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public interface ITE
|
||||
{
|
||||
|
@ -9,4 +11,6 @@ public interface ITE
|
|||
|
||||
void addPulverizerRecipe(int i, ItemStack blkQuartzOre, ItemStack matQuartz, ItemStack matQuartzDust);
|
||||
|
||||
boolean isPipe(TileEntity te, ForgeDirection opposite);
|
||||
|
||||
}
|
||||
|
|
|
@ -3,10 +3,12 @@ package appeng.integration.modules;
|
|||
import ic2.api.recipe.RecipeInputItemStack;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.integration.IIntegrationModule;
|
||||
import appeng.integration.abstraction.IIC2;
|
||||
|
||||
public class IC2 implements IIntegrationModule
|
||||
public class IC2 implements IIntegrationModule, IIC2
|
||||
{
|
||||
|
||||
public static IC2 instance;
|
||||
|
@ -21,24 +23,48 @@ public class IC2 implements IIntegrationModule
|
|||
@Override
|
||||
public void PostInit()
|
||||
{
|
||||
AEApi.instance().registries().matterCannon().registerAmmo( getItem( "uraniumDrop" ), 238.0289 );
|
||||
|
||||
// certus quartz
|
||||
maceratorRecipe( AEApi.instance().materials().materialCertusQuartzCrystal.stack( 1 ),
|
||||
AEApi.instance().materials().materialCertusQuartzDust.stack( 1 ) );
|
||||
maceratorRecipe( AEApi.instance().materials().materialCertusQuartzCrystal.stack( 1 ), AEApi.instance().materials().materialCertusQuartzDust.stack( 1 ) );
|
||||
|
||||
maceratorRecipe( AEApi.instance().materials().materialCertusQuartzCrystalCharged.stack( 1 ),
|
||||
AEApi.instance().materials().materialCertusQuartzDust.stack( 1 ) );
|
||||
|
||||
// fluix
|
||||
maceratorRecipe( AEApi.instance().materials().materialFluixCrystal.stack( 1 ),
|
||||
AEApi.instance().materials().materialFluixDust.stack( 1 ) );
|
||||
maceratorRecipe( AEApi.instance().materials().materialFluixCrystal.stack( 1 ), AEApi.instance().materials().materialFluixDust.stack( 1 ) );
|
||||
|
||||
// nether quartz
|
||||
maceratorRecipe( new ItemStack( Item.netherQuartz ), AEApi.instance().materials().materialNetherQuartzDust.stack( 1 ) );
|
||||
}
|
||||
|
||||
/*
|
||||
* private void compressorRecipe(ItemStack in, ItemStack out) { ic2.api.recipe.Recipes.compressor.addRecipe( new
|
||||
* RecipeInputItemStack( in, in.stackSize ), null, out ); }
|
||||
*/
|
||||
private void maceratorRecipe(ItemStack in, ItemStack out)
|
||||
{
|
||||
ic2.api.recipe.Recipes.macerator.addRecipe( new RecipeInputItemStack( in, in.stackSize ), null, out );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addToEnergyNet(TileEntity appEngTile)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFromEnergyNet(TileEntity appEngTile)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItem(String name)
|
||||
{
|
||||
return ic2.api.item.Items.getItem( name );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ package appeng.integration.modules;
|
|||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.integration.IIntegrationModule;
|
||||
|
||||
|
@ -21,11 +23,9 @@ public class TE implements IIntegrationModule
|
|||
public void PostInit()
|
||||
{
|
||||
// certus quartz
|
||||
pulverizer( AEApi.instance().materials().materialCertusQuartzCrystal.stack( 1 ),
|
||||
AEApi.instance().materials().materialCertusQuartzDust.stack( 1 ) );
|
||||
pulverizer( AEApi.instance().materials().materialCertusQuartzCrystal.stack( 1 ), AEApi.instance().materials().materialCertusQuartzDust.stack( 1 ) );
|
||||
|
||||
pulverizer( AEApi.instance().materials().materialCertusQuartzCrystalCharged.stack( 1 ),
|
||||
AEApi.instance().materials().materialCertusQuartzDust.stack( 1 ) );
|
||||
pulverizer( AEApi.instance().materials().materialCertusQuartzCrystalCharged.stack( 1 ), AEApi.instance().materials().materialCertusQuartzDust.stack( 1 ) );
|
||||
|
||||
// fluix
|
||||
pulverizer( AEApi.instance().materials().materialFluixCrystal.stack( 1 ), AEApi.instance().materials().materialFluixDust.stack( 1 ) );
|
||||
|
@ -39,4 +39,16 @@ public class TE implements IIntegrationModule
|
|||
thermalexpansion.api.crafting.CraftingManagers.pulverizerManager.addRecipe( 320, in, out );
|
||||
}
|
||||
|
||||
public void addItemsToPipe(TileEntity ad, ItemStack itemstack, ForgeDirection dir)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public boolean canAddItemsToPipe(TileEntity ad, ItemStack itemstack, ForgeDirection dir)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package appeng.integration.modules.helpers;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
|
@ -27,7 +28,7 @@ public class BCPipeInventory implements IMEInventory<IAEItemStack>
|
|||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectItems(IAEItemStack input, Actionable mode)
|
||||
public IAEItemStack injectItems(IAEItemStack input, Actionable mode, BaseActionSource src)
|
||||
{
|
||||
if ( mode == Actionable.SIMULATE )
|
||||
{
|
||||
|
@ -42,7 +43,7 @@ public class BCPipeInventory implements IMEInventory<IAEItemStack>
|
|||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack extractItems(IAEItemStack request, Actionable mode)
|
||||
public IAEItemStack extractItems(IAEItemStack request, Actionable mode, BaseActionSource src)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import net.mcft.copy.betterstorage.api.ICrateStorage;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
|
@ -28,7 +29,7 @@ public class BSCrate implements IMEInventory<IAEItemStack>
|
|||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectItems(IAEItemStack input, Actionable mode)
|
||||
public IAEItemStack injectItems(IAEItemStack input, Actionable mode, BaseActionSource src)
|
||||
{
|
||||
if ( mode == Actionable.SIMULATE )
|
||||
return null;
|
||||
|
@ -41,7 +42,7 @@ public class BSCrate implements IMEInventory<IAEItemStack>
|
|||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack extractItems(IAEItemStack request, Actionable mode)
|
||||
public IAEItemStack extractItems(IAEItemStack request, Actionable mode, BaseActionSource src)
|
||||
{
|
||||
if ( mode == Actionable.SIMULATE )
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@ package appeng.integration.modules.helpers;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
|
@ -48,7 +49,7 @@ public class FactorizationBarrel implements IMEInventory<IAEItemStack>
|
|||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectItems(IAEItemStack input, Actionable mode)
|
||||
public IAEItemStack injectItems(IAEItemStack input, Actionable mode, BaseActionSource src)
|
||||
{
|
||||
if ( input == null )
|
||||
return null;
|
||||
|
@ -89,7 +90,7 @@ public class FactorizationBarrel implements IMEInventory<IAEItemStack>
|
|||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack extractItems(IAEItemStack request, Actionable mode)
|
||||
public IAEItemStack extractItems(IAEItemStack request, Actionable mode, BaseActionSource src)
|
||||
{
|
||||
if ( containsItemType( request ) )
|
||||
{
|
||||
|
|
|
@ -4,6 +4,7 @@ import gregtechmod.api.interfaces.IDigitalChest;
|
|||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.me.storage.MEIInventoryWrapper;
|
||||
|
@ -29,7 +30,7 @@ public class GregTechQuantumChest extends MEIInventoryWrapper
|
|||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectItems(IAEItemStack input, Actionable mode)
|
||||
public IAEItemStack injectItems(IAEItemStack input, Actionable mode, BaseActionSource src)
|
||||
{
|
||||
ItemStack type = getType();
|
||||
if ( input.hasTagCompound() )
|
||||
|
@ -52,7 +53,7 @@ public class GregTechQuantumChest extends MEIInventoryWrapper
|
|||
if ( mode == Actionable.MODULATE )
|
||||
qc.setItemCount( type.stackSize + room );
|
||||
|
||||
return super.injectItems( is, mode );
|
||||
return super.injectItems( is, mode, src );
|
||||
}
|
||||
|
||||
if ( mode == Actionable.MODULATE )
|
||||
|
@ -61,14 +62,14 @@ public class GregTechQuantumChest extends MEIInventoryWrapper
|
|||
return null;
|
||||
}
|
||||
|
||||
return super.injectItems( input, mode );
|
||||
return super.injectItems( input, mode, src );
|
||||
}
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack extractItems(IAEItemStack i, Actionable mode)
|
||||
public IAEItemStack extractItems(IAEItemStack i, Actionable mode, BaseActionSource src)
|
||||
{
|
||||
ItemStack type = getType();
|
||||
if ( type != null )
|
||||
|
@ -85,7 +86,7 @@ public class GregTechQuantumChest extends MEIInventoryWrapper
|
|||
}
|
||||
}
|
||||
}
|
||||
return super.extractItems( i, mode );
|
||||
return super.extractItems( i, mode, src );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,6 +4,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import powercrystals.minefactoryreloaded.api.IDeepStorageUnit;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
|
@ -28,7 +29,7 @@ public class MFRDSU implements IMEInventory<IAEItemStack>
|
|||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectItems(IAEItemStack input, Actionable mode)
|
||||
public IAEItemStack injectItems(IAEItemStack input, Actionable mode, BaseActionSource src)
|
||||
{
|
||||
ItemStack is = dsu.getStoredItemType();
|
||||
if ( is != null )
|
||||
|
@ -66,7 +67,7 @@ public class MFRDSU implements IMEInventory<IAEItemStack>
|
|||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack extractItems(IAEItemStack request, Actionable mode)
|
||||
public IAEItemStack extractItems(IAEItemStack request, Actionable mode, BaseActionSource src)
|
||||
{
|
||||
ItemStack is = dsu.getStoredItemType();
|
||||
if ( request.equals( is ) )
|
||||
|
|
|
@ -1,24 +1,33 @@
|
|||
package appeng.items.materials;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.implementations.IItemGroup;
|
||||
import appeng.api.implementations.IStorageComponent;
|
||||
import appeng.api.implementations.IUpgradeModule;
|
||||
import appeng.core.Configuration;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.AEFeatureHandler;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ItemMaterial extends AEBaseItem implements IStorageComponent, IUpgradeModule
|
||||
{
|
||||
|
@ -28,6 +37,75 @@ public class ItemMaterial extends AEBaseItem implements IStorageComponent, IUpgr
|
|||
public ItemMaterial() {
|
||||
super( ItemMaterial.class );
|
||||
setfeature( EnumSet.of( AEFeature.Core ) );
|
||||
setHasSubtypes( true );
|
||||
}
|
||||
|
||||
class SlightlyBetterSort implements Comparator<String>
|
||||
{
|
||||
|
||||
Pattern p;
|
||||
|
||||
public SlightlyBetterSort(Pattern p) {
|
||||
this.p = p;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(String o1, String o2)
|
||||
{
|
||||
try
|
||||
{
|
||||
Matcher a = p.matcher( o1 );
|
||||
Matcher b = p.matcher( o2 );
|
||||
if ( a.find() && b.find() )
|
||||
{
|
||||
int ia = Integer.parseInt( a.group( 1 ) );
|
||||
int ib = Integer.parseInt( b.group( 1 ) );
|
||||
return Integer.compare( ia, ib );
|
||||
}
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
// ek!
|
||||
}
|
||||
return o1.compareTo( o2 );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
{
|
||||
super.addInformation( par1ItemStack, par2EntityPlayer, par3List, par4 );
|
||||
|
||||
Upgrades u = getType( par1ItemStack );
|
||||
if ( u != null )
|
||||
{
|
||||
List<String> textList = new LinkedList();
|
||||
for (Entry<ItemStack, Integer> j : u.getSupported().entrySet())
|
||||
{
|
||||
String name = null;
|
||||
|
||||
int limit = j.getValue();
|
||||
|
||||
if ( j.getKey().getItem() instanceof IItemGroup )
|
||||
{
|
||||
IItemGroup ig = (IItemGroup) j.getKey().getItem();
|
||||
String str = ig.getUnlocalizedGroupName( j.getKey() );
|
||||
if ( str != null )
|
||||
name = Platform.gui_localize( str ) + (limit > 1 ? " (" + limit + ")" : "");
|
||||
}
|
||||
|
||||
if ( name == null )
|
||||
name = j.getKey().getDisplayName() + (limit > 1 ? " (" + limit + ")" : "");
|
||||
|
||||
if ( !textList.contains( name ) )
|
||||
textList.add( name );
|
||||
}
|
||||
|
||||
Pattern p = Pattern.compile( "(\\d+)[^\\d]" );
|
||||
SlightlyBetterSort s = new SlightlyBetterSort( p );
|
||||
Collections.sort( textList, s );
|
||||
par3List.addAll( textList );
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack createMaterial(MaterialType mat)
|
||||
|
@ -72,21 +150,26 @@ public class ItemMaterial extends AEBaseItem implements IStorageComponent, IUpgr
|
|||
return dmgToMaterial.get( dmg ).icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack is)
|
||||
private String nameOf(ItemStack is)
|
||||
{
|
||||
return AEFeatureHandler.getName( ItemMaterial.class, getTypeByStack( is ).name() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister par1IconRegister)
|
||||
public String getUnlocalizedName(ItemStack is)
|
||||
{
|
||||
return "item.appliedenergistics2." + nameOf( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister icoRegister)
|
||||
{
|
||||
for (MaterialType mat : MaterialType.values())
|
||||
{
|
||||
if ( mat.damageValue != -1 )
|
||||
{
|
||||
String tex = "appliedenergistics2:" + getUnlocalizedName( new ItemStack( this, 1, mat.damageValue ) );
|
||||
mat.icon = par1IconRegister.registerIcon( tex );
|
||||
String tex = "appliedenergistics2:" + nameOf( new ItemStack( this, 1, mat.damageValue ) );
|
||||
mat.icon = icoRegister.registerIcon( tex );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -169,6 +252,8 @@ public class ItemMaterial extends AEBaseItem implements IStorageComponent, IUpgr
|
|||
return Upgrades.REDSTONE;
|
||||
case CardSpeed:
|
||||
return Upgrades.SPEED;
|
||||
case CardInverter:
|
||||
return Upgrades.INVERTER;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ public enum MaterialType
|
|||
BasicCard, CardRedstone, CardCapacity,
|
||||
|
||||
// Adv Cards
|
||||
AdvCard, CardFuzzy, CardSpeed,
|
||||
AdvCard, CardFuzzy, CardSpeed, CardInverter,
|
||||
|
||||
Cell2SpatialPart(AEFeature.SpatialIO), Cell16SpatialPart(AEFeature.SpatialIO), Cell128SpatialPart(AEFeature.SpatialIO),
|
||||
|
||||
|
@ -48,8 +48,8 @@ public enum MaterialType
|
|||
|
||||
BlankPattern, FormationCore, AnnihilationCore,
|
||||
|
||||
EnderDust(AEFeature.QuantumNetworkBridge, "dustEnder"), Singularity(AEFeature.QuantumNetworkBridge), QESingularity(AEFeature.QuantumNetworkBridge,
|
||||
EntitySingularity.class);
|
||||
EnderDust(AEFeature.QuantumNetworkBridge, "dustEnder", EntitySingularity.class), Singularity(AEFeature.QuantumNetworkBridge, EntitySingularity.class), QESingularity(
|
||||
AEFeature.QuantumNetworkBridge, EntitySingularity.class);
|
||||
|
||||
private String oreName;
|
||||
private EnumSet<AEFeature> features;
|
||||
|
@ -75,6 +75,16 @@ public enum MaterialType
|
|||
EntityRegistry.registerModEntity( droppedEntity, droppedEntity.getSimpleName(), EntityIds.get( droppedEntity ), AppEng.instance, 16, 4, true );
|
||||
}
|
||||
|
||||
MaterialType(AEFeature part, String oreDictionary, Class<? extends Entity> c) {
|
||||
features = EnumSet.of( part );
|
||||
oreName = oreDictionary;
|
||||
if ( OreDictionary.getOres( oreDictionary ).size() > 0 )
|
||||
features.add( AEFeature.DuplicateItems );
|
||||
|
||||
droppedEntity = c;
|
||||
EntityRegistry.registerModEntity( droppedEntity, droppedEntity.getSimpleName(), EntityIds.get( droppedEntity ), AppEng.instance, 16, 4, true );
|
||||
}
|
||||
|
||||
MaterialType(AEFeature part, String oreDictionary) {
|
||||
features = EnumSet.of( part );
|
||||
oreName = oreDictionary;
|
||||
|
|
|
@ -12,16 +12,18 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.implementations.IItemGroup;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartItem;
|
||||
import appeng.core.Configuration;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.AEFeatureHandler;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.items.AEBaseItem;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemPart extends AEBaseItem implements IPartItem
|
||||
public class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
{
|
||||
|
||||
class PartTypeIst
|
||||
|
@ -98,16 +100,32 @@ public class ItemPart extends AEBaseItem implements IPartItem
|
|||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack is)
|
||||
{
|
||||
return "item.appliedenergistics2." + getname( is );
|
||||
}
|
||||
|
||||
public String getname(ItemStack is)
|
||||
{
|
||||
return AEFeatureHandler.getName( ItemPart.class, getTypeByStack( is ).name() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemDisplayName(ItemStack is)
|
||||
{
|
||||
Enum[] varients = getTypeByStack( is ).getVarients();
|
||||
|
||||
if ( varients != null )
|
||||
return super.getItemDisplayName( is ) + " - " + varients[dmgToPart.get( is.getItemDamage() ).varient].toString();
|
||||
|
||||
return super.getItemDisplayName( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister par1IconRegister)
|
||||
{
|
||||
for (Entry<Integer, PartTypeIst> part : dmgToPart.entrySet())
|
||||
{
|
||||
String tex = "appliedenergistics2:" + getUnlocalizedName( new ItemStack( this, 1, part.getKey() ) );
|
||||
String tex = "appliedenergistics2:" + getname( new ItemStack( this, 1, part.getKey() ) );
|
||||
part.getValue().ico = par1IconRegister.registerIcon( tex );
|
||||
}
|
||||
}
|
||||
|
@ -145,4 +163,17 @@ public class ItemPart extends AEBaseItem implements IPartItem
|
|||
return dmgToPart.get( itemDamage ).varient;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedGroupName(ItemStack is)
|
||||
{
|
||||
switch (getTypeByStack( is ))
|
||||
{
|
||||
case ImportBus:
|
||||
case ExportBus:
|
||||
return GuiText.IOBuses.getUnlocalized();
|
||||
default:
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,13 +13,19 @@ import appeng.parts.automation.PartLevelEmitter;
|
|||
import appeng.parts.misc.PartCableAnchor;
|
||||
import appeng.parts.misc.PartInterface;
|
||||
import appeng.parts.misc.PartInvertedToggleBus;
|
||||
import appeng.parts.misc.PartP2PTunnel;
|
||||
import appeng.parts.misc.PartStorageBus;
|
||||
import appeng.parts.misc.PartToggleBus;
|
||||
import appeng.parts.networking.PartCableCovered;
|
||||
import appeng.parts.networking.PartCableGlass;
|
||||
import appeng.parts.networking.PartCableSmart;
|
||||
import appeng.parts.networking.PartDenseCable;
|
||||
import appeng.parts.networking.PartQuartzFiber;
|
||||
import appeng.parts.p2p.PartP2PBCPower;
|
||||
import appeng.parts.p2p.PartP2PIC2Power;
|
||||
import appeng.parts.p2p.PartP2PItems;
|
||||
import appeng.parts.p2p.PartP2PLiquids;
|
||||
import appeng.parts.p2p.PartP2PRedstone;
|
||||
import appeng.parts.p2p.PartP2PTunnelME;
|
||||
import appeng.parts.reporting.PartConversionMonitor;
|
||||
import appeng.parts.reporting.PartCraftingMonitor;
|
||||
import appeng.parts.reporting.PartCraftingTerminal;
|
||||
|
@ -38,6 +44,8 @@ public enum PartType
|
|||
|
||||
CableSmart(AEFeature.Core, PartCableSmart.class), CableCovered(AEFeature.Core, PartCableCovered.class), CableGlass(AEFeature.Core, PartCableGlass.class),
|
||||
|
||||
CableDense(AEFeature.DenseCables, PartDenseCable.class),
|
||||
|
||||
CableAnchor(AEFeature.Core, PartCableAnchor.class),
|
||||
|
||||
QuartzFiber(AEFeature.Core, PartQuartzFiber.class),
|
||||
|
@ -60,7 +68,17 @@ public enum PartType
|
|||
|
||||
FormationPlane(AEFeature.FormationPlane, PartFormationPlane.class),
|
||||
|
||||
P2PTunnel(AEFeature.P2PTunnel, PartP2PTunnel.class),
|
||||
P2PTunnelME(AEFeature.P2PTunnelME, PartP2PTunnelME.class),
|
||||
|
||||
P2PTunnelRedstone(AEFeature.P2PTunnelRedstone, PartP2PRedstone.class),
|
||||
|
||||
P2PTunnelItems(AEFeature.P2PTunnelItems, PartP2PItems.class),
|
||||
|
||||
P2PTunnelLiquids(AEFeature.P2PTunnelLiquids, PartP2PLiquids.class),
|
||||
|
||||
P2PTunnelMJ(AEFeature.P2PTunnelMJ, PartP2PBCPower.class),
|
||||
|
||||
P2PTunnelEU(AEFeature.P2PTunnelEU, PartP2PIC2Power.class),
|
||||
|
||||
CraftingMonitor(AEFeature.Crafting, PartCraftingMonitor.class),
|
||||
|
||||
|
@ -86,7 +104,7 @@ public enum PartType
|
|||
|
||||
public Enum[] getVarients()
|
||||
{
|
||||
return (this == CableSmart || this == CableCovered || this == CableGlass) ? AEColor.values() : null;
|
||||
return (this == CableSmart || this == CableCovered || this == CableGlass || this == CableDense) ? AEColor.values() : null;
|
||||
}
|
||||
|
||||
public EnumSet<AEFeature> getFeature()
|
||||
|
|
24
items/storage/CellConfig.java
Normal file
24
items/storage/CellConfig.java
Normal file
|
@ -0,0 +1,24 @@
|
|||
package appeng.items.storage;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class CellConfig extends AppEngInternalInventory
|
||||
{
|
||||
|
||||
final ItemStack is;
|
||||
|
||||
public CellConfig(ItemStack is) {
|
||||
super( null, 63 );
|
||||
this.is = is;
|
||||
readFromNBT( Platform.openNbtData( is ), "list" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInventoryChanged()
|
||||
{
|
||||
writeToNBT( Platform.openNbtData( is ), "list" );
|
||||
}
|
||||
|
||||
}
|
24
items/storage/CellUpgrades.java
Normal file
24
items/storage/CellUpgrades.java
Normal file
|
@ -0,0 +1,24 @@
|
|||
package appeng.items.storage;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.parts.automation.UpgradeInventory;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class CellUpgrades extends UpgradeInventory
|
||||
{
|
||||
|
||||
final ItemStack is;
|
||||
|
||||
public CellUpgrades(ItemStack is, int upgrades) {
|
||||
super( is.getItem(), null, upgrades );
|
||||
this.is = is;
|
||||
readFromNBT( Platform.openNbtData( is ), "upgrades" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInventoryChanged()
|
||||
{
|
||||
writeToNBT( Platform.openNbtData( is ), "upgrades" );
|
||||
}
|
||||
|
||||
}
|
|
@ -4,18 +4,25 @@ import java.util.EnumSet;
|
|||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.implementations.IItemGroup;
|
||||
import appeng.api.implementations.IStorageCell;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.items.materials.MaterialType;
|
||||
import appeng.me.storage.CellInventory;
|
||||
import appeng.me.storage.CellInventoryHandler;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell
|
||||
public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, IItemGroup
|
||||
{
|
||||
|
||||
final MaterialType component;
|
||||
|
@ -25,7 +32,7 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell
|
|||
public ItemBasicStorageCell(MaterialType whichCell, int Kilobytes) {
|
||||
super( ItemBasicStorageCell.class, Kilobytes + "k" );
|
||||
setfeature( EnumSet.of( AEFeature.StorageCells ) );
|
||||
maxStackSize = 1;
|
||||
setMaxStackSize( 1 );
|
||||
totalBytes = Kilobytes * 1024;
|
||||
component = whichCell;
|
||||
|
||||
|
@ -51,22 +58,24 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell
|
|||
@Override
|
||||
public void addInformation(ItemStack i, EntityPlayer p, List l, boolean b)
|
||||
{
|
||||
CellInventory cd = ((CellInventoryHandler) CellInventory.getCell( i )).getCellInv();
|
||||
IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( i, StorageChannel.ITEMS );
|
||||
|
||||
if ( cd != null )
|
||||
if ( cdi instanceof CellInventoryHandler )
|
||||
{
|
||||
l.add( cd.usedBytes() + " " + StatCollector.translateToLocal( "Appeng.GuiITooltip.Of" ) + " " + cd.totalBytes() + " "
|
||||
+ StatCollector.translateToLocal( "Appeng.GuiITooltip.BytesUsed" ) );
|
||||
l.add( cd.storedItemTypes() + " " + StatCollector.translateToLocal( "Appeng.GuiITooltip.Of" ) + " " + cd.getTotalItemTypes() + " "
|
||||
+ StatCollector.translateToLocal( "Appeng.GuiITooltip.Types" ) );
|
||||
/*
|
||||
* if ( cd.isPreformatted() ) { String List = StatCollector.translateToLocal( cd.getListMode() ==
|
||||
* ListMode.WHITELIST ? "AppEng.Gui.Whitelisted" : "AppEng.Gui.Blacklisted" ); if ( cd.isFuzzyPreformatted()
|
||||
* ) l.add( StatCollector.translateToLocal( "Appeng.GuiITooltip.Partitioned" ) + " - " + List + " " +
|
||||
* StatCollector.translateToLocal( "Appeng.GuiITooltip.Fuzzy" ) ); else l.add(
|
||||
* StatCollector.translateToLocal( "Appeng.GuiITooltip.Partitioned" ) + " - " + List + " " +
|
||||
* StatCollector.translateToLocal( "Appeng.GuiITooltip.Precise" ) ); }
|
||||
*/
|
||||
CellInventory cd = ((CellInventoryHandler) cdi).getCellInv();
|
||||
if ( cd != null )
|
||||
{
|
||||
l.add( cd.usedBytes() + " " + GuiText.Of.getLocal() + " " + cd.totalBytes() + " " + GuiText.BytesUsed.getLocal() );
|
||||
l.add( cd.storedItemTypes() + " " + GuiText.Of.getLocal() + " " + cd.getTotalItemTypes() + " " + GuiText.Types.getLocal() );
|
||||
/*
|
||||
* if ( cd.isPreformatted() ) { String List = StatCollector.translateToLocal( cd.getListMode() ==
|
||||
* ListMode.WHITELIST ? "AppEng.Gui.Whitelisted" : "AppEng.Gui.Blacklisted" ); if (
|
||||
* cd.isFuzzyPreformatted() ) l.add( StatCollector.translateToLocal( "Appeng.GuiITooltip.Partitioned" )
|
||||
* + " - " + List + " " + StatCollector.translateToLocal( "Appeng.GuiITooltip.Fuzzy" ) ); else l.add(
|
||||
* StatCollector.translateToLocal( "Appeng.GuiITooltip.Partitioned" ) + " - " + List + " " +
|
||||
* StatCollector.translateToLocal( "Appeng.GuiITooltip.Precise" ) ); }
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,4 +125,49 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell
|
|||
{
|
||||
return idleDrain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getUpgradesInventory(ItemStack is)
|
||||
{
|
||||
return new CellUpgrades( is, 2 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getConfigInventory(ItemStack is)
|
||||
{
|
||||
return new CellConfig( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public FuzzyMode getFuzzyMode(ItemStack is)
|
||||
{
|
||||
String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
|
||||
try
|
||||
{
|
||||
return FuzzyMode.valueOf( fz );
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
return FuzzyMode.IGNORE_ALL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFuzzyMode(ItemStack is, FuzzyMode fzMode)
|
||||
{
|
||||
Platform.openNbtData( is ).setString( "FuzzyMode", fzMode.name() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedGroupName(ItemStack is)
|
||||
{
|
||||
return GuiText.StorageCells.getUnlocalized();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEditable(ItemStack is)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,16 +2,49 @@ package appeng.items.storage;
|
|||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.storage.ICellWorkbenchItem;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.items.AEBaseItem;
|
||||
|
||||
public class ItemCreativeStorageCell extends AEBaseItem
|
||||
public class ItemCreativeStorageCell extends AEBaseItem implements ICellWorkbenchItem
|
||||
{
|
||||
|
||||
public ItemCreativeStorageCell() {
|
||||
super( ItemCreativeStorageCell.class );
|
||||
setfeature( EnumSet.of( AEFeature.StorageCells, AEFeature.Creative ) );
|
||||
maxStackSize = 1;
|
||||
setMaxStackSize( 1 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEditable(ItemStack is)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getUpgradesInventory(ItemStack is)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getConfigInventory(ItemStack is)
|
||||
{
|
||||
return new CellConfig( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public FuzzyMode getFuzzyMode(ItemStack is)
|
||||
{
|
||||
return FuzzyMode.IGNORE_ALL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFuzzyMode(ItemStack is, FuzzyMode fzMode)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,12 +8,14 @@ import appeng.items.materials.MaterialType;
|
|||
|
||||
public class ItemSpatialStorageCell extends AEBaseItem
|
||||
{
|
||||
|
||||
final MaterialType component;
|
||||
final int maxRegion;
|
||||
|
||||
public ItemSpatialStorageCell(MaterialType whichCell, int spatialScale) {
|
||||
super( ItemSpatialStorageCell.class, spatialScale + "Cubed" );
|
||||
setfeature( EnumSet.of( AEFeature.SpatialIO ) );
|
||||
setMaxStackSize( 1 );
|
||||
maxRegion = spatialScale;
|
||||
component = whichCell;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
|||
public ToolMemoryCard() {
|
||||
super( ToolMemoryCard.class );
|
||||
setfeature( EnumSet.of( AEFeature.Core ) );
|
||||
setMaxStackSize( 1 );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -39,7 +40,6 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
|||
{
|
||||
NBTTagCompound c = Platform.openNbtData( is );
|
||||
c.setString( "Config", SettingsName );
|
||||
;
|
||||
c.setCompoundTag( "Data", data );
|
||||
}
|
||||
|
||||
|
@ -64,6 +64,9 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
|||
@Override
|
||||
public void notifyUser(Block blk, EntityPlayer player, MemoryCardMessages msg)
|
||||
{
|
||||
if ( Platform.isClient() )
|
||||
return;
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case INVALID_MACHINE:
|
||||
|
|
|
@ -1,11 +1,48 @@
|
|||
package appeng.items.tools.powered;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumMovingObjectType;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.implementations.IStorageCell;
|
||||
import appeng.api.networking.security.PlayerSource;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.core.Configuration;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.localization.PlayerMessages;
|
||||
import appeng.core.sync.packets.PacketMatterCannon;
|
||||
import appeng.items.storage.CellConfig;
|
||||
import appeng.items.storage.CellUpgrades;
|
||||
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
|
||||
import appeng.me.storage.CellInventory;
|
||||
import appeng.me.storage.CellInventoryHandler;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.ItemList;
|
||||
|
||||
public class ToolMassCannon extends AEBasePoweredItem
|
||||
public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
{
|
||||
|
||||
public ToolMassCannon() {
|
||||
|
@ -13,4 +50,291 @@ public class ToolMassCannon extends AEBasePoweredItem
|
|||
setfeature( EnumSet.of( AEFeature.MatterCannon, AEFeature.PoweredTools ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack is, EntityPlayer player, List lines, boolean advancedItemTooltips)
|
||||
{
|
||||
super.addInformation( is, player, lines, advancedItemTooltips );
|
||||
|
||||
IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( is, StorageChannel.ITEMS );
|
||||
|
||||
if ( cdi instanceof CellInventoryHandler )
|
||||
{
|
||||
CellInventory cd = ((CellInventoryHandler) cdi).getCellInv();
|
||||
if ( cd != null )
|
||||
{
|
||||
lines.add( cd.usedBytes() + " " + GuiText.Of.getLocal() + " " + cd.totalBytes() + " " + GuiText.BytesUsed.getLocal() );
|
||||
lines.add( cd.storedItemTypes() + " " + GuiText.Of.getLocal() + " " + cd.getTotalItemTypes() + " " + GuiText.Types.getLocal() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack item, World w, EntityPlayer p)
|
||||
{
|
||||
if ( this.getAECurrentPower( item ) > 1600 )
|
||||
{
|
||||
int shots = 1;
|
||||
|
||||
CellUpgrades cu = (CellUpgrades) getUpgradesInventory( item );
|
||||
if ( cu != null )
|
||||
shots += cu.getInstalledUpgrades( Upgrades.SPEED );
|
||||
|
||||
for (int sh = 0; sh < shots; sh++)
|
||||
{
|
||||
extractAEPower( item, 1600 );
|
||||
|
||||
if ( Platform.isClient() )
|
||||
return item;
|
||||
|
||||
IMEInventory inv = AEApi.instance().registries().cell().getCellInventory( item, StorageChannel.ITEMS );
|
||||
if ( inv != null )
|
||||
{
|
||||
IItemList itemList = inv.getAvailableItems( new ItemList() );
|
||||
IAEStack aeammo = itemList.getFirstItem();
|
||||
if ( aeammo instanceof IAEItemStack )
|
||||
{
|
||||
aeammo.setStackSize( 1 );
|
||||
ItemStack ammo = ((IAEItemStack) aeammo).getItemStack();
|
||||
if ( ammo == null )
|
||||
return item;
|
||||
|
||||
ammo.stackSize = 1;
|
||||
aeammo = inv.extractItems( aeammo, Actionable.MODULATE, new PlayerSource( p, null ) );
|
||||
if ( aeammo == null )
|
||||
return item;
|
||||
|
||||
float f = 1.0F;
|
||||
float f1 = p.prevRotationPitch + (p.rotationPitch - p.prevRotationPitch) * f;
|
||||
float f2 = p.prevRotationYaw + (p.rotationYaw - p.prevRotationYaw) * f;
|
||||
double d0 = p.prevPosX + (p.posX - p.prevPosX) * (double) f;
|
||||
double d1 = p.prevPosY + (p.posY - p.prevPosY) * (double) f + 1.62D - (double) p.yOffset;
|
||||
double d2 = p.prevPosZ + (p.posZ - p.prevPosZ) * (double) f;
|
||||
Vec3 vec3 = w.getWorldVec3Pool().getVecFromPool( d0, d1, d2 );
|
||||
float f3 = MathHelper.cos( -f2 * 0.017453292F - (float) Math.PI );
|
||||
float f4 = MathHelper.sin( -f2 * 0.017453292F - (float) Math.PI );
|
||||
float f5 = -MathHelper.cos( -f1 * 0.017453292F );
|
||||
float f6 = MathHelper.sin( -f1 * 0.017453292F );
|
||||
float f7 = f4 * f5;
|
||||
float f8 = f3 * f5;
|
||||
double d3 = 32.0D;
|
||||
|
||||
float penitration = AEApi.instance().registries().matterCannon().getPenetration( ammo ); // 196.96655f;
|
||||
boolean hasDestroyedSomething = true;
|
||||
while (penitration > 0 && hasDestroyedSomething)
|
||||
{
|
||||
hasDestroyedSomething = false;
|
||||
|
||||
Vec3 vec31 = vec3.addVector( (double) f7 * d3, (double) f6 * d3, (double) f8 * d3 );
|
||||
|
||||
AxisAlignedBB bb = AxisAlignedBB
|
||||
.getAABBPool()
|
||||
.getAABB( Math.min( vec3.xCoord, vec31.xCoord ), Math.min( vec3.yCoord, vec31.yCoord ),
|
||||
Math.min( vec3.zCoord, vec31.zCoord ), Math.max( vec3.xCoord, vec31.xCoord ),
|
||||
Math.max( vec3.yCoord, vec31.yCoord ), Math.max( vec3.zCoord, vec31.zCoord ) ).expand( 16, 16, 16 );
|
||||
|
||||
Entity entity = null;
|
||||
List list = w.getEntitiesWithinAABBExcludingEntity( p, bb );
|
||||
double Closeest = 9999999.0D;
|
||||
int l;
|
||||
|
||||
for (l = 0; l < list.size(); ++l)
|
||||
{
|
||||
Entity entity1 = (Entity) list.get( l );
|
||||
|
||||
if ( entity1.isDead == false && entity1 != p && !(entity1 instanceof EntityItem) )
|
||||
{
|
||||
if ( entity1.isEntityAlive() )
|
||||
{
|
||||
// prevent killing / flying of mounts.
|
||||
if ( entity1.riddenByEntity == p )
|
||||
continue;
|
||||
|
||||
f1 = 0.3F;
|
||||
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand( (double) f1, (double) f1, (double) f1 );
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept( vec3, vec31 );
|
||||
|
||||
if ( movingobjectposition1 != null )
|
||||
{
|
||||
double nd = vec3.squareDistanceTo( movingobjectposition1.hitVec );
|
||||
|
||||
if ( nd < Closeest )
|
||||
{
|
||||
entity = entity1;
|
||||
Closeest = nd;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vec3 Srec = w.getWorldVec3Pool().getVecFromPool( d0, d1, d2 );
|
||||
MovingObjectPosition pos = w.rayTraceBlocks_do_do( vec3, vec31, true, false );
|
||||
if ( entity != null && pos != null && pos.hitVec.squareDistanceTo( Srec ) > Closeest )
|
||||
{
|
||||
pos = new MovingObjectPosition( entity );
|
||||
}
|
||||
else if ( entity != null && pos == null )
|
||||
{
|
||||
pos = new MovingObjectPosition( entity );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
CommonHelper.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, (new PacketMatterCannon( d0, d1, d2, (float) (f7 * d3),
|
||||
(float) (f6 * d3), (float) (f8 * d3), (byte) (pos == null ? 32 : pos.hitVec.squareDistanceTo( Srec ) + 1) ))
|
||||
.getPacket() );
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
err.printStackTrace();
|
||||
}
|
||||
|
||||
if ( pos != null )
|
||||
{
|
||||
DamageSource dmgSrc = DamageSource.causePlayerDamage( p );
|
||||
dmgSrc.damageType = "masscannon";
|
||||
|
||||
if ( pos.typeOfHit == EnumMovingObjectType.ENTITY )
|
||||
{
|
||||
int dmg = (int) Math.ceil( penitration / 20.0f );
|
||||
if ( pos.entityHit instanceof EntityLivingBase )
|
||||
{
|
||||
EntityLivingBase el = (EntityLivingBase) pos.entityHit;
|
||||
penitration -= dmg;
|
||||
el.knockBack( p, 0, (double) f7 * d3, (double) f8 * d3 );
|
||||
// el.knockBack( p, 0, vec3.xCoord, vec3.zCoord );
|
||||
el.attackEntityFrom( dmgSrc, dmg );
|
||||
if ( !el.isEntityAlive() )
|
||||
hasDestroyedSomething = true;
|
||||
}
|
||||
else if ( pos.entityHit instanceof EntityItem )
|
||||
{
|
||||
hasDestroyedSomething = true;
|
||||
pos.entityHit.setDead();
|
||||
}
|
||||
else if ( pos.entityHit.attackEntityFrom( dmgSrc, dmg ) )
|
||||
{
|
||||
hasDestroyedSomething = true;
|
||||
}
|
||||
}
|
||||
else if ( pos.typeOfHit == EnumMovingObjectType.TILE )
|
||||
{
|
||||
if ( !Configuration.instance.isFeatureEnabled( AEFeature.MassCannonBlockDamage ) )
|
||||
penitration = 0;
|
||||
else
|
||||
{
|
||||
int bid = w.getBlockId( pos.blockX, pos.blockY, pos.blockZ );
|
||||
// int meta = w.getBlockMetadata( pos.blockX, pos.blockY, pos.blockZ );
|
||||
|
||||
if ( bid > 0 )
|
||||
{
|
||||
Block b = Block.blocksList[bid];
|
||||
float hardness = b.getBlockHardness( w, pos.blockX, pos.blockY, pos.blockZ ) * 9.0f;
|
||||
if ( hardness >= 0.0 )
|
||||
{
|
||||
if ( penitration > hardness )
|
||||
{
|
||||
hasDestroyedSomething = true;
|
||||
penitration -= hardness;
|
||||
penitration *= 0.60;
|
||||
w.destroyBlock( pos.blockX, pos.blockY, pos.blockZ, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
p.sendChatToPlayer( PlayerMessages.AmmoDepleted.get() );
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean storableInStorageCell()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStorageCell(ItemStack i)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getIdleDrain()
|
||||
{
|
||||
return 0.5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getUpgradesInventory(ItemStack is)
|
||||
{
|
||||
return new CellUpgrades( is, 4 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getConfigInventory(ItemStack is)
|
||||
{
|
||||
return new CellConfig( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public FuzzyMode getFuzzyMode(ItemStack is)
|
||||
{
|
||||
String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
|
||||
try
|
||||
{
|
||||
return FuzzyMode.valueOf( fz );
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
return FuzzyMode.IGNORE_ALL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFuzzyMode(ItemStack is, FuzzyMode fzMode)
|
||||
{
|
||||
Platform.openNbtData( is ).setString( "FuzzyMode", fzMode.name() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEditable(ItemStack is)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBytes(ItemStack cellItem)
|
||||
{
|
||||
return 512;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int BytePerType(ItemStack iscellItem)
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTotalTypes(ItemStack cellItem)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlackListed(ItemStack cellItem, IAEItemStack requsetedAddition)
|
||||
{
|
||||
return AEApi.instance().registries().matterCannon().getPenetration( requsetedAddition.getItemStack() ) == 0;
|
||||
}
|
||||
}
|
||||
|
|
26
items/tools/powered/ToolNetworkTool.java
Normal file
26
items/tools/powered/ToolNetworkTool.java
Normal file
|
@ -0,0 +1,26 @@
|
|||
package appeng.items.tools.powered;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.IGuiItem;
|
||||
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
|
||||
|
||||
public class ToolNetworkTool extends AEBasePoweredItem implements IGuiItem
|
||||
{
|
||||
|
||||
public ToolNetworkTool() {
|
||||
super( ToolNetworkTool.class, null );
|
||||
setfeature( EnumSet.of( AEFeature.NetworkTool, AEFeature.PoweredTools ) );
|
||||
maxStoredPower = 100000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGuiObject(ItemStack is)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
154
items/tools/powered/ToolPortableCell.java
Normal file
154
items/tools/powered/ToolPortableCell.java
Normal file
|
@ -0,0 +1,154 @@
|
|||
package appeng.items.tools.powered;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.implementations.IStorageCell;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.helpers.CellItemViewer;
|
||||
import appeng.helpers.IGuiItem;
|
||||
import appeng.items.storage.CellConfig;
|
||||
import appeng.items.storage.CellUpgrades;
|
||||
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
|
||||
import appeng.me.storage.CellInventory;
|
||||
import appeng.me.storage.CellInventoryHandler;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell, IGuiItem
|
||||
{
|
||||
|
||||
public ToolPortableCell() {
|
||||
super( ToolPortableCell.class, null );
|
||||
setfeature( EnumSet.of( AEFeature.PortableCell, AEFeature.StorageCells, AEFeature.PoweredTools ) );
|
||||
maxStoredPower = 20000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack item, World w, EntityPlayer player)
|
||||
{
|
||||
Platform.openGUI( player, null, ForgeDirection.UNKNOWN, GuiBridge.GUI_PORTABLE_CELL );
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack is, EntityPlayer player, List lines, boolean advancedItemTooltips)
|
||||
{
|
||||
super.addInformation( is, player, lines, advancedItemTooltips );
|
||||
|
||||
IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( is, StorageChannel.ITEMS );
|
||||
|
||||
if ( cdi instanceof CellInventoryHandler )
|
||||
{
|
||||
CellInventory cd = ((CellInventoryHandler) cdi).getCellInv();
|
||||
if ( cd != null )
|
||||
{
|
||||
lines.add( cd.usedBytes() + " " + GuiText.Of.getLocal() + " " + cd.totalBytes() + " " + GuiText.BytesUsed.getLocal() );
|
||||
lines.add( cd.storedItemTypes() + " " + GuiText.Of.getLocal() + " " + cd.getTotalItemTypes() + " " + GuiText.Types.getLocal() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBytes(ItemStack cellItem)
|
||||
{
|
||||
return 512;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int BytePerType(ItemStack iscellItem)
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTotalTypes(ItemStack cellItem)
|
||||
{
|
||||
return 27;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlackListed(ItemStack cellItem, IAEItemStack requsetedAddition)
|
||||
{
|
||||
Item i = requsetedAddition.getItem();
|
||||
|
||||
if ( i instanceof IStorageCell )
|
||||
return !((IStorageCell) i).storableInStorageCell();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean storableInStorageCell()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStorageCell(ItemStack i)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getIdleDrain()
|
||||
{
|
||||
return 0.5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getUpgradesInventory(ItemStack is)
|
||||
{
|
||||
return new CellUpgrades( is, 2 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getConfigInventory(ItemStack is)
|
||||
{
|
||||
return new CellConfig( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public FuzzyMode getFuzzyMode(ItemStack is)
|
||||
{
|
||||
String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
|
||||
try
|
||||
{
|
||||
return FuzzyMode.valueOf( fz );
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
return FuzzyMode.IGNORE_ALL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFuzzyMode(ItemStack is, FuzzyMode fzMode)
|
||||
{
|
||||
Platform.openNbtData( is ).setString( "FuzzyMode", fzMode.name() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEditable(ItemStack is)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGuiObject(ItemStack is)
|
||||
{
|
||||
return new CellItemViewer( is );
|
||||
}
|
||||
}
|
|
@ -5,6 +5,6 @@ public class AEBasePoweredItem extends UniversalElectricity
|
|||
|
||||
public AEBasePoweredItem(Class c, String subname) {
|
||||
super( c, subname );
|
||||
setMaxStackSize( 1 );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.api.implementations.IAEItemPowerStorage;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
@ -43,7 +44,7 @@ public class AERootPoweredItem extends AEBaseItem implements IAEItemPowerStorage
|
|||
|
||||
double percent = internalCurrentPower / internalMaxPower;
|
||||
|
||||
lines.add( Platform.gui_localize( "Stored Energy" ) + ":" + MessageFormat.format( " {0,number,#} ", internalCurrentPower )
|
||||
lines.add( GuiText.StoredEnergy.getLocal() + ":" + MessageFormat.format( " {0,number,#} ", internalCurrentPower )
|
||||
+ Platform.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
|
||||
|
||||
}
|
||||
|
|
|
@ -151,12 +151,6 @@ public class Grid implements IGrid
|
|||
// postEventTo( gridNode, networkChanged );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReady()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IReadOnlyCollection<IGridNode> getNodes()
|
||||
{
|
||||
|
|
|
@ -6,80 +6,57 @@ import appeng.api.networking.IGridHost;
|
|||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.IGridStorage;
|
||||
import appeng.me.cache.TickManagerCache;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class GridCacheWrapper implements IGridCache
|
||||
{
|
||||
|
||||
final IGridCache myCache;
|
||||
final public boolean isTickHandler;
|
||||
final IGridCache myCache;
|
||||
final String name;
|
||||
|
||||
public long LastFiveTicksTime = 0;
|
||||
public long LastFiveRemoveTime = 0;
|
||||
public long LastFiveAddNode = 0;
|
||||
|
||||
public GridCacheWrapper(IGridCache gc) {
|
||||
public GridCacheWrapper(final IGridCache gc) {
|
||||
myCache = gc;
|
||||
name = myCache.getClass().getName();
|
||||
isTickHandler = myCache instanceof TickManagerCache;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateTick(IGrid grid)
|
||||
public void onUpdateTick(final IGrid grid)
|
||||
{
|
||||
long startTime = Platform.nanoTime();
|
||||
|
||||
myCache.onUpdateTick( grid );
|
||||
|
||||
long estimatedTime = Platform.nanoTime() - startTime;
|
||||
|
||||
if ( isTickHandler ) // remove the ticking of tickables from the
|
||||
// equation.
|
||||
estimatedTime -= ((TickManagerCache) myCache).getInnerTime();
|
||||
|
||||
LastFiveTicksTime = ((LastFiveTicksTime * 4) / 5) + estimatedTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeNode(IGrid grid, IGridNode gridNode, IGridHost machine)
|
||||
public void removeNode(final IGrid grid, final IGridNode gridNode, final IGridHost machine)
|
||||
{
|
||||
long startTime = Platform.nanoTime();
|
||||
|
||||
myCache.removeNode( grid, gridNode, machine );
|
||||
|
||||
long estimatedTime = Platform.nanoTime() - startTime;
|
||||
LastFiveRemoveTime = ((LastFiveRemoveTime * 4) / 5) + estimatedTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addNode(IGrid grid, IGridNode gridNode, IGridHost machine)
|
||||
public void addNode(final IGrid grid, final IGridNode gridNode, final IGridHost machine)
|
||||
{
|
||||
long startTime = Platform.nanoTime();
|
||||
|
||||
myCache.addNode( grid, gridNode, machine );
|
||||
|
||||
long estimatedTime = Platform.nanoTime() - startTime;
|
||||
LastFiveAddNode = ((LastFiveAddNode * 4) / 5) + estimatedTime;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return myCache.getClass().getName();
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSplit(IGridStorage storageB)
|
||||
public void onSplit(final IGridStorage storageB)
|
||||
{
|
||||
myCache.onSplit( storageB );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onJoin(IGridStorage storageB)
|
||||
public void onJoin(final IGridStorage storageB)
|
||||
{
|
||||
myCache.onJoin( storageB );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populateGridStorage(IGridStorage storage)
|
||||
public void populateGridStorage(final IGridStorage storage)
|
||||
{
|
||||
myCache.populateGridStorage( storage );
|
||||
}
|
||||
|
|
|
@ -485,4 +485,10 @@ public class GridNode implements IGridNode, IPathItem
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasFlag(GridFlags flag)
|
||||
{
|
||||
return getGridBlock().getFlags().contains( flag );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
154
me/cache/EnergyGridCache.java
vendored
154
me/cache/EnergyGridCache.java
vendored
|
@ -51,9 +51,34 @@ public class EnergyGridCache implements IEnergyGrid
|
|||
double prev_extra = 0;
|
||||
double extra = 0;
|
||||
|
||||
IAEPowerStorage lastProvider;
|
||||
Set<IAEPowerStorage> providers = new LinkedHashSet();
|
||||
|
||||
IAEPowerStorage lastRequestor;
|
||||
Set<IAEPowerStorage> requesters = new LinkedHashSet();
|
||||
|
||||
private IAEPowerStorage getFirstRequestor()
|
||||
{
|
||||
if ( lastRequestor == null )
|
||||
{
|
||||
Iterator<IAEPowerStorage> i = requesters.iterator();
|
||||
lastRequestor = i.hasNext() ? i.next() : null;
|
||||
}
|
||||
|
||||
return lastRequestor;
|
||||
}
|
||||
|
||||
private IAEPowerStorage getFirstProvider()
|
||||
{
|
||||
if ( lastProvider == null )
|
||||
{
|
||||
Iterator<IAEPowerStorage> i = providers.iterator();
|
||||
lastProvider = i.hasNext() ? i.next() : null;
|
||||
}
|
||||
|
||||
return lastProvider;
|
||||
}
|
||||
|
||||
Set<IEnergyGridProvider> gproviders = new LinkedHashSet();
|
||||
|
||||
final IGrid myGrid;
|
||||
|
@ -131,11 +156,14 @@ public class EnergyGridCache implements IEnergyGrid
|
|||
{
|
||||
while (i > 0 && !requesters.isEmpty())
|
||||
{
|
||||
IAEPowerStorage node = requesters.iterator().next();
|
||||
IAEPowerStorage node = getFirstRequestor();
|
||||
|
||||
i = node.injectAEPower( i, Actionable.MODULATE );
|
||||
if ( i > 0 )
|
||||
{
|
||||
requesters.remove( node );
|
||||
lastRequestor = null;
|
||||
}
|
||||
}
|
||||
|
||||
extra = i;
|
||||
|
@ -145,10 +173,13 @@ public class EnergyGridCache implements IEnergyGrid
|
|||
return i;
|
||||
}
|
||||
|
||||
Set<IEnergyGrid> seen = new HashSet();
|
||||
|
||||
@Override
|
||||
public double extractAEPower(double amt, Actionable mode, PowerMultiplier pm)
|
||||
{
|
||||
return pm.divide( extractAEPower( pm.multiply( amt ), mode, new HashSet() ) );
|
||||
seen.clear();
|
||||
return pm.divide( extractAEPower( pm.multiply( amt ), mode, seen ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -203,45 +234,17 @@ public class EnergyGridCache implements IEnergyGrid
|
|||
if ( ps.getPowerFlow() != AccessRestriction.WRITE )
|
||||
globalAvailablePower -= ps.getAECurrentPower();
|
||||
|
||||
if ( lastProvider == machine )
|
||||
lastProvider = null;
|
||||
|
||||
if ( lastRequestor == machine )
|
||||
lastRequestor = null;
|
||||
|
||||
providers.remove( machine );
|
||||
requesters.remove( machine );
|
||||
}
|
||||
}
|
||||
|
||||
// recalculate the whole thing?
|
||||
public void reset(IGrid grid)
|
||||
{
|
||||
providers = new LinkedHashSet();
|
||||
requesters = new LinkedHashSet();
|
||||
|
||||
// re-calculate power info
|
||||
for (Class c : grid.getMachinesClasses())
|
||||
{
|
||||
if ( IAEPowerStorage.class.isAssignableFrom( c ) )
|
||||
{
|
||||
for (Object obj : grid.getMachines( c ))
|
||||
{
|
||||
IAEPowerStorage ps = (IAEPowerStorage) obj;
|
||||
if ( ps.isAEPublicPowerStorage() )
|
||||
{
|
||||
double max = ps.getAEMaxPower();
|
||||
double current = ps.getAECurrentPower();
|
||||
|
||||
if ( current > 0 && ps.getPowerFlow() != AccessRestriction.WRITE )
|
||||
{
|
||||
providers.add( ps );
|
||||
globalAvailablePower += ps.getAECurrentPower();
|
||||
}
|
||||
|
||||
if ( current < max && ps.getPowerFlow() != AccessRestriction.READ )
|
||||
requesters.add( ps );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateTick(IGrid grid)
|
||||
{
|
||||
|
@ -280,7 +283,6 @@ public class EnergyGridCache implements IEnergyGrid
|
|||
|
||||
private void publicPowerState(boolean newState, IGrid grid)
|
||||
{
|
||||
|
||||
if ( publicHasPower == newState )
|
||||
return;
|
||||
|
||||
|
@ -311,44 +313,18 @@ public class EnergyGridCache implements IEnergyGrid
|
|||
@Override
|
||||
public double extractAEPower(double amt, Actionable mode, Set<IEnergyGrid> seen)
|
||||
{
|
||||
if ( seen.contains( this ) )
|
||||
if ( !seen.add( this ) )
|
||||
return 0;
|
||||
|
||||
seen.add( this );
|
||||
|
||||
double extractedPower = extra;
|
||||
|
||||
if ( mode == Actionable.SIMULATE )
|
||||
{
|
||||
Iterator<IAEPowerStorage> it = providers.iterator();
|
||||
while (extractedPower < amt && it.hasNext())
|
||||
{
|
||||
IAEPowerStorage node = it.next();
|
||||
|
||||
double req = amt - extractedPower;
|
||||
double newPower = node.extractAEPower( req, Actionable.SIMULATE, PowerMultiplier.ONE );
|
||||
extractedPower += newPower;
|
||||
}
|
||||
extractedPower += simulateExtract( extractedPower, amt );
|
||||
return extractedPower;
|
||||
}
|
||||
else
|
||||
{
|
||||
extra = 0;
|
||||
|
||||
while (extractedPower < amt && !providers.isEmpty())
|
||||
{
|
||||
IAEPowerStorage node = providers.iterator().next();
|
||||
|
||||
double req = amt - extractedPower;
|
||||
double newPower = node.extractAEPower( req, Actionable.MODULATE, PowerMultiplier.ONE );
|
||||
extractedPower += newPower;
|
||||
|
||||
if ( newPower < req )
|
||||
providers.remove( node );
|
||||
}
|
||||
|
||||
// add power used to the current tick.
|
||||
totalDrainPastTicks[0] += extractedPower;
|
||||
}
|
||||
extractedPower += doExtract( extractedPower, amt );
|
||||
|
||||
// got more then we wanted?
|
||||
if ( extractedPower > amt )
|
||||
|
@ -361,8 +337,9 @@ public class EnergyGridCache implements IEnergyGrid
|
|||
|
||||
if ( extractedPower < amt )
|
||||
{
|
||||
for (IEnergyGridProvider egp : gproviders)
|
||||
extractedPower += egp.extractAEPower( amt - extractedPower, mode, seen );
|
||||
Iterator<IEnergyGridProvider> i = gproviders.iterator();
|
||||
while (extractedPower < amt && i.hasNext())
|
||||
extractedPower += i.next().extractAEPower( amt - extractedPower, mode, seen );
|
||||
}
|
||||
|
||||
// go less or the correct amount?
|
||||
|
@ -370,6 +347,45 @@ public class EnergyGridCache implements IEnergyGrid
|
|||
return extractedPower;
|
||||
}
|
||||
|
||||
private double doExtract(double extractedPower, double amt)
|
||||
{
|
||||
extra = 0;
|
||||
|
||||
while (extractedPower < amt && !providers.isEmpty())
|
||||
{
|
||||
IAEPowerStorage node = getFirstProvider();
|
||||
|
||||
double req = amt - extractedPower;
|
||||
double newPower = node.extractAEPower( req, Actionable.MODULATE, PowerMultiplier.ONE );
|
||||
extractedPower += newPower;
|
||||
|
||||
if ( newPower < req )
|
||||
{
|
||||
providers.remove( node );
|
||||
lastProvider = null;
|
||||
}
|
||||
}
|
||||
|
||||
totalDrainPastTicks[0] += extractedPower;
|
||||
return extractedPower;
|
||||
}
|
||||
|
||||
private double simulateExtract(double extractedPower, double amt)
|
||||
{
|
||||
Iterator<IAEPowerStorage> it = providers.iterator();
|
||||
|
||||
while (extractedPower < amt && it.hasNext())
|
||||
{
|
||||
IAEPowerStorage node = it.next();
|
||||
|
||||
double req = amt - extractedPower;
|
||||
double newPower = node.extractAEPower( req, Actionable.SIMULATE, PowerMultiplier.ONE );
|
||||
extractedPower += newPower;
|
||||
}
|
||||
|
||||
return extractedPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNetworkPowered()
|
||||
{
|
||||
|
|
15
me/cache/NetworkMonitor.java
vendored
15
me/cache/NetworkMonitor.java
vendored
|
@ -33,19 +33,6 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
|
|||
|
||||
final static public LinkedList depth = new LinkedList();
|
||||
|
||||
private BaseActionSource src;
|
||||
|
||||
public void setSource(BaseActionSource src)
|
||||
{
|
||||
this.src = src;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BaseActionSource getSource()
|
||||
{
|
||||
return src;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void postChange(T diff, BaseActionSource src)
|
||||
{
|
||||
|
@ -86,7 +73,7 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
|
|||
if ( sendEvent )
|
||||
{
|
||||
sendEvent = false;
|
||||
myGridCache.myGrid.postEvent( new MENetworkStorageEvent( getStorageList(), myChannel ) );
|
||||
myGridCache.myGrid.postEvent( new MENetworkStorageEvent( this, myChannel ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
96
me/cache/P2PCache.java
vendored
96
me/cache/P2PCache.java
vendored
|
@ -1,6 +1,5 @@
|
|||
package appeng.me.cache;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
|
||||
import appeng.api.networking.IGrid;
|
||||
|
@ -8,7 +7,9 @@ import appeng.api.networking.IGridCache;
|
|||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.IGridStorage;
|
||||
import appeng.parts.misc.PartP2PTunnel;
|
||||
import appeng.core.AELog;
|
||||
import appeng.me.cache.helpers.TunnelCollection;
|
||||
import appeng.parts.p2p.PartP2PTunnel;
|
||||
|
||||
import com.google.common.collect.LinkedHashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
@ -16,8 +17,9 @@ import com.google.common.collect.Multimap;
|
|||
public class P2PCache implements IGridCache
|
||||
{
|
||||
|
||||
private HashMap<Long, PartP2PTunnel> inputs = new HashMap();
|
||||
private Multimap<Long, PartP2PTunnel> Tunnels = LinkedHashMultimap.create();
|
||||
final private HashMap<Long, PartP2PTunnel> inputs = new HashMap();
|
||||
final private Multimap<Long, PartP2PTunnel> outputs = LinkedHashMultimap.create();
|
||||
final private TunnelCollection NullColl = new TunnelCollection<PartP2PTunnel>( null, null );
|
||||
|
||||
final IGrid myGrid;
|
||||
|
||||
|
@ -25,50 +27,78 @@ public class P2PCache implements IGridCache
|
|||
myGrid = g;
|
||||
}
|
||||
|
||||
public void updateFreq(PartP2PTunnel t, long NewFreq)
|
||||
{
|
||||
outputs.remove( t.freq, t );
|
||||
inputs.remove( t.freq );
|
||||
|
||||
t.freq = NewFreq;
|
||||
|
||||
if ( t.output )
|
||||
outputs.put( t.freq, t );
|
||||
else
|
||||
inputs.put( t.freq, t );
|
||||
|
||||
AELog.info( "update-" + (t.output ? "output: " : "input: ") + t.freq );
|
||||
updateTunnel( t.freq, t.output );
|
||||
updateTunnel( t.freq, !t.output );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addNode(IGrid grid, IGridNode node, IGridHost machine)
|
||||
{
|
||||
if ( machine instanceof PartP2PTunnel )
|
||||
reset( grid );
|
||||
{
|
||||
PartP2PTunnel t = (PartP2PTunnel) machine;
|
||||
AELog.info( "add-" + (t.output ? "output: " : "input: ") + t.freq );
|
||||
|
||||
if ( t.output )
|
||||
outputs.put( t.freq, t );
|
||||
else
|
||||
inputs.put( t.freq, t );
|
||||
|
||||
updateTunnel( t.freq, !t.output );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeNode(IGrid grid, IGridNode node, IGridHost machine)
|
||||
{
|
||||
if ( machine instanceof PartP2PTunnel )
|
||||
reset( grid );
|
||||
}
|
||||
|
||||
public void reset(IGrid grid)
|
||||
{
|
||||
|
||||
Tunnels.clear();
|
||||
inputs.clear();
|
||||
|
||||
for (IGridNode n : grid.getMachines( PartP2PTunnel.class ))
|
||||
{
|
||||
PartP2PTunnel p = (PartP2PTunnel) n.getMachine();
|
||||
if ( p.freq > 0 )
|
||||
{
|
||||
if ( p.output )
|
||||
Tunnels.put( p.freq, p );
|
||||
else if ( inputs.containsKey( p.freq ) )
|
||||
p.output = true;
|
||||
else
|
||||
inputs.put( p.freq, p );
|
||||
}
|
||||
PartP2PTunnel t = (PartP2PTunnel) machine;
|
||||
AELog.info( "rmv-" + (t.output ? "output: " : "input: ") + t.freq );
|
||||
|
||||
if ( t.output )
|
||||
outputs.remove( t.freq, t );
|
||||
else
|
||||
inputs.remove( t.freq );
|
||||
|
||||
updateTunnel( t.freq, !t.output );
|
||||
}
|
||||
|
||||
for (PartP2PTunnel p : inputs.values())
|
||||
p.onChange();
|
||||
|
||||
for (PartP2PTunnel p : Tunnels.values())
|
||||
p.onChange();
|
||||
}
|
||||
|
||||
public Collection<PartP2PTunnel> getOutputs(long freq)
|
||||
private void updateTunnel(long freq, boolean updateOutputs)
|
||||
{
|
||||
return Tunnels.get( freq );
|
||||
if ( updateOutputs )
|
||||
{
|
||||
for (PartP2PTunnel p : outputs.values())
|
||||
p.onChange();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (PartP2PTunnel p : inputs.values())
|
||||
p.onChange();
|
||||
}
|
||||
}
|
||||
|
||||
public TunnelCollection<PartP2PTunnel> getOutputs(long freq, Class<? extends PartP2PTunnel> c)
|
||||
{
|
||||
PartP2PTunnel in = inputs.get( freq );
|
||||
if ( in == null )
|
||||
return NullColl;
|
||||
|
||||
return inputs.get( freq ).getCollection( outputs.get( freq ) );
|
||||
}
|
||||
|
||||
public PartP2PTunnel getInput(long freq)
|
||||
|
|
13
me/cache/TickManagerCache.java
vendored
13
me/cache/TickManagerCache.java
vendored
|
@ -14,13 +14,11 @@ import appeng.api.networking.ticking.TickRateModulation;
|
|||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.core.AELog;
|
||||
import appeng.me.cache.helpers.TickTracker;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class TickManagerCache implements ITickManager
|
||||
{
|
||||
|
||||
private long currentTick = 0;
|
||||
private long lastInnerTime = 0;
|
||||
|
||||
final IGrid myGrid;
|
||||
|
||||
|
@ -40,11 +38,6 @@ public class TickManagerCache implements ITickManager
|
|||
return currentTick;
|
||||
}
|
||||
|
||||
public long getInnerTime()
|
||||
{
|
||||
return lastInnerTime;
|
||||
}
|
||||
|
||||
public long getAvgNanoTime(IGridNode node)
|
||||
{
|
||||
TickTracker tt = awake.get( node );
|
||||
|
@ -70,13 +63,7 @@ public class TickManagerCache implements ITickManager
|
|||
{
|
||||
// remove tt..
|
||||
upcomingTicks.poll();
|
||||
|
||||
long startTime = Platform.nanoTime();
|
||||
TickRateModulation mod = tt.gt.tickingRequest( tt.node, diff );
|
||||
long estimatedTime = Platform.nanoTime() - startTime;
|
||||
lastInnerTime += estimatedTime;
|
||||
|
||||
tt.LastFiveTicksTime = ((tt.LastFiveTicksTime * 4) / 5) + estimatedTime;
|
||||
|
||||
switch (mod)
|
||||
{
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue