diff --git a/block/misc/BlockQuartzGrowthAccelerator.java b/block/misc/BlockQuartzGrowthAccelerator.java index f65e4ca8c..3bd4f3c97 100644 --- a/block/misc/BlockQuartzGrowthAccelerator.java +++ b/block/misc/BlockQuartzGrowthAccelerator.java @@ -54,7 +54,7 @@ public class BlockQuartzGrowthAccelerator extends AEBaseBlock implements IOrient TileQuartzGrowthAccelerator tqga = getTileEntity( w, x, y, z ); - if ( tqga.hasPower && CommonHelper.proxy.shouldAddParticles( r ) ) + if ( tqga != null && tqga.hasPower && CommonHelper.proxy.shouldAddParticles( r ) ) { double d0 = (double) (r.nextFloat() - 0.5F); double d1 = (double) (r.nextFloat() - 0.5F); diff --git a/client/render/RenderBlocksWorkaround.java b/client/render/RenderBlocksWorkaround.java index f8f664fb2..2220683ec 100644 --- a/client/render/RenderBlocksWorkaround.java +++ b/client/render/RenderBlocksWorkaround.java @@ -364,8 +364,8 @@ public class RenderBlocksWorkaround extends RenderBlocks { Tessellator tessellator = Tessellator.instance; - double d4 = (double) par8Icon.getInterpolatedU( this.renderMinZ * 16.0D ); - double d3 = (double) par8Icon.getInterpolatedU( this.renderMaxZ * 16.0D ); + double d3 = (double) par8Icon.getInterpolatedU( 16.0D - this.renderMinZ * 16.0D ); + double d4 = (double) par8Icon.getInterpolatedU( 16.0D - this.renderMaxZ * 16.0D ); double d5 = (double) par8Icon.getInterpolatedV( 16.0D - this.renderMaxY * 16.0D ); double d6 = (double) par8Icon.getInterpolatedV( 16.0D - this.renderMinY * 16.0D ); @@ -554,8 +554,8 @@ public class RenderBlocksWorkaround extends RenderBlocks { Tessellator tessellator = Tessellator.instance; - double d4 = (double) par8Icon.getInterpolatedU( this.renderMinX * 16.0D ); - double d3 = (double) par8Icon.getInterpolatedU( this.renderMaxX * 16.0D ); + double d3 = (double) par8Icon.getInterpolatedU( 16.0D - this.renderMinX * 16.0D ); + double d4 = (double) par8Icon.getInterpolatedU( 16.0D - this.renderMaxX * 16.0D ); double d5 = (double) par8Icon.getInterpolatedV( 16.0D - this.renderMaxY * 16.0D ); double d6 = (double) par8Icon.getInterpolatedV( 16.0D - this.renderMinY * 16.0D ); diff --git a/fmp/CableBusPart.java b/fmp/CableBusPart.java index 8b0df29cf..162eb3e10 100644 --- a/fmp/CableBusPart.java +++ b/fmp/CableBusPart.java @@ -482,7 +482,8 @@ public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IReds @Override public void partChanged() { - notifyNeighbors(); + if ( isInWorld() ) + notifyNeighbors(); } @Override diff --git a/integration/IntegrationType.java b/integration/IntegrationType.java index f6fdbcd46..02d1ec9ce 100644 --- a/integration/IntegrationType.java +++ b/integration/IntegrationType.java @@ -40,7 +40,9 @@ public enum IntegrationType Mekanism(IntegrationSide.BOTH, "Mekanism", "Mekanism"), - ImmibisMicroblocks(IntegrationSide.BOTH, "ImmibisMicroblocks", "ImmibisMicroblocks"); + ImmibisMicroblocks(IntegrationSide.BOTH, "ImmibisMicroblocks", "ImmibisMicroblocks"), + + BetterStorage(IntegrationSide.BOTH, "BetterStorage", "betterstorage" ); public final IntegrationSide side; public final String dspName; diff --git a/integration/abstraction/IBS.java b/integration/abstraction/IBetterStorage.java similarity index 83% rename from integration/abstraction/IBS.java rename to integration/abstraction/IBetterStorage.java index 437372488..7acd679d8 100644 --- a/integration/abstraction/IBS.java +++ b/integration/abstraction/IBetterStorage.java @@ -3,7 +3,7 @@ package appeng.integration.abstraction; import net.minecraftforge.common.util.ForgeDirection; import appeng.util.InventoryAdaptor; -public interface IBS +public interface IBetterStorage { boolean isStorageCrate(Object te); diff --git a/integration/modules/dead/BS.java b/integration/modules/BetterStorage.java similarity index 68% rename from integration/modules/dead/BS.java rename to integration/modules/BetterStorage.java index ace05046d..ec095bd70 100644 --- a/integration/modules/dead/BS.java +++ b/integration/modules/BetterStorage.java @@ -1,18 +1,18 @@ -package appeng.integration.modules.dead; +package appeng.integration.modules; import net.mcft.copy.betterstorage.api.ICrateStorage; import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.integration.IIntegrationModule; -import appeng.integration.abstraction.IBS; -import appeng.integration.modules.helpers.dead.BSCrateHandler; -import appeng.integration.modules.helpers.dead.BSCrateStorageAdaptor; +import appeng.integration.abstraction.IBetterStorage; +import appeng.integration.modules.helpers.BSCrateHandler; +import appeng.integration.modules.helpers.BSCrateStorageAdaptor; import appeng.util.InventoryAdaptor; -public class BS implements IIntegrationModule, IBS +public class BetterStorage implements IIntegrationModule, IBetterStorage { - public static BS instance; + public static BetterStorage instance; @Override public boolean isStorageCrate(Object te) diff --git a/integration/modules/dead/Mekanism.java b/integration/modules/dead/Mekanism.java deleted file mode 100644 index 9e4288abb..000000000 --- a/integration/modules/dead/Mekanism.java +++ /dev/null @@ -1,41 +0,0 @@ -package appeng.integration.modules.dead; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import appeng.api.AEApi; -import appeng.integration.IIntegrationModule; - -public class Mekanism implements IIntegrationModule -{ - - public static Mekanism instance; - - @Override - public void Init() - { - // TODO Auto-generated method stub - - } - - @Override - public void PostInit() - { - // certus quartz - crusher( AEApi.instance().materials().materialCertusQuartzCrystal.stack( 1 ), - AEApi.instance().materials().materialCertusQuartzDust.stack( 1 ) ); - - crusher( AEApi.instance().materials().materialCertusQuartzCrystalCharged.stack( 1 ), - AEApi.instance().materials().materialCertusQuartzDust.stack( 1 ) ); - - // fluix - crusher( AEApi.instance().materials().materialFluixCrystal.stack( 1 ), AEApi.instance().materials().materialFluixDust.stack( 1 ) ); - - // nether quartz - crusher( new ItemStack( Item.netherQuartz ), AEApi.instance().materials().materialNetherQuartzDust.stack( 1 ) ); - } - - private void crusher(ItemStack input, ItemStack output) - { - mekanism.api.RecipeHelper.addCrusherRecipe( input, output ); - } -} diff --git a/integration/modules/dead/TE.java b/integration/modules/dead/TE.java deleted file mode 100644 index e5f08662f..000000000 --- a/integration/modules/dead/TE.java +++ /dev/null @@ -1,78 +0,0 @@ -package appeng.integration.modules; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; -import appeng.api.AEApi; -import appeng.integration.BaseModule; -import appeng.integration.IIntegrationModule; -import appeng.integration.abstraction.ITE; -import cpw.mods.fml.common.event.FMLInterModComms; - -public class TE extends BaseModule implements IIntegrationModule, ITE -{ - - public static TE instance; - - @Override - public void Init() - { - - } - - @Override - public void PostInit() - { - // certus quartz - pulverizer( AEApi.instance().materials().materialCertusQuartzCrystal.stack( 1 ), AEApi.instance().materials().materialCertusQuartzDust.stack( 1 ) ); - - pulverizer( AEApi.instance().materials().materialCertusQuartzCrystalCharged.stack( 1 ), AEApi.instance().materials().materialCertusQuartzDust.stack( 1 ) ); - - // fluix - pulverizer( AEApi.instance().materials().materialFluixCrystal.stack( 1 ), AEApi.instance().materials().materialFluixDust.stack( 1 ) ); - - // nether quartz - pulverizer( new ItemStack( Item.netherQuartz ), AEApi.instance().materials().materialNetherQuartzDust.stack( 1 ) ); - } - - private void pulverizer(ItemStack in, ItemStack out) - { - NBTTagCompound toSend = new NBTTagCompound(); - toSend.setInteger( "energy", 3200 ); - toSend.setTag( "input", new NBTTagCompound() ); - toSend.setTag( "primaryOutput", new NBTTagCompound() ); - - in.writeToNBT( toSend.getCompoundTag( "input" ) ); - out.writeToNBT( toSend.getCompoundTag( "primaryOutput" ) ); - FMLInterModComms.sendMessage( "ThermalExpansion", "PulverizerRecipe", toSend ); - } - - @Override - public ItemStack addItemsToPipe(TileEntity ad, ItemStack itemstack, ForgeDirection dir) - { - return ((IItemConduit) ad).insertItem( dir, itemstack ); - } - - @Override - public void addPulverizerRecipe(int i, ItemStack blkQuartz, ItemStack blockDust) - { - // TODO Auto-generated method stub - - } - - @Override - public void addPulverizerRecipe(int i, ItemStack blkQuartzOre, ItemStack matQuartz, ItemStack matQuartzDust) - { - // TODO Auto-generated method stub - - } - - @Override - public boolean isPipe(TileEntity te, ForgeDirection opposite) - { - return te instanceof IItemConduit; - } - -} diff --git a/integration/modules/helpers/dead/BSCrate.java b/integration/modules/helpers/BSCrate.java similarity index 97% rename from integration/modules/helpers/dead/BSCrate.java rename to integration/modules/helpers/BSCrate.java index 5140eaab0..bdcbe8320 100644 --- a/integration/modules/helpers/dead/BSCrate.java +++ b/integration/modules/helpers/BSCrate.java @@ -1,4 +1,4 @@ -package appeng.integration.modules.helpers.dead; +package appeng.integration.modules.helpers; import net.mcft.copy.betterstorage.api.ICrateStorage; import net.minecraft.item.ItemStack; diff --git a/integration/modules/helpers/dead/BSCrateHandler.java b/integration/modules/helpers/BSCrateHandler.java similarity index 65% rename from integration/modules/helpers/dead/BSCrateHandler.java rename to integration/modules/helpers/BSCrateHandler.java index d7524c8dc..45220ff50 100644 --- a/integration/modules/helpers/dead/BSCrateHandler.java +++ b/integration/modules/helpers/BSCrateHandler.java @@ -1,8 +1,9 @@ -package appeng.integration.modules.helpers.dead; +package appeng.integration.modules.helpers; import net.mcft.copy.betterstorage.api.ICrateStorage; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; +import appeng.api.networking.security.BaseActionSource; import appeng.api.storage.IExternalStorageHandler; import appeng.api.storage.IMEInventory; import appeng.api.storage.StorageChannel; @@ -11,15 +12,15 @@ public class BSCrateHandler implements IExternalStorageHandler { @Override - public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel chan) + public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource mySrc) { - return chan == StorageChannel.ITEMS && te instanceof ICrateStorage; + return channel == StorageChannel.ITEMS && te instanceof ICrateStorage; } @Override - public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel chan) + public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource src) { - if ( chan == StorageChannel.ITEMS ) + if ( channel == StorageChannel.ITEMS ) return new BSCrate( te, ForgeDirection.UNKNOWN ); return null; } diff --git a/integration/modules/helpers/dead/BSCrateStorageAdaptor.java b/integration/modules/helpers/BSCrateStorageAdaptor.java similarity index 98% rename from integration/modules/helpers/dead/BSCrateStorageAdaptor.java rename to integration/modules/helpers/BSCrateStorageAdaptor.java index efece6d67..202238f29 100644 --- a/integration/modules/helpers/dead/BSCrateStorageAdaptor.java +++ b/integration/modules/helpers/BSCrateStorageAdaptor.java @@ -1,4 +1,4 @@ -package appeng.integration.modules.helpers.dead; +package appeng.integration.modules.helpers; import java.util.Iterator; diff --git a/me/cluster/implementations/CraftingCPUCluster.java b/me/cluster/implementations/CraftingCPUCluster.java index dfec61168..a3d1bb835 100644 --- a/me/cluster/implementations/CraftingCPUCluster.java +++ b/me/cluster/implementations/CraftingCPUCluster.java @@ -631,8 +631,11 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU { postChange( input[x], machineSrc ); ic.setInventorySlotContents( x, is ); - found = true; - continue; + if ( is.stackSize == input[x].getStackSize() ) + { + found = true; + continue; + } } } diff --git a/me/storage/MEMonitorIInventory.java b/me/storage/MEMonitorIInventory.java index e4874111f..3ccddb0ed 100644 --- a/me/storage/MEMonitorIInventory.java +++ b/me/storage/MEMonitorIInventory.java @@ -165,7 +165,7 @@ public class MEMonitorIInventory implements IMEInventory, IMEMonit for (ItemSlot is : adaptor) { CachedItemStack old = memory.get( is.slot ); - ItemStack newIS = is == null ? null : is.getItemStack(); + ItemStack newIS = is == null || is.isExtractable == false ? null : is.getItemStack(); ItemStack oldIS = old == null ? null : old.itemStack; if ( isDiffrent( newIS, oldIS ) ) diff --git a/tile/networking/TileEnergyCell.java b/tile/networking/TileEnergyCell.java index 51ff7dc45..a3ef40634 100644 --- a/tile/networking/TileEnergyCell.java +++ b/tile/networking/TileEnergyCell.java @@ -5,7 +5,6 @@ import net.minecraftforge.common.util.ForgeDirection; import appeng.api.config.AccessRestriction; import appeng.api.config.Actionable; import appeng.api.config.PowerMultiplier; -import appeng.api.networking.GridFlags; import appeng.api.networking.energy.IAEPowerStorage; import appeng.api.networking.events.MENetworkPowerStorage; import appeng.api.networking.events.MENetworkPowerStorage.PowerEventType; @@ -70,7 +69,6 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage public TileEnergyCell() { gridProxy.setIdlePowerUsage( 0 ); - gridProxy.setFlags( GridFlags.CANNOT_CARRY ); addNewHandler( new TileEnergyCellHandler() ); } diff --git a/tile/storage/TileDrive.java b/tile/storage/TileDrive.java index 2e95e6b52..52e318716 100644 --- a/tile/storage/TileDrive.java +++ b/tile/storage/TileDrive.java @@ -125,6 +125,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior @Override public void readFromNBT(NBTTagCompound data) { + isCached = false; priority = data.getInteger( "priority" ); } @@ -175,8 +176,11 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior @Override public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added) { - isCached = false; // recalculate the storage cell. - updateState(); + if ( isCached ) + { + isCached = false; // recalculate the storage cell. + updateState(); + } try { diff --git a/util/InventoryAdaptor.java b/util/InventoryAdaptor.java index 47f09b596..ac792b1da 100644 --- a/util/InventoryAdaptor.java +++ b/util/InventoryAdaptor.java @@ -9,6 +9,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntityChest; import net.minecraftforge.common.util.ForgeDirection; import appeng.api.config.FuzzyMode; +import appeng.core.AppEng; +import appeng.integration.IntegrationType; +import appeng.integration.abstraction.IBetterStorage; import appeng.util.inv.AdaptorIInventory; import appeng.util.inv.AdaptorISpecialInventory; import appeng.util.inv.AdaptorList; @@ -43,7 +46,9 @@ public abstract class InventoryAdaptor implements Iterable { if ( te == null ) return null; - + + IBetterStorage bs = (IBetterStorage) (AppEng.instance.isIntegrationEnabled( IntegrationType.BetterStorage ) ? AppEng.instance.getIntegration( IntegrationType.BetterStorage ) : null); + if ( te instanceof EntityPlayer ) { return new AdaptorIInventory( new AdaptorPlayerInventory( ((EntityPlayer) te).inventory ) ); @@ -51,10 +56,11 @@ public abstract class InventoryAdaptor implements Iterable else if ( te instanceof ArrayList ) { return new AdaptorList( (ArrayList) te ); - }/* - * else if ( BS.instance != null && BS.instance.isStorageCrate( te ) ) { return BS.instance.getAdaptor( te, d ); - * } - */ + } + else if ( bs != null && bs.isStorageCrate( te ) ) + { + return bs.getAdaptor( te, d ); + } else if ( te instanceof TileEntityChest ) { return new AdaptorIInventory( (IInventory) Platform.GetChestInv( te ) ); diff --git a/util/inv/AdaptorIInventory.java b/util/inv/AdaptorIInventory.java index 90e5b162b..d23a20eee 100644 --- a/util/inv/AdaptorIInventory.java +++ b/util/inv/AdaptorIInventory.java @@ -341,8 +341,12 @@ public class AdaptorIInventory extends InventoryAdaptor @Override public ItemSlot next() { - is.slot = x; - is.setItemStack( i.getStackInSlot( x++ ) ); + ItemStack iss = i.getStackInSlot( x ); + + is.isExtractable = canRemoveStackFromSlot( x, iss ); + is.setItemStack( iss ); + + is.slot = x++; return is; } diff --git a/util/inv/IMEAdaptorIterator.java b/util/inv/IMEAdaptorIterator.java index c4bdb4743..0cbeeae87 100644 --- a/util/inv/IMEAdaptorIterator.java +++ b/util/inv/IMEAdaptorIterator.java @@ -33,6 +33,7 @@ public class IMEAdaptorIterator implements Iterator public ItemSlot next() { slot.slot = offset++; + slot.isExtractable=true; if ( parent.maxSlots < offset ) parent.maxSlots = offset; diff --git a/util/inv/ItemSlot.java b/util/inv/ItemSlot.java index dd301edfe..ba7604a33 100644 --- a/util/inv/ItemSlot.java +++ b/util/inv/ItemSlot.java @@ -13,6 +13,8 @@ public class ItemSlot private IAEItemStack aeitemstack; private ItemStack itemStack; + public boolean isExtractable; + public void setItemStack(ItemStack is) { aeitemstack = null; diff --git a/util/item/ItemList.java b/util/item/ItemList.java index e74f7b624..31b3b4114 100644 --- a/util/item/ItemList.java +++ b/util/item/ItemList.java @@ -207,16 +207,16 @@ public final class ItemList implements IItemList output = new LinkedList(); - for (IAEItemStack is : or.aeotherOptions) + for (IAEItemStack is : or.getAEEquivilients()) output.addAll( findFuzzyDamage( (AEItemStack) is, fuzzy, is.getItemDamage() == OreDictionary.WILDCARD_VALUE ) ); return output; diff --git a/util/item/OreHelper.java b/util/item/OreHelper.java index dcc05341a..1d8494f58 100644 --- a/util/item/OreHelper.java +++ b/util/item/OreHelper.java @@ -68,7 +68,6 @@ public class OreHelper OreRefrence ref = new OreRefrence(); Collection ores = ref.getOres(); Collection set = ref.getEquivilients(); - Collection aeset = ref.getAEEquivilients(); for (String ore : OreDictionary.getOreNames()) { @@ -93,14 +92,7 @@ public class OreHelper } if ( !set.isEmpty() ) - { or.oreValue = ref; - - // SUMMON AE STACKS! - for (ItemStack is : set) - if ( is.getItem() != null ) - aeset.add( AEItemStack.create( is ) ); - } } return or.oreValue; @@ -118,7 +110,7 @@ public class OreHelper return false; Collection bOres = b.getOres(); - for (Integer ore : a.ores) + for (Integer ore : a.getOres()) { if ( bOres.contains( ore ) ) return true; @@ -134,9 +126,9 @@ public class OreHelper if ( a == b ) return true; - + Collection bOres = b.getOres(); - for (Integer ore : a.ores) + for (Integer ore : a.getOres()) { if ( bOres.contains( ore ) ) return true; diff --git a/util/item/OreRefrence.java b/util/item/OreRefrence.java index c0fe8b0a2..44ff451a7 100644 --- a/util/item/OreRefrence.java +++ b/util/item/OreRefrence.java @@ -1,8 +1,10 @@ package appeng.util.item; +import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.LinkedList; +import java.util.List; import net.minecraft.item.ItemStack; import appeng.api.storage.data.IAEItemStack; @@ -10,17 +12,27 @@ import appeng.api.storage.data.IAEItemStack; public class OreRefrence { - LinkedList otherOptions = new LinkedList(); - LinkedList aeotherOptions = new LinkedList(); - HashSet ores = new HashSet(); + private LinkedList otherOptions = new LinkedList(); + private ArrayList aeotherOptions = null; + private HashSet ores = new HashSet(); public Collection getEquivilients() { return otherOptions; } - public Collection getAEEquivilients() + public List getAEEquivilients() { + if ( aeotherOptions == null ) + { + aeotherOptions = new ArrayList( otherOptions.size() ); + + // SUMMON AE STACKS! + for (ItemStack is : otherOptions) + if ( is.getItem() != null ) + aeotherOptions.add( AEItemStack.create( is ) ); + } + return aeotherOptions; }