This commit is contained in:
AlgorithmX2 2014-08-12 19:21:42 -05:00
commit a3091741ff
22 changed files with 79 additions and 172 deletions

View file

@ -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);

View file

@ -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 );

View file

@ -482,7 +482,8 @@ public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IReds
@Override
public void partChanged()
{
notifyNeighbors();
if ( isInWorld() )
notifyNeighbors();
}
@Override

View file

@ -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;

View file

@ -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);

View file

@ -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)

View file

@ -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 );
}
}

View file

@ -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;
}
}

View file

@ -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;

View file

@ -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;
}

View file

@ -1,4 +1,4 @@
package appeng.integration.modules.helpers.dead;
package appeng.integration.modules.helpers;
import java.util.Iterator;

View file

@ -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;
}
}
}

View file

@ -165,7 +165,7 @@ public class MEMonitorIInventory implements IMEInventory<IAEItemStack>, 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 ) )

View file

@ -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() );
}

View file

@ -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
{

View file

@ -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<ItemSlot>
{
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<ItemSlot>
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 ) );

View file

@ -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;
}

View file

@ -33,6 +33,7 @@ public class IMEAdaptorIterator implements Iterator<ItemSlot>
public ItemSlot next()
{
slot.slot = offset++;
slot.isExtractable=true;
if ( parent.maxSlots < offset )
parent.maxSlots = offset;

View file

@ -13,6 +13,8 @@ public class ItemSlot
private IAEItemStack aeitemstack;
private ItemStack itemStack;
public boolean isExtractable;
public void setItemStack(ItemStack is)
{
aeitemstack = null;

View file

@ -207,16 +207,16 @@ public final class ItemList<StackType extends IAEStack> implements IItemList<Sta
if ( ais.isOre() )
{
OreRefrence or = ais.def.isOre;
if ( or.aeotherOptions.size() == 1 )
if ( or.getAEEquivilients().size() == 1 )
{
IAEItemStack is = or.aeotherOptions.get( 0 );
IAEItemStack is = or.getAEEquivilients().get( 0 );
return findFuzzyDamage( (AEItemStack) is, fuzzy, is.getItemDamage() == OreDictionary.WILDCARD_VALUE );
}
else
{
Collection<StackType> 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;

View file

@ -68,7 +68,6 @@ public class OreHelper
OreRefrence ref = new OreRefrence();
Collection<Integer> ores = ref.getOres();
Collection<ItemStack> set = ref.getEquivilients();
Collection<IAEItemStack> 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<Integer> 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<Integer> bOres = b.getOres();
for (Integer ore : a.ores)
for (Integer ore : a.getOres())
{
if ( bOres.contains( ore ) )
return true;

View file

@ -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<ItemStack> otherOptions = new LinkedList();
LinkedList<IAEItemStack> aeotherOptions = new LinkedList();
HashSet<Integer> ores = new HashSet<Integer>();
private LinkedList<ItemStack> otherOptions = new LinkedList();
private ArrayList aeotherOptions = null;
private HashSet<Integer> ores = new HashSet<Integer>();
public Collection<ItemStack> getEquivilients()
{
return otherOptions;
}
public Collection<IAEItemStack> getAEEquivilients()
public List<IAEItemStack> 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;
}