diff --git a/block/misc/BlockQuartzGrowthAccelerator.java b/block/misc/BlockQuartzGrowthAccelerator.java index 66060a174..7396d36be 100644 --- a/block/misc/BlockQuartzGrowthAccelerator.java +++ b/block/misc/BlockQuartzGrowthAccelerator.java @@ -116,4 +116,10 @@ public class BlockQuartzGrowthAccelerator extends AEBaseBlock implements IOrient Minecraft.getMinecraft().effectRenderer.addEffect( (EntityFX) fx ); } } + + @Override + public boolean usesMetadata() + { + return true; + } } diff --git a/block/misc/BlockQuartzTorch.java b/block/misc/BlockQuartzTorch.java index f4b0c4a15..96212909f 100644 --- a/block/misc/BlockQuartzTorch.java +++ b/block/misc/BlockQuartzTorch.java @@ -20,8 +20,8 @@ import appeng.block.AEBaseBlock; import appeng.client.render.BaseBlockRender; import appeng.client.render.blocks.RenderQuartzTorch; import appeng.client.render.effects.LightningEffect; -import appeng.core.CommonHelper; import appeng.core.AEConfig; +import appeng.core.CommonHelper; import appeng.core.features.AEFeature; import appeng.helpers.ICustomCollision; import appeng.helpers.MetaRotation; @@ -131,4 +131,10 @@ public class BlockQuartzTorch extends AEBaseBlock implements IOrientableBlock, I } } + @Override + public boolean usesMetadata() + { + return true; + } + } diff --git a/block/solids/BlockQuartzPillar.java b/block/solids/BlockQuartzPillar.java index f6589f8e1..b42328b69 100644 --- a/block/solids/BlockQuartzPillar.java +++ b/block/solids/BlockQuartzPillar.java @@ -24,4 +24,10 @@ public class BlockQuartzPillar extends AEBaseBlock implements IOrientableBlock return new MetaRotation( w, x, y, z ); } + @Override + public boolean usesMetadata() + { + return true; + } + } diff --git a/block/solids/BlockSkyStone.java b/block/solids/BlockSkyStone.java index eb7a46571..eeee31065 100644 --- a/block/solids/BlockSkyStone.java +++ b/block/solids/BlockSkyStone.java @@ -168,4 +168,10 @@ public class BlockSkyStone extends AEBaseBlock implements IOrientableBlock return getRenderType(); } + @Override + public boolean usesMetadata() + { + return false; + } + } diff --git a/block/solids/OreQuartz.java b/block/solids/OreQuartz.java index 6ba2cb9a1..9c40a9f1e 100644 --- a/block/solids/OreQuartz.java +++ b/block/solids/OreQuartz.java @@ -11,15 +11,12 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.oredict.OreDictionary; import appeng.api.AEApi; -import appeng.api.util.IOrientable; -import appeng.api.util.IOrientableBlock; import appeng.block.AEBaseBlock; import appeng.client.render.BaseBlockRender; import appeng.client.render.blocks.RenderQuartzOre; import appeng.core.features.AEFeature; -import appeng.helpers.LocationRotation; -public class OreQuartz extends AEBaseBlock implements IOrientableBlock +public class OreQuartz extends AEBaseBlock { public int boostBrightnessLow; @@ -77,12 +74,6 @@ public class OreQuartz extends AEBaseBlock implements IOrientableBlock return AEApi.instance().materials().materialCertusQuartzCrystal.stack( 1 ); } - @Override - public IOrientable getOrientable(final IBlockAccess w, final int x, final int y, final int z) - { - return new LocationRotation( w, x, y, z ); - } - @Override public Item getItemDropped(int id, Random rand, int meta) { diff --git a/client/render/BusRenderHelper.java b/client/render/BusRenderHelper.java index 6f41739ef..f14529a32 100644 --- a/client/render/BusRenderHelper.java +++ b/client/render/BusRenderHelper.java @@ -334,7 +334,7 @@ public class BusRenderHelper implements IPartRenderHelper if ( !renderThis() ) return; - renderer.renderStandardBlock( renderer.blockAccess.getBlock( x, y, z ), x, y, z ); + renderer.renderStandardBlock( blk, x, y, z ); } @Override diff --git a/core/Registration.java b/core/Registration.java index d274fa577..2f69e15ba 100644 --- a/core/Registration.java +++ b/core/Registration.java @@ -419,8 +419,7 @@ public class Registration } catch (Throwable e) { - AELog.severe( "Error with Feature: " + c.getName() ); - throw new RuntimeException( e ); + throw new RuntimeException( "Error with Feature: " + c.getName(), e ); } } diff --git a/core/sync/packets/PacketMEInventoryUpdate.java b/core/sync/packets/PacketMEInventoryUpdate.java index 46b970e35..d4dda61cd 100644 --- a/core/sync/packets/PacketMEInventoryUpdate.java +++ b/core/sync/packets/PacketMEInventoryUpdate.java @@ -136,7 +136,7 @@ public class PacketMEInventoryUpdate extends AppEngPacket is.writeToPacket( tmp ); compressFrame.flush(); - if ( writtenBytes + tmp.readableBytes() > 30000 ) + if ( writtenBytes + tmp.readableBytes() > 2 * 1024 * 1024 ) // 2mb! throw new BufferOverflowException(); else { diff --git a/facade/FacadeContainer.java b/facade/FacadeContainer.java index e088ff1f6..3be869e25 100644 --- a/facade/FacadeContainer.java +++ b/facade/FacadeContainer.java @@ -49,6 +49,8 @@ public class FacadeContainer implements IFacadeContainer { int facadeSides = out.readByte(); + boolean changed = false; + int ids[] = new int[2]; for (int x = 0; x < facades.length; x++) { @@ -64,6 +66,7 @@ public class FacadeContainer implements IFacadeContainer if ( isBC && AppEng.instance.isIntegrationEnabled( "BC" ) ) { IBC bc = (IBC) AppEng.instance.getIntegration( "BC" ); + changed = changed || facades[x] == null; facades[x] = bc.createFacadePart( (Block) Block.blockRegistry.getObjectById( ids[0] ), ids[1], side ); } else if ( !isBC ) @@ -71,13 +74,20 @@ public class FacadeContainer implements IFacadeContainer ItemFacade ifa = (ItemFacade) AEApi.instance().items().itemFacade.item(); ItemStack facade = ifa.createFromInts( ids ); if ( facade != null ) + { + changed = changed || facades[x] == null; facades[x] = ifa.createPartFromItemStack( facade, side ); + } } } else + { + changed = changed || facades[x] != null; facades[x] = null; + } } - return false; + + return changed; } public void readFromNBT(NBTTagCompound c) @@ -160,4 +170,20 @@ public class FacadeContainer implements IFacadeContainer return false; return true; } + + public void rotateLeft() + { + IFacadePart newfacades[] = new FacadePart[6]; + + newfacades[ForgeDirection.UP.ordinal()] = facades[ForgeDirection.UP.ordinal()]; + newfacades[ForgeDirection.DOWN.ordinal()] = facades[ForgeDirection.DOWN.ordinal()]; + + newfacades[ForgeDirection.EAST.ordinal()] = facades[ForgeDirection.NORTH.ordinal()]; + newfacades[ForgeDirection.SOUTH.ordinal()] = facades[ForgeDirection.EAST.ordinal()]; + newfacades[ForgeDirection.WEST.ordinal()] = facades[ForgeDirection.SOUTH.ordinal()]; + newfacades[ForgeDirection.NORTH.ordinal()] = facades[ForgeDirection.WEST.ordinal()]; + + for (int x = 0; x < facades.length; x++) + facades[x] = newfacades[x]; + } } diff --git a/integration/modules/BC.java b/integration/modules/BC.java index 0c468a5cd..d7571f163 100644 --- a/integration/modules/BC.java +++ b/integration/modules/BC.java @@ -1,5 +1,7 @@ package appeng.integration.modules; +import java.lang.reflect.Field; + import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -12,12 +14,19 @@ import appeng.api.config.TunnelType; import appeng.api.definitions.Blocks; import appeng.api.features.IP2PTunnelRegistry; import appeng.api.parts.IFacadePart; +import appeng.api.util.AEItemDefinition; +import appeng.api.util.IOrientableBlock; +import appeng.core.AppEng; import appeng.facade.FacadePart; import appeng.integration.BaseModule; import appeng.integration.abstraction.IBC; -import appeng.integration.modules.helpers.BCPipeHandler; +import appeng.integration.modules.BCHelpers.AECableSchematicTile; +import appeng.integration.modules.BCHelpers.AEGenericSchematicTile; +import appeng.integration.modules.BCHelpers.AERotateableBlockSchematic; +import appeng.integration.modules.BCHelpers.BCPipeHandler; import buildcraft.BuildCraftEnergy; import buildcraft.BuildCraftTransport; +import buildcraft.api.blueprints.SchematicRegistry; import buildcraft.api.tools.IToolWrench; import buildcraft.api.transport.IPipeConnection; import buildcraft.api.transport.IPipeTile; @@ -191,6 +200,15 @@ public class BC extends BaseModule implements IBC addFacade( b.blockQuartzChiseled.stack( 1 ) ); addFacade( b.blockQuartzPiller.stack( 1 ) ); + try + { + initBuilderSupport(); + } + catch (Throwable builderSupport) + { + // not supported? + } + Block skyStone = b.blockSkyStone.block(); if ( skyStone != null ) { @@ -201,6 +219,42 @@ public class BC extends BaseModule implements IBC } } + private void initBuilderSupport() + { + SchematicRegistry.declareBlueprintSupport( AppEng.modid ); + + Blocks blks = AEApi.instance().blocks(); + Block cable = blks.blockMultiPart.block(); + for (Field f : blks.getClass().getFields()) + { + AEItemDefinition def; + try + { + def = (AEItemDefinition) f.get( blks ); + if ( def != null ) + { + Block myBlock = def.block(); + if ( myBlock instanceof IOrientableBlock && ((IOrientableBlock) myBlock).usesMetadata() && def.entity() == null ) + { + SchematicRegistry.registerSchematicBlock( myBlock, AERotateableBlockSchematic.class ); + } + else if ( myBlock == cable ) + { + SchematicRegistry.registerSchematicBlock( myBlock, AECableSchematicTile.class ); + } + else if ( def.entity() != null ) + { + SchematicRegistry.registerSchematicBlock( myBlock, AEGenericSchematicTile.class ); + } + } + } + catch (Throwable t) + { + // :P + } + } + } + @Override public void PostInit() { diff --git a/integration/modules/BCHelpers/AECableSchematicTile.java b/integration/modules/BCHelpers/AECableSchematicTile.java new file mode 100644 index 000000000..c369f1dc5 --- /dev/null +++ b/integration/modules/BCHelpers/AECableSchematicTile.java @@ -0,0 +1,143 @@ +package appeng.integration.modules.BCHelpers; + +import java.util.Set; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Vec3; +import net.minecraftforge.common.util.ForgeDirection; +import appeng.api.parts.IFacadeContainer; +import appeng.api.parts.IPart; +import appeng.api.parts.IPartHost; +import appeng.api.parts.LayerFlags; +import appeng.api.parts.SelectedPart; +import appeng.api.util.AEColor; +import appeng.api.util.DimensionalCoord; +import appeng.parts.CableBusContainer; +import buildcraft.api.blueprints.IBuilderContext; + +public class AECableSchematicTile extends AEGenericSchematicTile implements IPartHost +{ + + @Override + public void rotateLeft(IBuilderContext context) + { + CableBusContainer cbc = new CableBusContainer( this ); + cbc.readFromNBT( tileNBT ); + + cbc.rotateLeft(); + + tileNBT = new NBTTagCompound(); + cbc.writeToNBT( tileNBT ); + } + + @Override + public IFacadeContainer getFacadeContainer() + { + return null; + } + + @Override + public boolean canAddPart(ItemStack part, ForgeDirection side) + { + return false; + } + + @Override + public ForgeDirection addPart(ItemStack is, ForgeDirection side, EntityPlayer owner) + { + return null; + } + + @Override + public IPart getPart(ForgeDirection side) + { + return null; + } + + @Override + public void removePart(ForgeDirection side, boolean suppressUpdate) + { + + } + + @Override + public void markForUpdate() + { + + } + + @Override + public DimensionalCoord getLocation() + { + return null; + } + + @Override + public TileEntity getTile() + { + return null; + } + + @Override + public AEColor getColor() + { + return null; + } + + @Override + public void clearContainer() + { + + } + + @Override + public boolean isBlocked(ForgeDirection side) + { + return false; + } + + @Override + public SelectedPart selectPart(Vec3 pos) + { + return null; + } + + @Override + public void markForSave() + { + + } + + @Override + public void partChanged() + { + + } + + @Override + public boolean hasRedstone(ForgeDirection side) + { + return false; + } + + @Override + public boolean isEmpty() + { + return false; + } + + @Override + public Set getLayerFlags() + { + return null; + } + + @Override + public void cleanup() + { + + } +} diff --git a/integration/modules/BCHelpers/AEGenericSchematicTile.java b/integration/modules/BCHelpers/AEGenericSchematicTile.java new file mode 100644 index 000000000..e5cd279ba --- /dev/null +++ b/integration/modules/BCHelpers/AEGenericSchematicTile.java @@ -0,0 +1,59 @@ +package appeng.integration.modules.BCHelpers; + +import java.util.ArrayList; + +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; +import appeng.tile.AEBaseTile; +import appeng.util.Platform; +import buildcraft.api.blueprints.IBuilderContext; +import buildcraft.api.blueprints.SchematicTile; + +public class AEGenericSchematicTile extends SchematicTile +{ + + @Override + public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) + { + TileEntity tile = context.world().getTileEntity( x, y, z ); + ArrayList list = new ArrayList(); + if ( tile instanceof AEBaseTile ) + { + AEBaseTile tcb = (AEBaseTile) tile; + tcb.getDrops( tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, list ); + } + + storedRequirements = list.toArray( new ItemStack[list.size()] ); + } + + @Override + public void rotateLeft(IBuilderContext context) + { + if ( tileNBT.hasKey( "orientation_forward" ) && tileNBT.hasKey( "orientation_up" ) ) + { + String forward = tileNBT.getString( "orientation_forward" ); + String up = tileNBT.getString( "orientation_up" ); + + if ( forward != null && up != null ) + { + try + { + ForgeDirection fdForward = ForgeDirection.valueOf( forward ); + ForgeDirection fdUp = ForgeDirection.valueOf( up ); + + fdForward = Platform.rotateAround( fdForward, ForgeDirection.DOWN ); + fdUp = Platform.rotateAround( fdUp, ForgeDirection.DOWN ); + + tileNBT.setString( "orientation_forward", fdForward.name() ); + tileNBT.setString( "orientation_up", fdUp.name() ); + } + catch (Throwable t) + { + + } + } + } + } + +} diff --git a/integration/modules/BCHelpers/AERotateableBlockSchematic.java b/integration/modules/BCHelpers/AERotateableBlockSchematic.java new file mode 100644 index 000000000..76b79d64a --- /dev/null +++ b/integration/modules/BCHelpers/AERotateableBlockSchematic.java @@ -0,0 +1,21 @@ +package appeng.integration.modules.BCHelpers; + +import net.minecraftforge.common.util.ForgeDirection; +import appeng.util.Platform; +import buildcraft.api.blueprints.IBuilderContext; +import buildcraft.api.blueprints.SchematicBlock; + +public class AERotateableBlockSchematic extends SchematicBlock +{ + + @Override + public void rotateLeft(IBuilderContext context) + { + if ( meta < 6 ) + { + ForgeDirection d = Platform.rotateAround( ForgeDirection.values()[meta], ForgeDirection.DOWN ); + meta = d.ordinal(); + } + } + +} diff --git a/integration/modules/helpers/BCPipeHandler.java b/integration/modules/BCHelpers/BCPipeHandler.java similarity index 94% rename from integration/modules/helpers/BCPipeHandler.java rename to integration/modules/BCHelpers/BCPipeHandler.java index 07296841a..4d4a76e22 100644 --- a/integration/modules/helpers/BCPipeHandler.java +++ b/integration/modules/BCHelpers/BCPipeHandler.java @@ -1,4 +1,4 @@ -package appeng.integration.modules.helpers; +package appeng.integration.modules.BCHelpers; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; diff --git a/integration/modules/helpers/BCPipeInventory.java b/integration/modules/BCHelpers/BCPipeInventory.java similarity index 96% rename from integration/modules/helpers/BCPipeInventory.java rename to integration/modules/BCHelpers/BCPipeInventory.java index b16af7165..a2bd0f9db 100644 --- a/integration/modules/helpers/BCPipeInventory.java +++ b/integration/modules/BCHelpers/BCPipeInventory.java @@ -1,4 +1,4 @@ -package appeng.integration.modules.helpers; +package appeng.integration.modules.BCHelpers; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; diff --git a/integration/modules/NEI.java b/integration/modules/NEI.java index 1d4413631..93d1e297b 100644 --- a/integration/modules/NEI.java +++ b/integration/modules/NEI.java @@ -12,12 +12,12 @@ import net.minecraft.item.ItemStack; import appeng.client.gui.implementations.GuiCraftingTerm; import appeng.integration.IIntegrationModule; import appeng.integration.abstraction.INEI; -import appeng.integration.modules.helpers.NEIAEShapedRecipeHandler; -import appeng.integration.modules.helpers.NEIAEShapelessRecipeHandler; -import appeng.integration.modules.helpers.NEICraftingHandler; -import appeng.integration.modules.helpers.NEIGrinderRecipeHandler; -import appeng.integration.modules.helpers.NEIInscriberRecipeHandler; -import appeng.integration.modules.helpers.NEIWorldCraftingHandler; +import appeng.integration.modules.NEIHelpers.NEIAEShapedRecipeHandler; +import appeng.integration.modules.NEIHelpers.NEIAEShapelessRecipeHandler; +import appeng.integration.modules.NEIHelpers.NEICraftingHandler; +import appeng.integration.modules.NEIHelpers.NEIGrinderRecipeHandler; +import appeng.integration.modules.NEIHelpers.NEIInscriberRecipeHandler; +import appeng.integration.modules.NEIHelpers.NEIWorldCraftingHandler; import codechicken.nei.guihook.GuiContainerManager; public class NEI implements IIntegrationModule, INEI diff --git a/integration/modules/helpers/NEIAEShapedRecipeHandler.java b/integration/modules/NEIHelpers/NEIAEShapedRecipeHandler.java similarity index 99% rename from integration/modules/helpers/NEIAEShapedRecipeHandler.java rename to integration/modules/NEIHelpers/NEIAEShapedRecipeHandler.java index ab3621074..6505f1bfa 100644 --- a/integration/modules/helpers/NEIAEShapedRecipeHandler.java +++ b/integration/modules/NEIHelpers/NEIAEShapedRecipeHandler.java @@ -1,4 +1,4 @@ -package appeng.integration.modules.helpers; +package appeng.integration.modules.NEIHelpers; import java.awt.Rectangle; import java.util.ArrayList; diff --git a/integration/modules/helpers/NEIAEShapelessRecipeHandler.java b/integration/modules/NEIHelpers/NEIAEShapelessRecipeHandler.java similarity index 99% rename from integration/modules/helpers/NEIAEShapelessRecipeHandler.java rename to integration/modules/NEIHelpers/NEIAEShapelessRecipeHandler.java index b8f81830d..4d36a41b2 100644 --- a/integration/modules/helpers/NEIAEShapelessRecipeHandler.java +++ b/integration/modules/NEIHelpers/NEIAEShapelessRecipeHandler.java @@ -1,4 +1,4 @@ -package appeng.integration.modules.helpers; +package appeng.integration.modules.NEIHelpers; import java.awt.Rectangle; import java.util.ArrayList; diff --git a/integration/modules/helpers/NEICraftingHandler.java b/integration/modules/NEIHelpers/NEICraftingHandler.java similarity index 97% rename from integration/modules/helpers/NEICraftingHandler.java rename to integration/modules/NEIHelpers/NEICraftingHandler.java index 58a712335..4c65669c2 100644 --- a/integration/modules/helpers/NEICraftingHandler.java +++ b/integration/modules/NEIHelpers/NEICraftingHandler.java @@ -1,4 +1,4 @@ -package appeng.integration.modules.helpers; +package appeng.integration.modules.NEIHelpers; import java.util.List; diff --git a/integration/modules/helpers/NEIGrinderRecipeHandler.java b/integration/modules/NEIHelpers/NEIGrinderRecipeHandler.java similarity index 99% rename from integration/modules/helpers/NEIGrinderRecipeHandler.java rename to integration/modules/NEIHelpers/NEIGrinderRecipeHandler.java index 79235d2b2..b5789d57e 100644 --- a/integration/modules/helpers/NEIGrinderRecipeHandler.java +++ b/integration/modules/NEIHelpers/NEIGrinderRecipeHandler.java @@ -1,4 +1,4 @@ -package appeng.integration.modules.helpers; +package appeng.integration.modules.NEIHelpers; import static codechicken.lib.gui.GuiDraw.changeTexture; import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect; diff --git a/integration/modules/helpers/NEIInscriberRecipeHandler.java b/integration/modules/NEIHelpers/NEIInscriberRecipeHandler.java similarity index 98% rename from integration/modules/helpers/NEIInscriberRecipeHandler.java rename to integration/modules/NEIHelpers/NEIInscriberRecipeHandler.java index 497320670..586a19ee1 100644 --- a/integration/modules/helpers/NEIInscriberRecipeHandler.java +++ b/integration/modules/NEIHelpers/NEIInscriberRecipeHandler.java @@ -1,4 +1,4 @@ -package appeng.integration.modules.helpers; +package appeng.integration.modules.NEIHelpers; import static codechicken.lib.gui.GuiDraw.changeTexture; import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect; diff --git a/integration/modules/helpers/NEIWorldCraftingHandler.java b/integration/modules/NEIHelpers/NEIWorldCraftingHandler.java similarity index 99% rename from integration/modules/helpers/NEIWorldCraftingHandler.java rename to integration/modules/NEIHelpers/NEIWorldCraftingHandler.java index ed9f71293..332f7634a 100644 --- a/integration/modules/helpers/NEIWorldCraftingHandler.java +++ b/integration/modules/NEIHelpers/NEIWorldCraftingHandler.java @@ -1,4 +1,4 @@ -package appeng.integration.modules.helpers; +package appeng.integration.modules.NEIHelpers; import java.util.ArrayList; import java.util.HashMap; diff --git a/items/parts/ItemFacade.java b/items/parts/ItemFacade.java index 7ce29ec09..947dd5d4c 100644 --- a/items/parts/ItemFacade.java +++ b/items/parts/ItemFacade.java @@ -27,6 +27,8 @@ import appeng.facade.FacadePart; import appeng.facade.IFacadeItem; import appeng.items.AEBaseItem; import appeng.util.Platform; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -158,6 +160,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte ds[0] = Item.getIdFromItem( l.getItem() ); ds[1] = metadata; data.setIntArray( "x", ds ); + UniqueIdentifier ui = GameRegistry.findUniqueIdentifierFor( l.getItem() ); + data.setString( "modid", ui.modId ); + data.setString( "itemname", ui.name ); is.setTagCompound( data ); return is; } @@ -170,9 +175,16 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte NBTTagCompound data = is.getTagCompound(); if ( data != null ) { - int[] blk = data.getIntArray( "x" ); - if ( blk != null && blk.length == 2 ) - return Block.getBlockById( blk[0] ); + if ( data.hasKey( "modid" ) && data.hasKey( "itemname" ) ) + { + return GameRegistry.findBlock( data.getString( "modid" ), data.getString( "itemname" ) ); + } + else + { + int[] blk = data.getIntArray( "x" ); + if ( blk != null && blk.length == 2 ) + return Block.getBlockById( blk[0] ); + } } return Blocks.glass; } diff --git a/migration/OldItemPart.java b/migration/OldItemPart.java index 47eaaac4f..52242618b 100644 --- a/migration/OldItemPart.java +++ b/migration/OldItemPart.java @@ -19,7 +19,6 @@ import appeng.api.parts.IPart; import appeng.api.parts.IPartItem; import appeng.core.AEConfig; import appeng.core.features.AEFeature; -import appeng.core.features.AEFeatureHandler; import appeng.core.features.ItemStackSrc; import appeng.core.localization.GuiText; import appeng.items.AEBaseItem; @@ -150,9 +149,10 @@ public class OldItemPart extends AEBaseItem implements IPartItem, IItemGroup, II { return "PART"; } - + @Override - public String getItemStackDisplayName(ItemStack par1ItemStack) { + public String getItemStackDisplayName(ItemStack par1ItemStack) + { return "AE2-OLD-PART"; } diff --git a/migration/OldMaterialType.java b/migration/OldMaterialType.java index bc47fa618..c75db2375 100644 --- a/migration/OldMaterialType.java +++ b/migration/OldMaterialType.java @@ -5,7 +5,6 @@ import java.util.EnumSet; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import net.minecraftforge.oredict.OreDictionary; import appeng.core.AppEng; import appeng.core.features.AEFeature; import appeng.entity.EntityChargedQuartz; diff --git a/parts/CableBusContainer.java b/parts/CableBusContainer.java index e8874bc25..e3d512f33 100644 --- a/parts/CableBusContainer.java +++ b/parts/CableBusContainer.java @@ -79,6 +79,23 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer return sides[side.ordinal()]; } + public void rotateLeft() + { + IPart newSides[] = new IPart[6]; + + newSides[ForgeDirection.UP.ordinal()] = sides[ForgeDirection.UP.ordinal()]; + newSides[ForgeDirection.DOWN.ordinal()] = sides[ForgeDirection.DOWN.ordinal()]; + + newSides[ForgeDirection.EAST.ordinal()] = sides[ForgeDirection.NORTH.ordinal()]; + newSides[ForgeDirection.SOUTH.ordinal()] = sides[ForgeDirection.EAST.ordinal()]; + newSides[ForgeDirection.WEST.ordinal()] = sides[ForgeDirection.SOUTH.ordinal()]; + newSides[ForgeDirection.NORTH.ordinal()] = sides[ForgeDirection.WEST.ordinal()]; + + sides = newSides; + + fc.rotateLeft(); + } + public void updateDynamicRender() { requiresDynamicRender = false; @@ -575,6 +592,8 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer { byte sides = data.readByte(); + boolean updateBlock = false; + for (int x = 0; x < 7; x++) { ForgeDirection side = ForgeDirection.getOrientation( x ); @@ -589,7 +608,10 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer ItemStack current = p != null ? p.getItemStack( PartItemStack.Network ) : null; if ( current != null && current.getItem() == myItem && current.getItemDamage() == dmgValue ) - p.readFromStream( data ); + { + if ( p.readFromStream( data ) ) + updateBlock = true; + } else { removePart( side, false ); @@ -607,7 +629,9 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer removePart( side, false ); } - return fc.readFromStream( data ); + if ( fc.readFromStream( data ) ) + return true; + return updateBlock; } ForgeDirection getSide(IPart part) diff --git a/parts/networking/PartCable.java b/parts/networking/PartCable.java index 18ef53a96..b1c53a9c4 100644 --- a/parts/networking/PartCable.java +++ b/parts/networking/PartCable.java @@ -284,7 +284,7 @@ public class PartCable extends AEBasePart implements IPartCable int cs = data.readByte(); int sideOut = data.readInt(); - EnumSet myC = connections; + EnumSet myC = connections.clone(); boolean wasPowered = powered; powered = false; boolean chchanged = false; diff --git a/tile/AEBaseTile.java b/tile/AEBaseTile.java index 9b527300b..03a19d178 100644 --- a/tile/AEBaseTile.java +++ b/tile/AEBaseTile.java @@ -322,12 +322,8 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, for (int l = 0; l < inv.getSizeInventory(); l++) { ItemStack is = inv.getStackInSlot( l ); - if ( is != null ) - { drops.add( is ); - inv.setInventorySlotContents( l, (ItemStack) null ); - } } } diff --git a/tile/misc/TileCellWorkbench.java b/tile/misc/TileCellWorkbench.java index 851c928f1..d31302f5f 100644 --- a/tile/misc/TileCellWorkbench.java +++ b/tile/misc/TileCellWorkbench.java @@ -174,10 +174,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I super.getDrops( w, x, y, z, drops ); if ( cell.getStackInSlot( 0 ) != null ) - { drops.add( cell.getStackInSlot( 0 ) ); - cell.setInventorySlotContents( 0, null ); - } } public ICellWorkbenchItem getCell() diff --git a/util/InventoryAdaptor.java b/util/InventoryAdaptor.java index 61aa2d6f5..8b3c496be 100644 --- a/util/InventoryAdaptor.java +++ b/util/InventoryAdaptor.java @@ -18,7 +18,6 @@ import appeng.util.inv.ItemSlot; import appeng.util.inv.WrapperMCISidedInventory; import buildcraft.api.inventory.ISpecialInventory; -@SuppressWarnings("deprecation") public abstract class InventoryAdaptor implements Iterable { diff --git a/util/inv/AdaptorISpecialInventory.java b/util/inv/AdaptorISpecialInventory.java index 26e920969..994b04857 100644 --- a/util/inv/AdaptorISpecialInventory.java +++ b/util/inv/AdaptorISpecialInventory.java @@ -9,7 +9,6 @@ import appeng.api.config.FuzzyMode; import appeng.util.InventoryAdaptor; import buildcraft.api.inventory.ISpecialInventory; -@SuppressWarnings("deprecation") public class AdaptorISpecialInventory extends InventoryAdaptor {