Initial rv1 beta merge.
This commit is contained in:
@@ -42,6 +42,7 @@ import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.AEFeatureHandler;
|
||||
import appeng.core.features.IAEFeature;
|
||||
import appeng.core.features.ItemStackSrc;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
@@ -203,7 +204,9 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
|
||||
protected AEBaseBlock(Class<?> c, Material mat, String subname) {
|
||||
super( mat );
|
||||
|
||||
if ( mat == Material.glass )
|
||||
if ( mat == AEGlassMaterial.instance )
|
||||
setStepSound( Block.soundTypeGlass );
|
||||
else if ( mat == Material.glass )
|
||||
setStepSound( Block.soundTypeGlass );
|
||||
else if ( mat == Material.rock )
|
||||
setStepSound( Block.soundTypeStone );
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.particle.EffectRenderer;
|
||||
import net.minecraft.client.particle.EntityDiggingFX;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -39,6 +38,7 @@ import appeng.core.Api;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IFMP;
|
||||
import appeng.parts.ICableBusContainer;
|
||||
@@ -75,7 +75,7 @@ public class BlockCableBus extends AEBaseBlock implements IRedNetConnection
|
||||
}
|
||||
|
||||
public BlockCableBus() {
|
||||
super( BlockCableBus.class, Material.glass );
|
||||
super( BlockCableBus.class, AEGlassMaterial.instance );
|
||||
setfeature( EnumSet.of( AEFeature.Core ) );
|
||||
setLightOpacity( 0 );
|
||||
isFullSize = isOpaque = false;
|
||||
|
||||
@@ -2,16 +2,16 @@ package appeng.block.networking;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.tile.networking.TileCreativeEnergyCell;
|
||||
|
||||
public class BlockCreativeEnergyCell extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockCreativeEnergyCell() {
|
||||
super( BlockCreativeEnergyCell.class, Material.glass );
|
||||
super( BlockCreativeEnergyCell.class, AEGlassMaterial.instance );
|
||||
setfeature( EnumSet.of( AEFeature.Creative ) );
|
||||
setTileEntiy( TileCreativeEnergyCell.class );
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package appeng.block.networking;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -15,6 +14,7 @@ import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderBlockEnergyCube;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.tile.networking.TileEnergyCell;
|
||||
import appeng.util.Platform;
|
||||
|
||||
@@ -27,7 +27,7 @@ public class BlockEnergyCell extends AEBaseBlock
|
||||
}
|
||||
|
||||
public BlockEnergyCell(Class c) {
|
||||
super( c, Material.glass );
|
||||
super( c, AEGlassMaterial.instance );
|
||||
}
|
||||
|
||||
public BlockEnergyCell() {
|
||||
|
||||
@@ -4,7 +4,6 @@ import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
@@ -16,6 +15,7 @@ import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderBlockWireless;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.tile.networking.TileWireless;
|
||||
import appeng.util.Platform;
|
||||
@@ -24,7 +24,7 @@ public class BlockWireless extends AEBaseBlock implements ICustomCollision
|
||||
{
|
||||
|
||||
public BlockWireless() {
|
||||
super( BlockWireless.class, Material.glass );
|
||||
super( BlockWireless.class, AEGlassMaterial.instance );
|
||||
setfeature( EnumSet.of( AEFeature.Core, AEFeature.WirelessAccessTerminal ) );
|
||||
setTileEntiy( TileWireless.class );
|
||||
setLightOpacity( 0 );
|
||||
|
||||
@@ -6,7 +6,6 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
@@ -19,6 +18,7 @@ import appeng.client.render.blocks.RenderQNB;
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.tile.qnb.TileQuantumBridge;
|
||||
import appeng.util.Platform;
|
||||
@@ -29,7 +29,7 @@ public class BlockQuantumLinkChamber extends AEBaseBlock implements ICustomColli
|
||||
{
|
||||
|
||||
public BlockQuantumLinkChamber() {
|
||||
super( BlockQuantumLinkChamber.class, Material.glass );
|
||||
super( BlockQuantumLinkChamber.class, AEGlassMaterial.instance );
|
||||
setfeature( EnumSet.of( AEFeature.QuantumNetworkBridge ) );
|
||||
setTileEntiy( TileQuantumBridge.class );
|
||||
float shave = 2.0f / 16.0f;
|
||||
|
||||
@@ -8,6 +8,7 @@ import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderQuartzGlass;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -28,7 +29,8 @@ public class BlockQuartzGlass extends AEBaseBlock
|
||||
@Override
|
||||
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() )
|
||||
return false;
|
||||
|
||||
@@ -3,20 +3,20 @@ package appeng.block.spatial;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderSpatialPylon;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.tile.spatial.TileSpatialPylon;
|
||||
|
||||
public class BlockSpatialPylon extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockSpatialPylon() {
|
||||
super( BlockSpatialPylon.class, Material.glass );
|
||||
super( BlockSpatialPylon.class, AEGlassMaterial.instance );
|
||||
setfeature( EnumSet.of( AEFeature.SpatialIO ) );
|
||||
setTileEntiy( TileSpatialPylon.class );
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
@@ -53,6 +54,9 @@ import appeng.helpers.InventoryAction;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.INEI;
|
||||
import appeng.util.Platform;
|
||||
|
||||
import com.google.common.base.Stopwatch;
|
||||
|
||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||
|
||||
public abstract class AEBaseGui extends GuiContainer
|
||||
@@ -169,6 +173,11 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
super.mouseClicked( xCoord, yCoord, btn );
|
||||
}
|
||||
|
||||
boolean disableShiftClick = false;
|
||||
Stopwatch dbl_clickTimer = Stopwatch.createStarted();
|
||||
ItemStack dbl_whichItem;
|
||||
Slot bl_clicked;
|
||||
|
||||
@Override
|
||||
protected void handleMouseClick(Slot slot, int slotIdx, int ctrlDown, int key)
|
||||
{
|
||||
@@ -364,6 +373,40 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
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 );
|
||||
}
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ public class GuiCraftConfirm extends AEBaseGui
|
||||
|
||||
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.myName.length() > 0 )
|
||||
|
||||
@@ -57,9 +57,9 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
||||
|
||||
protected void setCPU(ICraftingCPU c)
|
||||
{
|
||||
if ( c== monitor)
|
||||
if ( c == monitor )
|
||||
return;
|
||||
|
||||
|
||||
if ( monitor != null )
|
||||
monitor.removeListener( this );
|
||||
|
||||
@@ -185,11 +185,14 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
||||
}
|
||||
|
||||
@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();
|
||||
change.setStackSize( 1 );
|
||||
list.add( change );
|
||||
for (IAEItemStack is : change)
|
||||
{
|
||||
is = is.copy();
|
||||
is.setStackSize( 1 );
|
||||
list.add( is );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -317,9 +317,10 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
@@ -49,6 +49,8 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
||||
public int storageBiomeID = -1;
|
||||
public int storageProviderID = -1;
|
||||
|
||||
public int formationPlaneEntityLimit = 128;
|
||||
|
||||
public float spawnChargedChance = 0.92f;
|
||||
public int quartzOresPerCluster = 4;
|
||||
public int quartzOresClusterAmount = 15;
|
||||
@@ -253,6 +255,8 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
||||
WirelessTerminalDrainMultiplier = get( "wireless", "WirelessTerminalDrainMultiplier", WirelessTerminalDrainMultiplier ).getDouble(
|
||||
WirelessTerminalDrainMultiplier );
|
||||
|
||||
formationPlaneEntityLimit = get( "automation", "formationPlaneEntityLimit", formationPlaneEntityLimit ).getInt( formationPlaneEntityLimit );
|
||||
|
||||
wireless_battery = get( "battery", "wireless", wireless_battery ).getInt( wireless_battery );
|
||||
staff_battery = get( "battery", "staff", staff_battery ).getInt( staff_battery );
|
||||
manipulator_battery = get( "battery", "manipulator", manipulator_battery ).getInt( manipulator_battery );
|
||||
|
||||
@@ -92,6 +92,7 @@ import appeng.core.localization.GuiText;
|
||||
import appeng.core.localization.PlayerMessages;
|
||||
import appeng.core.stats.PlayerStatsRegistration;
|
||||
import appeng.debug.BlockChunkloader;
|
||||
import appeng.debug.BlockCubeGenerator;
|
||||
import appeng.debug.BlockItemGen;
|
||||
import appeng.debug.BlockPhantomNode;
|
||||
import appeng.debug.ToolDebugCard;
|
||||
@@ -421,6 +422,7 @@ public class Registration
|
||||
addFeature( BlockItemGen.class );
|
||||
addFeature( BlockChunkloader.class );
|
||||
addFeature( BlockPhantomNode.class );
|
||||
addFeature( BlockCubeGenerator.class );
|
||||
}
|
||||
|
||||
private AEItemDefinition addFeature(Class c, Object... Args)
|
||||
|
||||
@@ -258,21 +258,21 @@ public class WorldSettings extends Configuration
|
||||
File aeBaseFolder = new File( world.getPath() + File.separatorChar + "AE2" );
|
||||
|
||||
if ( !aeBaseFolder.exists() || !aeBaseFolder.isDirectory() )
|
||||
if ( !aeBaseFolder.mkdir() )
|
||||
if ( !aeBaseFolder.mkdir() || !aeBaseFolder.exists() )
|
||||
{
|
||||
throw new RuntimeException( "Failed to create " + aeBaseFolder.getAbsolutePath() );
|
||||
}
|
||||
|
||||
File compass = new File( aeBaseFolder, "compass" );
|
||||
if ( !compass.exists() || !compass.isDirectory() )
|
||||
if ( !compass.mkdir() )
|
||||
if ( !compass.mkdir() || !compass.exists() )
|
||||
{
|
||||
throw new RuntimeException( "Failed to create " + compass.getAbsolutePath() );
|
||||
}
|
||||
|
||||
File spawnData = new File( aeBaseFolder, "spawndata" );
|
||||
if ( !spawnData.exists() || !spawnData.isDirectory() )
|
||||
if ( !spawnData.mkdir() )
|
||||
if ( !spawnData.mkdir() || !spawnData.exists() )
|
||||
{
|
||||
throw new RuntimeException( "Failed to create " + spawnData.getAbsolutePath() );
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public enum AEFeature
|
||||
|
||||
enableDisassemblyCrafting("Crafting"), MolecularAssembler("CraftingFeatures"), MeteoriteCompass("Tools"), Patterns("CraftingFeatures"),
|
||||
|
||||
ChunkLoggerTrace("Commands", false), Achievements("Misc");
|
||||
ChunkLoggerTrace("Commands", false), LogSecurityAudits("Misc", false), Achievements("Misc");
|
||||
|
||||
String Category;
|
||||
boolean visible = true;
|
||||
|
||||
@@ -65,7 +65,7 @@ public class BasicCellHandler implements ICellHandler
|
||||
if ( handler instanceof CellInventoryHandler )
|
||||
{
|
||||
CellInventoryHandler ci = (CellInventoryHandler) handler;
|
||||
return ci.getCellInv().getStatusForCell();
|
||||
return ci.getStatusForCell();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,9 @@ public enum GuiText
|
||||
|
||||
InterfaceTerminalHint, Range, TransparentFacades, TransparentFacadesHint,
|
||||
|
||||
NoCraftingJobs, CPUs, FacadeCrafting, inWorldCraftingPresses, ChargedQuartzFind;
|
||||
NoCraftingJobs, CPUs, FacadeCrafting, inWorldCraftingPresses, ChargedQuartzFind,
|
||||
|
||||
Included, Excluded, Partitioned, Precise, Fuzzy;
|
||||
|
||||
String root;
|
||||
|
||||
|
||||
@@ -29,7 +29,8 @@ public class CraftingTreeProcess
|
||||
CraftingJob job;
|
||||
|
||||
long crafts = 0;
|
||||
boolean damageable;
|
||||
boolean containerItems;
|
||||
boolean limitQty;
|
||||
boolean fullsimulation;
|
||||
|
||||
private long bytes = 0;
|
||||
@@ -70,14 +71,24 @@ public class CraftingTreeProcess
|
||||
{
|
||||
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 ) )
|
||||
damageable = true;
|
||||
limitQty = containerItems = true;
|
||||
}
|
||||
}
|
||||
|
||||
boolean complicated = false;
|
||||
|
||||
if ( damageable || complicated )
|
||||
if ( containerItems || complicated )
|
||||
{
|
||||
for (int x = 0; x < list.length; x++)
|
||||
{
|
||||
@@ -106,6 +117,28 @@ public class CraftingTreeProcess
|
||||
}
|
||||
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())
|
||||
{
|
||||
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)
|
||||
{
|
||||
if ( damageable || fullsimulation )
|
||||
if ( limitQty || fullsimulation )
|
||||
return 1;
|
||||
return (remaining / stackSize) + (remaining % stackSize != 0 ? 1 : 0);
|
||||
}
|
||||
@@ -190,7 +223,7 @@ public class CraftingTreeProcess
|
||||
IAEItemStack item = entry.getKey().getStack( entry.getValue() );
|
||||
IAEItemStack stack = entry.getKey().request( inv, item.getStackSize() * i, src );
|
||||
|
||||
if ( damageable )
|
||||
if ( containerItems )
|
||||
{
|
||||
ItemStack is = Platform.getContainerItem( stack.getItemStack() );
|
||||
IAEItemStack o = AEApi.instance().storage().createItemStack( is );
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,11 +9,11 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import appeng.api.implementations.items.IGrowableCrystal;
|
||||
import appeng.api.implementations.tiles.ICrystalGrowthAccelerator;
|
||||
import appeng.client.EffectType;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.misc.TileQuartzGrowthAccelerator;
|
||||
import appeng.util.Platform;
|
||||
|
||||
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)
|
||||
{
|
||||
TileEntity te = worldObj.getTileEntity( x, y, z );
|
||||
if ( te instanceof TileQuartzGrowthAccelerator )
|
||||
return ((TileQuartzGrowthAccelerator) te).isPowered();
|
||||
if ( te instanceof ICrystalGrowthAccelerator )
|
||||
return ((ICrystalGrowthAccelerator) te).isPowered();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -532,7 +532,7 @@ public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IReds
|
||||
((TIInventoryTile) tile()).rebuildSlotMap();
|
||||
|
||||
if ( world() != null && world().blockExists( x(), y(), z() ) && !CableBusContainer.isLoading() )
|
||||
world().notifyBlocksOfNeighborChange( x(), y(), z(), Platform.air );
|
||||
Platform.notifyBlocksOfNeighbors(world(), x(), y(), z() );
|
||||
}
|
||||
|
||||
// @Override
|
||||
|
||||
@@ -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 ));
|
||||
|
||||
}
|
||||
@@ -22,6 +22,9 @@ import uristqwerty.CraftGuide.api.StackInfo;
|
||||
import uristqwerty.CraftGuide.api.StackInfoSource;
|
||||
import uristqwerty.gui_craftguide.texture.DynamicTexture;
|
||||
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.recipes.game.ShapedRecipe;
|
||||
import appeng.recipes.game.ShapelessRecipe;
|
||||
@@ -222,8 +225,21 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
|
||||
if ( output[i] instanceof ItemStack[] )
|
||||
output[i] = Arrays.asList( (ItemStack[]) output[i] );
|
||||
|
||||
// if ( output[i] instanceof List )
|
||||
// output[i] = ((List) output[i]).get( 0 );
|
||||
if ( output[i] instanceof IIngredient )
|
||||
{
|
||||
try
|
||||
{
|
||||
output[i] = toCG( ((IIngredient) output[i]).getItemStackSet() );
|
||||
}
|
||||
catch (RegistrationError e)
|
||||
{
|
||||
|
||||
}
|
||||
catch (MissingIngredientError e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
output[9] = recipeOutput;
|
||||
@@ -244,8 +260,21 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
|
||||
if ( output[i] instanceof ItemStack[] )
|
||||
output[i] = Arrays.asList( (ItemStack[]) output[i] );
|
||||
|
||||
// if ( output[i] instanceof List )
|
||||
// output[i] = ((List) output[i]).get( 0 );
|
||||
if ( output[i] instanceof IIngredient )
|
||||
{
|
||||
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[] )
|
||||
output[i] = Arrays.asList( (ItemStack[]) output[i] );
|
||||
|
||||
// if ( output[i] instanceof List )
|
||||
// output[i] = ((List) output[i]).get( 0 );
|
||||
if ( output[i] instanceof IIngredient )
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
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
|
||||
public Object[] getCraftingRecipe(IRecipe recipe, boolean allowSmallGrid)
|
||||
{
|
||||
|
||||
@@ -69,7 +69,6 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
public ItemCrystalSeed() {
|
||||
super( ItemCrystalSeed.class );
|
||||
setHasSubtypes( true );
|
||||
setMaxStackSize( 8 );
|
||||
setfeature( EnumSet.of( AEFeature.Core ) );
|
||||
|
||||
EntityRegistry.registerModEntity( EntityGrowingCrystal.class, EntityGrowingCrystal.class.getSimpleName(), EntityIds.get( EntityGrowingCrystal.class ),
|
||||
|
||||
@@ -33,7 +33,7 @@ public class ItemPaintBall extends AEBaseItem
|
||||
|
||||
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)
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.IncludeExclude;
|
||||
import appeng.api.implementations.items.IItemGroup;
|
||||
import appeng.api.implementations.items.IStorageCell;
|
||||
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 );
|
||||
|
||||
if ( cdi instanceof CellInventoryHandler )
|
||||
if ( cdi instanceof ICellInventoryHandler )
|
||||
{
|
||||
ICellInventoryHandler CI = (ICellInventoryHandler) cdi;
|
||||
|
||||
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.getStoredItemTypes() + " " + GuiText.Of.getLocal() + " " + cd.getTotalItemTypes() + " " + GuiText.Types.getLocal() );
|
||||
/*
|
||||
* if ( cd.isPreformatted() ) { String List = StatCollector.translateToLocal( cd.getListMode() ==
|
||||
* ListMode.WHITELIST ? "AppEng.Gui.Whitelisted" : "AppEng.Gui.Blacklisted" ); if (
|
||||
* cd.isFuzzyPreformatted() ) l.add( StatCollector.translateToLocal( "Appeng.GuiITooltip.Partitioned" )
|
||||
* + " - " + List + " " + StatCollector.translateToLocal( "Appeng.GuiITooltip.Fuzzy" ) ); else l.add(
|
||||
* StatCollector.translateToLocal( "Appeng.GuiITooltip.Partitioned" ) + " - " + List + " " +
|
||||
* StatCollector.translateToLocal( "Appeng.GuiITooltip.Precise" ) ); }
|
||||
*/
|
||||
l.add(cd.getUsedBytes() + " " + GuiText.Of.getLocal() + " "
|
||||
+ cd.getTotalBytes() + " "
|
||||
+ GuiText.BytesUsed.getLocal());
|
||||
|
||||
l.add(cd.getStoredItemTypes() + " " + GuiText.Of.getLocal()
|
||||
+ " " + cd.getTotalItemTypes() + " "
|
||||
+ GuiText.Types.getLocal());
|
||||
|
||||
if ( 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
|
||||
public int getBytes(ItemStack cellItem)
|
||||
{
|
||||
public int getBytes(ItemStack cellItem) {
|
||||
return totalBytes;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 ( Platform.isClient() )
|
||||
return true;
|
||||
return !world.isRemote;
|
||||
|
||||
ForgeDirection mySide = ForgeDirection.getOrientation( side );
|
||||
if ( b.rotateBlock( world, x, y, z, mySide ) )
|
||||
|
||||
@@ -11,6 +11,9 @@ import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||
import appeng.api.networking.pathing.IPathingGrid;
|
||||
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.util.Platform;
|
||||
import appeng.util.ReadOnlyCollection;
|
||||
@@ -34,7 +37,15 @@ public class GridConnection implements IGridConnection, IPathItem
|
||||
GridNode b = (GridNode) bNode;
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
if ( a == null || b == null )
|
||||
throw new GridException( "Connection Forged Between null enties." );
|
||||
|
||||
Vendored
+3
-6
@@ -295,8 +295,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||
emitableItems.clear();
|
||||
|
||||
// update the stuff that was in the list...
|
||||
for (IAEItemStack out : oldItems.keySet())
|
||||
sg.postAlterationOfStoredItems( StorageChannel.ITEMS, out, new BaseActionSource() );
|
||||
sg.postAlterationOfStoredItems( StorageChannel.ITEMS, oldItems.keySet(), new BaseActionSource() );
|
||||
|
||||
// re-create list..
|
||||
for (ICraftingProvider cp : providers)
|
||||
@@ -324,10 +323,9 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||
|
||||
// make them immutable
|
||||
for (Entry<IAEItemStack, Set<ICraftingPatternDetails>> e : tmpCraft.entrySet())
|
||||
{
|
||||
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
|
||||
@@ -438,7 +436,6 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||
if ( cpu.isActive() && !cpu.isBusy() && cpu.getAvailableStorage() >= job.getByteTotal() )
|
||||
{
|
||||
validCpusClusters.add( cpu );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+11
-2
@@ -384,8 +384,17 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
tickInjectionPerTick = 0;
|
||||
|
||||
// power information.
|
||||
double drained = extractAEPower( getIdlePowerUsage(), Actionable.MODULATE, PowerMultiplier.CONFIG );
|
||||
boolean currentlyHasPower = drained >= drainPerTick - 0.001;
|
||||
boolean currentlyHasPower = false;
|
||||
|
||||
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..
|
||||
if ( currentlyHasPower == hasPower )
|
||||
|
||||
Vendored
+72
-36
@@ -3,6 +3,7 @@ package appeng.me.cache;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.networking.IGrid;
|
||||
@@ -63,21 +64,66 @@ public class GridStorageCache implements IStorageGrid
|
||||
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
|
||||
public void registerCellProvider(ICellProvider provider)
|
||||
{
|
||||
inactiveCellProviders.add( provider );
|
||||
addCellProvider( provider );
|
||||
addCellProvider( provider, new CellChangeTracker() ).applyChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterCellProvider(ICellProvider provider)
|
||||
{
|
||||
removeCellProvider( provider );
|
||||
removeCellProvider( provider, new CellChangeTracker() ).applyChanges();
|
||||
inactiveCellProviders.remove( provider );
|
||||
}
|
||||
|
||||
public void addCellProvider(ICellProvider cc)
|
||||
public CellChangeTracker addCellProvider(ICellProvider cc, CellChangeTracker tracker)
|
||||
{
|
||||
if ( inactiveCellProviders.contains( cc ) )
|
||||
{
|
||||
@@ -90,17 +136,19 @@ public class GridStorageCache implements IStorageGrid
|
||||
|
||||
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 ))
|
||||
{
|
||||
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 ) )
|
||||
{
|
||||
@@ -113,14 +161,16 @@ public class GridStorageCache implements IStorageGrid
|
||||
|
||||
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 ))
|
||||
{
|
||||
postChanges( StorageChannel.FLUIDS, -1, h.getAvailableItems( AEApi.instance().storage().createFluidList() ), actionSrc );
|
||||
tracker.postChanges( StorageChannel.FLUIDS, -1, h, actionSrc );
|
||||
}
|
||||
}
|
||||
|
||||
return tracker;
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
@@ -133,6 +183,8 @@ public class GridStorageCache implements IStorageGrid
|
||||
ll.addAll( inactiveCellProviders );
|
||||
ll.addAll( activeCellProviders );
|
||||
|
||||
CellChangeTracker tracker = new CellChangeTracker();
|
||||
|
||||
for (ICellProvider cc : ll)
|
||||
{
|
||||
boolean Active = true;
|
||||
@@ -147,13 +199,15 @@ public class GridStorageCache implements IStorageGrid
|
||||
}
|
||||
|
||||
if ( Active )
|
||||
addCellProvider( cc );
|
||||
addCellProvider( cc, tracker );
|
||||
else
|
||||
removeCellProvider( cc );
|
||||
removeCellProvider( cc, tracker );
|
||||
}
|
||||
|
||||
itemMonitor.forceUpdate();
|
||||
fluidMonitor.forceUpdate();
|
||||
|
||||
tracker.applyChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -164,7 +218,7 @@ public class GridStorageCache implements IStorageGrid
|
||||
ICellContainer cc = (ICellContainer) machine;
|
||||
|
||||
myGrid.postEvent( new MENetworkCellArrayUpdate() );
|
||||
removeCellProvider( cc );
|
||||
removeCellProvider( cc, new CellChangeTracker() ).applyChanges();
|
||||
inactiveCellProviders.remove( cc );
|
||||
}
|
||||
|
||||
@@ -189,7 +243,7 @@ public class GridStorageCache implements IStorageGrid
|
||||
|
||||
myGrid.postEvent( new MENetworkCellArrayUpdate() );
|
||||
if ( node.isActive() )
|
||||
addCellProvider( cc );
|
||||
addCellProvider( cc, new CellChangeTracker() ).applyChanges();
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
case FLUIDS:
|
||||
for (IAEFluidStack fs : ((IItemList<IAEFluidStack>) availableItems))
|
||||
{
|
||||
if ( up_or_down > 0 )
|
||||
fluidMonitor.postChange( fs, src );
|
||||
else
|
||||
{
|
||||
fs.setStackSize( -fs.getStackSize() );
|
||||
fluidMonitor.postChange( fs, src );
|
||||
}
|
||||
}
|
||||
fluidMonitor.postChange( up_or_down > 0, (IItemList<IAEFluidStack>) availableItems, src );
|
||||
break;
|
||||
case ITEMS:
|
||||
for (IAEItemStack fs : ((IItemList<IAEItemStack>) availableItems))
|
||||
{
|
||||
if ( up_or_down > 0 )
|
||||
itemMonitor.postChange( fs, src );
|
||||
else
|
||||
{
|
||||
fs.setStackSize( -fs.getStackSize() );
|
||||
itemMonitor.postChange( fs, src );
|
||||
}
|
||||
}
|
||||
itemMonitor.postChange( up_or_down > 0, (IItemList<IAEItemStack>) availableItems, src );
|
||||
break;
|
||||
default:
|
||||
}
|
||||
@@ -274,12 +310,12 @@ public class GridStorageCache implements IStorageGrid
|
||||
}
|
||||
|
||||
@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 )
|
||||
itemMonitor.postChange( (IAEItemStack) input, src );
|
||||
itemMonitor.postChange( true, (Iterable<IAEItemStack>) input, src );
|
||||
else if ( chan == StorageChannel.FLUIDS )
|
||||
fluidMonitor.postChange( (IAEFluidStack) input, src );
|
||||
fluidMonitor.postChange( true, (Iterable<IAEFluidStack>) input, src );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Vendored
+32
-19
@@ -47,9 +47,14 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
|
||||
}
|
||||
|
||||
final static public LinkedList depth = new LinkedList();
|
||||
|
||||
|
||||
@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 ) )
|
||||
return;
|
||||
@@ -57,28 +62,36 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
|
||||
depth.push( this );
|
||||
|
||||
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 );
|
||||
if ( !list.isEmpty() )
|
||||
{
|
||||
IItemList<T> myStorageList = getStorageList();
|
||||
T diffrence = changedItem;
|
||||
|
||||
IAEStack fullStack = myStorageList.findPrecise( diff );
|
||||
if ( fullStack == null )
|
||||
if ( !Add && changedItem != 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();
|
||||
fullStack.setStackSize( 0 );
|
||||
IAEStack fullStack = myStorageList.findPrecise( changedItem );
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+48
-34
@@ -3,6 +3,9 @@ package appeng.me.cache;
|
||||
import java.util.HashMap;
|
||||
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.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
@@ -52,45 +55,56 @@ public class TickManagerCache implements ITickManager
|
||||
@Override
|
||||
public void onUpdateTick()
|
||||
{
|
||||
currentTick++;
|
||||
while (!upcomingTicks.isEmpty())
|
||||
TickTracker tt = null;
|
||||
try
|
||||
{
|
||||
TickTracker tt = upcomingTicks.peek();
|
||||
int diff = (int) (currentTick - tt.lastTick);
|
||||
if ( diff >= tt.current_rate )
|
||||
currentTick++;
|
||||
while (!upcomingTicks.isEmpty())
|
||||
{
|
||||
// remove tt..
|
||||
upcomingTicks.poll();
|
||||
TickRateModulation mod = tt.gt.tickingRequest( tt.node, diff );
|
||||
|
||||
switch (mod)
|
||||
tt = upcomingTicks.peek();
|
||||
int diff = (int) (currentTick - tt.lastTick);
|
||||
if ( diff >= tt.current_rate )
|
||||
{
|
||||
case FASTER:
|
||||
tt.setRate( tt.current_rate - 2 );
|
||||
break;
|
||||
case IDLE:
|
||||
tt.setRate( tt.request.maxTickRate );
|
||||
break;
|
||||
case SAME:
|
||||
break;
|
||||
case SLEEP:
|
||||
sleepDevice( tt.node );
|
||||
break;
|
||||
case SLOWER:
|
||||
tt.setRate( tt.current_rate + 1 );
|
||||
break;
|
||||
case URGENT:
|
||||
tt.setRate( 0 );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
// remove tt..
|
||||
upcomingTicks.poll();
|
||||
TickRateModulation mod = tt.gt.tickingRequest( tt.node, diff );
|
||||
|
||||
switch (mod)
|
||||
{
|
||||
case FASTER:
|
||||
tt.setRate( tt.current_rate - 2 );
|
||||
break;
|
||||
case IDLE:
|
||||
tt.setRate( tt.request.maxTickRate );
|
||||
break;
|
||||
case SAME:
|
||||
break;
|
||||
case SLEEP:
|
||||
sleepDevice( tt.node );
|
||||
break;
|
||||
case SLOWER:
|
||||
tt.setRate( tt.current_rate + 1 );
|
||||
break;
|
||||
case URGENT:
|
||||
tt.setRate( 0 );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if ( awake.containsKey( tt.node ) )
|
||||
addToQueue( tt );
|
||||
}
|
||||
|
||||
if ( awake.containsKey( tt.node ) )
|
||||
addToQueue( tt );
|
||||
else
|
||||
return; // done!
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+23
@@ -1,9 +1,12 @@
|
||||
package appeng.me.cache.helpers;
|
||||
|
||||
import net.minecraft.crash.CrashReportCategory;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.ticking.IGridTickable;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.me.cache.TickManagerCache;
|
||||
import appeng.parts.AEBasePart;
|
||||
|
||||
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);
|
||||
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.item.AEItemStack;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
@@ -76,6 +77,8 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
|
||||
boolean waiting = false;
|
||||
private boolean isComplete = true;
|
||||
int usedOps[] = new int[3];
|
||||
|
||||
Map<ICraftingPatternDetails, TaskProgress> tasks = new HashMap<ICraftingPatternDetails, TaskProgress>();
|
||||
IItemList<IAEItemStack> waitingFor = AEApi.instance().storage().createItemList();
|
||||
|
||||
@@ -106,16 +109,18 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
{
|
||||
Iterator<Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object>> i = getListeners();
|
||||
|
||||
ImmutableList<IAEItemStack> single = null;
|
||||
|
||||
// protect integrity
|
||||
if ( i.hasNext() )
|
||||
diff = diff.copy();
|
||||
single = ImmutableList.of( diff.copy() );
|
||||
|
||||
while (i.hasNext())
|
||||
{
|
||||
Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object> o = i.next();
|
||||
IMEMonitorHandlerReceiver<IAEItemStack> recv = o.getKey();
|
||||
if ( recv.isValid( o.getValue() ) )
|
||||
recv.postChange( null, diff, src );
|
||||
recv.postChange( null, single, src );
|
||||
else
|
||||
i.remove();
|
||||
}
|
||||
@@ -492,8 +497,8 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
|
||||
IItemList<IAEItemStack> list;
|
||||
getListOfItem( list = AEApi.instance().storage().createItemList(), CraftingItemList.ALL );
|
||||
for (IAEItemStack g : list)
|
||||
postChange( g, machineSrc );
|
||||
for (IAEItemStack is : list)
|
||||
postChange( is, machineSrc );
|
||||
|
||||
isComplete = true;
|
||||
myLastLink = null;
|
||||
@@ -539,14 +544,21 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
if ( waiting || tasks.isEmpty() ) // nothing to do here...
|
||||
return;
|
||||
|
||||
remainingOperations = accelerator + 1;
|
||||
remainingOperations = accelerator + 1 - (usedOps[0] + usedOps[1] + usedOps[2]);
|
||||
int started = remainingOperations;
|
||||
|
||||
do
|
||||
if ( remainingOperations > 0 )
|
||||
{
|
||||
didsomething = false;
|
||||
executeCrafting( eg, cc );
|
||||
do
|
||||
{
|
||||
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 )
|
||||
waiting = true;
|
||||
@@ -1091,4 +1103,11 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
return wat != null && wat.getStackSize() > 0;
|
||||
}
|
||||
|
||||
public void breakCluster()
|
||||
{
|
||||
TileCraftingTile t = getCore();
|
||||
if ( t != null )
|
||||
t.breakCluster();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package appeng.me.storage;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.TreeMap;
|
||||
|
||||
@@ -163,6 +164,8 @@ public class MEMonitorIInventory implements IMEInventory<IAEItemStack>, IMEMonit
|
||||
{
|
||||
boolean changed = false;
|
||||
|
||||
LinkedList<IAEItemStack> changes = new LinkedList<IAEItemStack>();
|
||||
|
||||
list.resetStatus();
|
||||
for (ItemSlot is : adaptor)
|
||||
{
|
||||
@@ -178,12 +181,12 @@ public class MEMonitorIInventory implements IMEInventory<IAEItemStack>, IMEMonit
|
||||
if ( old != null && old.aeStack != null )
|
||||
{
|
||||
old.aeStack.setStackSize( -old.aeStack.getStackSize() );
|
||||
postDiffrence( old.aeStack );
|
||||
changes.add( old.aeStack );
|
||||
}
|
||||
|
||||
if ( cis != null && cis.aeStack != null )
|
||||
{
|
||||
postDiffrence( cis.aeStack );
|
||||
changes.add( cis.aeStack );
|
||||
list.add( cis.aeStack );
|
||||
}
|
||||
|
||||
@@ -208,12 +211,15 @@ public class MEMonitorIInventory implements IMEInventory<IAEItemStack>, IMEMonit
|
||||
|
||||
IAEItemStack a = stack.copy();
|
||||
a.setStackSize( diff );
|
||||
postDiffrence( a );
|
||||
changes.add( a );
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !changes.isEmpty() )
|
||||
postDiffrence( changes );
|
||||
|
||||
return changed ? TickRateModulation.URGENT : TickRateModulation.SLOWER;
|
||||
}
|
||||
|
||||
@@ -228,7 +234,7 @@ public class MEMonitorIInventory implements IMEInventory<IAEItemStack>, IMEMonit
|
||||
return !Platform.isSameItemPrecise( a, b );
|
||||
}
|
||||
|
||||
private void postDiffrence(IAEItemStack a)
|
||||
private void postDiffrence(Iterable<IAEItemStack> a)
|
||||
{
|
||||
// AELog.info( a.getItemStack().getUnlocalizedName() + " @ " + a.getStackSize() );
|
||||
if ( a != null )
|
||||
|
||||
@@ -90,7 +90,7 @@ public class MEMonitorPassthu<T extends IAEStack<T>> extends MEPassthru<T> imple
|
||||
}
|
||||
|
||||
@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();
|
||||
while (i.hasNext())
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.crash.CrashReportCategory;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -507,4 +508,9 @@ public class AEBasePart implements IPart, IGridProxyable, IActionHost, IUpgradea
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addEntityCrashInfo(CrashReportCategory crashreportcategory)
|
||||
{
|
||||
crashreportcategory.addCrashSection( "Part Side", side );
|
||||
}
|
||||
}
|
||||
@@ -135,6 +135,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
updateDynamicRender();
|
||||
updateConnections();
|
||||
markForUpdate();
|
||||
markForSave();
|
||||
partChanged();
|
||||
}
|
||||
}
|
||||
@@ -267,6 +268,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
|
||||
updateConnections();
|
||||
markForUpdate();
|
||||
markForSave();
|
||||
partChanged();
|
||||
return ForgeDirection.UNKNOWN;
|
||||
}
|
||||
@@ -310,6 +312,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
updateDynamicRender();
|
||||
updateConnections();
|
||||
markForUpdate();
|
||||
markForSave();
|
||||
partChanged();
|
||||
return side;
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.client.texture.CableBusTextures;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.helpers.IPriorityHost;
|
||||
import appeng.me.GridAccessException;
|
||||
@@ -111,6 +112,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
{
|
||||
wasActive = currentActive;
|
||||
updateHandler();// proxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
|
||||
getHost().markForUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,6 +124,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
{
|
||||
wasActive = currentActive;
|
||||
updateHandler();// proxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
|
||||
getHost().markForUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +245,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
@Override
|
||||
public List<IMEInventoryHandler> getCellArray(StorageChannel channel)
|
||||
{
|
||||
if ( proxy.isActive() )
|
||||
if ( proxy.isActive() && channel == StorageChannel.ITEMS )
|
||||
{
|
||||
List<IMEInventoryHandler> Handler = new ArrayList( 1 );
|
||||
Handler.add( myHandler );
|
||||
@@ -449,7 +452,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
for (List Z : c.entityLists)
|
||||
sum += Z.size();
|
||||
|
||||
if ( sum < 32 )
|
||||
if ( sum < AEConfig.instance.formationPlaneEntityLimit )
|
||||
{
|
||||
if ( type == Actionable.MODULATE )
|
||||
{
|
||||
|
||||
@@ -66,6 +66,9 @@ public class PartImportBus extends PartSharedItemBus implements IGridTickable, I
|
||||
@Override
|
||||
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 );
|
||||
if ( out == null )
|
||||
return true;
|
||||
|
||||
@@ -257,7 +257,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
}
|
||||
|
||||
@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 );
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ public class PartCableAnchor implements IPart
|
||||
@Override
|
||||
public boolean isLadder(EntityLivingBase entity)
|
||||
{
|
||||
return mySide.offsetY == 0 && entity.isCollidedHorizontally;
|
||||
return mySide.offsetY == 0 && ( entity.isCollidedHorizontally || ! entity.onGround );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,6 +7,8 @@ public class PartInvertedToggleBus extends PartToggleBus
|
||||
|
||||
public PartInvertedToggleBus(ItemStack is) {
|
||||
super( PartInvertedToggleBus.class, is );
|
||||
proxy.setIdlePowerUsage( 0.0 );
|
||||
outerProxy.setIdlePowerUsage( 0.0 );
|
||||
proxy.setFlags();
|
||||
outerProxy.setFlags();
|
||||
}
|
||||
|
||||
@@ -450,7 +450,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postChange(IBaseMonitor<IAEItemStack> monitor, IAEItemStack change, BaseActionSource source)
|
||||
public void postChange(IBaseMonitor<IAEItemStack> monitor, Iterable<IAEItemStack> change, BaseActionSource source)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -601,9 +601,10 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
|
||||
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() ) );
|
||||
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;
|
||||
rh.setTexture( getSmartTexture( getCableColor() ) );
|
||||
|
||||
@@ -320,6 +320,7 @@ public class PartDenseCable extends PartCable
|
||||
@SideOnly(Side.CLIENT)
|
||||
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() ) );
|
||||
|
||||
EnumSet<ForgeDirection> sides = connections.clone();
|
||||
|
||||
@@ -26,7 +26,8 @@ public class VersionChecker implements Runnable
|
||||
private long delay = 0;
|
||||
private boolean VersionChecker = true;
|
||||
|
||||
public VersionChecker() {
|
||||
public VersionChecker()
|
||||
{
|
||||
long now = (new Date()).getTime();
|
||||
delay = (1000 * 3600 * 5) - (now - AEConfig.instance.latestTimeStamp);
|
||||
if ( delay < 1 )
|
||||
@@ -38,19 +39,21 @@ public class VersionChecker implements Runnable
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread.sleep( delay );
|
||||
sleep( delay );
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
// :(
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
Thread.yield();
|
||||
|
||||
try
|
||||
{
|
||||
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 );
|
||||
|
||||
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)
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread.sleep( 1000 * 3600 * 4 );
|
||||
sleep( 1000 * 3600 * 4 );
|
||||
}
|
||||
catch (InterruptedException e1)
|
||||
{
|
||||
@@ -120,4 +123,9 @@ public class VersionChecker implements Runnable
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void sleep(long i) throws InterruptedException
|
||||
{
|
||||
Thread.sleep( i );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,6 +322,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
AELog.error( t );
|
||||
}
|
||||
|
||||
stream.capacity( stream.readableBytes() );
|
||||
data.setByteArray( "X", stream.array() );
|
||||
return new S35PacketUpdateTileEntity( xCoord, yCoord, zCoord, 64, data );
|
||||
}
|
||||
|
||||
@@ -62,6 +62,9 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
||||
|
||||
public void updateStatus(CraftingCPUCluster c)
|
||||
{
|
||||
if ( clust != null && clust != c )
|
||||
clust.breakCluster();
|
||||
|
||||
clust = c;
|
||||
updateMeta( true );
|
||||
}
|
||||
|
||||
@@ -375,6 +375,11 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IAEAppEn
|
||||
if ( inv.getStackInSlot( 9 ) != null )
|
||||
{
|
||||
pushOut( inv.getStackInSlot( 9 ) );
|
||||
|
||||
// did it eject?
|
||||
if ( inv.getStackInSlot( 9 ) == null )
|
||||
markDirty();
|
||||
|
||||
ejectHeldItems();
|
||||
updateSleepyness();
|
||||
progress = 0;
|
||||
@@ -453,6 +458,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IAEAppEn
|
||||
// ;P
|
||||
}
|
||||
|
||||
markDirty();
|
||||
updateSleepyness();
|
||||
return isAwake ? TickRateModulation.IDLE : TickRateModulation.SLEEP;
|
||||
}
|
||||
@@ -543,7 +549,22 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IAEAppEn
|
||||
@MENetworkEventSubscribe
|
||||
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 )
|
||||
{
|
||||
isPowered = newState;
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.EnumSet;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.implementations.IPowerChannelState;
|
||||
import appeng.api.implementations.tiles.ICrystalGrowthAccelerator;
|
||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||
import appeng.api.util.AECableType;
|
||||
@@ -16,7 +17,7 @@ import appeng.tile.events.TileEventType;
|
||||
import appeng.tile.grid.AENetworkTile;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPowerChannelState
|
||||
public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPowerChannelState, ICrystalGrowthAccelerator
|
||||
{
|
||||
|
||||
public boolean hasPower = false;
|
||||
|
||||
@@ -294,7 +294,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
||||
}
|
||||
|
||||
@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) )
|
||||
{
|
||||
|
||||
@@ -163,6 +163,13 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
|
||||
return inv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReady()
|
||||
{
|
||||
super.onReady();
|
||||
updateState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added)
|
||||
{
|
||||
|
||||
+28
-23
@@ -7,6 +7,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
@@ -54,6 +55,7 @@ import net.minecraft.world.WorldServer;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
@@ -1398,28 +1400,25 @@ public class Platform
|
||||
|
||||
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 )
|
||||
{
|
||||
IMEInventory<IAEItemStack> myItems = AEApi.instance().registries().cell().getCellInventory( removed, null, StorageChannel.ITEMS );
|
||||
|
||||
if ( myItems != null )
|
||||
{
|
||||
for (IAEItemStack is : myItems.getAvailableItems( AEApi.instance().storage().createItemList() ))
|
||||
{
|
||||
for (IAEItemStack is : myItems.getAvailableItems( itemChanges ))
|
||||
is.setStackSize( -is.getStackSize() );
|
||||
gs.postAlterationOfStoredItems( StorageChannel.ITEMS, is, src );
|
||||
}
|
||||
}
|
||||
|
||||
IMEInventory<IAEFluidStack> myFluids = AEApi.instance().registries().cell().getCellInventory( removed, null, StorageChannel.FLUIDS );
|
||||
|
||||
if ( myFluids != null )
|
||||
{
|
||||
for (IAEFluidStack is : myFluids.getAvailableItems( AEApi.instance().storage().createFluidList() ))
|
||||
{
|
||||
for (IAEFluidStack is : myFluids.getAvailableItems( fluidChanges ))
|
||||
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 );
|
||||
|
||||
if ( myItems != null )
|
||||
{
|
||||
for (IAEItemStack is : myItems.getAvailableItems( AEApi.instance().storage().createItemList() ))
|
||||
{
|
||||
gs.postAlterationOfStoredItems( StorageChannel.ITEMS, is, src );
|
||||
}
|
||||
}
|
||||
myItems.getAvailableItems( itemChanges );
|
||||
|
||||
IMEInventory<IAEFluidStack> myFluids = AEApi.instance().registries().cell().getCellInventory( added, null, StorageChannel.FLUIDS );
|
||||
|
||||
if ( myFluids != null )
|
||||
{
|
||||
for (IAEFluidStack is : myFluids.getAvailableItems( AEApi.instance().storage().createFluidList() ))
|
||||
{
|
||||
gs.postAlterationOfStoredItems( StorageChannel.FLUIDS, is, src );
|
||||
}
|
||||
}
|
||||
myFluids.getAvailableItems( fluidChanges );
|
||||
}
|
||||
|
||||
gs.postAlterationOfStoredItems( StorageChannel.ITEMS, itemChanges, src );
|
||||
}
|
||||
|
||||
static public <T extends IAEStack<T>> void postListChanges(IItemList<T> before, IItemList<T> after, IMEMonitorHandlerReceiver<T> meMonitorPassthu,
|
||||
BaseActionSource source)
|
||||
{
|
||||
LinkedList<T> changes = new LinkedList();
|
||||
|
||||
for (T is : before)
|
||||
is.setStackSize( -is.getStackSize() );
|
||||
|
||||
@@ -1460,9 +1453,12 @@ public class Platform
|
||||
{
|
||||
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)
|
||||
@@ -1524,6 +1520,12 @@ public class Platform
|
||||
boolean a_isSecure = isPowered( a.getGrid() ) && a.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...
|
||||
if ( a_isSecure && b_isSecure )
|
||||
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)
|
||||
{
|
||||
@@ -1701,7 +1706,7 @@ public class Platform
|
||||
}
|
||||
|
||||
ItemStack ci = i.getContainerItem( stackInSlot.copy() );
|
||||
if ( ci.isItemStackDamageable() && ci.getItemDamage() == ci.getMaxDamage() )
|
||||
if ( ci != null && ci.isItemStackDamageable() && ci.getItemDamage() == ci.getMaxDamage() )
|
||||
ci = null;
|
||||
|
||||
return ci;
|
||||
|
||||
Reference in New Issue
Block a user