diff --git a/block/AEBaseBlock.java b/block/AEBaseBlock.java index e40de2eef..ee1f840ae 100644 --- a/block/AEBaseBlock.java +++ b/block/AEBaseBlock.java @@ -43,10 +43,12 @@ import appeng.core.features.ItemStackSrc; import appeng.helpers.ICustomCollision; import appeng.tile.AEBaseTile; import appeng.tile.networking.TileCableBus; +import appeng.tile.storage.TileSkyChest; import appeng.util.LookDirection; import appeng.util.Platform; import appeng.util.SettingsFrom; import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.ReflectionHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -157,6 +159,11 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature return getRendererInstance().getTexture( ForgeDirection.getOrientation( direction ) ); } + public IIcon unmappedGetIcon(IBlockAccess w, int x, int y, int z, int s) + { + return super.getIcon( w, x, y, z, s ); + } + @Override public IIcon getIcon(IBlockAccess w, int x, int y, int z, int s) { @@ -168,6 +175,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature AEBaseTile.registerTileItem( c, new ItemStackSrc( this, 0 ) ); GameRegistry.registerTileEntity( tileEntityType = c, FeatureFullname ); isInventory = IInventory.class.isAssignableFrom( c ); + setTileProvider( hasBlockTileEntity() ); } protected void setfeature(EnumSet f) @@ -180,6 +188,13 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature setLightOpacity( 15 ); setLightLevel( 0 ); setHardness( 1.2F ); + setTileProvider( false ); + } + + // update Block value. + private void setTileProvider(boolean b) + { + ReflectionHelper.setPrivateValue( Block.class, this, b, "isTileProvider" ); } protected AEBaseBlock(Class c, Material mat, String subname) { @@ -230,12 +245,6 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature return tileEntityType != null; } - @Override - final public boolean hasTileEntity(int metadata) - { - return hasBlockTileEntity(); - } - public Class getTileEntityClass() { return tileEntityType; @@ -266,14 +275,18 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature @Override final public TileEntity createNewTileEntity(World var1, int var2) { - try + if ( hasBlockTileEntity() ) { - return tileEntityType.newInstance(); - } - catch (Throwable e) - { - throw new RuntimeException( e ); + try + { + return tileEntityType.newInstance(); + } + catch (Throwable e) + { + throw new RuntimeException( e ); + } } + return null; } final public T getTileEntity(IBlockAccess w, int x, int y, int z) @@ -293,7 +306,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature return false; } - protected void customRotateBlock(IOrientable rotateable, ForgeDirection axis) + protected void customRotateBlock(IOrientable rotatable, ForgeDirection axis) { } @@ -301,28 +314,28 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature @Override final public boolean rotateBlock(World w, int x, int y, int z, ForgeDirection axis) { - IOrientable rotateable = null; + IOrientable rotatable = null; if ( hasBlockTileEntity() ) { - rotateable = (AEBaseTile) getTileEntity( w, x, y, z ); + rotatable = (AEBaseTile) getTileEntity( w, x, y, z ); } else if ( this instanceof IOrientableBlock ) { - rotateable = ((IOrientableBlock) this).getOrientable( w, x, y, z ); + rotatable = ((IOrientableBlock) this).getOrientable( w, x, y, z ); } - if ( rotateable != null && rotateable.canBeRotated() ) + if ( rotatable != null && rotatable.canBeRotated() ) { if ( hasCustomRotation() ) { - customRotateBlock( rotateable, axis ); + customRotateBlock( rotatable, axis ); return true; } else { - ForgeDirection forward = rotateable.getForward(); - ForgeDirection up = rotateable.getUp(); + ForgeDirection forward = rotatable.getForward(); + ForgeDirection up = rotatable.getUp(); for (int rs = 0; rs < 4; rs++) { @@ -331,14 +344,14 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature if ( this.isValidOrientation( w, x, y, z, forward, up ) ) { - rotateable.setOrientation( forward, up ); + rotatable.setOrientation( forward, up ); return true; } } } } - return false; + return super.rotateBlock( w, x, y, z, axis ); } public ForgeDirection mapRotation(IOrientable ori, ForgeDirection dir) @@ -641,7 +654,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature if ( tile == null ) return false; - if ( tile instanceof TileCableBus ) + if ( tile instanceof TileCableBus || tile instanceof TileSkyChest ) return false; ItemStack op = new ItemStack( this ); diff --git a/block/AEDecorativeBlock.java b/block/AEDecorativeBlock.java new file mode 100644 index 000000000..34a929e68 --- /dev/null +++ b/block/AEDecorativeBlock.java @@ -0,0 +1,26 @@ +package appeng.block; + +import net.minecraft.block.material.Material; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; + +public class AEDecorativeBlock extends AEBaseBlock +{ + + protected AEDecorativeBlock(Class c, Material mat) { + super( c, mat ); + } + + @Override + public IIcon getIcon(IBlockAccess w, int x, int y, int z, int s) + { + return super.unmappedGetIcon( w, x, y, z, s ); + } + + @Override + public int getRenderType() + { + return 0; + } + +} diff --git a/block/misc/BlockInterface.java b/block/misc/BlockInterface.java index 9674f1fd3..e4a3312ce 100644 --- a/block/misc/BlockInterface.java +++ b/block/misc/BlockInterface.java @@ -37,11 +37,11 @@ public class BlockInterface extends AEBaseBlock } @Override - protected void customRotateBlock(IOrientable rotateable, ForgeDirection axis) + protected void customRotateBlock(IOrientable rotatable, ForgeDirection axis) { - if ( rotateable instanceof TileInterface ) + if ( rotatable instanceof TileInterface ) { - ((TileInterface) rotateable).setSide( axis ); + ((TileInterface) rotatable).setSide( axis ); } } diff --git a/block/misc/BlockSecurity.java b/block/misc/BlockSecurity.java index d2c9f1838..b214a9f32 100644 --- a/block/misc/BlockSecurity.java +++ b/block/misc/BlockSecurity.java @@ -10,7 +10,6 @@ import appeng.block.AEBaseBlock; import appeng.client.render.BaseBlockRender; import appeng.client.render.blocks.RendererSecurity; import appeng.core.features.AEFeature; -import appeng.core.localization.PlayerMessages; import appeng.core.sync.GuiBridge; import appeng.tile.misc.TileSecurity; import appeng.util.Platform; @@ -39,15 +38,10 @@ public class BlockSecurity extends AEBaseBlock TileSecurity tg = getTileEntity( w, x, y, z ); if ( tg != null ) { - if ( Platform.isServer() ) - { - if ( tg.isPowered() ) - { - Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_SECURITY ); - } - else - p.addChatMessage( PlayerMessages.MachineNotPowered.get() ); - } + if ( Platform.isClient() ) + return true; + + Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_SECURITY ); return true; } diff --git a/block/networking/BlockCableBus.java b/block/networking/BlockCableBus.java index d659f94fa..bfa679c08 100644 --- a/block/networking/BlockCableBus.java +++ b/block/networking/BlockCableBus.java @@ -57,10 +57,15 @@ public class BlockCableBus extends AEBaseBlock @Override public boolean recolourBlock(World world, int x, int y, int z, ForgeDirection side, int colour) + { + return recolourBlock( world, x, y, z, side, colour, null ); + } + + public boolean recolourBlock(World world, int x, int y, int z, ForgeDirection side, int colour, EntityPlayer who) { try { - return cb( world, x, y, z ).recolourBlock( side, colour ); + return cb( world, x, y, z ).recolourBlock( side, colour, who ); } catch (Throwable t) { diff --git a/block/solids/BlockFluix.java b/block/solids/BlockFluix.java index a30d8a4c9..ecb8414ff 100644 --- a/block/solids/BlockFluix.java +++ b/block/solids/BlockFluix.java @@ -3,14 +3,10 @@ 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.block.AEDecorativeBlock; import appeng.core.features.AEFeature; -import appeng.helpers.LocationRotation; -public class BlockFluix extends AEBaseBlock implements IOrientableBlock +public class BlockFluix extends AEDecorativeBlock { public BlockFluix() { @@ -18,10 +14,4 @@ public class BlockFluix extends AEBaseBlock implements IOrientableBlock 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 ); - } - } diff --git a/block/solids/BlockQuartz.java b/block/solids/BlockQuartz.java index 424b1c589..20bb1f8c1 100644 --- a/block/solids/BlockQuartz.java +++ b/block/solids/BlockQuartz.java @@ -3,10 +3,10 @@ package appeng.block.solids; import java.util.EnumSet; import net.minecraft.block.material.Material; -import appeng.block.AEBaseBlock; +import appeng.block.AEDecorativeBlock; import appeng.core.features.AEFeature; -public class BlockQuartz extends AEBaseBlock +public class BlockQuartz extends AEDecorativeBlock { public BlockQuartz() { diff --git a/block/solids/BlockQuartzChiseled.java b/block/solids/BlockQuartzChiseled.java index f24fa45d3..896d69971 100644 --- a/block/solids/BlockQuartzChiseled.java +++ b/block/solids/BlockQuartzChiseled.java @@ -3,10 +3,10 @@ package appeng.block.solids; import java.util.EnumSet; import net.minecraft.block.material.Material; -import appeng.block.AEBaseBlock; +import appeng.block.AEDecorativeBlock; import appeng.core.features.AEFeature; -public class BlockQuartzChiseled extends AEBaseBlock +public class BlockQuartzChiseled extends AEDecorativeBlock { public BlockQuartzChiseled() { diff --git a/block/solids/BlockSkyStone.java b/block/solids/BlockSkyStone.java index e9eb9edf3..eb7a46571 100644 --- a/block/solids/BlockSkyStone.java +++ b/block/solids/BlockSkyStone.java @@ -9,23 +9,28 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.PlayerEvent; +import rblocks.api.RotatableBlockEnable; import appeng.api.util.IOrientable; import appeng.api.util.IOrientableBlock; import appeng.block.AEBaseBlock; +import appeng.core.AppEng; import appeng.core.WorldSettings; import appeng.core.features.AEFeature; import appeng.helpers.LocationRotation; import appeng.helpers.NullRotation; +import appeng.integration.abstraction.IRB; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +@RotatableBlockEnable public class BlockSkyStone extends AEBaseBlock implements IOrientableBlock { @@ -41,7 +46,7 @@ public class BlockSkyStone extends AEBaseBlock implements IOrientableBlock @SubscribeEvent public void breakFaster(PlayerEvent.BreakSpeed Ev) { - if ( Ev.block == this && Ev.originalSpeed > 7 || Ev.metadata > 0 ) + if ( Ev.block == this && (Ev.originalSpeed > 7 || Ev.metadata > 0) ) Ev.newSpeed /= 0.1; } @@ -79,8 +84,20 @@ public class BlockSkyStone extends AEBaseBlock implements IOrientableBlock @Override public IOrientable getOrientable(final IBlockAccess w, final int x, final int y, final int z) { + if ( AppEng.instance.isIntegrationEnabled( "RB" ) ) + { + TileEntity te = w.getTileEntity( x, y, z ); + if ( te != null ) + { + IOrientable out = ((IRB) AppEng.instance.getIntegration( "RB" )).getOrientable( te ); + if ( out != null ) + return out; + } + } + if ( w.getBlockMetadata( x, y, z ) == 0 ) return new LocationRotation( w, x, y, z ); + return new NullRotation(); } @@ -145,4 +162,10 @@ public class BlockSkyStone extends AEBaseBlock implements IOrientableBlock WorldSettings.getInstance().getCompass().updateArea( w, x, y, z ); } + // use AE2's enderer, no rotatable blocks. + int getRealRenderType() + { + return getRenderType(); + } + } diff --git a/block/storage/BlockChest.java b/block/storage/BlockChest.java index 37c2de43c..27553fdd6 100644 --- a/block/storage/BlockChest.java +++ b/block/storage/BlockChest.java @@ -46,20 +46,18 @@ public class BlockChest extends AEBaseBlock { Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_CHEST ); } - else if ( tg.isPowered() ) + else { ItemStack cell = tg.getStackInSlot( 1 ); if ( cell != null ) { - ICellHandler ch = AEApi.instance().registries().cell().getHander( cell ); + ICellHandler ch = AEApi.instance().registries().cell().getHandler( cell ); tg.openGui( p, ch, cell, side ); } else p.addChatMessage( PlayerMessages.ChestCannotReadStorageCell.get() ); } - else - p.addChatMessage( PlayerMessages.MachineNotPowered.get() ); return true; } diff --git a/block/storage/BlockSkyChest.java b/block/storage/BlockSkyChest.java index b8fd13b0c..23f4fd18b 100644 --- a/block/storage/BlockSkyChest.java +++ b/block/storage/BlockSkyChest.java @@ -51,6 +51,11 @@ public class BlockSkyChest extends AEBaseBlock implements ICustomCollision return getUnlocalizedName(); } + @Override + public int damageDropped(int metadata) { + return metadata; + } + @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int direction, int metadata) @@ -94,7 +99,20 @@ public class BlockSkyChest extends AEBaseBlock implements ICustomCollision @Override public Iterable getSelectedBoundingBoxsFromPool(World w, int x, int y, int z, Entity e, boolean isVisual) { - return Arrays.asList( new AxisAlignedBB[] { AxisAlignedBB.getBoundingBox( 0.05, 0.05, 0.05, 0.95, 0.95, 0.95 ) } ); + TileSkyChest sk = getTileEntity( w, x, y, z ); + double sc = 0.06; + ForgeDirection o = ForgeDirection.UNKNOWN; + + if ( sk != null ) + o = sk.getUp(); + + double X = o.offsetX == 0 ? 0.06 : 0.0; + double Y = o.offsetY == 0 ? 0.06 : 0.0; + double Z = o.offsetZ == 0 ? 0.06 : 0.0; + + return Arrays.asList( new AxisAlignedBB[] { AxisAlignedBB.getBoundingBox( Math.max( 0.0, X - o.offsetX * sc ), Math.max( 0.0, Y - o.offsetY * sc ), + Math.max( 0.0, Z - o.offsetZ * sc ), Math.min( 1.0, (1.0 - X) - o.offsetX * sc ), Math.min( 1.0, (1.0 - Y) - o.offsetY * sc ), + Math.min( 1.0, (1.0 - Z) - o.offsetZ * sc ) ) } ); } @Override diff --git a/client/gui/AEBaseGui.java b/client/gui/AEBaseGui.java index 04832566a..3778fa4ef 100644 --- a/client/gui/AEBaseGui.java +++ b/client/gui/AEBaseGui.java @@ -46,8 +46,10 @@ import appeng.core.AEConfig; import appeng.core.AELog; import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketInventoryAction; +import appeng.core.sync.packets.PacketSwapSlots; import appeng.helpers.InventoryAction; import appeng.util.Platform; +import cpw.mods.fml.common.ObfuscationReflectionHelper; public abstract class AEBaseGui extends GuiContainer { @@ -271,6 +273,56 @@ public abstract class AEBaseGui extends GuiContainer super.handleMouseClick( slot, slotIdx, ctrlDown, key ); } + @Override + protected boolean checkHotbarKeys(int p_146983_1_) + { + Slot theSlot; + + try + { + theSlot = ObfuscationReflectionHelper.getPrivateValue( GuiContainer.class, this, "theSlot", "field_147006_u", "f" ); + } + catch (Throwable t) + { + return false; + } + + if ( this.mc.thePlayer.inventory.getItemStack() == null && theSlot != null ) + { + for (int j = 0; j < 9; ++j) + { + if ( p_146983_1_ == this.mc.gameSettings.keyBindsHotbar[j].getKeyCode() ) + { + if ( theSlot.getSlotStackLimit() == 64 ) + { + this.handleMouseClick( theSlot, theSlot.slotNumber, j, 2 ); + return true; + } + else + { + try + { + for (Slot s : (List) inventorySlots.inventorySlots) + { + if ( s.getSlotIndex() == j && s.inventory == ((AEBaseContainer) inventorySlots).getPlayerInv() ) + { + NetworkHandler.instance.sendToServer( new PacketSwapSlots( s.slotNumber, theSlot.slotNumber ) ); + return true; + } + } + } + catch (IOException e) + { + AELog.error( e ); + } + } + } + } + } + + return false; + } + @Override public void drawScreen(int mouse_x, int mouse_y, float btn) { @@ -526,7 +578,7 @@ public abstract class AEBaseGui extends GuiContainer AppEngRenderItem aeri = new AppEngRenderItem(); - private boolean isPowered() + protected boolean isPowered() { return true; } diff --git a/client/gui/implementations/GuiMEMonitorable.java b/client/gui/implementations/GuiMEMonitorable.java index fdf5c1ac7..f1214cf07 100644 --- a/client/gui/implementations/GuiMEMonitorable.java +++ b/client/gui/implementations/GuiMEMonitorable.java @@ -11,6 +11,7 @@ import org.lwjgl.input.Mouse; import appeng.api.config.SearchBoxMode; import appeng.api.config.Settings; +import appeng.api.config.TerminalStyle; import appeng.api.implementations.guiobjects.IPortableCell; import appeng.api.implementations.tiles.IMEChest; import appeng.api.implementations.tiles.IViewCellStorage; @@ -55,13 +56,15 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi int rows = 0; int maxRows = Integer.MAX_VALUE; + int standardSize; + IConfigManager configSrc; GuiImgButton ViewBox; GuiImgButton SortByBox; GuiImgButton SortDirBox; - GuiImgButton searchBoxSettings; + GuiImgButton searchBoxSettings, terminalStyleBox; boolean viewCell; ItemStack myCurrentViewCells[] = new ItemStack[5]; @@ -76,12 +79,15 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi super( c ); myScrollBar = new GuiScrollbar(); repo = new ItemRepo( myScrollBar, this ); + xSize = 195; ySize = 204; if ( te instanceof IViewCellStorage ) xSize += 33; + standardSize = xSize; + configSrc = ((IConfigureableObject) inventorySlots).getConfigManager(); (mecontainer = (ContainerMEMonitorable) inventorySlots).gui = this; @@ -123,6 +129,9 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi @Override public void initGui() { + maxRows = AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) == TerminalStyle.SMALL ? 6 : Integer.MAX_VALUE; + perRow = AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) != TerminalStyle.FULL ? 9 : 9 + ((width - standardSize) / 18); + int NEI = 0; int top = 4; int magicNumber = 114 + 1; @@ -144,6 +153,11 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi } } + if ( AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) != TerminalStyle.FULL ) + this.xSize = standardSize + ((perRow - 9) * 18); + else + this.xSize = standardSize; + super.initGui(); // full size : 204 // extra slots : 72 @@ -165,6 +179,10 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi buttonList.add( searchBoxSettings = new GuiImgButton( this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance.settings .getSetting( Settings.SEARCH_MODE ) ) ); + offset += 20; + + buttonList.add( terminalStyleBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.TERMINAL_STYLE, AEConfig.instance.settings + .getSetting( Settings.TERMINAL_STYLE ) ) ); searchField = new MEGuiTextField( fontRendererObj, this.guiLeft + Math.max( 82, xoffset ), this.guiTop + 6, 89, fontRendererObj.FONT_HEIGHT ); searchField.setEnableBackgroundDrawing( false ); @@ -201,7 +219,9 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi Enum cv = iBtn.getCurrentValue(); Enum next = Platform.rotateEnum( cv, backwards, iBtn.getSetting().getPossibleValues() ); - if ( btn == searchBoxSettings ) + if ( btn == terminalStyleBox ) + AEConfig.instance.settings.putSetting( iBtn.getSetting(), next ); + else if ( btn == searchBoxSettings ) AEConfig.instance.settings.putSetting( iBtn.getSetting(), next ); else { @@ -217,7 +237,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi iBtn.set( next ); - if ( next.getClass() == SearchBoxMode.class ) + if ( next.getClass() == SearchBoxMode.class || next.getClass() == TerminalStyle.class ) re_init(); } } @@ -261,6 +281,13 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi } } + @Override + public void updateScreen() + { + repo.setPower( mecontainer.hasPower ); + super.updateScreen(); + } + @Override public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) { @@ -335,4 +362,9 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi repo.updateView(); } + protected boolean isPowered() + { + return repo.hasPower(); + } + } diff --git a/client/gui/widgets/GuiImgButton.java b/client/gui/widgets/GuiImgButton.java index 9ff658e25..24ab6540d 100644 --- a/client/gui/widgets/GuiImgButton.java +++ b/client/gui/widgets/GuiImgButton.java @@ -23,6 +23,7 @@ import appeng.api.config.SearchBoxMode; import appeng.api.config.Settings; import appeng.api.config.SortDir; import appeng.api.config.SortOrder; +import appeng.api.config.TerminalStyle; import appeng.api.config.ViewItems; import appeng.api.config.YesNo; import appeng.client.texture.ExtraTextures; @@ -140,6 +141,10 @@ public class GuiImgButton extends GuiButton implements ITooltip registerApp( 16 * 5 + 3, Settings.LEVEL_TYPE, LevelType.ENERGY_LEVEL, ButtonToolTips.LevelType, ButtonToolTips.LevelType_Energy ); registerApp( 16 * 4 + 3, Settings.LEVEL_TYPE, LevelType.ITEM_LEVEL, ButtonToolTips.LevelType, ButtonToolTips.LevelType_Item ); + registerApp( 16 * 13 + 0, Settings.TERMINAL_STYLE, TerminalStyle.TALL, ButtonToolTips.TerminalStyle, ButtonToolTips.TerminalStyle_Tall ); + registerApp( 16 * 13 + 1, Settings.TERMINAL_STYLE, TerminalStyle.SMALL, ButtonToolTips.TerminalStyle, ButtonToolTips.TerminalStyle_Small ); + registerApp( 16 * 13 + 2, Settings.TERMINAL_STYLE, TerminalStyle.FULL, ButtonToolTips.TerminalStyle, ButtonToolTips.TerminalStyle_Full ); + registerApp( 64, Settings.SORT_BY, SortOrder.NAME, ButtonToolTips.SortBy, ButtonToolTips.ItemName ); registerApp( 65, Settings.SORT_BY, SortOrder.AMOUNT, ButtonToolTips.SortBy, ButtonToolTips.NumberOfItems ); registerApp( 68, Settings.SORT_BY, SortOrder.INVTWEAKS, ButtonToolTips.SortBy, ButtonToolTips.InventoryTweaks ); diff --git a/client/me/InternalSlotME.java b/client/me/InternalSlotME.java index ac79879c7..4f1046c1e 100644 --- a/client/me/InternalSlotME.java +++ b/client/me/InternalSlotME.java @@ -28,4 +28,9 @@ public class InternalSlotME { return repo.getRefrenceItem( offset ); } + + public boolean hasPower() + { + return repo.hasPower(); + } } diff --git a/client/me/ItemRepo.java b/client/me/ItemRepo.java index 4fd5970e5..914b1f7a7 100644 --- a/client/me/ItemRepo.java +++ b/client/me/ItemRepo.java @@ -241,4 +241,16 @@ public class ItemRepo list.resetStatus(); } + private boolean hasPower; + + public boolean hasPower() + { + return hasPower; + } + + public void setPower(boolean hasPower) + { + this.hasPower = hasPower; + } + } diff --git a/client/me/SlotME.java b/client/me/SlotME.java index 180ca510a..f227dfc12 100644 --- a/client/me/SlotME.java +++ b/client/me/SlotME.java @@ -19,12 +19,16 @@ public class SlotME extends Slot @Override public ItemStack getStack() { - return mySlot.getStack(); + if ( mySlot.hasPower() ) + return mySlot.getStack(); + return null; } public IAEItemStack getAEStack() { - return mySlot.getAEStack(); + if ( mySlot.hasPower() ) + return mySlot.getAEStack(); + return null; } @Override @@ -48,7 +52,9 @@ public class SlotME extends Slot @Override public boolean getHasStack() { - return getStack() != null; + if ( mySlot.hasPower() ) + return getStack() != null; + return false; } @Override diff --git a/client/render/blocks/RenderBlockSkyChest.java b/client/render/blocks/RenderBlockSkyChest.java index 5758acf54..cdd9aa76f 100644 --- a/client/render/blocks/RenderBlockSkyChest.java +++ b/client/render/blocks/RenderBlockSkyChest.java @@ -104,7 +104,7 @@ public class RenderBlockSkyChest extends BaseBlockRender lidangle = 1.0F - lidangle; lidangle = 1.0F - lidangle * lidangle * lidangle; - model.chestLid.offsetY = -(0.9f / 16.0f); + model.chestLid.offsetY = -(1.01f / 16.0f); model.chestLid.rotateAngleX = -((lidangle * 3.141593F) / 2.0F); model.renderAll(); diff --git a/client/render/blocks/RenderBlockSkyCompass.java b/client/render/blocks/RenderBlockSkyCompass.java index 3e2a2f2a2..d0b60e83c 100644 --- a/client/render/blocks/RenderBlockSkyCompass.java +++ b/client/render/blocks/RenderBlockSkyCompass.java @@ -65,11 +65,12 @@ public class RenderBlockSkyCompass extends BaseBlockRender if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON || type == ItemRenderType.INVENTORY || type == ItemRenderType.EQUIPPED ) { EntityPlayer p = Minecraft.getMinecraft().thePlayer; + float rYaw = p.rotationYaw; if ( type == ItemRenderType.EQUIPPED ) { p = (EntityPlayer) obj[1]; - p.rotationYaw = p.renderYawOffset; + rYaw = p.renderYawOffset; } int x = (int) p.posX; @@ -92,13 +93,13 @@ public class RenderBlockSkyCompass extends BaseBlockRender { if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON ) { - float offRads = p.rotationYaw / 180.0f * (float) Math.PI; + float offRads = rYaw / 180.0f * (float) Math.PI; float adjustment = (float) Math.PI * 0.74f; model.renderAll( (float) flipidiy( cr.rad + offRads + adjustment ) ); } else { - float offRads = p.rotationYaw / 180.0f * (float) Math.PI; + float offRads = rYaw / 180.0f * (float) Math.PI; float adjustment = (float) Math.PI * -0.74f; model.renderAll( (float) flipidiy( cr.rad + offRads + adjustment ) ); } diff --git a/client/render/blocks/RenderBlockWireless.java b/client/render/blocks/RenderBlockWireless.java index 69be2935e..401ed4ec3 100644 --- a/client/render/blocks/RenderBlockWireless.java +++ b/client/render/blocks/RenderBlockWireless.java @@ -45,8 +45,8 @@ public class RenderBlockWireless extends BaseBlockRender renderBlockBounds( renderer, 5, 5, 0, 11, 11, 1, ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.SOUTH ); renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer ); - r = CableBusTextures.PartMonitorSides.getIcon(); - ri.setTemporaryRenderIcons( r, r, ExtraTextures.BlockChargerInside.getIcon(), ExtraTextures.BlockChargerInside.getIcon(), r, r ); + r = CableBusTextures.PartWirelessSides.getIcon(); + ri.setTemporaryRenderIcons( r, r, ExtraTextures.BlockWirelessInside.getIcon(), ExtraTextures.BlockWirelessInside.getIcon(), r, r ); renderBlockBounds( renderer, 5, 5, 1, 11, 11, 2, ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.SOUTH ); renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer ); @@ -56,7 +56,7 @@ public class RenderBlockWireless extends BaseBlockRender super.postRenderInWorld( renderer ); tess.draw(); - ri.setTemporaryRenderIcons( r, r, ExtraTextures.BlockChargerInside.getIcon(), ExtraTextures.BlockChargerInside.getIcon(), r, r ); + ri.setTemporaryRenderIcons( r, r, ExtraTextures.BlockWirelessInside.getIcon(), ExtraTextures.BlockWirelessInside.getIcon(), r, r ); ForgeDirection sides[] = new ForgeDirection[] { ForgeDirection.EAST, ForgeDirection.WEST, ForgeDirection.UP, ForgeDirection.DOWN }; @@ -113,8 +113,8 @@ public class RenderBlockWireless extends BaseBlockRender renderBlockBounds( renderer, 5, 5, 0, 11, 11, 1, fdx, fdy, fdz ); super.renderInWorld( blk, world, x, y, z, renderer ); - r = CableBusTextures.PartMonitorSides.getIcon(); - ri.setTemporaryRenderIcons( r, r, ExtraTextures.BlockChargerInside.getIcon(), ExtraTextures.BlockChargerInside.getIcon(), r, r ); + r = CableBusTextures.PartWirelessSides.getIcon(); + ri.setTemporaryRenderIcons( r, r, ExtraTextures.BlockWirelessInside.getIcon(), ExtraTextures.BlockWirelessInside.getIcon(), r, r ); renderBlockBounds( renderer, 5, 5, 1, 11, 11, 2, fdx, fdy, fdz ); super.renderInWorld( blk, world, x, y, z, renderer ); @@ -126,7 +126,7 @@ public class RenderBlockWireless extends BaseBlockRender renderTorchAtAngle( renderer, fdx, fdy, fdz ); super.postRenderInWorld( renderer ); - ri.setTemporaryRenderIcons( r, r, ExtraTextures.BlockChargerInside.getIcon(), ExtraTextures.BlockChargerInside.getIcon(), r, r ); + ri.setTemporaryRenderIcons( r, r, ExtraTextures.BlockWirelessInside.getIcon(), ExtraTextures.BlockWirelessInside.getIcon(), r, r ); ForgeDirection sides[] = new ForgeDirection[] { ForgeDirection.EAST, ForgeDirection.WEST, ForgeDirection.UP, ForgeDirection.DOWN }; diff --git a/client/render/blocks/RenderMEChest.java b/client/render/blocks/RenderMEChest.java index 91cf3d725..142a01f1d 100644 --- a/client/render/blocks/RenderMEChest.java +++ b/client/render/blocks/RenderMEChest.java @@ -112,7 +112,7 @@ public class RenderMEChest extends BaseBlockRender Tessellator.instance.setColorOpaque_I( 0xffffff ); renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 ); - ICellHandler ch = AEApi.instance().registries().cell().getHander( sp.getStorageType() ); + ICellHandler ch = AEApi.instance().registries().cell().getHandler( sp.getStorageType() ); IIcon ico = ch == null ? null : ch.getTopTexture(); renderFace( x, y, z, imb, ico == null ? ExtraTextures.MEChest.getIcon() : ico, renderer, up ); diff --git a/client/render/blocks/RenderStorageMonitor.java b/client/render/blocks/RenderStorageMonitor.java deleted file mode 100644 index 4ccd41323..000000000 --- a/client/render/blocks/RenderStorageMonitor.java +++ /dev/null @@ -1,99 +0,0 @@ -package appeng.client.render.blocks; - -import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.item.ItemStack; - -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import appeng.api.implementations.parts.IPartStorageMonitor; -import appeng.api.storage.data.IAEItemStack; -import appeng.block.AEBaseBlock; -import appeng.client.render.BaseBlockRender; -import appeng.core.AELog; -import appeng.tile.AEBaseTile; - -public class RenderStorageMonitor extends BaseBlockRender -{ - - public RenderStorageMonitor() { - super( true, 30 ); - } - - @Override - public void renderTile(AEBaseBlock blk, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks rinstance) - { - IPartStorageMonitor monitor = (IPartStorageMonitor) tile; - IAEItemStack is = ((IAEItemStack) monitor.getDisplayed()); - - if ( is != null && monitor.isPowered() ) - { - FontRenderer fr = Minecraft.getMinecraft().fontRenderer; - - // applyTESRRotation( x, y, z, monitor.getForward(), monitor.getUp() - // ); - - GL11.glPushMatrix(); - try - { - ItemStack sis = is.getItemStack(); - sis.stackSize = 1; - - GL11.glTranslatef( 0.0f, -0.05f, -0.25f ); - GL11.glScalef( 1.0f / 1.5f, 1.0f / 1.5f, 1.0f / 1.5f ); - GL11.glScalef( 1.0f, -1.0f, 0.005f ); - - Block block = Block.getBlockFromItem( sis.getItem() ); - if ( sis.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d( block.getRenderType() ) ) - { - GL11.glRotatef( 25.0f, 1.0f, 0.0f, 0.0f ); - GL11.glRotatef( 15.0f, 0.0f, 1.0f, 0.0f ); - GL11.glRotatef( 30.0f, 0.0f, 1.0f, 0.0f ); - } - int br = 16 << 20 | 16 << 4; - int var11 = br % 65536; - int var12 = br / 65536; - OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, var11 * 0.8F, var12 * 0.8F ); - - GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F ); - - GL11.glDisable( GL11.GL_LIGHTING ); - GL11.glDisable( GL12.GL_RESCALE_NORMAL ); - tess.setColorOpaque_F( 1.0f, 1.0f, 1.0f ); - - doRenderItem( sis, tile ); - } - catch (Exception err) - { - AELog.error( err ); - } - - GL11.glPopMatrix(); - - GL11.glTranslatef( 0.0f, 0.14f, -0.24f ); - GL11.glScalef( 1.0f / 62.0f, 1.0f / 62.0f, 1.0f / 62.0f ); - - long qty = is.getStackSize(); - if ( qty > 999999999999L ) - qty = 999999999999L; - - String msg = Long.toString( qty ); - if ( qty > 1000000000 ) - msg = Long.toString( qty / 1000000000 ) + "B"; - else if ( qty > 1000000 ) - msg = Long.toString( qty / 1000000 ) + "M"; - else if ( qty > 9999 ) - msg = Long.toString( qty / 1000 ) + "K"; - - int width = fr.getStringWidth( msg ); - GL11.glTranslatef( -0.5f * width, 0.0f, -1.0f ); - fr.drawString( msg, 0, 0, 0 ); - } - } - -} diff --git a/client/texture/CableBusTextures.java b/client/texture/CableBusTextures.java index 05bca7f08..ba28585b9 100644 --- a/client/texture/CableBusTextures.java +++ b/client/texture/CableBusTextures.java @@ -61,7 +61,11 @@ public enum CableBusTextures BlockFormPlaneOn("BlockFormPlaneOn"), - ItemPartLevelEmitterOn("ItemPart.LevelEmitterOn"), PartTransitionPlaneBack("PartTransitionPlaneBack"); + ItemPartLevelEmitterOn("ItemPart.LevelEmitterOn"), PartTransitionPlaneBack("PartTransitionPlaneBack"), + + PartTunnelSides("PartTunnelSides"), PartPlaneSides("PartPlaneSides"), PartExportSides("PartExportSides"), PartImportSides("PartImportSides"), + + PartWirelessSides("PartWirelessSides"), PartStorageSides("PartStorageSides"), PartStorageBack("PartStorageBack"); final private String name; public IIcon IIcon; diff --git a/client/texture/ExtraTextures.java b/client/texture/ExtraTextures.java index 404bf5e62..5d323f1d2 100644 --- a/client/texture/ExtraTextures.java +++ b/client/texture/ExtraTextures.java @@ -50,7 +50,9 @@ public enum ExtraTextures BlockMESecurityOn("BlockMESecurityOn"), BlockInscriberInside("BlockInscriberInside"), - BlockQuartzGrowthAcceleratorOn("BlockQuartzGrowthAcceleratorOn"), BlockQuartzGrowthAcceleratorSideOn("BlockQuartzGrowthAcceleratorSideOn"); + BlockQuartzGrowthAcceleratorOn("BlockQuartzGrowthAcceleratorOn"), BlockQuartzGrowthAcceleratorSideOn("BlockQuartzGrowthAcceleratorSideOn"), + + BlockWirelessInside("BlockWirelessInside"); final private String name; public IIcon IIcon; diff --git a/client/texture/TaughtIcon.java b/client/texture/TaughtIcon.java index cb3490cb8..1c21acfbf 100644 --- a/client/texture/TaughtIcon.java +++ b/client/texture/TaughtIcon.java @@ -13,7 +13,7 @@ public class TaughtIcon implements IIcon public TaughtIcon(IIcon o, float tightness) { p = o; - this.tightness = tightness; + this.tightness = tightness * 0.4f; } @Override diff --git a/container/AEBaseContainer.java b/container/AEBaseContainer.java index b2513422a..fb83b4aad 100644 --- a/container/AEBaseContainer.java +++ b/container/AEBaseContainer.java @@ -115,8 +115,8 @@ public abstract class AEBaseContainer extends Container public ContainerOpenContext openContext; protected IMEInventoryHandler cellInv; - protected IEnergySource powerSrc; protected HashSet locked = new HashSet(); + protected IEnergySource powerSrc; public void lockPlayerInventorySlot(int idx) { @@ -756,4 +756,67 @@ public abstract class AEBaseContainer extends Container } } + public void swapSlotContents(int slotA, int slotB) + { + Slot a = getSlot( slotA ); + Slot b = getSlot( slotB ); + + // NPE protection... + if ( a == null || b == null ) + return; + + ItemStack isA = a.getStack(); + ItemStack isB = b.getStack(); + + // something to do? + if ( isA == null && isB == null ) + return; + + // can take? + + if ( isA != null && !a.canTakeStack( invPlayer.player ) ) + return; + + if ( isB != null && !b.canTakeStack( invPlayer.player ) ) + return; + + // swap valid? + + if ( isB != null && !a.isItemValid( isB ) ) + return; + + if ( isA != null && !b.isItemValid( isA ) ) + return; + + ItemStack testA = isB == null ? null : isB.copy(); + ItemStack testB = isA == null ? null : isA.copy(); + + // can put some back? + if ( testA != null && testA.stackSize > a.getSlotStackLimit() ) + { + if ( testB != null ) + return; + + int totalA = testA.stackSize; + testA.stackSize = a.getSlotStackLimit(); + testB = testA.copy(); + + testB.stackSize = totalA - testA.stackSize; + } + + if ( testB != null && testB.stackSize > b.getSlotStackLimit() ) + { + if ( testA != null ) + return; + + int totalB = testB.stackSize; + testB.stackSize = b.getSlotStackLimit(); + testA = testB.copy(); + + testA.stackSize = totalB - testA.stackSize; + } + + a.putStack( testA ); + b.putStack( testB ); + } } diff --git a/container/implementations/ContainerMEMonitorable.java b/container/implementations/ContainerMEMonitorable.java index 68d363aba..679597c6b 100644 --- a/container/implementations/ContainerMEMonitorable.java +++ b/container/implementations/ContainerMEMonitorable.java @@ -10,6 +10,8 @@ import net.minecraft.inventory.ICrafting; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; +import appeng.api.config.Actionable; +import appeng.api.config.PowerMultiplier; import appeng.api.config.SecurityPermissions; import appeng.api.config.Settings; import appeng.api.config.SortDir; @@ -38,6 +40,7 @@ import appeng.core.AELog; import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketMEInventoryUpdate; import appeng.core.sync.packets.PacketValueConfig; +import appeng.me.helpers.ChannelPowerSrc; import appeng.util.ConfigManager; import appeng.util.IConfigManagerHost; import appeng.util.Platform; @@ -52,9 +55,12 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa IConfigManager clientCM; public boolean canAccessViewCells = false; + public boolean hasPower = false; + public SlotRestrictedInput cellView[] = new SlotRestrictedInput[5]; public IConfigManagerHost gui; + private IGridNode networkNode; protected ContainerMEMonitorable(InventoryPlayer ip, ITerminalHost montiorable, boolean bindInventory) { super( ip, montiorable instanceof TileEntity ? (TileEntity) montiorable : null, montiorable instanceof IPart ? (IPart) montiorable : null ); @@ -85,9 +91,10 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa IGridNode node = ((IGridHost) montiorable).getGridNode( ForgeDirection.UNKNOWN ); if ( node != null ) { + networkNode = node; IGrid g = node.getGrid(); if ( g != null ) - powerSrc = g.getCache( IEnergyGrid.class ); + powerSrc = new ChannelPowerSrc( networkNode, (IEnergyGrid) g.getCache( IEnergyGrid.class ) ); } } } @@ -180,6 +187,8 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa } } + updatePowerStatus(); + boolean oldCanAccessViewCells = canAccessViewCells; canAccessViewCells = hasAccess( SecurityPermissions.BUILD, false ); if ( canAccessViewCells != oldCanAccessViewCells ) @@ -201,11 +210,46 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa } } + protected void updatePowerStatus() + { + boolean oldHasPower = hasPower; + try + { + if ( networkNode != null ) + hasPower = networkNode.isActive(); + else if ( powerSrc instanceof IEnergyGrid ) + hasPower = ((IEnergyGrid) powerSrc).isNetworkPowered(); + else + hasPower = powerSrc.extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.8; + } + catch (Throwable t) + { + // :P + } + + if ( hasPower != oldHasPower ) + { + for (Object c : this.crafters) + { + if ( c instanceof ICrafting ) + { + ICrafting cr = (ICrafting) c; + cr.sendProgressBarUpdate( this, 98, hasPower ? 1 : 0 ); + } + } + } + + } + @Override public void addCraftingToCrafters(ICrafting c) { super.addCraftingToCrafters( c ); + queueInventory( c ); + } + public void queueInventory(ICrafting c) + { if ( Platform.isServer() && c instanceof EntityPlayer && monitor != null ) { try @@ -238,11 +282,27 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa } } + @Override + public void onListUpdate() + { + for (Object c : this.crafters) + { + if ( c instanceof ICrafting ) + { + ICrafting cr = (ICrafting) c; + queueInventory( cr ); + } + } + } + @Override public void updateProgressBar(int idx, int value) { super.updateProgressBar( idx, value ); + if ( idx == 98 ) + hasPower = value == 1; + if ( idx == 99 ) canAccessViewCells = value == 1; diff --git a/container/implementations/ContainerSecurity.java b/container/implementations/ContainerSecurity.java index 3d1b63d53..251c7e460 100644 --- a/container/implementations/ContainerSecurity.java +++ b/container/implementations/ContainerSecurity.java @@ -85,6 +85,8 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE @Override public void updateProgressBar(int key, int value) { + super.updateProgressBar( key, value ); + if ( key == 0 ) security = value; } @@ -92,7 +94,7 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE @Override public void detectAndSendChanges() { - verifyPermissions( SecurityPermissions.SECURITY, true ); + verifyPermissions( SecurityPermissions.SECURITY, false ); int newSecurity = 0; @@ -105,6 +107,8 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE newSecurity = newSecurity | (1 << sp.ordinal()); } + updatePowerStatus(); + if ( newSecurity != security ) { if ( Platform.isServer() ) @@ -138,14 +142,14 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE { ItemStack term = wirelessIn.getStack().copy(); INetworkEncodable netEncodeable = null; - + if ( term.getItem() instanceof INetworkEncodable ) netEncodeable = (INetworkEncodable) term.getItem(); - + IWirelessTermHandler wTermHandler = AEApi.instance().registries().wireless().getWirelessTerminalHandler( term ); if ( wTermHandler != null ) netEncodeable = wTermHandler; - + if ( netEncodeable != null ) { netEncodeable.setEncryptionKey( term, "" + securityBox.securityKey, "" ); diff --git a/core/AEConfig.java b/core/AEConfig.java index d71e9f8e5..3e48dd90f 100644 --- a/core/AEConfig.java +++ b/core/AEConfig.java @@ -10,6 +10,7 @@ import appeng.api.config.PowerMultiplier; import appeng.api.config.PowerUnits; import appeng.api.config.SearchBoxMode; import appeng.api.config.Settings; +import appeng.api.config.TerminalStyle; import appeng.api.config.YesNo; import appeng.api.util.IConfigManager; import appeng.api.util.IConfigureableObject; @@ -121,9 +122,10 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo grinderOres = get( "GrindStone", "grinderOres", grinderOres ).getStringList(); oreDoublePercentage = get( "GrindStone", "oreDoublePercentage", oreDoublePercentage ).getDouble( oreDoublePercentage ); enableEffects = get( "Client", "enableEffects", true ).getBoolean( true ); - useLargeFonts= get( "Client", "useTerminalUseLargeFont", true ).getBoolean( true ); - + useLargeFonts = get( "Client", "useTerminalUseLargeFont", false ).getBoolean( false ); + settings.registerSetting( Settings.SEARCH_TOOLTIPS, YesNo.YES ); + settings.registerSetting( Settings.TERMINAL_STYLE, TerminalStyle.TALL ); settings.registerSetting( Settings.SEARCH_MODE, SearchBoxMode.AUTOSEARCH ); spawnChargedChance = (float) (1.0 - get( "worldGen", "spawnChargedChance", 1.0 - spawnChargedChance ).getDouble( 1.0 - spawnChargedChance )); @@ -176,11 +178,11 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo selectedPowerUnit = PowerUnits.AE; } - for (TickRates tr: TickRates.values() ) + for (TickRates tr : TickRates.values()) { - tr.Load(this); + tr.Load( this ); } - + if ( isFeatureEnabled( AEFeature.SpatialIO ) ) { storageBiomeID = get( "spatialio", "storageBiomeID", storageBiomeID ).getInt( storageBiomeID ); diff --git a/core/AppEng.java b/core/AppEng.java index 15e85b560..cd9db79f7 100644 --- a/core/AppEng.java +++ b/core/AppEng.java @@ -1,6 +1,7 @@ package appeng.core; import java.io.File; +import java.util.concurrent.TimeUnit; import appeng.core.crash.CrashEnhancement; import appeng.core.crash.CrashInfo; @@ -14,12 +15,16 @@ import appeng.server.AECommand; import appeng.services.Profiler; import appeng.services.VersionChecker; import appeng.util.Platform; + +import com.google.common.base.Stopwatch; + import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.event.FMLServerAboutToStartEvent; import cpw.mods.fml.common.event.FMLServerStartingEvent; import cpw.mods.fml.common.event.FMLServerStoppingEvent; import cpw.mods.fml.common.network.NetworkRegistry; @@ -82,6 +87,7 @@ public class AppEng // IntegrationSide.BOTH, "Forestry", "Forestry", "Forestry", // Forestry // IntegrationSide.BOTH, "Mekanism", "Mekanism", "Mekanism", // MeK IntegrationSide.CLIENT, "Waila", "Waila", "Waila", // Waila + IntegrationSide.BOTH, "Rotatable Blocks", "RotatableBlocks", "RB", // RB IntegrationSide.CLIENT, "Inventory Tweaks", "inventorytweaks", "InvTweaks", // INV IntegrationSide.CLIENT, "Not Enough Items", "NotEnoughItems", "NEI", // NEI IntegrationSide.CLIENT, "Craft Guide", "craftguide", "CraftGuide", // CraftGuide @@ -108,6 +114,7 @@ public class AppEng @EventHandler void PreInit(FMLPreInitializationEvent event) { + Stopwatch star = Stopwatch.createStarted(); configPath = event.getModConfigurationDirectory().getPath() + File.separator + "AppliedEnergistics2" + File.separator; AEConfig.instance = new AEConfig( configPath ); @@ -118,7 +125,8 @@ public class AppEng if ( Platform.isClient() ) { CreativeTab.init(); - CreativeTabFacade.init(); + if ( AEConfig.instance.isFeatureEnabled( AEFeature.Facades ) ) + CreativeTabFacade.init(); CommonHelper.proxy.init(); } @@ -136,23 +144,25 @@ public class AppEng startService( "AE2 VersionChecker", new Thread( VersionChecker.instance = new VersionChecker() ) ); } - AELog.info( "PreInit ( end )" ); + AELog.info( "PreInit ( end " + star.elapsed( TimeUnit.MILLISECONDS ) + "ms )" ); } @EventHandler void Init(FMLInitializationEvent event) { + Stopwatch star = Stopwatch.createStarted(); AELog.info( "Init" ); Registration.instance.Init( event ); integrationModules.init(); - AELog.info( "Init ( end )" ); + AELog.info( "Init ( end " + star.elapsed( TimeUnit.MILLISECONDS ) + "ms )" ); } @EventHandler void PostInit(FMLPostInitializationEvent event) { + Stopwatch star = Stopwatch.createStarted(); AELog.info( "PostInit" ); Registration.instance.PostInit( event ); @@ -163,7 +173,7 @@ public class AppEng NetworkRegistry.INSTANCE.registerGuiHandler( this, GuiBridge.GUI_Handler ); NetworkHandler.instance = new NetworkHandler( "AE2" ); - AELog.info( "PostInit ( end )" ); + AELog.info( "PostInit ( end " + star.elapsed( TimeUnit.MILLISECONDS ) + "ms )" ); } @EventHandler @@ -174,9 +184,14 @@ public class AppEng } @EventHandler - public void serverStarting(FMLServerStartingEvent evt) + public void serverStarting(FMLServerAboutToStartEvent evt) { WorldSettings.getInstance().init(); + } + + @EventHandler + public void serverStarting(FMLServerStartingEvent evt) + { evt.registerServerCommand( new AECommand( evt.getServer() ) ); } diff --git a/core/features/registries/CellRegistry.java b/core/features/registries/CellRegistry.java index dd33a13df..24e848b1b 100644 --- a/core/features/registries/CellRegistry.java +++ b/core/features/registries/CellRegistry.java @@ -37,7 +37,7 @@ public class CellRegistry implements ICellRegistry } @Override - public ICellHandler getHander(ItemStack is) + public ICellHandler getHandler(ItemStack is) { if ( is == null ) return null; diff --git a/core/features/registries/entries/BasicCellHandler.java b/core/features/registries/entries/BasicCellHandler.java index 3d0defc8a..a9bf16e2e 100644 --- a/core/features/registries/entries/BasicCellHandler.java +++ b/core/features/registries/entries/BasicCellHandler.java @@ -5,6 +5,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import appeng.api.implementations.tiles.IChestOrDrive; import appeng.api.storage.ICellHandler; +import appeng.api.storage.ICellInventory; +import appeng.api.storage.ICellInventoryHandler; import appeng.api.storage.IMEInventory; import appeng.api.storage.IMEInventoryHandler; import appeng.api.storage.StorageChannel; @@ -58,7 +60,7 @@ public class BasicCellHandler implements ICellHandler @Override public double cellIdleDrain(ItemStack is, IMEInventory handler) { - CellInventory inv = ((CellInventoryHandler) handler).getCellInv(); + ICellInventory inv = ((ICellInventoryHandler) handler).getCellInv(); return inv.getIdleDrain(); } } diff --git a/core/localization/ButtonToolTips.java b/core/localization/ButtonToolTips.java index c07845326..07b9aece9 100644 --- a/core/localization/ButtonToolTips.java +++ b/core/localization/ButtonToolTips.java @@ -32,7 +32,7 @@ public enum ButtonToolTips Blocking, NonBlocking, Craft, DontCraft, - LevelType, LevelType_Energy, LevelType_Item, InventoryTweaks; + LevelType, LevelType_Energy, LevelType_Item, InventoryTweaks, TerminalStyle, TerminalStyle_Full, TerminalStyle_Tall, TerminalStyle_Small; String root; diff --git a/core/sync/AppEngPacketHandlerBase.java b/core/sync/AppEngPacketHandlerBase.java index d34c4dbe6..5748f04d0 100644 --- a/core/sync/AppEngPacketHandlerBase.java +++ b/core/sync/AppEngPacketHandlerBase.java @@ -20,6 +20,7 @@ import appeng.core.sync.packets.PacketMultiPart; import appeng.core.sync.packets.PacketNewStorageDimension; import appeng.core.sync.packets.PacketPartPlacement; import appeng.core.sync.packets.PacketProgressBar; +import appeng.core.sync.packets.PacketSwapSlots; import appeng.core.sync.packets.PacketSwitchGuis; import appeng.core.sync.packets.PacketTransitionEffect; import appeng.core.sync.packets.PacketValueConfig; @@ -61,7 +62,9 @@ public class AppEngPacketHandlerBase PACKET_NEW_STORAGE_DIMENSION(PacketNewStorageDimension.class), - PACKET_SWITCH_GUIS(PacketSwitchGuis.class); + PACKET_SWITCH_GUIS(PacketSwitchGuis.class), + + PACKET_SWAP_SLOTS(PacketSwapSlots.class); final public Class pc; final public Constructor con; diff --git a/core/sync/packets/PacketSwapSlots.java b/core/sync/packets/PacketSwapSlots.java new file mode 100644 index 000000000..2ed6ac17e --- /dev/null +++ b/core/sync/packets/PacketSwapSlots.java @@ -0,0 +1,44 @@ +package appeng.core.sync.packets; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + +import java.io.IOException; + +import net.minecraft.entity.player.EntityPlayer; +import appeng.container.AEBaseContainer; +import appeng.core.sync.AppEngPacket; +import appeng.core.sync.network.INetworkInfo; + +public class PacketSwapSlots extends AppEngPacket +{ + + int slotA, slotB; + + // automatic. + public PacketSwapSlots(ByteBuf stream) throws IOException { + slotA = stream.readInt(); + slotB = stream.readInt(); + } + + @Override + public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player) + { + if ( player != null && player.openContainer instanceof AEBaseContainer ) + { + ((AEBaseContainer) player.openContainer).swapSlotContents( slotA, slotB ); + } + } + + // api + public PacketSwapSlots(int slotA, int slotB) throws IOException { + + ByteBuf data = Unpooled.buffer(); + + data.writeInt( getPacketID() ); + data.writeInt( this.slotA = slotA ); + data.writeInt( this.slotB = slotB ); + + configureWrite( data ); + } +} diff --git a/helpers/LocationRotation.java b/helpers/LocationRotation.java index fdde4a2dc..b8f700480 100644 --- a/helpers/LocationRotation.java +++ b/helpers/LocationRotation.java @@ -43,6 +43,6 @@ public class LocationRotation implements IOrientable @Override public boolean canBeRotated() { - return true; + return false; } } diff --git a/hooks/MeteoriteWorldGen.java b/hooks/MeteoriteWorldGen.java index 9282e64a1..978d26ebc 100644 --- a/hooks/MeteoriteWorldGen.java +++ b/hooks/MeteoriteWorldGen.java @@ -1,7 +1,6 @@ package appeng.hooks; import java.util.Random; -import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import net.minecraft.world.World; @@ -46,7 +45,6 @@ final public class MeteoriteWorldGen implements IWorldGenerator try { - future.get(); if ( obj.distance > AEConfig.instance.minMeteoriteDistanceSq ) @@ -67,11 +65,7 @@ final public class MeteoriteWorldGen implements IWorldGenerator } } - catch (InterruptedException e) - { - AELog.error( e ); - } - catch (ExecutionException e) + catch (Throwable e) { AELog.error( e ); } diff --git a/integration/abstraction/IRB.java b/integration/abstraction/IRB.java new file mode 100644 index 000000000..0770759ff --- /dev/null +++ b/integration/abstraction/IRB.java @@ -0,0 +1,11 @@ +package appeng.integration.abstraction; + +import net.minecraft.tileentity.TileEntity; +import appeng.api.util.IOrientable; + +public interface IRB +{ + + IOrientable getOrientable(TileEntity te); + +} diff --git a/integration/modules/BC.java b/integration/modules/BC.java index 5afc2e47d..2647f47c8 100644 --- a/integration/modules/BC.java +++ b/integration/modules/BC.java @@ -35,7 +35,8 @@ public class BC extends BaseModule implements IBC @Override public void addFacade(ItemStack item) { - FMLInterModComms.sendMessage( "BuildCraft|Transport", "add-facade", item ); + if ( item != null ) + FMLInterModComms.sendMessage( "BuildCraft|Transport", "add-facade", item ); } @Override @@ -186,6 +187,15 @@ public class BC extends BaseModule implements IBC addFacade( b.blockQuartz.stack( 1 ) ); addFacade( b.blockQuartzChiseled.stack( 1 ) ); addFacade( b.blockQuartzPiller.stack( 1 ) ); + + Block skyStone = b.blockSkyStone.block(); + if ( skyStone != null ) + { + addFacade( new ItemStack( skyStone, 1, 0 ) ); + addFacade( new ItemStack( skyStone, 1, 1 ) ); + addFacade( new ItemStack( skyStone, 1, 2 ) ); + addFacade( new ItemStack( skyStone, 1, 3 ) ); + } } @Override diff --git a/integration/modules/dead/NEI.java b/integration/modules/NEI.java similarity index 76% rename from integration/modules/dead/NEI.java rename to integration/modules/NEI.java index 4942e270a..0285ec537 100644 --- a/integration/modules/dead/NEI.java +++ b/integration/modules/NEI.java @@ -1,9 +1,10 @@ -package appeng.integration.modules.dead; +package appeng.integration.modules; import java.lang.reflect.Method; import appeng.integration.IIntegrationModule; -import appeng.integration.modules.helpers.NEIQuartzShapedRecipeHandler; +import appeng.integration.modules.helpers.NEIAEShapedRecipeHandler; +import appeng.integration.modules.helpers.NEIAEShapelessRecipeHandler; public class NEI implements IIntegrationModule { @@ -14,11 +15,15 @@ public class NEI implements IIntegrationModule public void Init() throws Throwable { Class API = Class.forName( "codechicken.nei.api.API" ); + Method registerRecipeHandler = API.getDeclaredMethod( "registerRecipeHandler", new Class[] { codechicken.nei.recipe.ICraftingHandler.class } ); Method registerUsageHandler = API.getDeclaredMethod( "registerUsageHandler", new Class[] { codechicken.nei.recipe.IUsageHandler.class } ); - registerRecipeHandler.invoke( API, new NEIQuartzShapedRecipeHandler() ); - registerUsageHandler.invoke( API, new NEIQuartzShapedRecipeHandler() ); + registerRecipeHandler.invoke( API, new NEIAEShapedRecipeHandler() ); + registerUsageHandler.invoke( API, new NEIAEShapedRecipeHandler() ); + + registerRecipeHandler.invoke( API, new NEIAEShapelessRecipeHandler() ); + registerUsageHandler.invoke( API, new NEIAEShapelessRecipeHandler() ); /* * Method registerGuiOverlay = API.getDeclaredMethod( "registerGuiOverlay", new Class[] { Class.class, diff --git a/integration/modules/RB.java b/integration/modules/RB.java new file mode 100644 index 000000000..122d200d0 --- /dev/null +++ b/integration/modules/RB.java @@ -0,0 +1,69 @@ +package appeng.integration.modules; + +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; +import rblocks.api.IOrientable; +import appeng.integration.BaseModule; +import appeng.integration.abstraction.IRB; + +public class RB extends BaseModule implements IRB +{ + + private class RBWrapper implements appeng.api.util.IOrientable + { + + final private IOrientable internal; + + public RBWrapper(IOrientable ww) { + internal = ww; + } + + @Override + public boolean canBeRotated() + { + return internal.canBeRotated(); + } + + @Override + public ForgeDirection getForward() + { + return internal.getForward(); + } + + @Override + public ForgeDirection getUp() + { + return internal.getUp(); + } + + @Override + public void setOrientation(ForgeDirection Forward, ForgeDirection Up) + { + internal.setOrientation( Forward, Up ); + } + + }; + + public static RB instance; + + @Override + public void Init() throws Throwable + { + TestClass( IOrientable.class ); + } + + @Override + public void PostInit() throws Throwable + { + + } + + @Override + public appeng.api.util.IOrientable getOrientable(TileEntity te) + { + if ( te instanceof IOrientable ) + return new RBWrapper( (IOrientable) te ); + return null; + } + +} diff --git a/integration/modules/helpers/dead/NEIQuartzShapedRecipeHandler.java b/integration/modules/helpers/NEIAEShapedRecipeHandler.java similarity index 87% rename from integration/modules/helpers/dead/NEIQuartzShapedRecipeHandler.java rename to integration/modules/helpers/NEIAEShapedRecipeHandler.java index d8756b4bf..8665e9b9e 100644 --- a/integration/modules/helpers/dead/NEIQuartzShapedRecipeHandler.java +++ b/integration/modules/helpers/NEIAEShapedRecipeHandler.java @@ -1,4 +1,4 @@ -package appeng.integration.modules.helpers.dead; +package appeng.integration.modules.helpers; import java.awt.Rectangle; import java.util.ArrayList; @@ -10,7 +10,7 @@ import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; -import appeng.recipes.AEShapedQuartzRecipe; +import appeng.recipes.game.ShapedRecipe; import codechicken.nei.NEIClientUtils; import codechicken.nei.NEIServerUtils; import codechicken.nei.PositionedStack; @@ -21,7 +21,7 @@ import codechicken.nei.api.IStackPositioner; import codechicken.nei.recipe.RecipeInfo; import codechicken.nei.recipe.TemplateRecipeHandler; -public class NEIQuartzShapedRecipeHandler extends TemplateRecipeHandler +public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler { public void loadTransferRects() @@ -43,14 +43,14 @@ public class NEIQuartzShapedRecipeHandler extends TemplateRecipeHandler @Override public void loadCraftingRecipes(String outputId, Object[] results) { - if ( (outputId.equals( "crafting" )) && (getClass() == NEIQuartzShapedRecipeHandler.class) ) + if ( (outputId.equals( "crafting" )) && (getClass() == NEIAEShapedRecipeHandler.class) ) { List allrecipes = CraftingManager.getInstance().getRecipeList(); for (IRecipe irecipe : allrecipes) { CachedShapedRecipe recipe = null; - if ( (irecipe instanceof AEShapedQuartzRecipe) ) - recipe = new CachedShapedRecipe( (AEShapedQuartzRecipe) irecipe ); + if ( (irecipe instanceof ShapedRecipe) ) + recipe = new CachedShapedRecipe( (ShapedRecipe) irecipe ); if ( recipe != null ) { @@ -73,8 +73,8 @@ public class NEIQuartzShapedRecipeHandler extends TemplateRecipeHandler if ( NEIServerUtils.areStacksSameTypeCrafting( irecipe.getRecipeOutput(), result ) ) { CachedShapedRecipe recipe = null; - if ( (irecipe instanceof AEShapedQuartzRecipe) ) - recipe = new CachedShapedRecipe( (AEShapedQuartzRecipe) irecipe ); + if ( (irecipe instanceof ShapedRecipe) ) + recipe = new CachedShapedRecipe( (ShapedRecipe) irecipe ); if ( recipe != null ) { @@ -91,10 +91,10 @@ public class NEIQuartzShapedRecipeHandler extends TemplateRecipeHandler for (IRecipe irecipe : allrecipes) { CachedShapedRecipe recipe = null; - if ( (irecipe instanceof AEShapedQuartzRecipe) ) - recipe = new CachedShapedRecipe( (AEShapedQuartzRecipe) irecipe ); + if ( (irecipe instanceof ShapedRecipe) ) + recipe = new CachedShapedRecipe( (ShapedRecipe) irecipe ); - if ( (recipe != null) && (recipe.contains( recipe.ingredients, ingredient.itemID )) ) + if ( (recipe != null) && (recipe.contains( recipe.ingredients, ingredient.getItem() )) ) { recipe.computeVisuals(); if ( recipe.contains( recipe.ingredients, ingredient ) ) @@ -163,7 +163,7 @@ public class NEIQuartzShapedRecipeHandler extends TemplateRecipeHandler public ArrayList ingredients; public PositionedStack result; - public CachedShapedRecipe(AEShapedQuartzRecipe irecipe) { + public CachedShapedRecipe(ShapedRecipe irecipe) { result = new PositionedStack( irecipe.getRecipeOutput(), 119, 24 ); ingredients = new ArrayList(); setIngredients( irecipe.getWidth(), irecipe.getHeight(), irecipe.getIngredients() ); diff --git a/integration/modules/helpers/NEIAEShapelessRecipeHandler.java b/integration/modules/helpers/NEIAEShapelessRecipeHandler.java new file mode 100644 index 000000000..db189bac2 --- /dev/null +++ b/integration/modules/helpers/NEIAEShapelessRecipeHandler.java @@ -0,0 +1,209 @@ +package appeng.integration.modules.helpers; + +import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.gui.inventory.GuiCrafting; +import net.minecraft.inventory.Container; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.item.crafting.IRecipe; +import appeng.recipes.game.ShapelessRecipe; +import codechicken.nei.NEIClientUtils; +import codechicken.nei.NEIServerUtils; +import codechicken.nei.PositionedStack; +import codechicken.nei.api.DefaultOverlayRenderer; +import codechicken.nei.api.IOverlayHandler; +import codechicken.nei.api.IRecipeOverlayRenderer; +import codechicken.nei.api.IStackPositioner; +import codechicken.nei.recipe.RecipeInfo; +import codechicken.nei.recipe.TemplateRecipeHandler; + +public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler +{ + + public void loadTransferRects() + { + this.transferRects.add( new TemplateRecipeHandler.RecipeTransferRect( new Rectangle( 84, 23, 24, 18 ), "crafting", new Object[0] ) ); + } + + public Class getGuiClass() + { + return GuiCrafting.class; + } + + @Override + public String getRecipeName() + { + return NEIClientUtils.translate( "recipe.shapeless", new Object[0] ); + } + + @Override + public void loadCraftingRecipes(String outputId, Object[] results) + { + if ( (outputId.equals( "crafting" )) && (getClass() == NEIAEShapelessRecipeHandler.class) ) + { + List allrecipes = CraftingManager.getInstance().getRecipeList(); + for (IRecipe irecipe : allrecipes) + { + CachedShapelessRecipe recipe = null; + if ( (irecipe instanceof ShapelessRecipe) ) + recipe = new CachedShapelessRecipe( (ShapelessRecipe) irecipe ); + + if ( recipe != null ) + { + recipe.computeVisuals(); + this.arecipes.add( recipe ); + } + } + } + else + { + super.loadCraftingRecipes( outputId, results ); + } + } + + public void loadCraftingRecipes(ItemStack result) + { + List allrecipes = CraftingManager.getInstance().getRecipeList(); + for (IRecipe irecipe : allrecipes) + { + if ( NEIServerUtils.areStacksSameTypeCrafting( irecipe.getRecipeOutput(), result ) ) + { + CachedShapelessRecipe recipe = null; + if ( (irecipe instanceof ShapelessRecipe) ) + recipe = new CachedShapelessRecipe( (ShapelessRecipe) irecipe ); + + if ( recipe != null ) + { + recipe.computeVisuals(); + this.arecipes.add( recipe ); + } + } + } + } + + public void loadUsageRecipes(ItemStack ingredient) + { + List allrecipes = CraftingManager.getInstance().getRecipeList(); + for (IRecipe irecipe : allrecipes) + { + CachedShapelessRecipe recipe = null; + if ( (irecipe instanceof ShapelessRecipe) ) + recipe = new CachedShapelessRecipe( (ShapelessRecipe) irecipe ); + + if ( (recipe != null) && (recipe.contains( recipe.ingredients, ingredient.getItem() )) ) + { + recipe.computeVisuals(); + if ( recipe.contains( recipe.ingredients, ingredient ) ) + { + recipe.setIngredientPermutation( recipe.ingredients, ingredient ); + this.arecipes.add( recipe ); + } + } + } + } + + public String getGuiTexture() + { + return "textures/gui/container/crafting_table.png"; + } + + public String getOverlayIdentifier() + { + return "crafting"; + } + + @Override + public boolean hasOverlay(GuiContainer gui, Container container, int recipe) + { + return (super.hasOverlay( gui, container, recipe )) || ((isRecipe2x2( recipe )) && (RecipeInfo.hasDefaultOverlay( gui, "crafting2x2" ))); + } + + @Override + public IRecipeOverlayRenderer getOverlayRenderer(GuiContainer gui, int recipe) + { + IRecipeOverlayRenderer renderer = super.getOverlayRenderer( gui, recipe ); + if ( renderer != null ) + { + return renderer; + } + IStackPositioner positioner = RecipeInfo.getStackPositioner( gui, "crafting2x2" ); + if ( positioner == null ) + return null; + return new DefaultOverlayRenderer( getIngredientStacks( recipe ), positioner ); + } + + @Override + public IOverlayHandler getOverlayHandler(GuiContainer gui, int recipe) + { + IOverlayHandler handler = super.getOverlayHandler( gui, recipe ); + if ( handler != null ) + { + return handler; + } + return RecipeInfo.getOverlayHandler( gui, "crafting2x2" ); + } + + public boolean isRecipe2x2(int recipe) + { + for (PositionedStack stack : getIngredientStacks( recipe )) + { + if ( (stack.relx > 43) || (stack.rely > 24) ) + return false; + } + return true; + } + + public class CachedShapelessRecipe extends TemplateRecipeHandler.CachedRecipe + { + + public ArrayList ingredients; + public PositionedStack result; + + public CachedShapelessRecipe(ShapelessRecipe irecipe) { + result = new PositionedStack( irecipe.getRecipeOutput(), 119, 24 ); + ingredients = new ArrayList(); + setIngredients( irecipe.getInput().toArray() ); + } + + public void setIngredients(Object[] items) + { + for (int x = 0; x < 3; x++) + { + for (int y = 0; y < 3; y++) + { + if ( items.length > (y * 3 + x) ) + { + PositionedStack stack = new PositionedStack( items[(y * 3 + x)], 25 + x * 18, 6 + y * 18, false ); + stack.setMaxSize( 1 ); + this.ingredients.add( stack ); + } + } + } + } + + @Override + public List getIngredients() + { + return getCycledIngredients( cycleticks / 20, this.ingredients ); + } + + @Override + public PositionedStack getResult() + { + return this.result; + } + + public void computeVisuals() + { + for (PositionedStack p : this.ingredients) + { + p.generatePermutations(); + } + this.result.generatePermutations(); + } + } +} \ No newline at end of file diff --git a/items/misc/ItemCrystalSeed.java b/items/misc/ItemCrystalSeed.java index a488698d5..54dd22f9c 100644 --- a/items/misc/ItemCrystalSeed.java +++ b/items/misc/ItemCrystalSeed.java @@ -9,6 +9,7 @@ import net.minecraft.client.renderer.texture.IIconRegister; 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.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -89,12 +90,20 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal return true; } + @Override + public void addInformation(ItemStack stack, EntityPlayer p, List l, boolean b) + { + int progress = stack.getItemDamage() % 200; + l.add( Math.floor( (float) progress / 2.0f ) + "%" ); + super.addInformation( stack, p, l, b ); + } + @Override public boolean isDamaged(ItemStack stack) { - if ( stack.getItemDamage() % 200 == 0 ) - return false; - return true; + // if ( stack.getItemDamage() % 200 == 0 ) + // return false; + return false; } @Override diff --git a/items/storage/ItemBasicStorageCell.java b/items/storage/ItemBasicStorageCell.java index afca46edd..73d630d6e 100644 --- a/items/storage/ItemBasicStorageCell.java +++ b/items/storage/ItemBasicStorageCell.java @@ -13,6 +13,8 @@ import appeng.api.AEApi; import appeng.api.config.FuzzyMode; import appeng.api.implementations.items.IItemGroup; import appeng.api.implementations.items.IStorageCell; +import appeng.api.storage.ICellInventory; +import appeng.api.storage.ICellInventoryHandler; import appeng.api.storage.IMEInventory; import appeng.api.storage.StorageChannel; import appeng.api.storage.data.IAEItemStack; @@ -23,7 +25,6 @@ import appeng.items.AEBaseItem; import appeng.items.contents.CellConfig; import appeng.items.contents.CellUpgrades; import appeng.items.materials.MaterialType; -import appeng.me.storage.CellInventory; import appeng.me.storage.CellInventoryHandler; import appeng.util.InventoryAdaptor; import appeng.util.Platform; @@ -68,11 +69,11 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II if ( cdi instanceof CellInventoryHandler ) { - CellInventory cd = ((CellInventoryHandler) cdi).getCellInv(); + ICellInventory cd = ((ICellInventoryHandler) 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() ); + l.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + " " + cd.getTotalBytes() + " " + GuiText.BytesUsed.getLocal() ); + l.add( cd.getStoredItemTypes() + " " + 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 ( diff --git a/items/tools/powered/ToolMassCannon.java b/items/tools/powered/ToolMassCannon.java index b73acd2ef..d2c06514c 100644 --- a/items/tools/powered/ToolMassCannon.java +++ b/items/tools/powered/ToolMassCannon.java @@ -24,6 +24,8 @@ import appeng.api.config.FuzzyMode; import appeng.api.config.Upgrades; import appeng.api.implementations.items.IStorageCell; import appeng.api.networking.security.PlayerSource; +import appeng.api.storage.ICellInventory; +import appeng.api.storage.ICellInventoryHandler; import appeng.api.storage.IMEInventory; import appeng.api.storage.StorageChannel; import appeng.api.storage.data.IAEItemStack; @@ -40,7 +42,6 @@ import appeng.hooks.DispenserMatterCannon; import appeng.items.contents.CellConfig; import appeng.items.contents.CellUpgrades; import appeng.items.tools.powered.powersink.AEBasePoweredItem; -import appeng.me.storage.CellInventory; import appeng.me.storage.CellInventoryHandler; import appeng.util.Platform; @@ -69,11 +70,11 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell if ( cdi instanceof CellInventoryHandler ) { - CellInventory cd = ((CellInventoryHandler) cdi).getCellInv(); + ICellInventory cd = ((ICellInventoryHandler) 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() ); + lines.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + " " + cd.getTotalBytes() + " " + GuiText.BytesUsed.getLocal() ); + lines.add( cd.getStoredItemTypes() + " " + GuiText.Of.getLocal() + " " + cd.getTotalItemTypes() + " " + GuiText.Types.getLocal() ); } } } diff --git a/items/tools/powered/ToolPortableCell.java b/items/tools/powered/ToolPortableCell.java index 9054702c5..659ddeee3 100644 --- a/items/tools/powered/ToolPortableCell.java +++ b/items/tools/powered/ToolPortableCell.java @@ -14,6 +14,8 @@ import appeng.api.implementations.guiobjects.IGuiItem; import appeng.api.implementations.guiobjects.IGuiItemObject; import appeng.api.implementations.items.IItemGroup; import appeng.api.implementations.items.IStorageCell; +import appeng.api.storage.ICellInventory; +import appeng.api.storage.ICellInventoryHandler; import appeng.api.storage.IMEInventory; import appeng.api.storage.StorageChannel; import appeng.api.storage.data.IAEItemStack; @@ -25,7 +27,6 @@ import appeng.items.contents.CellConfig; import appeng.items.contents.CellUpgrades; import appeng.items.contents.PortableCellViewer; import appeng.items.tools.powered.powersink.AEBasePoweredItem; -import appeng.me.storage.CellInventory; import appeng.me.storage.CellInventoryHandler; import appeng.util.Platform; @@ -54,11 +55,11 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell, if ( cdi instanceof CellInventoryHandler ) { - CellInventory cd = ((CellInventoryHandler) cdi).getCellInv(); + ICellInventory cd = ((ICellInventoryHandler) 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() ); + lines.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + " " + cd.getTotalBytes() + " " + GuiText.BytesUsed.getLocal() ); + lines.add( cd.getStoredItemTypes() + " " + GuiText.Of.getLocal() + " " + cd.getTotalItemTypes() + " " + GuiText.Types.getLocal() ); } } } diff --git a/items/tools/quartz/ToolQuartzWrench.java b/items/tools/quartz/ToolQuartzWrench.java index c5127f7d1..7f96a00f9 100644 --- a/items/tools/quartz/ToolQuartzWrench.java +++ b/items/tools/quartz/ToolQuartzWrench.java @@ -10,6 +10,7 @@ import net.minecraftforge.common.util.ForgeDirection; import appeng.api.implementations.items.IAEWrench; import appeng.core.features.AEFeature; import appeng.items.AEBaseItem; +import appeng.util.Platform; import buildcraft.api.tools.IToolWrench; import cpw.mods.fml.common.Optional.Interface; @@ -29,8 +30,10 @@ public class ToolQuartzWrench extends AEBaseItem implements IAEWrench, IToolWren Block b = world.getBlock( x, y, z ); if ( b != null && !player.isSneaking() ) { - if ( b.rotateBlock( world, x, y, z, ForgeDirection.getOrientation( side ) ) ) + ForgeDirection mySide = ForgeDirection.getOrientation( side ); + if ( b.rotateBlock( world, x, y, z, mySide ) ) { + b.onNeighborBlockChange( world, x, y, z, Platform.air ); player.swingItem(); return !world.isRemote; } diff --git a/me/cache/EnergyGridCache.java b/me/cache/EnergyGridCache.java index 8561dcbd2..9aa906135 100644 --- a/me/cache/EnergyGridCache.java +++ b/me/cache/EnergyGridCache.java @@ -241,10 +241,14 @@ public class EnergyGridCache implements IEnergyGrid double max = ps.getAEMaxPower(); double current = ps.getAECurrentPower(); - if ( current > 0 && ps.getPowerFlow() != AccessRestriction.WRITE ) + if ( ps.getPowerFlow() != AccessRestriction.WRITE ) { globalMaxPower += ps.getAEMaxPower(); - globalAvailablePower += ((IAEPowerStorage) machine).getAECurrentPower(); + } + + if ( current > 0 && ps.getPowerFlow() != AccessRestriction.WRITE ) + { + globalAvailablePower += current; providers.add( ps ); } diff --git a/me/cache/GridStorageCache.java b/me/cache/GridStorageCache.java index 435042f38..5802bb2cb 100644 --- a/me/cache/GridStorageCache.java +++ b/me/cache/GridStorageCache.java @@ -27,6 +27,7 @@ import appeng.api.storage.data.IAEStack; import appeng.api.storage.data.IItemList; import appeng.me.storage.ItemWatcher; import appeng.me.storage.NetworkInventoryHandler; + import com.google.common.collect.HashMultimap; import com.google.common.collect.SetMultimap; diff --git a/me/cache/NetworkMonitor.java b/me/cache/NetworkMonitor.java index e23024588..9fe06d5b4 100644 --- a/me/cache/NetworkMonitor.java +++ b/me/cache/NetworkMonitor.java @@ -1,11 +1,14 @@ package appeng.me.cache; +import java.util.Iterator; import java.util.LinkedList; +import java.util.Map.Entry; import java.util.Set; import appeng.api.networking.events.MENetworkStorageEvent; import appeng.api.networking.security.BaseActionSource; import appeng.api.storage.IMEInventoryHandler; +import appeng.api.storage.IMEMonitorHandlerReceiver; import appeng.api.storage.MEMonitorHandler; import appeng.api.storage.StorageChannel; import appeng.api.storage.data.IAEStack; @@ -23,6 +26,18 @@ public class NetworkMonitor> extends MEMonitorHandler public void forceUpdate() { hasChanged = true; + + Iterator, Object>> i = getListeners(); + while (i.hasNext()) + { + Entry, Object> o = i.next(); + IMEMonitorHandlerReceiver recv = o.getKey(); + + if ( recv.isValid( o.getValue() ) ) + recv.onListUpdate(); + else + i.remove(); + } } public NetworkMonitor(GridStorageCache cache, StorageChannel chan) { diff --git a/me/cache/SecurityCache.java b/me/cache/SecurityCache.java index 1015f62ac..6b61023a0 100644 --- a/me/cache/SecurityCache.java +++ b/me/cache/SecurityCache.java @@ -56,7 +56,7 @@ public class SecurityCache implements IGridCache, ISecurityGrid @Override public boolean hasPermission(EntityPlayer player, SecurityPermissions perm) { - return hasPermission( WorldSettings.getInstance().getPlayerID( player.getCommandSenderName() ), perm ); + return hasPermission( player == null ? -1 : WorldSettings.getInstance().getPlayerID( player.getCommandSenderName() ), perm ); } @Override diff --git a/me/helpers/ChannelPowerSrc.java b/me/helpers/ChannelPowerSrc.java new file mode 100644 index 000000000..43d5dda2c --- /dev/null +++ b/me/helpers/ChannelPowerSrc.java @@ -0,0 +1,27 @@ +package appeng.me.helpers; + +import appeng.api.config.Actionable; +import appeng.api.config.PowerMultiplier; +import appeng.api.networking.IGridNode; +import appeng.api.networking.energy.IEnergySource; + +public class ChannelPowerSrc implements IEnergySource +{ + + IGridNode node; + IEnergySource realSrc; + + public ChannelPowerSrc(IGridNode networkNode, IEnergySource src) { + node = networkNode; + realSrc = src; + } + + @Override + public double extractAEPower(double amt, Actionable mode, PowerMultiplier usePowerMultiplier) + { + if ( node.isActive() ) + return realSrc.extractAEPower( amt, mode, usePowerMultiplier ); + return 0.0; + } + +} diff --git a/me/storage/CellInventory.java b/me/storage/CellInventory.java index 155c066e5..c11edd8b0 100644 --- a/me/storage/CellInventory.java +++ b/me/storage/CellInventory.java @@ -15,6 +15,7 @@ import appeng.api.config.FuzzyMode; import appeng.api.exceptions.AppEngException; import appeng.api.implementations.items.IStorageCell; import appeng.api.networking.security.BaseActionSource; +import appeng.api.storage.ICellInventory; import appeng.api.storage.IMEInventory; import appeng.api.storage.IMEInventoryHandler; import appeng.api.storage.StorageChannel; @@ -23,7 +24,7 @@ import appeng.api.storage.data.IItemList; import appeng.util.Platform; import appeng.util.item.AEItemStack; -public class CellInventory implements IMEInventory +public class CellInventory implements ICellInventory { static final String ITEM_TYPE_TAG = "it"; @@ -58,7 +59,7 @@ public class CellInventory implements IMEInventory cellItems.resetStatus(); // clears totals and stuff. - int types = (int) storedItemTypes(); + int types = (int) getStoredItemTypes(); for (int x = 0; x < types; x++) { @@ -192,15 +193,17 @@ public class CellInventory implements IMEInventory return cellItems; } - public int BytesPerType() + @Override + public int getBytesPerType() { return CellType.BytePerType( i ); } + @Override public boolean canHoldNewItem() { - long bytesFree = freeBytes(); - return (bytesFree > BytesPerType() || (bytesFree == BytesPerType() && unusedItemCount() > 0)) && remainingItemTypes() > 0; + long bytesFree = getFreeBytes(); + return (bytesFree > getBytesPerType() || (bytesFree == getBytesPerType() && getUnusedItemCount() > 0)) && getRemainingItemTypes() > 0; } public static IMEInventoryHandler getCell(ItemStack o) @@ -254,33 +257,39 @@ public class CellInventory implements IMEInventory return false; } - public long totalBytes() + @Override + public long getTotalBytes() { return CellType.getBytes( i ); } - public long freeBytes() + @Override + public long getFreeBytes() { - return totalBytes() - usedBytes(); + return getTotalBytes() - getUsedBytes(); } - public long usedBytes() + @Override + public long getUsedBytes() { - long bytesForItemCount = (storedItemCount() + unusedItemCount()) / 8; - return storedItemTypes() * BytesPerType() + bytesForItemCount; + long bytesForItemCount = (getStoredItemCount() + getUnusedItemCount()) / 8; + return getStoredItemTypes() * getBytesPerType() + bytesForItemCount; } + @Override public long getTotalItemTypes() { return MAX_ITEM_TYPES; } - public long storedItemTypes() + @Override + public long getStoredItemTypes() { return storedItems; } - public long storedItemCount() + @Override + public long getStoredItemCount() { return storedItemCount; } @@ -290,24 +299,25 @@ public class CellInventory implements IMEInventory tagCompound.setInteger( ITEM_COUNT_TAG, storedItemCount = (int) (storedItemCount + delta) ); } - public long remainingItemTypes() + @Override + public long getRemainingItemTypes() { - long basedOnStorage = freeBytes() / BytesPerType(); - long baseOnTotal = getTotalItemTypes() - storedItemTypes(); + long basedOnStorage = getFreeBytes() / getBytesPerType(); + long baseOnTotal = getTotalItemTypes() - getStoredItemTypes(); return basedOnStorage > baseOnTotal ? baseOnTotal : basedOnStorage; } - public long remainingItemCount() + @Override + public long getRemainingItemCount() { - long remaining = freeBytes() * 8 + unusedItemCount(); + long remaining = getFreeBytes() * 8 + getUnusedItemCount(); return remaining > 0 ? remaining : 0; } - // returns the number of items that can be added without using an additional - // byte! - public int unusedItemCount() + @Override + public int getUnusedItemCount() { - int div = (int) (storedItemCount() % 8); + int div = (int) (getStoredItemCount() % 8); if ( div == 0 ) { @@ -359,7 +369,7 @@ public class CellInventory implements IMEInventory IAEItemStack l = getCellItems().findPrecise( input ); if ( l != null ) { - long remainingItemSlots = remainingItemCount(); + long remainingItemSlots = getRemainingItemCount(); if ( remainingItemSlots < 0 ) return input; @@ -389,7 +399,7 @@ public class CellInventory implements IMEInventory if ( canHoldNewItem() ) // room for new type, and for at least one item! { - int remainingItemCount = (int) remainingItemCount() - BytesPerType() * 8; + int remainingItemCount = (int) getRemainingItemCount() - getBytesPerType() * 8; if ( remainingItemCount > 0 ) { if ( input.getStackSize() > remainingItemCount ) @@ -479,33 +489,44 @@ public class CellInventory implements IMEInventory return StorageChannel.ITEMS; } + @Override public double getIdleDrain() { return CellType.getIdleDrain(); } + @Override public FuzzyMode getFuzzyMode() { return CellType.getFuzzyMode( this.i ); } + @Override public IInventory getConfigInventory() { return CellType.getConfigInventory( this.i ); } + @Override public IInventory getUpgradesInventory() { return CellType.getUpgradesInventory( this.i ); } + @Override public int getStatusForCell() { if ( canHoldNewItem() ) return 1; - if ( remainingItemCount() > 0 ) + if ( getRemainingItemCount() > 0 ) return 2; return 3; } + @Override + public ItemStack getItemStack() + { + return i; + } + } diff --git a/me/storage/CellInventoryHandler.java b/me/storage/CellInventoryHandler.java index 5eb3e4d93..855867534 100644 --- a/me/storage/CellInventoryHandler.java +++ b/me/storage/CellInventoryHandler.java @@ -8,6 +8,8 @@ import appeng.api.config.FuzzyMode; import appeng.api.config.IncludeExclude; import appeng.api.config.Upgrades; import appeng.api.implementations.items.IUpgradeModule; +import appeng.api.storage.ICellInventory; +import appeng.api.storage.ICellInventoryHandler; import appeng.api.storage.IMEInventory; import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IItemList; @@ -16,28 +18,29 @@ import appeng.util.item.AEItemStack; import appeng.util.prioitylist.FuzzyPriorityList; import appeng.util.prioitylist.PrecisePriorityList; -public class CellInventoryHandler extends MEInventoryHandler +public class CellInventoryHandler extends MEInventoryHandler implements ICellInventoryHandler { NBTTagCompound openNbtData() { - return Platform.openNbtData( getCellInv().i ); + return Platform.openNbtData( getCellInv().getItemStack() ); } - public CellInventory getCellInv() + @Override + public ICellInventory getCellInv() { Object o = this.internal; if ( o instanceof MEPassthru ) o = ((MEPassthru) o).getInternal(); - return (CellInventory) (o instanceof CellInventory ? o : null); + return (ICellInventory) (o instanceof ICellInventory ? o : null); } CellInventoryHandler(IMEInventory c) { super( c, IAEItemStack.class ); - CellInventory ci = getCellInv(); + ICellInventory ci = getCellInv(); if ( ci != null ) { IItemList priorityList = AEApi.instance().storage().createItemList(); diff --git a/me/storage/MEMonitorPassthu.java b/me/storage/MEMonitorPassthu.java index 6c7302cb2..08b6fe2f2 100644 --- a/me/storage/MEMonitorPassthu.java +++ b/me/storage/MEMonitorPassthu.java @@ -22,7 +22,7 @@ public class MEMonitorPassthu> extends MEPassthru imple public BaseActionSource changeSource; public MEMonitorPassthu(IMEInventory i, Class cla) { - super( i,cla ); + super( i, cla ); if ( i instanceof IMEMonitor ) monitor = (IMEMonitor) i; } @@ -34,13 +34,13 @@ public class MEMonitorPassthu> extends MEPassthru imple monitor.removeListener( this ); monitor = null; - IItemList before = getInternal() == null ? new ItemList(clz) : getInternal().getAvailableItems( new ItemList(clz) ); + IItemList before = getInternal() == null ? new ItemList( clz ) : getInternal().getAvailableItems( new ItemList( clz ) ); super.setInternal( i ); if ( i instanceof IMEMonitor ) monitor = (IMEMonitor) i; - IItemList after = getInternal() == null ? new ItemList(clz) : getInternal().getAvailableItems( new ItemList(clz) ); + IItemList after = getInternal() == null ? new ItemList( clz ) : getInternal().getAvailableItems( new ItemList( clz ) ); if ( monitor != null ) monitor.addListener( this, monitor ); @@ -64,7 +64,7 @@ public class MEMonitorPassthu> extends MEPassthru imple public IItemList getStorageList() { if ( monitor == null ) - return getInternal().getAvailableItems( new ItemList(clz) ); + return getInternal().getAvailableItems( new ItemList( clz ) ); return monitor.getStorageList(); } @@ -88,4 +88,19 @@ public class MEMonitorPassthu> extends MEPassthru imple i.remove(); } } + + @Override + public void onListUpdate() + { + Iterator, Object>> i = listeners.entrySet().iterator(); + while (i.hasNext()) + { + Entry, Object> e = i.next(); + IMEMonitorHandlerReceiver recv = e.getKey(); + if ( recv.isValid( e.getValue() ) ) + recv.onListUpdate(); + else + i.remove(); + } + } } diff --git a/parts/CableBusContainer.java b/parts/CableBusContainer.java index bb2f7678a..169da6041 100644 --- a/parts/CableBusContainer.java +++ b/parts/CableBusContainer.java @@ -782,7 +782,8 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer return light; } - public boolean recolourBlock(ForgeDirection side, int colour) + @Override + public boolean recolourBlock(ForgeDirection side, int colour, EntityPlayer who) { IPart cable = getPart( ForgeDirection.UNKNOWN ); if ( cable != null ) @@ -791,7 +792,7 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer AEColor colors[] = AEColor.values(); if ( colors.length > colour ) - return pc.changeColor( colors[colour] ); + return pc.changeColor( colors[colour], who ); } return false; } diff --git a/parts/ICableBusContainer.java b/parts/ICableBusContainer.java index a18888357..f74be2b6f 100644 --- a/parts/ICableBusContainer.java +++ b/parts/ICableBusContainer.java @@ -34,7 +34,7 @@ public interface ICableBusContainer SelectedPart selectPart(Vec3 v3); - boolean recolourBlock(ForgeDirection side, int colour); + boolean recolourBlock(ForgeDirection side, int colour, EntityPlayer who); boolean isLadder(EntityLivingBase entity); diff --git a/parts/NullCableBusContainer.java b/parts/NullCableBusContainer.java index caba57f51..a0fdad011 100644 --- a/parts/NullCableBusContainer.java +++ b/parts/NullCableBusContainer.java @@ -69,7 +69,7 @@ public class NullCableBusContainer implements ICableBusContainer } @Override - public boolean recolourBlock(ForgeDirection side, int colour) + public boolean recolourBlock(ForgeDirection side, int colour, EntityPlayer who) { return false; } diff --git a/parts/automation/PartAnnihilationPlane.java b/parts/automation/PartAnnihilationPlane.java index b836e643b..8578900aa 100644 --- a/parts/automation/PartAnnihilationPlane.java +++ b/parts/automation/PartAnnihilationPlane.java @@ -58,9 +58,9 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab @SideOnly(Side.CLIENT) public void renderInventory(IPartRenderHelper rh, RenderBlocks renderer) { - rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), - CableBusTextures.PartTransitionPlaneBack.getIcon(), is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), - CableBusTextures.PartMonitorSides.getIcon() ); + rh.setTexture( CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon(), + CableBusTextures.PartTransitionPlaneBack.getIcon(), is.getIconIndex(), CableBusTextures.PartPlaneSides.getIcon(), + CableBusTextures.PartPlaneSides.getIcon() ); rh.setBounds( 1, 1, 15, 15, 15, 16 ); rh.renderInventoryBox( renderer ); @@ -98,9 +98,9 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab boolean isActive = (clientFlags & (POWERED_FLAG | CHANNEL_FLAG)) == (POWERED_FLAG | CHANNEL_FLAG); renderCache = rh.useSimpliedRendering( x, y, z, this, renderCache ); - rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), + rh.setTexture( CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartTransitionPlaneBack.getIcon(), isActive ? CableBusTextures.BlockAnnihilationPlaneOn.getIcon() : is.getIconIndex(), - CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() ); + CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon() ); rh.setBounds( minX, minY, 15, maxX, maxY, 16 ); rh.renderBlock( x, y, z, renderer ); diff --git a/parts/automation/PartExportBus.java b/parts/automation/PartExportBus.java index 7fb4d3865..488521cb9 100644 --- a/parts/automation/PartExportBus.java +++ b/parts/automation/PartExportBus.java @@ -62,8 +62,8 @@ public class PartExportBus extends PartSharedItemBus implements IGridTickable public void renderInventory(IPartRenderHelper rh, RenderBlocks renderer) { - rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), - is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() ); + rh.setTexture( CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), + is.getIconIndex(), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon() ); rh.setBounds( 4, 4, 12, 12, 12, 14 ); rh.renderInventoryBox( renderer ); @@ -80,8 +80,8 @@ public class PartExportBus extends PartSharedItemBus implements IGridTickable public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer) { renderCache = rh.useSimpliedRendering( x, y, z, this, renderCache ); - rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), - is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() ); + rh.setTexture( CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), + is.getIconIndex(), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon() ); rh.setBounds( 4, 4, 12, 12, 12, 14 ); rh.renderBlock( x, y, z, renderer ); @@ -238,6 +238,6 @@ public class PartExportBus extends PartSharedItemBus implements IGridTickable @Override public TickingRequest getTickingRequest(IGridNode node) { - return new TickingRequest( TickRates.ExportBus.min,TickRates.ExportBus.max, isSleeping(), false ); + return new TickingRequest( TickRates.ExportBus.min, TickRates.ExportBus.max, isSleeping(), false ); } } diff --git a/parts/automation/PartFormationPlane.java b/parts/automation/PartFormationPlane.java index 5027942ff..f29d3ac4a 100644 --- a/parts/automation/PartFormationPlane.java +++ b/parts/automation/PartFormationPlane.java @@ -124,9 +124,9 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine @SideOnly(Side.CLIENT) public void renderInventory(IPartRenderHelper rh, RenderBlocks renderer) { - rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), - CableBusTextures.PartTransitionPlaneBack.getIcon(), is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), - CableBusTextures.PartMonitorSides.getIcon() ); + rh.setTexture( CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon(), + CableBusTextures.PartTransitionPlaneBack.getIcon(), is.getIconIndex(), CableBusTextures.PartPlaneSides.getIcon(), + CableBusTextures.PartPlaneSides.getIcon() ); rh.setBounds( 1, 1, 15, 15, 15, 16 ); rh.renderInventoryBox( renderer ); @@ -164,9 +164,9 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine boolean isActive = (clientFlags & (POWERED_FLAG | CHANNEL_FLAG)) == (POWERED_FLAG | CHANNEL_FLAG); renderCache = rh.useSimpliedRendering( x, y, z, this, renderCache ); - rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), + rh.setTexture( CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartTransitionPlaneBack.getIcon(), isActive ? CableBusTextures.BlockFormPlaneOn.getIcon() : is.getIconIndex(), - CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() ); + CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon() ); rh.setBounds( minX, minY, 15, maxX, maxY, 16 ); rh.renderBlock( x, y, z, renderer ); diff --git a/parts/automation/PartImportBus.java b/parts/automation/PartImportBus.java index d6f865bb1..05e18b558 100644 --- a/parts/automation/PartImportBus.java +++ b/parts/automation/PartImportBus.java @@ -82,8 +82,8 @@ public class PartImportBus extends PartSharedItemBus implements IGridTickable, I @SideOnly(Side.CLIENT) public void renderInventory(IPartRenderHelper rh, RenderBlocks renderer) { - rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), - is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() ); + rh.setTexture( CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), + is.getIconIndex(), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon() ); rh.setBounds( 3, 3, 15, 13, 13, 16 ); rh.renderInventoryBox( renderer ); @@ -100,8 +100,8 @@ public class PartImportBus extends PartSharedItemBus implements IGridTickable, I public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer) { renderCache = rh.useSimpliedRendering( x, y, z, this, renderCache ); - rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), - is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() ); + rh.setTexture( CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), + is.getIconIndex(), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon() ); rh.setBounds( 4, 4, 14, 12, 12, 16 ); rh.renderBlock( x, y, z, renderer ); diff --git a/parts/automation/PartLevelEmitter.java b/parts/automation/PartLevelEmitter.java index b4cf21a17..4711d8e3d 100644 --- a/parts/automation/PartLevelEmitter.java +++ b/parts/automation/PartLevelEmitter.java @@ -576,4 +576,17 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH return super.getInventoryByName( name ); } + @Override + public void onListUpdate() + { + try + { + updateReportingValue( proxy.getStorage().getItemInventory() ); + } + catch (GridAccessException e) + { + // ;P + } + } + } diff --git a/parts/misc/PartCableAnchor.java b/parts/misc/PartCableAnchor.java index bdbe939bc..036262ff5 100644 --- a/parts/misc/PartCableAnchor.java +++ b/parts/misc/PartCableAnchor.java @@ -210,7 +210,7 @@ public class PartCableAnchor implements IPart @Override public boolean isLadder(EntityLivingBase entity) { - return mySide.offsetY == 0; + return mySide.offsetY == 0 && entity.isCollidedHorizontally; } @Override diff --git a/parts/misc/PartStorageBus.java b/parts/misc/PartStorageBus.java index 4d239cfdc..105a75f13 100644 --- a/parts/misc/PartStorageBus.java +++ b/parts/misc/PartStorageBus.java @@ -279,8 +279,8 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC @SideOnly(Side.CLIENT) public void renderInventory(IPartRenderHelper rh, RenderBlocks renderer) { - rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), - is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() ); + rh.setTexture( CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageBack.getIcon(), + is.getIconIndex(), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon() ); rh.setBounds( 3, 3, 15, 13, 13, 16 ); rh.renderInventoryBox( renderer ); @@ -297,8 +297,8 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer) { renderCache = rh.useSimpliedRendering( x, y, z, this, renderCache ); - rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), - is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() ); + rh.setTexture( CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageBack.getIcon(), + is.getIconIndex(), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon() ); rh.setBounds( 3, 3, 15, 13, 13, 16 ); rh.renderBlock( x, y, z, renderer ); @@ -306,8 +306,8 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC rh.setBounds( 2, 2, 14, 14, 14, 15 ); rh.renderBlock( x, y, z, renderer ); - rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), - is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() ); + rh.setTexture( CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageBack.getIcon(), + is.getIconIndex(), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon() ); rh.setBounds( 5, 5, 12, 11, 11, 13 ); rh.renderBlock( x, y, z, renderer ); @@ -411,4 +411,10 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC return type == PipeType.ITEM && with == side ? ConnectOverride.CONNECT : ConnectOverride.DISCONNECT; } + @Override + public void onListUpdate() + { + // not used here. + } + } diff --git a/parts/networking/PartCable.java b/parts/networking/PartCable.java index 6fde9f8a5..e6fea62c0 100644 --- a/parts/networking/PartCable.java +++ b/parts/networking/PartCable.java @@ -7,6 +7,7 @@ import java.util.EnumSet; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; @@ -15,6 +16,7 @@ import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; import appeng.api.AEApi; +import appeng.api.config.SecurityPermissions; import appeng.api.implementations.parts.IPartCable; import appeng.api.networking.GridFlags; import appeng.api.networking.IGridConnection; @@ -879,13 +881,41 @@ public class PartCable extends AEBasePart implements IPartCable } @Override - public boolean changeColor(AEColor newColor) + public boolean changeColor(AEColor newColor, EntityPlayer who) { if ( getCableColor() != newColor ) { - is.setItemDamage( newColor.ordinal() ); - markForUpdate(); - return true; + ItemStack newPart = null; + + if ( getCableConnectionType() == AECableType.GLASS ) + newPart = AEApi.instance().parts().partCableGlass.stack( newColor, 1 ); + else if ( getCableConnectionType() == AECableType.COVERED ) + newPart = AEApi.instance().parts().partCableCovered.stack( newColor, 1 ); + else if ( getCableConnectionType() == AECableType.SMART ) + newPart = AEApi.instance().parts().partCableSmart.stack( newColor, 1 ); + else if ( getCableConnectionType() == AECableType.DENSE ) + newPart = AEApi.instance().parts().partCableDense.stack( newColor, 1 ); + + boolean hasPermission = true; + + try + { + hasPermission = proxy.getSecurity().hasPermission( who, SecurityPermissions.BUILD ); + } + catch (GridAccessException e) + { + // :P + } + + if ( newPart != null && hasPermission ) + { + if ( Platform.isClient() ) + return true; + + getHost().removePart( ForgeDirection.UNKNOWN, false ); + getHost().addPart( newPart, ForgeDirection.UNKNOWN, who ); + return true; + } } return false; } diff --git a/parts/p2p/PartP2PTunnel.java b/parts/p2p/PartP2PTunnel.java index e7784b740..8500d4365 100644 --- a/parts/p2p/PartP2PTunnel.java +++ b/parts/p2p/PartP2PTunnel.java @@ -275,8 +275,8 @@ public class PartP2PTunnel extends PartBasicState rh.setBounds( 2, 2, 14, 14, 14, 16 ); rh.renderInventoryBox( renderer ); - rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.BlockP2PTunnel2.getIcon(), - is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() ); + rh.setTexture( CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.BlockP2PTunnel2.getIcon(), + is.getIconIndex(), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon() ); rh.setBounds( 2, 2, 14, 14, 14, 16 ); rh.renderInventoryBox( renderer ); @@ -297,8 +297,8 @@ public class PartP2PTunnel extends PartBasicState rh.setBounds( 2, 2, 14, 14, 14, 16 ); rh.renderBlock( x, y, z, renderer ); - rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.BlockP2PTunnel2.getIcon(), - is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() ); + rh.setTexture( CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.BlockP2PTunnel2.getIcon(), + is.getIconIndex(), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon() ); rh.setBounds( 2, 2, 14, 14, 14, 16 ); rh.renderBlock( x, y, z, renderer ); diff --git a/parts/reporting/PartTerminal.java b/parts/reporting/PartTerminal.java index cfb70716c..5e0be23e3 100644 --- a/parts/reporting/PartTerminal.java +++ b/parts/reporting/PartTerminal.java @@ -14,7 +14,6 @@ import appeng.api.storage.IMEMonitor; import appeng.api.storage.ITerminalHost; import appeng.api.util.IConfigManager; import appeng.client.texture.CableBusTextures; -import appeng.core.localization.PlayerMessages; import appeng.core.sync.GuiBridge; import appeng.me.GridAccessException; import appeng.tile.inventory.AppEngInternalInventory; @@ -79,15 +78,7 @@ public class PartTerminal extends PartMonitor implements ITerminalHost, IConfigM if ( Platform.isClient() ) return true; - if ( proxy.isActive() ) - Platform.openGUI( player, getHost().getTile(), side, getGui() ); - else - { - if ( proxy.isPowered() ) - player.addChatMessage( PlayerMessages.CommunicationError.get() ); - else - player.addChatMessage( PlayerMessages.MachineNotPowered.get() ); - } + Platform.openGUI( player, getHost().getTile(), side, getGui() ); return true; } diff --git a/recipes/AEItemResolver.java b/recipes/AEItemResolver.java index 351fad934..e052b3982 100644 --- a/recipes/AEItemResolver.java +++ b/recipes/AEItemResolver.java @@ -79,7 +79,8 @@ public class AEItemResolver implements ISubItemResolver String materialName = itemName.substring( itemName.indexOf( "." ) + 1 ); MaterialType mt = MaterialType.valueOf( materialName ); itemName = itemName.substring( 0, itemName.indexOf( "." ) ); - return new ResolverResult( itemName, mt.damageValue ); + if ( mt.damageValue >= 0 ) + return new ResolverResult( itemName, mt.damageValue ); } if ( itemName.startsWith( "ItemPart." ) ) @@ -87,7 +88,9 @@ public class AEItemResolver implements ISubItemResolver String partName = itemName.substring( itemName.indexOf( "." ) + 1 ); PartType pt = PartType.valueOf( partName ); itemName = itemName.substring( 0, itemName.indexOf( "." ) ); - return new ResolverResult( itemName, ItemPart.instance.getDamageByType( pt ) ); + int dVal = ItemPart.instance.getDamageByType( pt ); + if ( dVal >= 0 ) + return new ResolverResult( itemName, dVal ); } } diff --git a/recipes/game/ShapedRecipe.java b/recipes/game/ShapedRecipe.java index 4ff1b8b32..735730a9a 100644 --- a/recipes/game/ShapedRecipe.java +++ b/recipes/game/ShapedRecipe.java @@ -254,4 +254,20 @@ public class ShapedRecipe implements IRecipe { return this.input; } + + public int getWidth() + { + return width; + } + + public int getHeight() + { + return height; + } + + public Object[] getIngredients() + { + return input; + } + } \ No newline at end of file diff --git a/recipes/game/ShapelessRecipe.java b/recipes/game/ShapelessRecipe.java index 6b2698767..18e466925 100644 --- a/recipes/game/ShapelessRecipe.java +++ b/recipes/game/ShapelessRecipe.java @@ -140,4 +140,5 @@ public class ShapelessRecipe implements IRecipe { return this.input; } + } \ No newline at end of file diff --git a/tile/misc/TileInscriber.java b/tile/misc/TileInscriber.java index 1e1edaec9..f21f4d3d3 100644 --- a/tile/misc/TileInscriber.java +++ b/tile/misc/TileInscriber.java @@ -61,7 +61,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable { public TileInscriberHandler() { - super( TileEventType.TICK, TileEventType.WORLD_NBT, TileEventType.NETWORK ); + super( TileEventType.WORLD_NBT, TileEventType.NETWORK ); } @Override @@ -123,12 +123,6 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable } } - @Override - public void Tick() - { - - } - }; @Override @@ -238,13 +232,22 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable { ItemStack PlateA = getStackInSlot( 0 ); ItemStack PlateB = getStackInSlot( 1 ); + ItemStack renamedItem = getStackInSlot( 2 ); + + if ( PlateA != null && PlateA.stackSize > 1 ) + return null; + + if ( PlateB != null && PlateB.stackSize > 1 ) + return null; + + if ( renamedItem != null && renamedItem.stackSize > 1 ) + return null; boolean isNameA = AEApi.instance().materials().materialNamePress.sameAs( PlateA ); boolean isNameB = AEApi.instance().materials().materialNamePress.sameAs( PlateB ); if ( (isNameA || isNameB) && (isNameA || PlateA == null) && (isNameB || PlateB == null) ) { - ItemStack renamedItem = getStackInSlot( 2 ); if ( renamedItem != null ) { String name = ""; diff --git a/tile/networking/TileWireless.java b/tile/networking/TileWireless.java index cabbd42ad..b2a91d00a 100644 --- a/tile/networking/TileWireless.java +++ b/tile/networking/TileWireless.java @@ -8,6 +8,7 @@ import java.util.EnumSet; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; +import appeng.api.implementations.IPowerChannelState; import appeng.api.implementations.tiles.IWirelessAccessPoint; import appeng.api.networking.GridFlags; import appeng.api.networking.IGrid; @@ -23,8 +24,9 @@ import appeng.tile.events.TileEventType; import appeng.tile.grid.AENetworkInvTile; import appeng.tile.inventory.AppEngInternalInventory; import appeng.tile.inventory.InvOperation; +import appeng.util.Platform; -public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoint +public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoint, IPowerChannelState { public static final int POWERED_FLAG = 1; @@ -148,23 +150,29 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi { return AEConfig.instance.wireless_getMaxRange( getBoosters() ); } - + @Override public boolean isActive() { + if ( Platform.isClient() ) + return isPowered() && (CHANNEL_FLAG == (clientFlags & CHANNEL_FLAG)); + return gridProxy.isActive(); } - + @Override public IGrid getGrid() { - try { + try + { return gridProxy.getGrid(); - } catch (GridAccessException e) { + } + catch (GridAccessException e) + { return null; } } - + private int getBoosters() { ItemStack boosters = inv.getStackInSlot( 0 ); @@ -177,4 +185,10 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi // :P } + @Override + public boolean isPowered() + { + return POWERED_FLAG == (clientFlags & POWERED_FLAG); + } + } diff --git a/tile/storage/TileChest.java b/tile/storage/TileChest.java index 9263a4351..8fc320066 100644 --- a/tile/storage/TileChest.java +++ b/tile/storage/TileChest.java @@ -319,6 +319,12 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan return false; } + @Override + public void onListUpdate() + { + // not used here + } + }; class ChestMonitorHandler extends MEMonitorHandler @@ -363,7 +369,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan if ( is != null ) { isCached = true; - cellHandler = AEApi.instance().registries().cell().getHander( is ); + cellHandler = AEApi.instance().registries().cell().getHandler( is ); if ( cellHandler != null ) { double power = 1.0; @@ -553,7 +559,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan return (state >> (slot * 3)) & 3; ItemStack cell = inv.getStackInSlot( 1 ); - ICellHandler ch = AEApi.instance().registries().cell().getHander( cell ); + ICellHandler ch = AEApi.instance().registries().cell().getHandler( cell ); if ( ch != null ) { diff --git a/tile/storage/TileDrive.java b/tile/storage/TileDrive.java index 17e5aa3b6..d580c4522 100644 --- a/tile/storage/TileDrive.java +++ b/tile/storage/TileDrive.java @@ -214,7 +214,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior if ( is != null ) { - handlersBySlot[x] = AEApi.instance().registries().cell().getHander( is ); + handlersBySlot[x] = AEApi.instance().registries().cell().getHandler( is ); if ( handlersBySlot[x] != null ) { diff --git a/util/inv/AdaptorIInventory.java b/util/inv/AdaptorIInventory.java index 5608dff12..d8e48f253 100644 --- a/util/inv/AdaptorIInventory.java +++ b/util/inv/AdaptorIInventory.java @@ -240,7 +240,7 @@ public class AdaptorIInventory extends InventoryAdaptor } else if ( is != null ) { - if ( Platform.isSameItem( is, left ) ) + if ( Platform.isSameItemPrecise( is, left ) ) { if ( is.stackSize < stack_limit ) { @@ -303,7 +303,7 @@ public class AdaptorIInventory extends InventoryAdaptor } else { - if ( Platform.isSameItem( is, left ) ) + if ( Platform.isSameItemPrecise( is, left ) ) { if ( is.stackSize < stack_limit ) {