Initial rv1 beta merge.

This commit is contained in:
AlgorithmX2
2014-09-13 15:12:47 -05:00
58 changed files with 754 additions and 210 deletions
+4 -1
View File
@@ -42,6 +42,7 @@ import appeng.core.features.AEFeature;
import appeng.core.features.AEFeatureHandler; import appeng.core.features.AEFeatureHandler;
import appeng.core.features.IAEFeature; import appeng.core.features.IAEFeature;
import appeng.core.features.ItemStackSrc; import appeng.core.features.ItemStackSrc;
import appeng.helpers.AEGlassMaterial;
import appeng.helpers.ICustomCollision; import appeng.helpers.ICustomCollision;
import appeng.tile.AEBaseTile; import appeng.tile.AEBaseTile;
import appeng.tile.networking.TileCableBus; import appeng.tile.networking.TileCableBus;
@@ -203,7 +204,9 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
protected AEBaseBlock(Class<?> c, Material mat, String subname) { protected AEBaseBlock(Class<?> c, Material mat, String subname) {
super( mat ); super( mat );
if ( mat == Material.glass ) if ( mat == AEGlassMaterial.instance )
setStepSound( Block.soundTypeGlass );
else if ( mat == Material.glass )
setStepSound( Block.soundTypeGlass ); setStepSound( Block.soundTypeGlass );
else if ( mat == Material.rock ) else if ( mat == Material.rock )
setStepSound( Block.soundTypeStone ); setStepSound( Block.soundTypeStone );
+2 -2
View File
@@ -5,7 +5,6 @@ import java.util.List;
import java.util.Random; import java.util.Random;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.particle.EffectRenderer; import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.particle.EntityDiggingFX; import net.minecraft.client.particle.EntityDiggingFX;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@@ -39,6 +38,7 @@ import appeng.core.Api;
import appeng.core.AppEng; import appeng.core.AppEng;
import appeng.core.CommonHelper; import appeng.core.CommonHelper;
import appeng.core.features.AEFeature; import appeng.core.features.AEFeature;
import appeng.helpers.AEGlassMaterial;
import appeng.integration.IntegrationType; import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IFMP; import appeng.integration.abstraction.IFMP;
import appeng.parts.ICableBusContainer; import appeng.parts.ICableBusContainer;
@@ -75,7 +75,7 @@ public class BlockCableBus extends AEBaseBlock implements IRedNetConnection
} }
public BlockCableBus() { public BlockCableBus() {
super( BlockCableBus.class, Material.glass ); super( BlockCableBus.class, AEGlassMaterial.instance );
setfeature( EnumSet.of( AEFeature.Core ) ); setfeature( EnumSet.of( AEFeature.Core ) );
setLightOpacity( 0 ); setLightOpacity( 0 );
isFullSize = isOpaque = false; isFullSize = isOpaque = false;
@@ -2,16 +2,16 @@ package appeng.block.networking;
import java.util.EnumSet; import java.util.EnumSet;
import net.minecraft.block.material.Material;
import appeng.block.AEBaseBlock; import appeng.block.AEBaseBlock;
import appeng.core.features.AEFeature; import appeng.core.features.AEFeature;
import appeng.helpers.AEGlassMaterial;
import appeng.tile.networking.TileCreativeEnergyCell; import appeng.tile.networking.TileCreativeEnergyCell;
public class BlockCreativeEnergyCell extends AEBaseBlock public class BlockCreativeEnergyCell extends AEBaseBlock
{ {
public BlockCreativeEnergyCell() { public BlockCreativeEnergyCell() {
super( BlockCreativeEnergyCell.class, Material.glass ); super( BlockCreativeEnergyCell.class, AEGlassMaterial.instance );
setfeature( EnumSet.of( AEFeature.Creative ) ); setfeature( EnumSet.of( AEFeature.Creative ) );
setTileEntiy( TileCreativeEnergyCell.class ); setTileEntiy( TileCreativeEnergyCell.class );
} }
+2 -2
View File
@@ -3,7 +3,6 @@ package appeng.block.networking;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@@ -15,6 +14,7 @@ import appeng.client.render.BaseBlockRender;
import appeng.client.render.blocks.RenderBlockEnergyCube; import appeng.client.render.blocks.RenderBlockEnergyCube;
import appeng.client.texture.ExtraBlockTextures; import appeng.client.texture.ExtraBlockTextures;
import appeng.core.features.AEFeature; import appeng.core.features.AEFeature;
import appeng.helpers.AEGlassMaterial;
import appeng.tile.networking.TileEnergyCell; import appeng.tile.networking.TileEnergyCell;
import appeng.util.Platform; import appeng.util.Platform;
@@ -27,7 +27,7 @@ public class BlockEnergyCell extends AEBaseBlock
} }
public BlockEnergyCell(Class c) { public BlockEnergyCell(Class c) {
super( c, Material.glass ); super( c, AEGlassMaterial.instance );
} }
public BlockEnergyCell() { public BlockEnergyCell() {
+2 -2
View File
@@ -4,7 +4,6 @@ import java.util.Arrays;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
@@ -16,6 +15,7 @@ import appeng.client.render.BaseBlockRender;
import appeng.client.render.blocks.RenderBlockWireless; import appeng.client.render.blocks.RenderBlockWireless;
import appeng.core.features.AEFeature; import appeng.core.features.AEFeature;
import appeng.core.sync.GuiBridge; import appeng.core.sync.GuiBridge;
import appeng.helpers.AEGlassMaterial;
import appeng.helpers.ICustomCollision; import appeng.helpers.ICustomCollision;
import appeng.tile.networking.TileWireless; import appeng.tile.networking.TileWireless;
import appeng.util.Platform; import appeng.util.Platform;
@@ -24,7 +24,7 @@ public class BlockWireless extends AEBaseBlock implements ICustomCollision
{ {
public BlockWireless() { public BlockWireless() {
super( BlockWireless.class, Material.glass ); super( BlockWireless.class, AEGlassMaterial.instance );
setfeature( EnumSet.of( AEFeature.Core, AEFeature.WirelessAccessTerminal ) ); setfeature( EnumSet.of( AEFeature.Core, AEFeature.WirelessAccessTerminal ) );
setTileEntiy( TileWireless.class ); setTileEntiy( TileWireless.class );
setLightOpacity( 0 ); setLightOpacity( 0 );
+2 -2
View File
@@ -6,7 +6,6 @@ import java.util.List;
import java.util.Random; import java.util.Random;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
@@ -19,6 +18,7 @@ import appeng.client.render.blocks.RenderQNB;
import appeng.core.CommonHelper; import appeng.core.CommonHelper;
import appeng.core.features.AEFeature; import appeng.core.features.AEFeature;
import appeng.core.sync.GuiBridge; import appeng.core.sync.GuiBridge;
import appeng.helpers.AEGlassMaterial;
import appeng.helpers.ICustomCollision; import appeng.helpers.ICustomCollision;
import appeng.tile.qnb.TileQuantumBridge; import appeng.tile.qnb.TileQuantumBridge;
import appeng.util.Platform; import appeng.util.Platform;
@@ -29,7 +29,7 @@ public class BlockQuantumLinkChamber extends AEBaseBlock implements ICustomColli
{ {
public BlockQuantumLinkChamber() { public BlockQuantumLinkChamber() {
super( BlockQuantumLinkChamber.class, Material.glass ); super( BlockQuantumLinkChamber.class, AEGlassMaterial.instance );
setfeature( EnumSet.of( AEFeature.QuantumNetworkBridge ) ); setfeature( EnumSet.of( AEFeature.QuantumNetworkBridge ) );
setTileEntiy( TileQuantumBridge.class ); setTileEntiy( TileQuantumBridge.class );
float shave = 2.0f / 16.0f; float shave = 2.0f / 16.0f;
+3 -1
View File
@@ -8,6 +8,7 @@ import appeng.block.AEBaseBlock;
import appeng.client.render.BaseBlockRender; import appeng.client.render.BaseBlockRender;
import appeng.client.render.blocks.RenderQuartzGlass; import appeng.client.render.blocks.RenderQuartzGlass;
import appeng.core.features.AEFeature; import appeng.core.features.AEFeature;
import appeng.helpers.AEGlassMaterial;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -28,7 +29,8 @@ public class BlockQuartzGlass extends AEBaseBlock
@Override @Override
public boolean shouldSideBeRendered(IBlockAccess w, int x, int y, int z, int side) public boolean shouldSideBeRendered(IBlockAccess w, int x, int y, int z, int side)
{ {
if ( w.getBlock( x, y, z ).getMaterial() == Material.glass ) Material mat = w.getBlock( x, y, z ).getMaterial();
if ( mat == Material.glass || mat == AEGlassMaterial.instance )
{ {
if ( w.getBlock( x, y, z ).getRenderType() == this.getRenderType() ) if ( w.getBlock( x, y, z ).getRenderType() == this.getRenderType() )
return false; return false;
+2 -2
View File
@@ -3,20 +3,20 @@ package appeng.block.spatial;
import java.util.EnumSet; import java.util.EnumSet;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import appeng.block.AEBaseBlock; import appeng.block.AEBaseBlock;
import appeng.client.render.BaseBlockRender; import appeng.client.render.BaseBlockRender;
import appeng.client.render.blocks.RenderSpatialPylon; import appeng.client.render.blocks.RenderSpatialPylon;
import appeng.core.features.AEFeature; import appeng.core.features.AEFeature;
import appeng.helpers.AEGlassMaterial;
import appeng.tile.spatial.TileSpatialPylon; import appeng.tile.spatial.TileSpatialPylon;
public class BlockSpatialPylon extends AEBaseBlock public class BlockSpatialPylon extends AEBaseBlock
{ {
public BlockSpatialPylon() { public BlockSpatialPylon() {
super( BlockSpatialPylon.class, Material.glass ); super( BlockSpatialPylon.class, AEGlassMaterial.instance );
setfeature( EnumSet.of( AEFeature.SpatialIO ) ); setfeature( EnumSet.of( AEFeature.SpatialIO ) );
setTileEntiy( TileSpatialPylon.class ); setTileEntiy( TileSpatialPylon.class );
} }
+43
View File
@@ -7,6 +7,7 @@ import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
@@ -53,6 +54,9 @@ import appeng.helpers.InventoryAction;
import appeng.integration.IntegrationType; import appeng.integration.IntegrationType;
import appeng.integration.abstraction.INEI; import appeng.integration.abstraction.INEI;
import appeng.util.Platform; import appeng.util.Platform;
import com.google.common.base.Stopwatch;
import cpw.mods.fml.common.ObfuscationReflectionHelper; import cpw.mods.fml.common.ObfuscationReflectionHelper;
public abstract class AEBaseGui extends GuiContainer public abstract class AEBaseGui extends GuiContainer
@@ -169,6 +173,11 @@ public abstract class AEBaseGui extends GuiContainer
super.mouseClicked( xCoord, yCoord, btn ); super.mouseClicked( xCoord, yCoord, btn );
} }
boolean disableShiftClick = false;
Stopwatch dbl_clickTimer = Stopwatch.createStarted();
ItemStack dbl_whichItem;
Slot bl_clicked;
@Override @Override
protected void handleMouseClick(Slot slot, int slotIdx, int ctrlDown, int key) protected void handleMouseClick(Slot slot, int slotIdx, int ctrlDown, int key)
{ {
@@ -364,6 +373,40 @@ public abstract class AEBaseGui extends GuiContainer
return; return;
} }
if ( disableShiftClick == false && isShiftKeyDown() )
{
disableShiftClick = true;
if ( dbl_whichItem == null || bl_clicked != slot || dbl_clickTimer.elapsed( TimeUnit.MILLISECONDS ) > 150 )
{
// some simple double click logic.
bl_clicked = slot;
dbl_clickTimer = Stopwatch.createStarted();
if ( slot != null )
dbl_whichItem = slot.getHasStack() ? slot.getStack().copy() : null;
else
dbl_whichItem = null;
}
else if ( dbl_whichItem != null )
{
// a replica of the weird broken vanilla feature.
Iterator iterator = this.inventorySlots.inventorySlots.iterator();
while (iterator.hasNext())
{
Slot targetSlot = (Slot) iterator.next();
if ( targetSlot != null && targetSlot.canTakeStack( this.mc.thePlayer ) && targetSlot.getHasStack()
&& targetSlot.inventory == slot.inventory && Container.func_94527_a( targetSlot, dbl_whichItem, true ) )
{
this.handleMouseClick( targetSlot, targetSlot.slotNumber, ctrlDown, 1 );
}
}
}
disableShiftClick = false;
}
super.handleMouseClick( slot, slotIdx, ctrlDown, key ); super.handleMouseClick( slot, slotIdx, ctrlDown, key );
} }
@@ -108,7 +108,7 @@ public class GuiCraftConfirm extends AEBaseGui
private void updateCPUButtonText() private void updateCPUButtonText()
{ {
String btnTextText = GuiText.CraftingCPU.getLocal() + ": " + GuiText.Automatic; String btnTextText = GuiText.CraftingCPU.getLocal() + ": " + GuiText.Automatic.getLocal();
if ( ccc.selectedCpu >= 0 )// && ccc.selectedCpu < ccc.cpus.size() ) if ( ccc.selectedCpu >= 0 )// && ccc.selectedCpu < ccc.cpus.size() )
{ {
if ( ccc.myName.length() > 0 ) if ( ccc.myName.length() > 0 )
@@ -57,9 +57,9 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
protected void setCPU(ICraftingCPU c) protected void setCPU(ICraftingCPU c)
{ {
if ( c== monitor) if ( c == monitor )
return; return;
if ( monitor != null ) if ( monitor != null )
monitor.removeListener( this ); monitor.removeListener( this );
@@ -185,11 +185,14 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
} }
@Override @Override
public void postChange(IBaseMonitor<IAEItemStack> monitor, IAEItemStack change, BaseActionSource actionSource) public void postChange(IBaseMonitor<IAEItemStack> monitor, Iterable<IAEItemStack> change, BaseActionSource actionSource)
{ {
change = change.copy(); for (IAEItemStack is : change)
change.setStackSize( 1 ); {
list.add( change ); is = is.copy();
is.setStackSize( 1 );
list.add( is );
}
} }
@Override @Override
@@ -317,9 +317,10 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
} }
@Override @Override
public void postChange(IBaseMonitor<IAEItemStack> monitor, IAEItemStack change, BaseActionSource source) public void postChange(IBaseMonitor<IAEItemStack> monitor, Iterable<IAEItemStack> change, BaseActionSource source)
{ {
items.add( change ); for (IAEItemStack is : change)
items.add( is );
} }
@Override @Override
+4
View File
@@ -49,6 +49,8 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
public int storageBiomeID = -1; public int storageBiomeID = -1;
public int storageProviderID = -1; public int storageProviderID = -1;
public int formationPlaneEntityLimit = 128;
public float spawnChargedChance = 0.92f; public float spawnChargedChance = 0.92f;
public int quartzOresPerCluster = 4; public int quartzOresPerCluster = 4;
public int quartzOresClusterAmount = 15; public int quartzOresClusterAmount = 15;
@@ -253,6 +255,8 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
WirelessTerminalDrainMultiplier = get( "wireless", "WirelessTerminalDrainMultiplier", WirelessTerminalDrainMultiplier ).getDouble( WirelessTerminalDrainMultiplier = get( "wireless", "WirelessTerminalDrainMultiplier", WirelessTerminalDrainMultiplier ).getDouble(
WirelessTerminalDrainMultiplier ); WirelessTerminalDrainMultiplier );
formationPlaneEntityLimit = get( "automation", "formationPlaneEntityLimit", formationPlaneEntityLimit ).getInt( formationPlaneEntityLimit );
wireless_battery = get( "battery", "wireless", wireless_battery ).getInt( wireless_battery ); wireless_battery = get( "battery", "wireless", wireless_battery ).getInt( wireless_battery );
staff_battery = get( "battery", "staff", staff_battery ).getInt( staff_battery ); staff_battery = get( "battery", "staff", staff_battery ).getInt( staff_battery );
manipulator_battery = get( "battery", "manipulator", manipulator_battery ).getInt( manipulator_battery ); manipulator_battery = get( "battery", "manipulator", manipulator_battery ).getInt( manipulator_battery );
+2
View File
@@ -92,6 +92,7 @@ import appeng.core.localization.GuiText;
import appeng.core.localization.PlayerMessages; import appeng.core.localization.PlayerMessages;
import appeng.core.stats.PlayerStatsRegistration; import appeng.core.stats.PlayerStatsRegistration;
import appeng.debug.BlockChunkloader; import appeng.debug.BlockChunkloader;
import appeng.debug.BlockCubeGenerator;
import appeng.debug.BlockItemGen; import appeng.debug.BlockItemGen;
import appeng.debug.BlockPhantomNode; import appeng.debug.BlockPhantomNode;
import appeng.debug.ToolDebugCard; import appeng.debug.ToolDebugCard;
@@ -421,6 +422,7 @@ public class Registration
addFeature( BlockItemGen.class ); addFeature( BlockItemGen.class );
addFeature( BlockChunkloader.class ); addFeature( BlockChunkloader.class );
addFeature( BlockPhantomNode.class ); addFeature( BlockPhantomNode.class );
addFeature( BlockCubeGenerator.class );
} }
private AEItemDefinition addFeature(Class c, Object... Args) private AEItemDefinition addFeature(Class c, Object... Args)
+3 -3
View File
@@ -258,21 +258,21 @@ public class WorldSettings extends Configuration
File aeBaseFolder = new File( world.getPath() + File.separatorChar + "AE2" ); File aeBaseFolder = new File( world.getPath() + File.separatorChar + "AE2" );
if ( !aeBaseFolder.exists() || !aeBaseFolder.isDirectory() ) if ( !aeBaseFolder.exists() || !aeBaseFolder.isDirectory() )
if ( !aeBaseFolder.mkdir() ) if ( !aeBaseFolder.mkdir() || !aeBaseFolder.exists() )
{ {
throw new RuntimeException( "Failed to create " + aeBaseFolder.getAbsolutePath() ); throw new RuntimeException( "Failed to create " + aeBaseFolder.getAbsolutePath() );
} }
File compass = new File( aeBaseFolder, "compass" ); File compass = new File( aeBaseFolder, "compass" );
if ( !compass.exists() || !compass.isDirectory() ) if ( !compass.exists() || !compass.isDirectory() )
if ( !compass.mkdir() ) if ( !compass.mkdir() || !compass.exists() )
{ {
throw new RuntimeException( "Failed to create " + compass.getAbsolutePath() ); throw new RuntimeException( "Failed to create " + compass.getAbsolutePath() );
} }
File spawnData = new File( aeBaseFolder, "spawndata" ); File spawnData = new File( aeBaseFolder, "spawndata" );
if ( !spawnData.exists() || !spawnData.isDirectory() ) if ( !spawnData.exists() || !spawnData.isDirectory() )
if ( !spawnData.mkdir() ) if ( !spawnData.mkdir() || !spawnData.exists() )
{ {
throw new RuntimeException( "Failed to create " + spawnData.getAbsolutePath() ); throw new RuntimeException( "Failed to create " + spawnData.getAbsolutePath() );
} }
+1 -1
View File
@@ -54,7 +54,7 @@ public enum AEFeature
enableDisassemblyCrafting("Crafting"), MolecularAssembler("CraftingFeatures"), MeteoriteCompass("Tools"), Patterns("CraftingFeatures"), enableDisassemblyCrafting("Crafting"), MolecularAssembler("CraftingFeatures"), MeteoriteCompass("Tools"), Patterns("CraftingFeatures"),
ChunkLoggerTrace("Commands", false), Achievements("Misc"); ChunkLoggerTrace("Commands", false), LogSecurityAudits("Misc", false), Achievements("Misc");
String Category; String Category;
boolean visible = true; boolean visible = true;
@@ -65,7 +65,7 @@ public class BasicCellHandler implements ICellHandler
if ( handler instanceof CellInventoryHandler ) if ( handler instanceof CellInventoryHandler )
{ {
CellInventoryHandler ci = (CellInventoryHandler) handler; CellInventoryHandler ci = (CellInventoryHandler) handler;
return ci.getCellInv().getStatusForCell(); return ci.getStatusForCell();
} }
return 0; return 0;
} }
+3 -1
View File
@@ -48,7 +48,9 @@ public enum GuiText
InterfaceTerminalHint, Range, TransparentFacades, TransparentFacadesHint, InterfaceTerminalHint, Range, TransparentFacades, TransparentFacadesHint,
NoCraftingJobs, CPUs, FacadeCrafting, inWorldCraftingPresses, ChargedQuartzFind; NoCraftingJobs, CPUs, FacadeCrafting, inWorldCraftingPresses, ChargedQuartzFind,
Included, Excluded, Partitioned, Precise, Fuzzy;
String root; String root;
+38 -5
View File
@@ -29,7 +29,8 @@ public class CraftingTreeProcess
CraftingJob job; CraftingJob job;
long crafts = 0; long crafts = 0;
boolean damageable; boolean containerItems;
boolean limitQty;
boolean fullsimulation; boolean fullsimulation;
private long bytes = 0; private long bytes = 0;
@@ -70,14 +71,24 @@ public class CraftingTreeProcess
{ {
ItemStack g = part.getItemStack(); ItemStack g = part.getItemStack();
boolean isAnInput = false;
for (IAEItemStack a : is)
{
if ( g != null && a != null && a.equals( g ) )
isAnInput = true;
}
if ( isAnInput )
limitQty = true;
if ( g.getItem().hasContainerItem( g ) ) if ( g.getItem().hasContainerItem( g ) )
damageable = true; limitQty = containerItems = true;
} }
} }
boolean complicated = false; boolean complicated = false;
if ( damageable || complicated ) if ( containerItems || complicated )
{ {
for (int x = 0; x < list.length; x++) for (int x = 0; x < list.length; x++)
{ {
@@ -106,6 +117,28 @@ public class CraftingTreeProcess
} }
else else
{ {
IAEItemStack list[] = details.getInputs();
IAEItemStack[] is = details.getInputs();
for (int x = 0; x < list.length; x++)
{
IAEItemStack part = list[x];
if ( part != null )
{
ItemStack g = part.getItemStack();
boolean isAnInput = false;
for (IAEItemStack a : is)
{
if ( g != null && a != null && a.equals( g ) )
isAnInput = true;
}
if ( isAnInput )
limitQty = true;
}
}
for (IAEItemStack part : details.getCondencedInputs()) for (IAEItemStack part : details.getCondencedInputs())
{ {
nodes.put( new CraftingTreeNode( cc, job, part.copy(), this, -1, depth + 1 ), part.getStackSize() ); nodes.put( new CraftingTreeNode( cc, job, part.copy(), this, -1, depth + 1 ), part.getStackSize() );
@@ -120,7 +153,7 @@ public class CraftingTreeProcess
long getTimes(long remaining, long stackSize) long getTimes(long remaining, long stackSize)
{ {
if ( damageable || fullsimulation ) if ( limitQty || fullsimulation )
return 1; return 1;
return (remaining / stackSize) + (remaining % stackSize != 0 ? 1 : 0); return (remaining / stackSize) + (remaining % stackSize != 0 ? 1 : 0);
} }
@@ -190,7 +223,7 @@ public class CraftingTreeProcess
IAEItemStack item = entry.getKey().getStack( entry.getValue() ); IAEItemStack item = entry.getKey().getStack( entry.getValue() );
IAEItemStack stack = entry.getKey().request( inv, item.getStackSize() * i, src ); IAEItemStack stack = entry.getKey().request( inv, item.getStackSize() * i, src );
if ( damageable ) if ( containerItems )
{ {
ItemStack is = Platform.getContainerItem( stack.getItemStack() ); ItemStack is = Platform.getContainerItem( stack.getItemStack() );
IAEItemStack o = AEApi.instance().storage().createItemStack( is ); IAEItemStack o = AEApi.instance().storage().createItemStack( is );
+38
View File
@@ -0,0 +1,38 @@
package appeng.debug;
import java.util.EnumSet;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import appeng.block.AEBaseBlock;
import appeng.core.features.AEFeature;
public class BlockCubeGenerator extends AEBaseBlock
{
public BlockCubeGenerator() {
super( BlockCubeGenerator.class, Material.iron );
setfeature( EnumSet.of( AEFeature.UnsupportedDeveloperTools, AEFeature.Creative ) );
setTileEntiy( TileCubeGenerator.class );
}
@Override
public boolean onActivated(World w, int x, int y, int z,
EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
TileCubeGenerator tcg = getTileEntity(w, x, y, z);
if ( tcg != null )
tcg.click( player );
return true;
}
@Override
public void registerBlockIcons(IIconRegister iconRegistry)
{
registerNoIcons();
}
}
+107
View File
@@ -0,0 +1,107 @@
package appeng.debug;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentText;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.core.CommonHelper;
import appeng.tile.AEBaseTile;
import appeng.tile.events.AETileEventHandler;
import appeng.tile.events.TileEventType;
import appeng.util.Platform;
public class TileCubeGenerator extends AEBaseTile
{
int size = 3;
ItemStack is = null;
int countdown = 20 * 10;
EntityPlayer who;
class TCG extends AETileEventHandler {
public TCG() {
super(TileEventType.TICK);
}
@Override
public void Tick()
{
if ( is != null && Platform.isServer() )
{
countdown--;
if (countdown % 20 == 0 )
{
for ( EntityPlayer e : CommonHelper.proxy.getPlayers() )
{
e.addChatMessage(new ChatComponentText("Spawning in... "+( countdown / 20 )));
}
}
if ( countdown <= 0 )
spawn();
}
}
};
void spawn()
{
worldObj.setBlock( xCoord, yCoord, zCoord, Platform.air, 0, 3 );
Item i = is.getItem();
int side = ForgeDirection.UP.ordinal();
int half = (int) Math.floor( size / 2 );
for ( int y = 0; y < size; y++ )
{
for ( int x = -half; x < half; x++ )
{
for ( int z = -half; z < half; z++ )
{
i.onItemUse( is.copy(), who, worldObj, x+xCoord, y+yCoord-1, z+zCoord, side, 0.5f, 0.0f, 0.5f );
}
}
}
}
public TileCubeGenerator() {
addNewHandler( new TCG() );
}
public void click(EntityPlayer player)
{
if ( Platform.isServer() )
{
ItemStack hand = player.inventory.getCurrentItem();
who = player;
if ( hand == null )
{
is = null;
if ( player.isSneaking() )
size --;
else
size++;
if ( size < 3 )
size = 3;
if ( size > 64 )
size = 64;
player.addChatMessage( new ChatComponentText("Size: "+size) );
}
else
{
countdown = 20 * 10;
is = hand;
}
}
}
}
+3 -3
View File
@@ -9,11 +9,11 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
import appeng.api.implementations.items.IGrowableCrystal; import appeng.api.implementations.items.IGrowableCrystal;
import appeng.api.implementations.tiles.ICrystalGrowthAccelerator;
import appeng.client.EffectType; import appeng.client.EffectType;
import appeng.core.AEConfig; import appeng.core.AEConfig;
import appeng.core.CommonHelper; import appeng.core.CommonHelper;
import appeng.core.features.AEFeature; import appeng.core.features.AEFeature;
import appeng.tile.misc.TileQuartzGrowthAccelerator;
import appeng.util.Platform; import appeng.util.Platform;
final public class EntityGrowingCrystal extends EntityItem final public class EntityGrowingCrystal extends EntityItem
@@ -145,8 +145,8 @@ final public class EntityGrowingCrystal extends EntityItem
private boolean isAccel(int x, int y, int z) private boolean isAccel(int x, int y, int z)
{ {
TileEntity te = worldObj.getTileEntity( x, y, z ); TileEntity te = worldObj.getTileEntity( x, y, z );
if ( te instanceof TileQuartzGrowthAccelerator ) if ( te instanceof ICrystalGrowthAccelerator )
return ((TileQuartzGrowthAccelerator) te).isPowered(); return ((ICrystalGrowthAccelerator) te).isPowered();
return false; return false;
} }
+1 -1
View File
@@ -532,7 +532,7 @@ public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IReds
((TIInventoryTile) tile()).rebuildSlotMap(); ((TIInventoryTile) tile()).rebuildSlotMap();
if ( world() != null && world().blockExists( x(), y(), z() ) && !CableBusContainer.isLoading() ) if ( world() != null && world().blockExists( x(), y(), z() ) && !CableBusContainer.isLoading() )
world().notifyBlocksOfNeighborChange( x(), y(), z(), Platform.air ); Platform.notifyBlocksOfNeighbors(world(), x(), y(), z() );
} }
// @Override // @Override
+20
View File
@@ -0,0 +1,20 @@
package appeng.helpers;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
public class AEGlassMaterial extends Material
{
public AEGlassMaterial(MapColor p_i2116_1_) {
super( p_i2116_1_ );
}
public boolean isOpaque()
{
return false;
}
public static AEGlassMaterial instance = (new AEGlassMaterial( MapColor.airColor ));
}
+62 -6
View File
@@ -22,6 +22,9 @@ import uristqwerty.CraftGuide.api.StackInfo;
import uristqwerty.CraftGuide.api.StackInfoSource; import uristqwerty.CraftGuide.api.StackInfoSource;
import uristqwerty.gui_craftguide.texture.DynamicTexture; import uristqwerty.gui_craftguide.texture.DynamicTexture;
import uristqwerty.gui_craftguide.texture.TextureClip; import uristqwerty.gui_craftguide.texture.TextureClip;
import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RegistrationError;
import appeng.api.recipes.IIngredient;
import appeng.integration.IIntegrationModule; import appeng.integration.IIntegrationModule;
import appeng.recipes.game.ShapedRecipe; import appeng.recipes.game.ShapedRecipe;
import appeng.recipes.game.ShapelessRecipe; import appeng.recipes.game.ShapelessRecipe;
@@ -222,8 +225,21 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
if ( output[i] instanceof ItemStack[] ) if ( output[i] instanceof ItemStack[] )
output[i] = Arrays.asList( (ItemStack[]) output[i] ); output[i] = Arrays.asList( (ItemStack[]) output[i] );
// if ( output[i] instanceof List ) if ( output[i] instanceof IIngredient )
// output[i] = ((List) output[i]).get( 0 ); {
try
{
output[i] = toCG( ((IIngredient) output[i]).getItemStackSet() );
}
catch (RegistrationError e)
{
}
catch (MissingIngredientError e)
{
}
}
} }
output[9] = recipeOutput; output[9] = recipeOutput;
@@ -244,8 +260,21 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
if ( output[i] instanceof ItemStack[] ) if ( output[i] instanceof ItemStack[] )
output[i] = Arrays.asList( (ItemStack[]) output[i] ); output[i] = Arrays.asList( (ItemStack[]) output[i] );
// if ( output[i] instanceof List ) if ( output[i] instanceof IIngredient )
// output[i] = ((List) output[i]).get( 0 ); {
try
{
output[i] = toCG( ((IIngredient) output[i]).getItemStackSet() );
}
catch (RegistrationError e)
{
}
catch (MissingIngredientError e)
{
}
}
} }
} }
@@ -267,8 +296,21 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
if ( output[i] instanceof ItemStack[] ) if ( output[i] instanceof ItemStack[] )
output[i] = Arrays.asList( (ItemStack[]) output[i] ); output[i] = Arrays.asList( (ItemStack[]) output[i] );
// if ( output[i] instanceof List ) if ( output[i] instanceof IIngredient )
// output[i] = ((List) output[i]).get( 0 ); {
try
{
output[i] = toCG( ((IIngredient) output[i]).getItemStackSet() );
}
catch (RegistrationError e)
{
}
catch (MissingIngredientError e)
{
}
}
} }
} }
@@ -276,6 +318,20 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
return output; return output;
} }
private Object toCG(ItemStack[] itemStackSet)
{
List<ItemStack> list = Arrays.asList( itemStackSet );
for (int x = 0; x < list.size(); x++)
{
list.set( x, list.get( x ).copy() );
if ( list.get( x ).stackSize == 0 )
list.get( x ).stackSize = 1;
}
return list;
}
@Override @Override
public Object[] getCraftingRecipe(IRecipe recipe, boolean allowSmallGrid) public Object[] getCraftingRecipe(IRecipe recipe, boolean allowSmallGrid)
{ {
-1
View File
@@ -69,7 +69,6 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
public ItemCrystalSeed() { public ItemCrystalSeed() {
super( ItemCrystalSeed.class ); super( ItemCrystalSeed.class );
setHasSubtypes( true ); setHasSubtypes( true );
setMaxStackSize( 8 );
setfeature( EnumSet.of( AEFeature.Core ) ); setfeature( EnumSet.of( AEFeature.Core ) );
EntityRegistry.registerModEntity( EntityGrowingCrystal.class, EntityGrowingCrystal.class.getSimpleName(), EntityIds.get( EntityGrowingCrystal.class ), EntityRegistry.registerModEntity( EntityGrowingCrystal.class, EntityGrowingCrystal.class.getSimpleName(), EntityIds.get( EntityGrowingCrystal.class ),
+1 -1
View File
@@ -33,7 +33,7 @@ public class ItemPaintBall extends AEBaseItem
public String getExtraName(ItemStack is) public String getExtraName(ItemStack is)
{ {
return (is.getItemDamage() >= 20 ? GuiText.Lumen + " " : "") + getColor( is ); return (is.getItemDamage() >= 20 ? GuiText.Lumen.getLocal() + " " : "") + getColor( is );
} }
public AEColor getColor(ItemStack is) public AEColor getColor(ItemStack is)
+25 -14
View File
@@ -12,6 +12,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.config.FuzzyMode; import appeng.api.config.FuzzyMode;
import appeng.api.config.IncludeExclude;
import appeng.api.implementations.items.IItemGroup; import appeng.api.implementations.items.IItemGroup;
import appeng.api.implementations.items.IStorageCell; import appeng.api.implementations.items.IStorageCell;
import appeng.api.storage.ICellInventory; import appeng.api.storage.ICellInventory;
@@ -75,28 +76,38 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II
{ {
IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( i, null, StorageChannel.ITEMS ); IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( i, null, StorageChannel.ITEMS );
if ( cdi instanceof CellInventoryHandler ) if ( cdi instanceof ICellInventoryHandler )
{ {
ICellInventoryHandler CI = (ICellInventoryHandler) cdi;
ICellInventory cd = ((ICellInventoryHandler) cdi).getCellInv(); ICellInventory cd = ((ICellInventoryHandler) cdi).getCellInv();
if ( cd != null ) if (cd != null)
{ {
l.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + " " + cd.getTotalBytes() + " " + GuiText.BytesUsed.getLocal() ); l.add(cd.getUsedBytes() + " " + GuiText.Of.getLocal() + " "
l.add( cd.getStoredItemTypes() + " " + GuiText.Of.getLocal() + " " + cd.getTotalItemTypes() + " " + GuiText.Types.getLocal() ); + cd.getTotalBytes() + " "
/* + GuiText.BytesUsed.getLocal());
* if ( cd.isPreformatted() ) { String List = StatCollector.translateToLocal( cd.getListMode() ==
* ListMode.WHITELIST ? "AppEng.Gui.Whitelisted" : "AppEng.Gui.Blacklisted" ); if ( l.add(cd.getStoredItemTypes() + " " + GuiText.Of.getLocal()
* cd.isFuzzyPreformatted() ) l.add( StatCollector.translateToLocal( "Appeng.GuiITooltip.Partitioned" ) + " " + cd.getTotalItemTypes() + " "
* + " - " + List + " " + StatCollector.translateToLocal( "Appeng.GuiITooltip.Fuzzy" ) ); else l.add( + GuiText.Types.getLocal());
* StatCollector.translateToLocal( "Appeng.GuiITooltip.Partitioned" ) + " - " + List + " " +
* StatCollector.translateToLocal( "Appeng.GuiITooltip.Precise" ) ); } if ( CI.isPreformatted() )
*/ {
String List = (CI.getIncludeExcludeMode() == IncludeExclude.WHITELIST ? GuiText.Included
: GuiText.Excluded ).getLocal();
if ( CI.isFuzzy() )
l.add( GuiText.Partitioned.getLocal() + " - " + List + " " + GuiText.Fuzzy.getLocal() );
else
l.add( GuiText.Partitioned.getLocal() + " - " + List + " " + GuiText.Precise.getLocal() );
}
} }
} }
} }
@Override @Override
public int getBytes(ItemStack cellItem) public int getBytes(ItemStack cellItem) {
{
return totalBytes; return totalBytes;
} }
+1 -1
View File
@@ -32,7 +32,7 @@ public class ToolQuartzWrench extends AEBaseItem implements IAEWrench, IToolWren
if ( b != null && !player.isSneaking() && Platform.hasPermissions( new DimensionalCoord( world, x, y, z ), player ) ) if ( b != null && !player.isSneaking() && Platform.hasPermissions( new DimensionalCoord( world, x, y, z ), player ) )
{ {
if ( Platform.isClient() ) if ( Platform.isClient() )
return true; return !world.isRemote;
ForgeDirection mySide = ForgeDirection.getOrientation( side ); ForgeDirection mySide = ForgeDirection.getOrientation( side );
if ( b.rotateBlock( world, x, y, z, mySide ) ) if ( b.rotateBlock( world, x, y, z, mySide ) )
+11
View File
@@ -11,6 +11,9 @@ import appeng.api.networking.IGridNode;
import appeng.api.networking.events.MENetworkChannelsChanged; import appeng.api.networking.events.MENetworkChannelsChanged;
import appeng.api.networking.pathing.IPathingGrid; import appeng.api.networking.pathing.IPathingGrid;
import appeng.api.util.IReadOnlyCollection; import appeng.api.util.IReadOnlyCollection;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.features.AEFeature;
import appeng.me.pathfinding.IPathItem; import appeng.me.pathfinding.IPathItem;
import appeng.util.Platform; import appeng.util.Platform;
import appeng.util.ReadOnlyCollection; import appeng.util.ReadOnlyCollection;
@@ -34,7 +37,15 @@ public class GridConnection implements IGridConnection, IPathItem
GridNode b = (GridNode) bNode; GridNode b = (GridNode) bNode;
if ( Platform.securityCheck( a, b ) ) if ( Platform.securityCheck( a, b ) )
{
if ( AEConfig.instance.isFeatureEnabled( AEFeature.LogSecurityAudits ) )
{
AELog.info( "Audit Failed 1: " + a.getGridBlock().getLocation() );
AELog.info( "Audit Failed 2: " + b.getGridBlock().getLocation() );
}
throw new FailedConnection(); throw new FailedConnection();
}
if ( a == null || b == null ) if ( a == null || b == null )
throw new GridException( "Connection Forged Between null enties." ); throw new GridException( "Connection Forged Between null enties." );
+3 -6
View File
@@ -295,8 +295,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
emitableItems.clear(); emitableItems.clear();
// update the stuff that was in the list... // update the stuff that was in the list...
for (IAEItemStack out : oldItems.keySet()) sg.postAlterationOfStoredItems( StorageChannel.ITEMS, oldItems.keySet(), new BaseActionSource() );
sg.postAlterationOfStoredItems( StorageChannel.ITEMS, out, new BaseActionSource() );
// re-create list.. // re-create list..
for (ICraftingProvider cp : providers) for (ICraftingProvider cp : providers)
@@ -324,10 +323,9 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
// make them immutable // make them immutable
for (Entry<IAEItemStack, Set<ICraftingPatternDetails>> e : tmpCraft.entrySet()) for (Entry<IAEItemStack, Set<ICraftingPatternDetails>> e : tmpCraft.entrySet())
{
craftableItems.put( e.getKey(), ImmutableSortedSet.copyOf( e.getValue() ) ); craftableItems.put( e.getKey(), ImmutableSortedSet.copyOf( e.getValue() ) );
sg.postAlterationOfStoredItems( StorageChannel.ITEMS, e.getKey(), new BaseActionSource() );
} sg.postAlterationOfStoredItems( StorageChannel.ITEMS, craftableItems.keySet(), new BaseActionSource() );
} }
@Override @Override
@@ -438,7 +436,6 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
if ( cpu.isActive() && !cpu.isBusy() && cpu.getAvailableStorage() >= job.getByteTotal() ) if ( cpu.isActive() && !cpu.isBusy() && cpu.getAvailableStorage() >= job.getByteTotal() )
{ {
validCpusClusters.add( cpu ); validCpusClusters.add( cpu );
break;
} }
} }
+11 -2
View File
@@ -384,8 +384,17 @@ public class EnergyGridCache implements IEnergyGrid
tickInjectionPerTick = 0; tickInjectionPerTick = 0;
// power information. // power information.
double drained = extractAEPower( getIdlePowerUsage(), Actionable.MODULATE, PowerMultiplier.CONFIG ); boolean currentlyHasPower = false;
boolean currentlyHasPower = drained >= drainPerTick - 0.001;
if ( drainPerTick > 0.0001 )
{
double drained = extractAEPower( getIdlePowerUsage(), Actionable.MODULATE, PowerMultiplier.CONFIG );
currentlyHasPower = drained >= drainPerTick - 0.001;
}
else
{
currentlyHasPower = extractAEPower( 0.1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0;
}
// ticks since change.. // ticks since change..
if ( currentlyHasPower == hasPower ) if ( currentlyHasPower == hasPower )
+72 -36
View File
@@ -3,6 +3,7 @@ package appeng.me.cache;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.networking.IGrid; import appeng.api.networking.IGrid;
@@ -63,21 +64,66 @@ public class GridStorageCache implements IStorageGrid
fluidMonitor.onTick(); fluidMonitor.onTick();
} }
private class CellChangeTrackerRecord
{
final StorageChannel channel;
final int up_or_down;
final IItemList list;
final BaseActionSource src;
public CellChangeTrackerRecord(StorageChannel channel, int i, IMEInventoryHandler<? extends IAEStack> h, BaseActionSource actionSrc) {
this.channel = channel;
this.up_or_down = i;
this.src = actionSrc;
if ( channel == StorageChannel.ITEMS )
this.list = ((IMEInventoryHandler<IAEItemStack>) h).getAvailableItems( AEApi.instance().storage().createItemList() );
else if ( channel == StorageChannel.FLUIDS )
this.list = ((IMEInventoryHandler<IAEFluidStack>) h).getAvailableItems( AEApi.instance().storage().createFluidList() );
else
this.list = null;
}
public void applyChanges()
{
postChangesToNetwork( channel, up_or_down, list, src );
}
};
private class CellChangeTracker
{
List<CellChangeTrackerRecord> data = new LinkedList();
public void postChanges(StorageChannel channel, int i, IMEInventoryHandler<? extends IAEStack> h, BaseActionSource actionSrc)
{
data.add( new CellChangeTrackerRecord( channel, i, h, actionSrc ) );
}
public void applyChanges()
{
for (CellChangeTrackerRecord rec : data)
rec.applyChanges();
}
};
@Override @Override
public void registerCellProvider(ICellProvider provider) public void registerCellProvider(ICellProvider provider)
{ {
inactiveCellProviders.add( provider ); inactiveCellProviders.add( provider );
addCellProvider( provider ); addCellProvider( provider, new CellChangeTracker() ).applyChanges();
} }
@Override @Override
public void unregisterCellProvider(ICellProvider provider) public void unregisterCellProvider(ICellProvider provider)
{ {
removeCellProvider( provider ); removeCellProvider( provider, new CellChangeTracker() ).applyChanges();
inactiveCellProviders.remove( provider ); inactiveCellProviders.remove( provider );
} }
public void addCellProvider(ICellProvider cc) public CellChangeTracker addCellProvider(ICellProvider cc, CellChangeTracker tracker)
{ {
if ( inactiveCellProviders.contains( cc ) ) if ( inactiveCellProviders.contains( cc ) )
{ {
@@ -90,17 +136,19 @@ public class GridStorageCache implements IStorageGrid
for (IMEInventoryHandler<IAEItemStack> h : cc.getCellArray( StorageChannel.ITEMS )) for (IMEInventoryHandler<IAEItemStack> h : cc.getCellArray( StorageChannel.ITEMS ))
{ {
postChanges( StorageChannel.ITEMS, 1, h.getAvailableItems( AEApi.instance().storage().createItemList() ), actionSrc ); tracker.postChanges( StorageChannel.ITEMS, 1, h, actionSrc );
} }
for (IMEInventoryHandler<IAEFluidStack> h : cc.getCellArray( StorageChannel.FLUIDS )) for (IMEInventoryHandler<IAEFluidStack> h : cc.getCellArray( StorageChannel.FLUIDS ))
{ {
postChanges( StorageChannel.FLUIDS, 1, h.getAvailableItems( AEApi.instance().storage().createFluidList() ), actionSrc ); tracker.postChanges( StorageChannel.FLUIDS, 1, h, actionSrc );
} }
} }
return tracker;
} }
public void removeCellProvider(ICellProvider cc) public CellChangeTracker removeCellProvider(ICellProvider cc, CellChangeTracker tracker)
{ {
if ( activeCellProviders.contains( cc ) ) if ( activeCellProviders.contains( cc ) )
{ {
@@ -113,14 +161,16 @@ public class GridStorageCache implements IStorageGrid
for (IMEInventoryHandler<IAEItemStack> h : cc.getCellArray( StorageChannel.ITEMS )) for (IMEInventoryHandler<IAEItemStack> h : cc.getCellArray( StorageChannel.ITEMS ))
{ {
postChanges( StorageChannel.ITEMS, -1, h.getAvailableItems( AEApi.instance().storage().createItemList() ), actionSrc ); tracker.postChanges( StorageChannel.ITEMS, -1, h, actionSrc );
} }
for (IMEInventoryHandler<IAEFluidStack> h : cc.getCellArray( StorageChannel.FLUIDS )) for (IMEInventoryHandler<IAEFluidStack> h : cc.getCellArray( StorageChannel.FLUIDS ))
{ {
postChanges( StorageChannel.FLUIDS, -1, h.getAvailableItems( AEApi.instance().storage().createFluidList() ), actionSrc ); tracker.postChanges( StorageChannel.FLUIDS, -1, h, actionSrc );
} }
} }
return tracker;
} }
@MENetworkEventSubscribe @MENetworkEventSubscribe
@@ -133,6 +183,8 @@ public class GridStorageCache implements IStorageGrid
ll.addAll( inactiveCellProviders ); ll.addAll( inactiveCellProviders );
ll.addAll( activeCellProviders ); ll.addAll( activeCellProviders );
CellChangeTracker tracker = new CellChangeTracker();
for (ICellProvider cc : ll) for (ICellProvider cc : ll)
{ {
boolean Active = true; boolean Active = true;
@@ -147,13 +199,15 @@ public class GridStorageCache implements IStorageGrid
} }
if ( Active ) if ( Active )
addCellProvider( cc ); addCellProvider( cc, tracker );
else else
removeCellProvider( cc ); removeCellProvider( cc, tracker );
} }
itemMonitor.forceUpdate(); itemMonitor.forceUpdate();
fluidMonitor.forceUpdate(); fluidMonitor.forceUpdate();
tracker.applyChanges();
} }
@Override @Override
@@ -164,7 +218,7 @@ public class GridStorageCache implements IStorageGrid
ICellContainer cc = (ICellContainer) machine; ICellContainer cc = (ICellContainer) machine;
myGrid.postEvent( new MENetworkCellArrayUpdate() ); myGrid.postEvent( new MENetworkCellArrayUpdate() );
removeCellProvider( cc ); removeCellProvider( cc, new CellChangeTracker() ).applyChanges();
inactiveCellProviders.remove( cc ); inactiveCellProviders.remove( cc );
} }
@@ -189,7 +243,7 @@ public class GridStorageCache implements IStorageGrid
myGrid.postEvent( new MENetworkCellArrayUpdate() ); myGrid.postEvent( new MENetworkCellArrayUpdate() );
if ( node.isActive() ) if ( node.isActive() )
addCellProvider( cc ); addCellProvider( cc, new CellChangeTracker() ).applyChanges();
} }
if ( machine instanceof IStackWatcherHost ) if ( machine instanceof IStackWatcherHost )
@@ -227,33 +281,15 @@ public class GridStorageCache implements IStorageGrid
} }
} }
private void postChanges(StorageChannel chan, int up_or_down, IItemList availableItems, BaseActionSource src) private void postChangesToNetwork(StorageChannel chan, int up_or_down, IItemList availableItems, BaseActionSource src)
{ {
switch (chan) switch (chan)
{ {
case FLUIDS: case FLUIDS:
for (IAEFluidStack fs : ((IItemList<IAEFluidStack>) availableItems)) fluidMonitor.postChange( up_or_down > 0, (IItemList<IAEFluidStack>) availableItems, src );
{
if ( up_or_down > 0 )
fluidMonitor.postChange( fs, src );
else
{
fs.setStackSize( -fs.getStackSize() );
fluidMonitor.postChange( fs, src );
}
}
break; break;
case ITEMS: case ITEMS:
for (IAEItemStack fs : ((IItemList<IAEItemStack>) availableItems)) itemMonitor.postChange( up_or_down > 0, (IItemList<IAEItemStack>) availableItems, src );
{
if ( up_or_down > 0 )
itemMonitor.postChange( fs, src );
else
{
fs.setStackSize( -fs.getStackSize() );
itemMonitor.postChange( fs, src );
}
}
break; break;
default: default:
} }
@@ -274,12 +310,12 @@ public class GridStorageCache implements IStorageGrid
} }
@Override @Override
public void postAlterationOfStoredItems(StorageChannel chan, IAEStack input, BaseActionSource src) public void postAlterationOfStoredItems(StorageChannel chan, Iterable<? extends IAEStack> input, BaseActionSource src)
{ {
if ( chan == StorageChannel.ITEMS ) if ( chan == StorageChannel.ITEMS )
itemMonitor.postChange( (IAEItemStack) input, src ); itemMonitor.postChange( true, (Iterable<IAEItemStack>) input, src );
else if ( chan == StorageChannel.FLUIDS ) else if ( chan == StorageChannel.FLUIDS )
fluidMonitor.postChange( (IAEFluidStack) input, src ); fluidMonitor.postChange( true, (Iterable<IAEFluidStack>) input, src );
} }
@Override @Override
+32 -19
View File
@@ -47,9 +47,14 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
} }
final static public LinkedList depth = new LinkedList(); final static public LinkedList depth = new LinkedList();
@Override @Override
protected void postChange(T diff, BaseActionSource src) protected void postChangesToListeners(Iterable<T> changes, BaseActionSource src)
{
postChange( true, changes, src );
}
protected void postChange(boolean Add, Iterable<T> changes, BaseActionSource src)
{ {
if ( depth.contains( this ) ) if ( depth.contains( this ) )
return; return;
@@ -57,28 +62,36 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
depth.push( this ); depth.push( this );
sendEvent = true; sendEvent = true;
super.postChange( diff, src ); notifyListenersOfChange( changes, src );
if ( myGridCache.interestManager.containsKey( diff ) ) IItemList<T> myStorageList = getStorageList();
for (T changedItem : changes)
{ {
Set<ItemWatcher> list = myGridCache.interestManager.get( diff ); T diffrence = changedItem;
if ( !list.isEmpty() )
{
IItemList<T> myStorageList = getStorageList();
IAEStack fullStack = myStorageList.findPrecise( diff ); if ( !Add && changedItem != null )
if ( fullStack == null ) (diffrence = changedItem.copy()).setStackSize( -changedItem.getStackSize() );
if ( myGridCache.interestManager.containsKey( changedItem ) )
{
Set<ItemWatcher> list = myGridCache.interestManager.get( changedItem );
if ( !list.isEmpty() )
{ {
fullStack = diff.copy(); IAEStack fullStack = myStorageList.findPrecise( changedItem );
fullStack.setStackSize( 0 ); if ( fullStack == null )
{
fullStack = changedItem.copy();
fullStack.setStackSize( 0 );
}
myGridCache.interestManager.enableTransactions();
for (ItemWatcher iw : list)
iw.getHost().onStackChange( myStorageList, fullStack, diffrence, src, getChannel() );
myGridCache.interestManager.disableTransactions();
} }
myGridCache.interestManager.enableTransactions();
for (ItemWatcher iw : list)
iw.getHost().onStackChange( myStorageList, fullStack, diff, src, getChannel() );
myGridCache.interestManager.disableTransactions();
} }
} }
+48 -34
View File
@@ -3,6 +3,9 @@ package appeng.me.cache;
import java.util.HashMap; import java.util.HashMap;
import java.util.PriorityQueue; import java.util.PriorityQueue;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.util.ReportedException;
import appeng.api.networking.IGrid; import appeng.api.networking.IGrid;
import appeng.api.networking.IGridHost; import appeng.api.networking.IGridHost;
import appeng.api.networking.IGridNode; import appeng.api.networking.IGridNode;
@@ -52,45 +55,56 @@ public class TickManagerCache implements ITickManager
@Override @Override
public void onUpdateTick() public void onUpdateTick()
{ {
currentTick++; TickTracker tt = null;
while (!upcomingTicks.isEmpty()) try
{ {
TickTracker tt = upcomingTicks.peek(); currentTick++;
int diff = (int) (currentTick - tt.lastTick); while (!upcomingTicks.isEmpty())
if ( diff >= tt.current_rate )
{ {
// remove tt.. tt = upcomingTicks.peek();
upcomingTicks.poll(); int diff = (int) (currentTick - tt.lastTick);
TickRateModulation mod = tt.gt.tickingRequest( tt.node, diff ); if ( diff >= tt.current_rate )
switch (mod)
{ {
case FASTER: // remove tt..
tt.setRate( tt.current_rate - 2 ); upcomingTicks.poll();
break; TickRateModulation mod = tt.gt.tickingRequest( tt.node, diff );
case IDLE:
tt.setRate( tt.request.maxTickRate ); switch (mod)
break; {
case SAME: case FASTER:
break; tt.setRate( tt.current_rate - 2 );
case SLEEP: break;
sleepDevice( tt.node ); case IDLE:
break; tt.setRate( tt.request.maxTickRate );
case SLOWER: break;
tt.setRate( tt.current_rate + 1 ); case SAME:
break; break;
case URGENT: case SLEEP:
tt.setRate( 0 ); sleepDevice( tt.node );
break; break;
default: case SLOWER:
break; tt.setRate( tt.current_rate + 1 );
break;
case URGENT:
tt.setRate( 0 );
break;
default:
break;
}
if ( awake.containsKey( tt.node ) )
addToQueue( tt );
} }
else
if ( awake.containsKey( tt.node ) ) return; // done!
addToQueue( tt );
} }
else }
return; // done! catch( Throwable t )
{
CrashReport crashreport = CrashReport.makeCrashReport(t, "Ticking GridNode");
CrashReportCategory crashreportcategory = crashreport.makeCategory( tt.gt.getClass().getSimpleName() + " being ticked." );
tt.addEntityCrashInfo(crashreportcategory);
throw new ReportedException(crashreport);
} }
} }
+23
View File
@@ -1,9 +1,12 @@
package appeng.me.cache.helpers; package appeng.me.cache.helpers;
import net.minecraft.crash.CrashReportCategory;
import appeng.api.networking.IGridNode; import appeng.api.networking.IGridNode;
import appeng.api.networking.ticking.IGridTickable; import appeng.api.networking.ticking.IGridTickable;
import appeng.api.networking.ticking.TickingRequest; import appeng.api.networking.ticking.TickingRequest;
import appeng.api.util.DimensionalCoord;
import appeng.me.cache.TickManagerCache; import appeng.me.cache.TickManagerCache;
import appeng.parts.AEBasePart;
public class TickTracker implements Comparable<TickTracker> public class TickTracker implements Comparable<TickTracker>
{ {
@@ -50,4 +53,24 @@ public class TickTracker implements Comparable<TickTracker>
int ts_nextTick = (int) ((t.lastTick - host.getCurrentTick()) + t.current_rate); int ts_nextTick = (int) ((t.lastTick - host.getCurrentTick()) + t.current_rate);
return nextTick - ts_nextTick; return nextTick - ts_nextTick;
} }
public void addEntityCrashInfo(CrashReportCategory crashreportcategory)
{
if ( gt instanceof AEBasePart )
{
AEBasePart part = (AEBasePart)gt;
part.addEntityCrashInfo( crashreportcategory );
}
crashreportcategory.addCrashSection( "CurrentTickRate", current_rate );
crashreportcategory.addCrashSection( "MinTickRate", request.minTickRate );
crashreportcategory.addCrashSection( "MaxTickRate", request.maxTickRate );
crashreportcategory.addCrashSection( "MachineType", gt.getClass().getName() );
crashreportcategory.addCrashSection( "GridBlockType", node.getGridBlock().getClass().getName() );
crashreportcategory.addCrashSection( "ConnectedSides", node.getConnectedSides() );
DimensionalCoord dc = node.getGridBlock().getLocation();
if ( dc != null )
crashreportcategory.addCrashSection( "Location", dc );
}
}; };
@@ -54,6 +54,7 @@ import appeng.tile.crafting.TileCraftingTile;
import appeng.util.Platform; import appeng.util.Platform;
import appeng.util.item.AEItemStack; import appeng.util.item.AEItemStack;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
@@ -76,6 +77,8 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
boolean waiting = false; boolean waiting = false;
private boolean isComplete = true; private boolean isComplete = true;
int usedOps[] = new int[3];
Map<ICraftingPatternDetails, TaskProgress> tasks = new HashMap<ICraftingPatternDetails, TaskProgress>(); Map<ICraftingPatternDetails, TaskProgress> tasks = new HashMap<ICraftingPatternDetails, TaskProgress>();
IItemList<IAEItemStack> waitingFor = AEApi.instance().storage().createItemList(); IItemList<IAEItemStack> waitingFor = AEApi.instance().storage().createItemList();
@@ -106,16 +109,18 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
{ {
Iterator<Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object>> i = getListeners(); Iterator<Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object>> i = getListeners();
ImmutableList<IAEItemStack> single = null;
// protect integrity // protect integrity
if ( i.hasNext() ) if ( i.hasNext() )
diff = diff.copy(); single = ImmutableList.of( diff.copy() );
while (i.hasNext()) while (i.hasNext())
{ {
Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object> o = i.next(); Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object> o = i.next();
IMEMonitorHandlerReceiver<IAEItemStack> recv = o.getKey(); IMEMonitorHandlerReceiver<IAEItemStack> recv = o.getKey();
if ( recv.isValid( o.getValue() ) ) if ( recv.isValid( o.getValue() ) )
recv.postChange( null, diff, src ); recv.postChange( null, single, src );
else else
i.remove(); i.remove();
} }
@@ -492,8 +497,8 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
IItemList<IAEItemStack> list; IItemList<IAEItemStack> list;
getListOfItem( list = AEApi.instance().storage().createItemList(), CraftingItemList.ALL ); getListOfItem( list = AEApi.instance().storage().createItemList(), CraftingItemList.ALL );
for (IAEItemStack g : list) for (IAEItemStack is : list)
postChange( g, machineSrc ); postChange( is, machineSrc );
isComplete = true; isComplete = true;
myLastLink = null; myLastLink = null;
@@ -539,14 +544,21 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
if ( waiting || tasks.isEmpty() ) // nothing to do here... if ( waiting || tasks.isEmpty() ) // nothing to do here...
return; return;
remainingOperations = accelerator + 1; remainingOperations = accelerator + 1 - (usedOps[0] + usedOps[1] + usedOps[2]);
int started = remainingOperations;
do if ( remainingOperations > 0 )
{ {
didsomething = false; do
executeCrafting( eg, cc ); {
didsomething = false;
executeCrafting( eg, cc );
}
while (didsomething && remainingOperations > 0);
} }
while (didsomething && remainingOperations > 0); usedOps[2] = usedOps[1];
usedOps[1] = usedOps[0];
usedOps[0] = started - remainingOperations;
if ( remainingOperations > 0 && didsomething == false ) if ( remainingOperations > 0 && didsomething == false )
waiting = true; waiting = true;
@@ -1091,4 +1103,11 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
return wat != null && wat.getStackSize() > 0; return wat != null && wat.getStackSize() > 0;
} }
public void breakCluster()
{
TileCraftingTile t = getCore();
if ( t != null )
t.breakCluster();
}
} }
+27
View File
@@ -93,4 +93,31 @@ public class CellInventoryHandler extends MEInventoryHandler<IAEItemStack> imple
} }
} }
} }
public boolean isPreformatted()
{
return ! myPartitionList.isEmpty();
}
public boolean isFuzzy()
{
return myPartitionList instanceof FuzzyPriorityList;
}
@Override
public IncludeExclude getIncludeExcludeMode()
{
return myWhitelist;
}
public int getStatusForCell()
{
int val = getCellInv().getStatusForCell();
if ( val == 1 && isPreformatted() )
val = 2;
return val;
}
} }
+10 -4
View File
@@ -2,6 +2,7 @@ package appeng.me.storage;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.TreeMap; import java.util.TreeMap;
@@ -163,6 +164,8 @@ public class MEMonitorIInventory implements IMEInventory<IAEItemStack>, IMEMonit
{ {
boolean changed = false; boolean changed = false;
LinkedList<IAEItemStack> changes = new LinkedList<IAEItemStack>();
list.resetStatus(); list.resetStatus();
for (ItemSlot is : adaptor) for (ItemSlot is : adaptor)
{ {
@@ -178,12 +181,12 @@ public class MEMonitorIInventory implements IMEInventory<IAEItemStack>, IMEMonit
if ( old != null && old.aeStack != null ) if ( old != null && old.aeStack != null )
{ {
old.aeStack.setStackSize( -old.aeStack.getStackSize() ); old.aeStack.setStackSize( -old.aeStack.getStackSize() );
postDiffrence( old.aeStack ); changes.add( old.aeStack );
} }
if ( cis != null && cis.aeStack != null ) if ( cis != null && cis.aeStack != null )
{ {
postDiffrence( cis.aeStack ); changes.add( cis.aeStack );
list.add( cis.aeStack ); list.add( cis.aeStack );
} }
@@ -208,12 +211,15 @@ public class MEMonitorIInventory implements IMEInventory<IAEItemStack>, IMEMonit
IAEItemStack a = stack.copy(); IAEItemStack a = stack.copy();
a.setStackSize( diff ); a.setStackSize( diff );
postDiffrence( a ); changes.add( a );
changed = true; changed = true;
} }
} }
} }
if ( !changes.isEmpty() )
postDiffrence( changes );
return changed ? TickRateModulation.URGENT : TickRateModulation.SLOWER; return changed ? TickRateModulation.URGENT : TickRateModulation.SLOWER;
} }
@@ -228,7 +234,7 @@ public class MEMonitorIInventory implements IMEInventory<IAEItemStack>, IMEMonit
return !Platform.isSameItemPrecise( a, b ); return !Platform.isSameItemPrecise( a, b );
} }
private void postDiffrence(IAEItemStack a) private void postDiffrence(Iterable<IAEItemStack> a)
{ {
// AELog.info( a.getItemStack().getUnlocalizedName() + " @ " + a.getStackSize() ); // AELog.info( a.getItemStack().getUnlocalizedName() + " @ " + a.getStackSize() );
if ( a != null ) if ( a != null )
+1 -1
View File
@@ -90,7 +90,7 @@ public class MEMonitorPassthu<T extends IAEStack<T>> extends MEPassthru<T> imple
} }
@Override @Override
public void postChange(IBaseMonitor<T> monitor, T change, BaseActionSource source) public void postChange(IBaseMonitor<T> monitor, Iterable<T> change, BaseActionSource source)
{ {
Iterator<Entry<IMEMonitorHandlerReceiver<T>, Object>> i = listeners.entrySet().iterator(); Iterator<Entry<IMEMonitorHandlerReceiver<T>, Object>> i = listeners.entrySet().iterator();
while (i.hasNext()) while (i.hasNext())
+6
View File
@@ -9,6 +9,7 @@ import java.util.List;
import java.util.Random; import java.util.Random;
import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@@ -507,4 +508,9 @@ public class AEBasePart implements IPart, IGridProxyable, IActionHost, IUpgradea
{ {
return null; return null;
} }
public void addEntityCrashInfo(CrashReportCategory crashreportcategory)
{
crashreportcategory.addCrashSection( "Part Side", side );
}
} }
+3
View File
@@ -135,6 +135,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
updateDynamicRender(); updateDynamicRender();
updateConnections(); updateConnections();
markForUpdate(); markForUpdate();
markForSave();
partChanged(); partChanged();
} }
} }
@@ -267,6 +268,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
updateConnections(); updateConnections();
markForUpdate(); markForUpdate();
markForSave();
partChanged(); partChanged();
return ForgeDirection.UNKNOWN; return ForgeDirection.UNKNOWN;
} }
@@ -310,6 +312,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
updateDynamicRender(); updateDynamicRender();
updateConnections(); updateConnections();
markForUpdate(); markForUpdate();
markForSave();
partChanged(); partChanged();
return side; return side;
} }
+5 -2
View File
@@ -47,6 +47,7 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList; import appeng.api.storage.data.IItemList;
import appeng.api.util.IConfigManager; import appeng.api.util.IConfigManager;
import appeng.client.texture.CableBusTextures; import appeng.client.texture.CableBusTextures;
import appeng.core.AEConfig;
import appeng.core.sync.GuiBridge; import appeng.core.sync.GuiBridge;
import appeng.helpers.IPriorityHost; import appeng.helpers.IPriorityHost;
import appeng.me.GridAccessException; import appeng.me.GridAccessException;
@@ -111,6 +112,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
{ {
wasActive = currentActive; wasActive = currentActive;
updateHandler();// proxy.getGrid().postEvent( new MENetworkCellArrayUpdate() ); updateHandler();// proxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
getHost().markForUpdate();
} }
} }
@@ -122,6 +124,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
{ {
wasActive = currentActive; wasActive = currentActive;
updateHandler();// proxy.getGrid().postEvent( new MENetworkCellArrayUpdate() ); updateHandler();// proxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
getHost().markForUpdate();
} }
} }
@@ -242,7 +245,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
@Override @Override
public List<IMEInventoryHandler> getCellArray(StorageChannel channel) public List<IMEInventoryHandler> getCellArray(StorageChannel channel)
{ {
if ( proxy.isActive() ) if ( proxy.isActive() && channel == StorageChannel.ITEMS )
{ {
List<IMEInventoryHandler> Handler = new ArrayList( 1 ); List<IMEInventoryHandler> Handler = new ArrayList( 1 );
Handler.add( myHandler ); Handler.add( myHandler );
@@ -449,7 +452,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
for (List Z : c.entityLists) for (List Z : c.entityLists)
sum += Z.size(); sum += Z.size();
if ( sum < 32 ) if ( sum < AEConfig.instance.formationPlaneEntityLimit )
{ {
if ( type == Actionable.MODULATE ) if ( type == Actionable.MODULATE )
{ {
+3
View File
@@ -66,6 +66,9 @@ public class PartImportBus extends PartSharedItemBus implements IGridTickable, I
@Override @Override
public boolean canInsert(ItemStack stack) public boolean canInsert(ItemStack stack)
{ {
if ( stack == null || stack.getItem() == null )
return false;
IAEItemStack out = destination.injectItems( lastItemChecked = AEApi.instance().storage().createItemStack( stack ), Actionable.SIMULATE, mySrc ); IAEItemStack out = destination.injectItems( lastItemChecked = AEApi.instance().storage().createItemStack( stack ), Actionable.SIMULATE, mySrc );
if ( out == null ) if ( out == null )
return true; return true;
+1 -1
View File
@@ -257,7 +257,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
} }
@Override @Override
public void postChange(IBaseMonitor<IAEItemStack> monitor, IAEItemStack change, BaseActionSource actionSource) public void postChange(IBaseMonitor<IAEItemStack> monitor, Iterable<IAEItemStack> change, BaseActionSource actionSource)
{ {
updateReportingValue( (IMEMonitor<IAEItemStack>) monitor ); updateReportingValue( (IMEMonitor<IAEItemStack>) monitor );
} }
+1 -1
View File
@@ -218,7 +218,7 @@ public class PartCableAnchor implements IPart
@Override @Override
public boolean isLadder(EntityLivingBase entity) public boolean isLadder(EntityLivingBase entity)
{ {
return mySide.offsetY == 0 && entity.isCollidedHorizontally; return mySide.offsetY == 0 && ( entity.isCollidedHorizontally || ! entity.onGround );
} }
@Override @Override
+2
View File
@@ -7,6 +7,8 @@ public class PartInvertedToggleBus extends PartToggleBus
public PartInvertedToggleBus(ItemStack is) { public PartInvertedToggleBus(ItemStack is) {
super( PartInvertedToggleBus.class, is ); super( PartInvertedToggleBus.class, is );
proxy.setIdlePowerUsage( 0.0 );
outerProxy.setIdlePowerUsage( 0.0 );
proxy.setFlags(); proxy.setFlags();
outerProxy.setFlags(); outerProxy.setFlags();
} }
+1 -1
View File
@@ -450,7 +450,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
} }
@Override @Override
public void postChange(IBaseMonitor<IAEItemStack> monitor, IAEItemStack change, BaseActionSource source) public void postChange(IBaseMonitor<IAEItemStack> monitor, Iterable<IAEItemStack> change, BaseActionSource source)
{ {
try try
{ {
+3 -2
View File
@@ -601,9 +601,10 @@ public class PartCable extends AEBasePart implements IPartCable
rh.setTexture( getTexture( getCableColor() ) ); rh.setTexture( getTexture( getCableColor() ) );
} }
else if ( ghh != null && ccph != null && ghh.getCableConnectionType( of ) == AECableType.COVERED && ccph.getColor() != AEColor.Transparent ) else if ( ghh != null && ccph != null && ghh.getCableConnectionType( of ) == AECableType.COVERED && ccph.getColor() != AEColor.Transparent
&& ccph.getPart( of.getOpposite() ) == null )
rh.setTexture( getCoveredTexture( ccph.getColor() ) ); rh.setTexture( getCoveredTexture( ccph.getColor() ) );
else if ( ghh != null && ccph != null && ghh.getCableConnectionType( of ) == AECableType.SMART ) else if ( ghh != null && ccph != null && ghh.getCableConnectionType( of ) == AECableType.SMART && ccph.getPart( of.getOpposite() ) == null )
{ {
isSmart = true; isSmart = true;
rh.setTexture( getSmartTexture( getCableColor() ) ); rh.setTexture( getSmartTexture( getCableColor() ) );
+1
View File
@@ -320,6 +320,7 @@ public class PartDenseCable extends PartCable
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer) public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer)
{ {
renderCache = rh.useSimpliedRendering( x, y, z, this, renderCache );
rh.setTexture( getTexture( getCableColor() ) ); rh.setTexture( getTexture( getCableColor() ) );
EnumSet<ForgeDirection> sides = connections.clone(); EnumSet<ForgeDirection> sides = connections.clone();
+13 -5
View File
@@ -26,7 +26,8 @@ public class VersionChecker implements Runnable
private long delay = 0; private long delay = 0;
private boolean VersionChecker = true; private boolean VersionChecker = true;
public VersionChecker() { public VersionChecker()
{
long now = (new Date()).getTime(); long now = (new Date()).getTime();
delay = (1000 * 3600 * 5) - (now - AEConfig.instance.latestTimeStamp); delay = (1000 * 3600 * 5) - (now - AEConfig.instance.latestTimeStamp);
if ( delay < 1 ) if ( delay < 1 )
@@ -38,19 +39,21 @@ public class VersionChecker implements Runnable
{ {
try try
{ {
Thread.sleep( delay ); sleep( delay );
} }
catch (InterruptedException e) catch (InterruptedException e)
{ {
// :(
} }
while (true) while (true)
{ {
Thread.yield(); Thread.yield();
try try
{ {
String MCVersion = cpw.mods.fml.common.Loader.instance().getMCVersionString().replace( "Minecraft ", "" ); String MCVersion = cpw.mods.fml.common.Loader.instance().getMCVersionString().replace( "Minecraft ", "" );
URL url = new URL( "http://ae2.ae-mod.info/builds/latest.json?VersionMC=" + MCVersion + "&Channel=" + AEConfig.CHANNEL + "&CurrentVersion=" URL url = new URL( "http://feeds.ae-mod.info/latest.json?VersionMC=" + MCVersion + "&Channel=" + AEConfig.CHANNEL + "&CurrentVersion="
+ AEConfig.VERSION ); + AEConfig.VERSION );
URLConnection yc = url.openConnection(); URLConnection yc = url.openConnection();
@@ -105,13 +108,13 @@ public class VersionChecker implements Runnable
} }
} }
Thread.sleep( 1000 * 3600 * 4 ); sleep( 1000 * 3600 * 4 );
} }
catch (Exception e) catch (Exception e)
{ {
try try
{ {
Thread.sleep( 1000 * 3600 * 4 ); sleep( 1000 * 3600 * 4 );
} }
catch (InterruptedException e1) catch (InterruptedException e1)
{ {
@@ -120,4 +123,9 @@ public class VersionChecker implements Runnable
} }
} }
} }
private void sleep(long i) throws InterruptedException
{
Thread.sleep( i );
}
} }
+1
View File
@@ -322,6 +322,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
AELog.error( t ); AELog.error( t );
} }
stream.capacity( stream.readableBytes() );
data.setByteArray( "X", stream.array() ); data.setByteArray( "X", stream.array() );
return new S35PacketUpdateTileEntity( xCoord, yCoord, zCoord, 64, data ); return new S35PacketUpdateTileEntity( xCoord, yCoord, zCoord, 64, data );
} }
+3
View File
@@ -62,6 +62,9 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
public void updateStatus(CraftingCPUCluster c) public void updateStatus(CraftingCPUCluster c)
{ {
if ( clust != null && clust != c )
clust.breakCluster();
clust = c; clust = c;
updateMeta( true ); updateMeta( true );
} }
+22 -1
View File
@@ -375,6 +375,11 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IAEAppEn
if ( inv.getStackInSlot( 9 ) != null ) if ( inv.getStackInSlot( 9 ) != null )
{ {
pushOut( inv.getStackInSlot( 9 ) ); pushOut( inv.getStackInSlot( 9 ) );
// did it eject?
if ( inv.getStackInSlot( 9 ) == null )
markDirty();
ejectHeldItems(); ejectHeldItems();
updateSleepyness(); updateSleepyness();
progress = 0; progress = 0;
@@ -453,6 +458,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IAEAppEn
// ;P // ;P
} }
markDirty();
updateSleepyness(); updateSleepyness();
return isAwake ? TickRateModulation.IDLE : TickRateModulation.SLEEP; return isAwake ? TickRateModulation.IDLE : TickRateModulation.SLEEP;
} }
@@ -543,7 +549,22 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IAEAppEn
@MENetworkEventSubscribe @MENetworkEventSubscribe
public void onPowerEvent(MENetworkPowerStatusChange p) public void onPowerEvent(MENetworkPowerStatusChange p)
{ {
boolean newState = gridProxy.isActive(); updatePowerState();
}
private void updatePowerState()
{
boolean newState = false;
try
{
newState = gridProxy.isActive() && gridProxy.getEnergy().extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.0001;
}
catch (GridAccessException e)
{
}
if ( newState != isPowered ) if ( newState != isPowered )
{ {
isPowered = newState; isPowered = newState;
+2 -1
View File
@@ -7,6 +7,7 @@ import java.util.EnumSet;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.implementations.IPowerChannelState; import appeng.api.implementations.IPowerChannelState;
import appeng.api.implementations.tiles.ICrystalGrowthAccelerator;
import appeng.api.networking.events.MENetworkEventSubscribe; import appeng.api.networking.events.MENetworkEventSubscribe;
import appeng.api.networking.events.MENetworkPowerStatusChange; import appeng.api.networking.events.MENetworkPowerStatusChange;
import appeng.api.util.AECableType; import appeng.api.util.AECableType;
@@ -16,7 +17,7 @@ import appeng.tile.events.TileEventType;
import appeng.tile.grid.AENetworkTile; import appeng.tile.grid.AENetworkTile;
import appeng.util.Platform; import appeng.util.Platform;
public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPowerChannelState public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPowerChannelState, ICrystalGrowthAccelerator
{ {
public boolean hasPower = false; public boolean hasPower = false;
+1 -1
View File
@@ -294,7 +294,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
} }
@Override @Override
public void postChange(IBaseMonitor<T> monitor, T change, BaseActionSource source) public void postChange(IBaseMonitor<T> monitor, Iterable<T> change, BaseActionSource source)
{ {
if ( source == mySrc || (source instanceof PlayerSource && ((PlayerSource) source).via == TileChest.this) ) if ( source == mySrc || (source instanceof PlayerSource && ((PlayerSource) source).via == TileChest.this) )
{ {
+7
View File
@@ -163,6 +163,13 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
return inv; return inv;
} }
@Override
public void onReady()
{
super.onReady();
updateState();
}
@Override @Override
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added) public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added)
{ {
+28 -23
View File
@@ -7,6 +7,7 @@ import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.Set; import java.util.Set;
@@ -54,6 +55,7 @@ import net.minecraft.world.WorldServer;
import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.common.util.FakePlayerFactory; import net.minecraftforge.common.util.FakePlayerFactory;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.config.AccessRestriction; import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable; import appeng.api.config.Actionable;
@@ -1398,28 +1400,25 @@ public class Platform
public static void postChanges(IStorageGrid gs, ItemStack removed, ItemStack added, BaseActionSource src) public static void postChanges(IStorageGrid gs, ItemStack removed, ItemStack added, BaseActionSource src)
{ {
IItemList<IAEItemStack> itemChanges = AEApi.instance().storage().createItemList();
IItemList<IAEFluidStack> fluidChanges = AEApi.instance().storage().createFluidList();
if ( removed != null ) if ( removed != null )
{ {
IMEInventory<IAEItemStack> myItems = AEApi.instance().registries().cell().getCellInventory( removed, null, StorageChannel.ITEMS ); IMEInventory<IAEItemStack> myItems = AEApi.instance().registries().cell().getCellInventory( removed, null, StorageChannel.ITEMS );
if ( myItems != null ) if ( myItems != null )
{ {
for (IAEItemStack is : myItems.getAvailableItems( AEApi.instance().storage().createItemList() )) for (IAEItemStack is : myItems.getAvailableItems( itemChanges ))
{
is.setStackSize( -is.getStackSize() ); is.setStackSize( -is.getStackSize() );
gs.postAlterationOfStoredItems( StorageChannel.ITEMS, is, src );
}
} }
IMEInventory<IAEFluidStack> myFluids = AEApi.instance().registries().cell().getCellInventory( removed, null, StorageChannel.FLUIDS ); IMEInventory<IAEFluidStack> myFluids = AEApi.instance().registries().cell().getCellInventory( removed, null, StorageChannel.FLUIDS );
if ( myFluids != null ) if ( myFluids != null )
{ {
for (IAEFluidStack is : myFluids.getAvailableItems( AEApi.instance().storage().createFluidList() )) for (IAEFluidStack is : myFluids.getAvailableItems( fluidChanges ))
{
is.setStackSize( -is.getStackSize() ); is.setStackSize( -is.getStackSize() );
gs.postAlterationOfStoredItems( StorageChannel.FLUIDS, is, src );
}
} }
} }
@@ -1428,28 +1427,22 @@ public class Platform
IMEInventory<IAEItemStack> myItems = AEApi.instance().registries().cell().getCellInventory( added, null, StorageChannel.ITEMS ); IMEInventory<IAEItemStack> myItems = AEApi.instance().registries().cell().getCellInventory( added, null, StorageChannel.ITEMS );
if ( myItems != null ) if ( myItems != null )
{ myItems.getAvailableItems( itemChanges );
for (IAEItemStack is : myItems.getAvailableItems( AEApi.instance().storage().createItemList() ))
{
gs.postAlterationOfStoredItems( StorageChannel.ITEMS, is, src );
}
}
IMEInventory<IAEFluidStack> myFluids = AEApi.instance().registries().cell().getCellInventory( added, null, StorageChannel.FLUIDS ); IMEInventory<IAEFluidStack> myFluids = AEApi.instance().registries().cell().getCellInventory( added, null, StorageChannel.FLUIDS );
if ( myFluids != null ) if ( myFluids != null )
{ myFluids.getAvailableItems( fluidChanges );
for (IAEFluidStack is : myFluids.getAvailableItems( AEApi.instance().storage().createFluidList() ))
{
gs.postAlterationOfStoredItems( StorageChannel.FLUIDS, is, src );
}
}
} }
gs.postAlterationOfStoredItems( StorageChannel.ITEMS, itemChanges, src );
} }
static public <T extends IAEStack<T>> void postListChanges(IItemList<T> before, IItemList<T> after, IMEMonitorHandlerReceiver<T> meMonitorPassthu, static public <T extends IAEStack<T>> void postListChanges(IItemList<T> before, IItemList<T> after, IMEMonitorHandlerReceiver<T> meMonitorPassthu,
BaseActionSource source) BaseActionSource source)
{ {
LinkedList<T> changes = new LinkedList();
for (T is : before) for (T is : before)
is.setStackSize( -is.getStackSize() ); is.setStackSize( -is.getStackSize() );
@@ -1460,9 +1453,12 @@ public class Platform
{ {
if ( is.getStackSize() != 0 ) if ( is.getStackSize() != 0 )
{ {
meMonitorPassthu.postChange( null, is, source ); changes.add( is );
} }
} }
if ( !changes.isEmpty() )
meMonitorPassthu.postChange( null, changes, source );
} }
public static int generateTileHash(TileEntity target) public static int generateTileHash(TileEntity target)
@@ -1524,6 +1520,12 @@ public class Platform
boolean a_isSecure = isPowered( a.getGrid() ) && a.lastSecurityKey != -1; boolean a_isSecure = isPowered( a.getGrid() ) && a.lastSecurityKey != -1;
boolean b_isSecure = isPowered( b.getGrid() ) && b.lastSecurityKey != -1; boolean b_isSecure = isPowered( b.getGrid() ) && b.lastSecurityKey != -1;
if ( AEConfig.instance.isFeatureEnabled( AEFeature.LogSecurityAudits ) )
{
AELog.info( "Audit: " + a_isSecure + " : " + b_isSecure + " @ " + a.lastSecurityKey + " vs " + b.lastSecurityKey + " & " + a.playerID + " vs "
+ b.playerID );
}
// can't do that son... // can't do that son...
if ( a_isSecure && b_isSecure ) if ( a_isSecure && b_isSecure )
return true; return true;
@@ -1654,7 +1656,10 @@ public class Platform
} }
} }
if ( aitems != null && (ae_req.isOre() || providedTemplate.hasTagCompound() || providedTemplate.isItemStackDamageable()) ) boolean checkFuzzy = ae_req.isOre() || providedTemplate.getItemDamage() == OreDictionary.WILDCARD_VALUE || providedTemplate.hasTagCompound()
|| providedTemplate.isItemStackDamageable();
if ( aitems != null && checkFuzzy )
{ {
for (IAEItemStack x : aitems) for (IAEItemStack x : aitems)
{ {
@@ -1701,7 +1706,7 @@ public class Platform
} }
ItemStack ci = i.getContainerItem( stackInSlot.copy() ); ItemStack ci = i.getContainerItem( stackInSlot.copy() );
if ( ci.isItemStackDamageable() && ci.getItemDamage() == ci.getMaxDamage() ) if ( ci != null && ci.isItemStackDamageable() && ci.getItemDamage() == ci.getMaxDamage() )
ci = null; ci = null;
return ci; return ci;