Compare commits

...

29 Commits

Author SHA1 Message Date
thatsIch 3675f154d1 Merge pull request #993 from Mazdallier/patch-1
Update fr_FR.lang
2015-03-09 15:05:21 +01:00
Yves 5e5be0e192 Update fr_FR.lang 2015-03-09 13:46:12 +01:00
yueh cdf949a557 Merge pull request #991 from thatsIch/b-972-level-emitter-tooltip
Fixes #972 Tooltip now corresponds to the actual behaviour
2015-03-09 13:00:03 +01:00
yueh 4c5aeac39f Merge pull request #952 from yueh/update-dependency-versions
Updated Forge and other dependencies
2015-03-09 12:59:52 +01:00
yueh a5f58bb22f Merge pull request #829 from yueh/fix-improve-orehelper-performance
Improved OreHelper performance
2015-03-09 12:59:38 +01:00
thatsIch dddfd6dbaf Fixes #972 Tooltip now corresponds to the actual behaviour 2015-03-09 10:07:13 +01:00
yueh 311939c63c Merge pull request #973 from yueh/feature-improve-security-audit-log
Some further improvements to the security audit
2015-03-07 16:37:59 +01:00
yueh d8a3556bc3 Merge pull request #983 from yueh/fix-982
Removes creating a ItemStack with a full NBT copy
2015-03-07 16:35:56 +01:00
yueh 57e84c3039 Removes creating a ItemStack with a full NBT copy
There is no need to create a full copy just to fetch the already available
stacksize. It still respects the maximum stacksize of Integer.MAX_VALUE as they copy is doing.

Fixes #982
2015-03-07 15:45:59 +01:00
yueh 1bcf7f9d52 Some further improvements to the security audit 2015-03-05 14:53:10 +01:00
yueh 2746002eb1 Merge pull request #949 from yueh/feature-optional-colored-crafting-status
Added an option to disable the colored crafting status
2015-02-28 18:50:11 +01:00
yueh ee6a3def22 Merge pull request #956 from yueh/feature-improve-security-audit-log
Added some more information to the security audit
2015-02-28 18:49:53 +01:00
yueh 0b15c56037 Added some more information to the security audit 2015-02-28 17:22:17 +01:00
yueh 39c26a72e2 Updated Forge and other dependencies 2015-02-27 23:11:44 +01:00
yueh d2f62ef98c Merge pull request #940 from bakaxyf/patch-1
Update zh_CN.lang
2015-02-27 15:20:40 +01:00
yueh 6476a519bb Added an option to disable the colored crafting status 2015-02-27 13:43:08 +01:00
yueh b8e2d73aa0 Merge pull request #824 from Eearslya/request-817
Added feature request #817
2015-02-27 12:36:02 +01:00
yueh 5a2b35ccd0 Merge pull request #855 from yueh/fix-cable-renderer
Fixes cable render crash and covered cables render as smart.
2015-02-27 11:07:40 +01:00
yueh 16218e46ec Merge pull request #926 from yueh/fix-910
Fixes #910, report the correct hitbox to fmp
2015-02-27 11:07:10 +01:00
yueh 27b692823c Merge pull request #947 from yueh/fix-943
Fixes #943 readded callable for simultaneous block breaking
2015-02-27 11:06:59 +01:00
yueh 68aaec16bc Improved OreHelper performance 2015-02-27 00:17:33 +01:00
yueh ec8d393403 Fixes #943 readded callable for simultaneous block breaking 2015-02-26 22:41:51 +01:00
bakaxyf 27e5eac6aa Update zh_CN.lang 2015-02-25 13:47:40 +08:00
yueh ca521935e0 Fixes #910, report the correct hitbox to fmp 2015-02-22 12:42:39 +01:00
yueh f60798129c Fixes cable render crash and covered cables render as smart. 2015-02-06 19:39:08 +01:00
AlgorithmX2 3e90f354c5 Updated Texture / Model License to be specific. 2015-02-03 10:01:48 -06:00
yueh a27ed6d9ba Merge pull request #840 from yueh/remove-trailing-whitespace
remove trailing whitespaces
2015-02-03 12:05:17 +01:00
yueh b18addbf37 remove trailing whitespaces 2015-02-03 12:04:13 +01:00
Eearslya 3fa501d726 Added feature request #817
Crafting CPU GUI now shows a yellow background on items being crafted, and a yellow background on scheduled items.
2015-02-02 06:37:17 -08:00
315 changed files with 2291 additions and 2167 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ Applied Energistics 2 API is (c) 2013 - 2014 AlgorithmX2 and licensed under MIT.
Applied Energistics 2 is (c) 2013 - 2014 AlgorithmX2 and licensed under LGPL v3. Applied Energistics 2 is (c) 2013 - 2014 AlgorithmX2 and licensed under LGPL v3.
See the LICENSE.txt for details or go to http://www.gnu.org/licenses/lgpl-3.0.txt for more information. See the LICENSE.txt for details or go to http://www.gnu.org/licenses/lgpl-3.0.txt for more information.
Textures and Models are licensed under Creative Commons 3. Textures and Models are licensed under [Creative Commons, Attribution-NonCommercial-ShareAlike 3.0]( https://creativecommons.org/licenses/by-nc-sa/3.0/).
## Downloads ## Downloads
+6 -6
View File
@@ -8,17 +8,17 @@ archivesBaseName=appliedenergistics2
# Versions # # Versions #
######################################################### #########################################################
minecraft_version=1.7.10 minecraft_version=1.7.10
forge_version=10.13.2.1230 forge_version=10.13.2.1291
######################################################### #########################################################
# APIs used for development # # APIs used for development #
######################################################### #########################################################
cb_minecraft_version=1.7.10 cb_minecraft_version=1.7.10
fmp_version=1.1.0.311 fmp_version=1.1.1.321
code_chicken_lib_version=1.1.1.105 code_chicken_lib_version=1.1.1.110
code_chicken_core_version=1.0.4.29 code_chicken_core_version=1.0.4.35
nei_version=1.0.3.66 nei_version=1.0.4.90
waila_version=1.5.7a_1.7.10 waila_version=1.5.9_1.7.10
######################################################### #########################################################
# API Stubs # # API Stubs #
@@ -84,7 +84,7 @@ public class DimensionalCoord extends WorldCoord
@Override @Override
public String toString() public String toString()
{ {
return this.dimId + "," + super.toString(); return "dimension=" + this.dimId + ", " + super.toString();
} }
public World getWorld() public World getWorld()
+1 -1
View File
@@ -148,7 +148,7 @@ public class WorldCoord
@Override @Override
public String toString() public String toString()
{ {
return "" + this.x + "," + this.y + "," + this.z; return "x=" + this.x + ", y=" + this.y + ", z=" + this.z;
} }
@Override @Override
@@ -39,10 +39,12 @@ import appeng.api.config.SortOrder;
import appeng.api.config.ViewItems; import appeng.api.config.ViewItems;
import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList; import appeng.api.storage.data.IItemList;
import appeng.api.util.AEColor;
import appeng.client.gui.AEBaseGui; import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiScrollbar; import appeng.client.gui.widgets.GuiScrollbar;
import appeng.client.gui.widgets.ISortSource; import appeng.client.gui.widgets.ISortSource;
import appeng.container.implementations.ContainerCraftingCPU; import appeng.container.implementations.ContainerCraftingCPU;
import appeng.core.AEConfig;
import appeng.core.AELog; import appeng.core.AELog;
import appeng.core.localization.GuiText; import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.network.NetworkHandler;
@@ -307,13 +309,30 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
IAEItemStack pendingStack = this.pending.findPrecise( refStack ); IAEItemStack pendingStack = this.pending.findPrecise( refStack );
int lines = 0; int lines = 0;
boolean active = false, scheduled = false;
if ( stored != null && stored.getStackSize() > 0 ) if ( stored != null && stored.getStackSize() > 0 )
{
lines++; lines++;
}
if ( activeStack != null && activeStack.getStackSize() > 0 ) if ( activeStack != null && activeStack.getStackSize() > 0 )
{
lines++; lines++;
active = true;
}
if ( pendingStack != null && pendingStack.getStackSize() > 0 ) if ( pendingStack != null && pendingStack.getStackSize() > 0 )
{
lines++; lines++;
scheduled = true;
}
if ( AEConfig.instance.useColoredCraftingStatus && ( active || scheduled ) )
{
int bgcol = ( active ? AEColor.Green.blackVariant : AEColor.Yellow.blackVariant ) | 0x5A000000;
int startX = (x * (1 + sectionLength) + xo) * 2;
int startY = ((y * offY + yo) - 3) * 2;
drawRect( startX, startY, startX + (sectionLength * 2), startY + (offY * 2) - 2, bgcol);
}
int negY = ((lines - 1) * 5) / 2; int negY = ((lines - 1) * 5) / 2;
int downY = 0; int downY = 0;
+3
View File
@@ -134,6 +134,7 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
public boolean enableEffects = true; public boolean enableEffects = true;
public boolean useLargeFonts = false; public boolean useLargeFonts = false;
public boolean useColoredCraftingStatus;
public final int[] craftByStacks = new int[] { 1, 10, 100, 1000 }; public final int[] craftByStacks = new int[] { 1, 10, 100, 1000 };
public final int[] priorityByStacks = new int[] { 1, 10, 100, 1000 }; public final int[] priorityByStacks = new int[] { 1, 10, 100, 1000 };
public final int[] levelByStacks = new int[] { 1, 10, 100, 1000 }; public final int[] levelByStacks = new int[] { 1, 10, 100, 1000 };
@@ -156,6 +157,7 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
public int craftingCalculationTimePerTick = 5; public int craftingCalculationTimePerTick = 5;
@SubscribeEvent @SubscribeEvent
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs) public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs)
{ {
@@ -170,6 +172,7 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
this.disableColoredCableRecipesInNEI = this.get( "Client", "disableColoredCableRecipesInNEI", true ).getBoolean( true ); this.disableColoredCableRecipesInNEI = this.get( "Client", "disableColoredCableRecipesInNEI", true ).getBoolean( true );
this.enableEffects = this.get( "Client", "enableEffects", true ).getBoolean( true ); this.enableEffects = this.get( "Client", "enableEffects", true ).getBoolean( true );
this.useLargeFonts = this.get( "Client", "useTerminalUseLargeFont", false ).getBoolean( false ); this.useLargeFonts = this.get( "Client", "useTerminalUseLargeFont", false ).getBoolean( false );
this.useColoredCraftingStatus = this.get( "Client", "useColoredCraftingStatus", true ).getBoolean( true );
// load buttons.. // load buttons..
for (int btnNum = 0; btnNum < 4; btnNum++) for (int btnNum = 0; btnNum < 4; btnNum++)
+1 -1
View File
@@ -431,7 +431,7 @@ public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IReds
public Iterable<Cuboid6> getCollisionBoxes() public Iterable<Cuboid6> getCollisionBoxes()
{ {
LinkedList<Cuboid6> l = new LinkedList<Cuboid6>(); LinkedList<Cuboid6> l = new LinkedList<Cuboid6>();
for (AxisAlignedBB b : this.cb.getSelectedBoundingBoxesFromPool( false, true, null, false )) for (AxisAlignedBB b : this.cb.getSelectedBoundingBoxesFromPool( false, true, null, true ))
{ {
l.add( new Cuboid6( b.minX, b.minY, b.minZ, b.maxX, b.maxY, b.maxZ ) ); l.add( new Cuboid6( b.minX, b.minY, b.minZ, b.maxX, b.maxY, b.maxZ ) );
} }
+19 -13
View File
@@ -30,6 +30,7 @@ import appeng.api.networking.IGridConnection;
import appeng.api.networking.IGridNode; 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.DimensionalCoord;
import appeng.api.util.IReadOnlyCollection; import appeng.api.util.IReadOnlyCollection;
import appeng.core.AEConfig; import appeng.core.AEConfig;
import appeng.core.AELog; import appeng.core.AELog;
@@ -38,6 +39,7 @@ import appeng.me.pathfinding.IPathItem;
import appeng.util.Platform; import appeng.util.Platform;
import appeng.util.ReadOnlyCollection; import appeng.util.ReadOnlyCollection;
public class GridConnection implements IGridConnection, IPathItem public class GridConnection implements IGridConnection, IPathItem
{ {
@@ -51,17 +53,21 @@ public class GridConnection implements IGridConnection, IPathItem
public int channelData = 0; public int channelData = 0;
public GridConnection(IGridNode aNode, IGridNode bNode, ForgeDirection fromAtoB) throws FailedConnection { public GridConnection( IGridNode aNode, IGridNode bNode, ForgeDirection fromAtoB ) throws FailedConnection
{
GridNode a = (GridNode) aNode; GridNode a = ( GridNode ) aNode;
GridNode b = (GridNode) bNode; GridNode b = ( GridNode ) bNode;
if ( Platform.securityCheck( a, b ) ) if ( Platform.securityCheck( a, b ) )
{ {
if ( AEConfig.instance.isFeatureEnabled( AEFeature.LogSecurityAudits ) ) if ( AEConfig.instance.isFeatureEnabled( AEFeature.LogSecurityAudits ) )
{ {
AELog.info( "Audit Failed 1: " + a.getGridBlock().getLocation() ); final DimensionalCoord aCoordinates = a.getGridBlock().getLocation();
AELog.info( "Audit Failed 2: " + b.getGridBlock().getLocation() ); final DimensionalCoord bCoordinates = b.getGridBlock().getLocation();
AELog.info( "Security audit 1 failed at [%s] belonging to player [id=%d]", aCoordinates.toString(), a.playerID );
AELog.info( "Security audit 2 failed at [%s] belonging to player [id=%d]", bCoordinates.toString(), b.playerID );
} }
throw new FailedConnection(); throw new FailedConnection();
@@ -113,7 +119,7 @@ public class GridConnection implements IGridConnection, IPathItem
this.sideB.addConnection( this ); this.sideB.addConnection( this );
} }
private boolean isNetworkABetter(GridNode a, GridNode b) private boolean isNetworkABetter( GridNode a, GridNode b )
{ {
return a.getMyGrid().getPriority() > b.getMyGrid().getPriority() || a.getMyGrid().size() > b.getMyGrid().size(); return a.getMyGrid().getPriority() > b.getMyGrid().getPriority() || a.getMyGrid().size() > b.getMyGrid().size();
} }
@@ -139,7 +145,7 @@ public class GridConnection implements IGridConnection, IPathItem
} }
@Override @Override
public ForgeDirection getDirection(IGridNode side) public ForgeDirection getDirection( IGridNode side )
{ {
if ( this.fromAtoB == ForgeDirection.UNKNOWN ) if ( this.fromAtoB == ForgeDirection.UNKNOWN )
return this.fromAtoB; return this.fromAtoB;
@@ -157,7 +163,7 @@ public class GridConnection implements IGridConnection, IPathItem
} }
@Override @Override
public IGridNode getOtherSide(IGridNode gridNode) public IGridNode getOtherSide( IGridNode gridNode )
{ {
if ( gridNode == this.sideA ) if ( gridNode == this.sideA )
return this.sideB; return this.sideB;
@@ -176,11 +182,11 @@ public class GridConnection implements IGridConnection, IPathItem
@Override @Override
public IReadOnlyCollection<IPathItem> getPossibleOptions() public IReadOnlyCollection<IPathItem> getPossibleOptions()
{ {
return new ReadOnlyCollection<IPathItem>( Arrays.asList( (IPathItem) this.a(), (IPathItem) this.b() ) ); return new ReadOnlyCollection<IPathItem>( Arrays.asList( ( IPathItem ) this.a(), ( IPathItem ) this.b() ) );
} }
@Override @Override
public void incrementChannelCount(int usedChannels) public void incrementChannelCount( int usedChannels )
{ {
this.channelData += usedChannels; this.channelData += usedChannels;
} }
@@ -194,7 +200,7 @@ public class GridConnection implements IGridConnection, IPathItem
@Override @Override
public int getUsedChannels() public int getUsedChannels()
{ {
return (this.channelData >> 8) & 0xff; return ( this.channelData >> 8 ) & 0xff;
} }
public int getLastUsedChannels() public int getLastUsedChannels()
@@ -211,7 +217,7 @@ public class GridConnection implements IGridConnection, IPathItem
} }
@Override @Override
public void setControllerRoute(IPathItem fast, boolean zeroOut) public void setControllerRoute( IPathItem fast, boolean zeroOut )
{ {
if ( zeroOut ) if ( zeroOut )
this.channelData &= ~0xff; this.channelData &= ~0xff;
@@ -230,7 +236,7 @@ public class GridConnection implements IGridConnection, IPathItem
{ {
if ( this.getUsedChannels() != this.getLastUsedChannels() ) if ( this.getUsedChannels() != this.getLastUsedChannels() )
{ {
this.channelData = (this.channelData & 0xff); this.channelData = ( this.channelData & 0xff );
this.channelData |= this.channelData << 8; this.channelData |= this.channelData << 8;
if ( this.sideA.getInternalGrid() != null ) if ( this.sideA.getInternalGrid() != null )
@@ -481,8 +481,7 @@ public class CellInventory implements ICellInventory
if ( request == null ) if ( request == null )
return null; return null;
ItemStack sharedItem = request.getItemStack(); long size = Math.min( Integer.MAX_VALUE, request.getStackSize() );
int size = sharedItem.stackSize;
IAEItemStack Results = null; IAEItemStack Results = null;
@@ -19,6 +19,8 @@
package appeng.parts.automation; package appeng.parts.automation;
import java.util.concurrent.Callable;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@@ -57,6 +59,7 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.client.texture.CableBusTextures; import appeng.client.texture.CableBusTextures;
import appeng.core.settings.TickRates; import appeng.core.settings.TickRates;
import appeng.core.sync.packets.PacketTransitionEffect; import appeng.core.sync.packets.PacketTransitionEffect;
import appeng.hooks.TickHandler;
import appeng.me.GridAccessException; import appeng.me.GridAccessException;
import appeng.parts.PartBasicState; import appeng.parts.PartBasicState;
import appeng.server.ServerHelper; import appeng.server.ServerHelper;
@@ -64,17 +67,25 @@ import appeng.util.Platform;
import appeng.util.item.AEItemStack; import appeng.util.item.AEItemStack;
public class PartAnnihilationPlane extends PartBasicState implements IGridTickable public class PartAnnihilationPlane extends PartBasicState implements IGridTickable, Callable<TickRateModulation>
{ {
private boolean isAccepting = true; private boolean isAccepting = true;
private final BaseActionSource mySrc = new MachineSource( this ); private final BaseActionSource mySrc = new MachineSource( this );
private boolean breaking = false;
public PartAnnihilationPlane( ItemStack is ) public PartAnnihilationPlane( ItemStack is )
{ {
super( PartAnnihilationPlane.class, is ); super( PartAnnihilationPlane.class, is );
} }
@Override
public TickRateModulation call() throws Exception
{
this.breaking = false;
return this.breakblock( true );
}
@Override @Override
@SideOnly( Side.CLIENT ) @SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer ) public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
@@ -233,7 +244,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
this.getHost().markForUpdate(); this.getHost().markForUpdate();
} }
public TickRateModulation breakblock() public TickRateModulation breakblock( boolean modulate )
{ {
if ( this.isAccepting() && this.proxy.isActive() ) if ( this.isAccepting() && this.proxy.isActive() )
{ {
@@ -273,29 +284,34 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
if ( hasPower && canStore ) if ( hasPower && canStore )
{ {
w.setBlock( x, y, z, Platform.AIR, 0, 3 ); if ( modulate )
energy.extractAEPower( total, Actionable.MODULATE, PowerMultiplier.CONFIG );
final AxisAlignedBB box = AxisAlignedBB.getBoundingBox( x - 0.2, y - 0.2, z - 0.2, x + 1.2, y + 1.2, z + 1.2 );
for ( final Object ei : w.getEntitiesWithinAABB( EntityItem.class, box ) )
{ {
if ( ei instanceof EntityItem ) w.setBlock( x, y, z, Platform.AIR, 0, 3 );
{ energy.extractAEPower( total, Actionable.MODULATE, PowerMultiplier.CONFIG );
final EntityItem entityItem = ( EntityItem ) ei;
this.storeEntityItem( entityItem );
}
}
for ( final ItemStack snaggedItem : out ) final AxisAlignedBB box = AxisAlignedBB.getBoundingBox( x - 0.2, y - 0.2, z - 0.2, x + 1.2, y + 1.2, z + 1.2 );
for ( final Object ei : w.getEntitiesWithinAABB( EntityItem.class, box ) )
{
if ( ei instanceof EntityItem )
{
final EntityItem entityItem = ( EntityItem ) ei;
this.storeEntityItem( entityItem );
}
}
for ( final ItemStack snaggedItem : out )
{
this.storeItemStack( snaggedItem );
}
ServerHelper.proxy.sendToAllNearExcept( null, x, y, z, 64, w, new PacketTransitionEffect( x, y, z, this.side, true ) );
}
else
{ {
if ( this.storeItemStack( snaggedItem ) ) this.breaking = true;
{ TickHandler.INSTANCE.addCallable( this.tile.getWorldObj(), this );
ServerHelper.proxy.sendToAllNearExcept( null, x, y, z, 64, w, new PacketTransitionEffect( x, y, z, this.side, true ) );
}
} }
return TickRateModulation.URGENT; return TickRateModulation.URGENT;
} }
} }
} }
@@ -397,8 +413,13 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
@Override @Override
public TickRateModulation tickingRequest( IGridNode node, int TicksSinceLastCall ) public TickRateModulation tickingRequest( IGridNode node, int TicksSinceLastCall )
{ {
if ( this.breaking )
{
return TickRateModulation.URGENT;
}
this.isAccepting = true; this.isAccepting = true;
return this.breakblock(); return this.breakblock( false );
} }
/** /**
File diff suppressed because it is too large Load Diff
+138 -110
View File
@@ -18,8 +18,18 @@
package appeng.util.item; package appeng.util.item;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@@ -27,15 +37,129 @@ import net.minecraftforge.oredict.OreDictionary;
import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IAEItemStack;
public class OreHelper public class OreHelper
{ {
public static final OreHelper INSTANCE = new OreHelper(); public static final OreHelper INSTANCE = new OreHelper();
static class ItemRef /**
* A local cache to speed up OreDictionary lookups.
*/
private final LoadingCache<String, List<ItemStack>> oreDictCache = CacheBuilder
.newBuilder().build( new CacheLoader<String, List<ItemStack>>(){
public List<ItemStack> load( String oreName )
{
return OreDictionary.getOres( oreName );
}
} );
private final Map<ItemRef, OreReference> references = new HashMap<ItemRef, OreReference>();
/**
* Test if the passed {@link ItemStack} is an ore.
*
* @param ItemStack the itemstack to test
* @return true if an ore entry exists, false otherwise
*/
public OreReference isOre( ItemStack ItemStack )
{
ItemRef ir = new ItemRef( ItemStack );
if ( !this.references.containsKey( ir ) )
{
final OreReference ref = new OreReference();
final Collection<Integer> ores = ref.getOres();
final Collection<String> set = ref.getEquivalents();
Set<String> toAdd = new HashSet<String>();
for ( String ore : OreDictionary.getOreNames() )
{
// skip ore if it is a match already.
if ( toAdd.contains( ore ) )
{
continue;
}
for ( ItemStack oreItem : oreDictCache.getUnchecked( ore ) )
{
if ( OreDictionary.itemMatches( oreItem, ItemStack, false ) )
{
toAdd.add( ore );
break;
}
}
}
for ( String ore : toAdd )
{
set.add( ore );
ores.add( OreDictionary.getOreID( ore ) );
}
if ( !set.isEmpty() )
this.references.put( ir, ref );
else
this.references.put( ir, null );
}
return this.references.get( ir );
}
public boolean sameOre( AEItemStack aeItemStack, IAEItemStack is )
{
OreReference a = aeItemStack.def.isOre;
OreReference b = aeItemStack.def.isOre;
return this.sameOre( a, b );
}
public boolean sameOre( OreReference a, OreReference b )
{
if ( a == null || b == null )
return false;
if ( a == b )
return true;
Collection<Integer> bOres = b.getOres();
for ( Integer ore : a.getOres() )
{
if ( bOres.contains( ore ) )
return true;
}
return false;
}
public boolean sameOre( AEItemStack aeItemStack, ItemStack o )
{
OreReference a = aeItemStack.def.isOre;
if ( a == null )
return false;
for ( String oreName : a.getEquivalents() )
{
for ( ItemStack oreItem : oreDictCache.getUnchecked( oreName ) )
{
if ( OreDictionary.itemMatches( oreItem, o, false ) )
return true;
}
}
return false;
}
public List<ItemStack> getCachedOres( String oreName )
{
return oreDictCache.getUnchecked( oreName );
}
private static class ItemRef
{ {
ItemRef(ItemStack stack) ItemRef( ItemStack stack )
{ {
this.ref = stack.getItem(); this.ref = stack.getItem();
@@ -47,18 +171,18 @@ public class OreHelper
this.hash = this.ref.hashCode() ^ this.damage; this.hash = this.ref.hashCode() ^ this.damage;
} }
final Item ref; private final Item ref;
final int damage; private final int damage;
final int hash; private final int hash;
@Override @Override
public boolean equals(Object obj) public boolean equals( Object obj )
{ {
if ( obj == null ) if ( obj == null )
return false; return false;
if ( this.getClass() != obj.getClass() ) if ( this.getClass() != obj.getClass() )
return false; return false;
ItemRef other = (ItemRef) obj; ItemRef other = ( ItemRef ) obj;
return this.damage == other.damage && this.ref == other.ref; return this.damage == other.damage && this.ref == other.ref;
} }
@@ -68,111 +192,15 @@ public class OreHelper
return this.hash; return this.hash;
} }
} @Override
public String toString()
static class OreResult
{
public OreReference oreValue = null;
}
final HashMap<ItemRef, OreResult> references = new HashMap<ItemRef, OreResult>();
public OreReference isOre(ItemStack ItemStack)
{
ItemRef ir = new ItemRef( ItemStack );
OreResult or = this.references.get( ir );
if ( or == null )
{ {
or = new OreResult(); StringBuilder builder = new StringBuilder();
this.references.put( ir, or ); builder.append( "ItemRef [ref=" ).append( ref.getUnlocalizedName() )
.append( ", damage=" ).append( damage ).append( ", hash=" )
OreReference ref = new OreReference(); .append( hash ).append( "]" );
Collection<Integer> ores = ref.getOres(); return builder.toString();
Collection<ItemStack> set = ref.getEquivalents();
for (String ore : OreDictionary.getOreNames())
{
boolean add = false;
for (ItemStack oreItem : OreDictionary.getOres( ore ))
{
if ( OreDictionary.itemMatches( oreItem, ItemStack, false ) )
{
add = true;
break;
}
}
if ( add )
{
for (ItemStack oreItem : OreDictionary.getOres( ore ))
set.add( oreItem.copy() );
ores.add( OreDictionary.getOreID( ore ) );
}
}
if ( !set.isEmpty() )
or.oreValue = ref;
} }
return or.oreValue;
}
public boolean sameOre(AEItemStack aeItemStack, IAEItemStack is)
{
OreReference a = aeItemStack.def.isOre;
OreReference b = aeItemStack.def.isOre;
if ( a == null || b == null )
return false;
if ( a == b )
return true;
Collection<Integer> bOres = b.getOres();
for (Integer ore : a.getOres())
{
if ( bOres.contains( ore ) )
return true;
}
return false;
}
public boolean sameOre(OreReference a, OreReference b)
{
if ( a == null || b == null )
return false;
if ( a == b )
return true;
Collection<Integer> bOres = b.getOres();
for (Integer ore : a.getOres())
{
if ( bOres.contains( ore ) )
return true;
}
return false;
}
public boolean sameOre(AEItemStack aeItemStack, ItemStack o)
{
OreReference a = aeItemStack.def.isOre;
if ( a == null )
return false;
for (ItemStack oreItem : a.getEquivalents())
{
if ( OreDictionary.itemMatches( oreItem, o, false ) )
return true;
}
return false;
} }
} }
@@ -18,24 +18,27 @@
package appeng.util.item; package appeng.util.item;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Set;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IAEItemStack;
public class OreReference public class OreReference
{ {
private final LinkedList<ItemStack> otherOptions = new LinkedList<ItemStack>(); private final List<String> otherOptions = new LinkedList<String>();
private ArrayList<IAEItemStack> aeOtherOptions = null; private List<IAEItemStack> aeOtherOptions = null;
private final HashSet<Integer> ores = new HashSet<Integer>(); private final Set<Integer> ores = new HashSet<Integer>();
public Collection<ItemStack> getEquivalents() public Collection<String> getEquivalents()
{ {
return this.otherOptions; return this.otherOptions;
} }
@@ -47,9 +50,17 @@ public class OreReference
this.aeOtherOptions = new ArrayList<IAEItemStack>( this.otherOptions.size() ); this.aeOtherOptions = new ArrayList<IAEItemStack>( this.otherOptions.size() );
// SUMMON AE STACKS! // SUMMON AE STACKS!
for (ItemStack is : this.otherOptions) for ( String oreName : this.otherOptions )
if ( is.getItem() != null ) {
this.aeOtherOptions.add( AEItemStack.create( is ) ); for ( ItemStack is : OreHelper.INSTANCE.getCachedOres( oreName ) )
{
if ( is.getItem() != null )
{
this.aeOtherOptions.add( AEItemStack.create( is ) );
}
}
}
} }
return this.aeOtherOptions; return this.aeOtherOptions;
@@ -252,7 +252,7 @@ gui.tooltips.appliedenergistics2.AlwaysActive=Always active
gui.tooltips.appliedenergistics2.ActiveWithoutSignal=Active without signal gui.tooltips.appliedenergistics2.ActiveWithoutSignal=Active without signal
gui.tooltips.appliedenergistics2.ActiveWithSignal=Active with signal gui.tooltips.appliedenergistics2.ActiveWithSignal=Active with signal
gui.tooltips.appliedenergistics2.ActiveOnPulse=Activate once per pulse gui.tooltips.appliedenergistics2.ActiveOnPulse=Activate once per pulse
gui.tooltips.appliedenergistics2.EmitLevelsBelow=Emit when levels are below or equal to limit. gui.tooltips.appliedenergistics2.EmitLevelsBelow=Emit when levels are below limit.
gui.tooltips.appliedenergistics2.EmitLevelAbove=Emit when levels are above or equal to limit. gui.tooltips.appliedenergistics2.EmitLevelAbove=Emit when levels are above or equal to limit.
gui.tooltips.appliedenergistics2.SearchMode_Auto=Auto Search gui.tooltips.appliedenergistics2.SearchMode_Auto=Auto Search
gui.tooltips.appliedenergistics2.SearchMode_Standard=Standard Search gui.tooltips.appliedenergistics2.SearchMode_Standard=Standard Search
@@ -50,6 +50,16 @@ tile.appliedenergistics2.BlockCraftingAccelerator.name=Unité de co-traitement
tile.appliedenergistics2.BlockCraftingUnit.name=Unité de craft tile.appliedenergistics2.BlockCraftingUnit.name=Unité de craft
tile.appliedenergistics2.BlockMolecularAssembler.name=Assembleur moléculaire tile.appliedenergistics2.BlockMolecularAssembler.name=Assembleur moléculaire
// Stairs
tile.appliedenergistics2.ChiseledQuartzStairBlock.name=Escaliers de Quartz Certus ciselé
tile.appliedenergistics2.FluixStairBlock.name=Escaliers de Fluix
tile.appliedenergistics2.QuartzPillarStairBlock.name=Escaliers de pilier de Quartz Certus
tile.appliedenergistics2.QuartzStairBlock.name=Escaliers de Quartz Certus
tile.appliedenergistics2.SkyStoneBlockStairBlock.name=Escaliers de bloc de pierre de ciel
tile.appliedenergistics2.SkyStoneBrickStairBlock.name=Escaliers de briques de pierre de ciel
tile.appliedenergistics2.SkyStoneSmallBrickStairBlock.name=Escaliers de petites briques de pierre de ciel
tile.appliedenergistics2.SkyStoneStairBlock.name=Escaliers de pierre de ciel
chat.appliedenergistics2.ChestCannotReadStorageCell=Le coffre ME Chest ne peut pas lire la cellule de stockage. chat.appliedenergistics2.ChestCannotReadStorageCell=Le coffre ME Chest ne peut pas lire la cellule de stockage.
chat.appliedenergistics2.SettingCleared=Paramètres effacés. chat.appliedenergistics2.SettingCleared=Paramètres effacés.
chat.appliedenergistics2.OutOfRange=Réseau sans-fil hors de portée. chat.appliedenergistics2.OutOfRange=Réseau sans-fil hors de portée.
@@ -242,7 +252,7 @@ gui.tooltips.appliedenergistics2.AlwaysActive=Toujours actif
gui.tooltips.appliedenergistics2.ActiveWithoutSignal=Actif sans signal gui.tooltips.appliedenergistics2.ActiveWithoutSignal=Actif sans signal
gui.tooltips.appliedenergistics2.ActiveWithSignal=Actif avec un signal gui.tooltips.appliedenergistics2.ActiveWithSignal=Actif avec un signal
gui.tooltips.appliedenergistics2.ActiveOnPulse=Activer une fois par impulsion gui.tooltips.appliedenergistics2.ActiveOnPulse=Activer une fois par impulsion
gui.tooltips.appliedenergistics2.EmitLevelsBelow=Emettre quand les niveaux sont inférieurs ou égaux à la limite. gui.tooltips.appliedenergistics2.EmitLevelsBelow=Emettre quand les niveaux sont inférieurs à la limite.
gui.tooltips.appliedenergistics2.EmitLevelAbove=Emettre quand les niveaux sont supérieurs ou égaux à la limite. gui.tooltips.appliedenergistics2.EmitLevelAbove=Emettre quand les niveaux sont supérieurs ou égaux à la limite.
gui.tooltips.appliedenergistics2.SearchMode_Auto=Recherche auto gui.tooltips.appliedenergistics2.SearchMode_Auto=Recherche auto
gui.tooltips.appliedenergistics2.SearchMode_Standard=Recharche standard gui.tooltips.appliedenergistics2.SearchMode_Standard=Recharche standard
@@ -278,6 +288,9 @@ gui.tooltips.appliedenergistics2.EmitWhenCrafting=Emettre un signal Redstone qua
gui.tooltips.appliedenergistics2.ReportInaccessibleItems=Rapport d'éléments inaccessibles gui.tooltips.appliedenergistics2.ReportInaccessibleItems=Rapport d'éléments inaccessibles
gui.tooltips.appliedenergistics2.ReportInaccessibleItemsYes=Oui: Les éléments ne pouvant pas être extraits seront visibles. gui.tooltips.appliedenergistics2.ReportInaccessibleItemsYes=Oui: Les éléments ne pouvant pas être extraits seront visibles.
gui.tooltips.appliedenergistics2.ReportInaccessibleItemsNo=Non: Seuls les éléments extractibles seront visibles. gui.tooltips.appliedenergistics2.ReportInaccessibleItemsNo=Non: Seuls les éléments extractibles seront visibles.
gui.tooltips.appliedenergistics2.BlockPlacement=Placement de bloc
gui.tooltips.appliedenergistics2.BlockPlacementYes=Les blocs seront placés comme un bloc.
gui.tooltips.appliedenergistics2.BlockPlacementNo=Les blocs seront jettés comme un élément.
gui.appliedenergistics2.units.appliedenergstics=AE gui.appliedenergistics2.units.appliedenergstics=AE
gui.appliedenergistics2.units.buildcraft=Minecraft Joules gui.appliedenergistics2.units.buildcraft=Minecraft Joules
@@ -304,6 +317,7 @@ gui.appliedenergistics2.Red=Rouge
gui.appliedenergistics2.Black=Noir gui.appliedenergistics2.Black=Noir
gui.appliedenergistics2.Fluix=Fluix gui.appliedenergistics2.Fluix=Fluix
waila.appliedenergistics2.Crafting=Fabrication
waila.appliedenergistics2.DeviceOnline=Dispositif en ligne waila.appliedenergistics2.DeviceOnline=Dispositif en ligne
waila.appliedenergistics2.DeviceOffline=Dispositif hors ligne waila.appliedenergistics2.DeviceOffline=Dispositif hors ligne
waila.appliedenergistics2.DeviceMissingChannel=Appareil sans canal waila.appliedenergistics2.DeviceMissingChannel=Appareil sans canal
@@ -380,7 +394,7 @@ item.appliedenergistics2.ItemMaterial.SiliconPress.name=Matrice de presse de sil
item.appliedenergistics2.ItemMaterial.SiliconPrint.name=Silicone imprimé item.appliedenergistics2.ItemMaterial.SiliconPrint.name=Silicone imprimé
item.appliedenergistics2.ItemMaterial.NamePress.name=Matrice de presse de nommage item.appliedenergistics2.ItemMaterial.NamePress.name=Matrice de presse de nommage
item.appliedenergistics2.ItemMaterial.SkyDust.name=Poussière de pierre du ciel item.appliedenergistics2.ItemMaterial.SkyDust.name=Poussière de pierre du ciel
item.appliedenergistics2.ItemMaterial.CardCrafting.name=Carte de craft item.appliedenergistics2.ItemMaterial.CardCrafting.name=Carte de fabrication
item.appliedenergistics2.ItemPart.AnnihilationPlane.name=Plan de dématérialisation ME item.appliedenergistics2.ItemPart.AnnihilationPlane.name=Plan de dématérialisation ME
item.appliedenergistics2.ItemPart.CableAnchor.name=Ancre de câble item.appliedenergistics2.ItemPart.CableAnchor.name=Ancre de câble
@@ -333,7 +333,7 @@ item.appliedenergistics2.ItemViewCell.name=显示元件
item.appliedenergistics2.ItemFacade.name=线缆伪装板 item.appliedenergistics2.ItemFacade.name=线缆伪装板
item.appliedenergistics2.ItemCrystalSeed.Certus.name=赛特斯石英种子 item.appliedenergistics2.ItemCrystalSeed.Certus.name=赛特斯石英种子
item.appliedenergistics2.ItemCrystalSeed.Nether.name=下界石英 item.appliedenergistics2.ItemCrystalSeed.Nether.name=下界石英
item.appliedenergistics2.ItemCrystalSeed.Fluix.name=福鲁伊克斯种子 item.appliedenergistics2.ItemCrystalSeed.Fluix.name=福鲁伊克斯种子
item.appliedenergistics2.ItemMaterial.InvalidType.name=该物品被禁用. item.appliedenergistics2.ItemMaterial.InvalidType.name=该物品被禁用.
item.appliedenergistics2.ItemMaterial.AdvCard.name=高级卡 item.appliedenergistics2.ItemMaterial.AdvCard.name=高级卡