Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6f15c2921a | |||
| d891e5da15 | |||
| 6607c8cd2f | |||
| 1e20086799 | |||
| f85ab7ddc2 | |||
| c3700737c3 | |||
| 2f8013a49b | |||
| af54883fd3 | |||
| 223a210d49 | |||
| c133e4f0ef | |||
| 424d27b71c | |||
| 2fe5a3cef8 | |||
| a3c33d5323 | |||
| e927c27b85 | |||
| d7d99c5e7e | |||
| b6d3be41e1 | |||
| 071ee83b7a | |||
| dfe7a29c92 | |||
| 2b02dc19c0 | |||
| 9bf296bec9 | |||
| 5db7fc8e8c | |||
| c7eb696d60 | |||
| 4f53f5910b | |||
| 971fc3d243 | |||
| c2b5a58dd2 | |||
| 53c32cc296 | |||
| 89299cdb3c | |||
| 2972f0ddc8 |
@@ -1,5 +1,4 @@
|
||||
[](https://travis-ci.org/AppliedEnergistics/Applied-Energistics-2)
|
||||
[](https://github.com/AppliedEnergistics/Applied-Energistics-2/tags)
|
||||
[](https://github.com/AppliedEnergistics/Applied-Energistics-2/releases)
|
||||
|
||||
# Applied Energistics 2
|
||||
@@ -53,7 +52,7 @@ Downloads can be found on [CurseForge](http://www.curse.com/mc-mods/minecraft/22
|
||||
|
||||
[Download Latest Nightly Build](https://ci.appveyor.com/api/projects/shartte/applied-energistics-2/artifacts/ae2-rv4-nightly.zip?branch=master)
|
||||
|
||||
Nightly builds for the Minecraft 1.10.2 branch of AE2 (rv4-alpha) are available from [AppVeyor](https://ci.appveyor.com/api/projects/shartte/applied-energistics-2/history). These builds are only for testing purposes and might lead to loss of data, and will contain significant bugs. Please see below on how you can report bugs you find during testing.
|
||||
Nightly builds for the Minecraft 1.10.2 branch of AE2 (rv4-alpha) are available from [AppVeyor](https://ci.appveyor.com/project/shartte/applied-energistics-2/history). These builds are only for testing purposes and might lead to loss of data, and will contain significant bugs. Please see below on how you can report bugs you find during testing.
|
||||
|
||||
## Installation
|
||||
|
||||
|
||||
@@ -271,87 +271,93 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
|
||||
@Override
|
||||
public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||
{
|
||||
if( player != null )
|
||||
if( player != null && heldItem != null )
|
||||
{
|
||||
if( heldItem != null )
|
||||
if( Platform.isWrench( player, heldItem, pos ) && player.isSneaking() )
|
||||
{
|
||||
if( Platform.isWrench( player, heldItem, pos ) && player.isSneaking() )
|
||||
final IBlockState blockState = w.getBlockState( pos );
|
||||
final Block block = blockState.getBlock();
|
||||
|
||||
if( block == null )
|
||||
{
|
||||
final IBlockState ids = w.getBlockState( pos );
|
||||
final Block id = ids.getBlock();
|
||||
if( id != null )
|
||||
{
|
||||
final AEBaseTile tile = this.getTileEntity( w, pos );
|
||||
final ItemStack[] drops = Platform.getBlockDrops( w, pos );
|
||||
|
||||
if( tile == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( tile instanceof TileCableBus || tile instanceof TileSkyChest )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final ItemStack op = new ItemStack( this );
|
||||
for( final ItemStack ol : drops )
|
||||
{
|
||||
if( Platform.isSameItemType( ol, op ) )
|
||||
{
|
||||
final NBTTagCompound tag = tile.downloadSettings( SettingsFrom.DISMANTLE_ITEM );
|
||||
if( tag != null )
|
||||
{
|
||||
ol.setTagCompound( tag );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( id.removedByPlayer( ids, w, pos, player, false ) )
|
||||
{
|
||||
final List<ItemStack> l = Lists.newArrayList( drops );
|
||||
Platform.spawnDrops( w, pos, l );
|
||||
w.setBlockToAir( pos );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if( heldItem.getItem() instanceof IMemoryCard && !( this instanceof BlockCableBus ) )
|
||||
final AEBaseTile tile = this.getTileEntity( w, pos );
|
||||
|
||||
if( tile == null )
|
||||
{
|
||||
final IMemoryCard memoryCard = (IMemoryCard) heldItem.getItem();
|
||||
if( player.isSneaking() )
|
||||
return false;
|
||||
}
|
||||
|
||||
if( tile instanceof TileCableBus || tile instanceof TileSkyChest )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final ItemStack[] itemDropCandidates = Platform.getBlockDrops( w, pos );
|
||||
final ItemStack op = new ItemStack( this );
|
||||
|
||||
for( final ItemStack ol : itemDropCandidates )
|
||||
{
|
||||
if( Platform.itemComparisons().isEqualItemType( ol, op ) )
|
||||
{
|
||||
final AEBaseTile t = this.getTileEntity( w, pos );
|
||||
if( t != null )
|
||||
final NBTTagCompound tag = tile.downloadSettings( SettingsFrom.DISMANTLE_ITEM );
|
||||
if( tag != null )
|
||||
{
|
||||
final String name = this.getUnlocalizedName();
|
||||
final NBTTagCompound data = t.downloadSettings( SettingsFrom.MEMORY_CARD );
|
||||
if( data != null )
|
||||
{
|
||||
memoryCard.setMemoryCardContents( heldItem, name, data );
|
||||
memoryCard.notifyUser( player, MemoryCardMessages.SETTINGS_SAVED );
|
||||
return true;
|
||||
}
|
||||
ol.setTagCompound( tag );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( block.removedByPlayer( blockState, w, pos, player, false ) )
|
||||
{
|
||||
final List<ItemStack> itemsToDrop = Lists.newArrayList( itemDropCandidates );
|
||||
Platform.spawnDrops( w, pos, itemsToDrop );
|
||||
w.setBlockToAir( pos );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if( heldItem.getItem() instanceof IMemoryCard && !( this instanceof BlockCableBus ) )
|
||||
{
|
||||
final IMemoryCard memoryCard = (IMemoryCard) heldItem.getItem();
|
||||
final AEBaseTile tileEntity = this.getTileEntity( w, pos );
|
||||
|
||||
if( tileEntity == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final String name = this.getUnlocalizedName();
|
||||
|
||||
if( player.isSneaking() )
|
||||
{
|
||||
final NBTTagCompound data = tileEntity.downloadSettings( SettingsFrom.MEMORY_CARD );
|
||||
if( data != null )
|
||||
{
|
||||
memoryCard.setMemoryCardContents( heldItem, name, data );
|
||||
memoryCard.notifyUser( player, MemoryCardMessages.SETTINGS_SAVED );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
final String savedName = memoryCard.getSettingsName( heldItem );
|
||||
final NBTTagCompound data = memoryCard.getData( heldItem );
|
||||
|
||||
if( this.getUnlocalizedName().equals( savedName ) )
|
||||
{
|
||||
tileEntity.uploadSettings( SettingsFrom.MEMORY_CARD, data );
|
||||
memoryCard.notifyUser( player, MemoryCardMessages.SETTINGS_LOADED );
|
||||
}
|
||||
else
|
||||
{
|
||||
final String name = memoryCard.getSettingsName( heldItem );
|
||||
final NBTTagCompound data = memoryCard.getData( heldItem );
|
||||
if( this.getUnlocalizedName().equals( name ) )
|
||||
{
|
||||
final AEBaseTile t = this.getTileEntity( w, pos );
|
||||
t.uploadSettings( SettingsFrom.MEMORY_CARD, data );
|
||||
memoryCard.notifyUser( player, MemoryCardMessages.SETTINGS_LOADED );
|
||||
}
|
||||
else
|
||||
{
|
||||
memoryCard.notifyUser( player, MemoryCardMessages.INVALID_MACHINE );
|
||||
}
|
||||
return false;
|
||||
memoryCard.notifyUser( player, MemoryCardMessages.INVALID_MACHINE );
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
package appeng.capabilities;
|
||||
|
||||
|
||||
import net.darkhax.tesla.api.ITeslaConsumer;
|
||||
import net.darkhax.tesla.api.ITeslaHolder;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
@@ -41,6 +43,12 @@ public final class Capabilities
|
||||
@CapabilityInject( IStorageMonitorableAccessor.class )
|
||||
public static Capability<IStorageMonitorableAccessor> STORAGE_MONITORABLE_ACCESSOR;
|
||||
|
||||
@CapabilityInject(ITeslaConsumer.class)
|
||||
public static Capability<ITeslaConsumer> TESLA_CONSUMER;
|
||||
|
||||
@CapabilityInject(ITeslaHolder.class)
|
||||
public static Capability<ITeslaHolder> TESLA_HOLDER;
|
||||
|
||||
/**
|
||||
* Register AE2 provided capabilities.
|
||||
*/
|
||||
|
||||
@@ -41,7 +41,7 @@ import appeng.integration.modules.JEI;
|
||||
import appeng.items.storage.ItemViewCell;
|
||||
import appeng.util.ItemSorters;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.prioitylist.IPartitionList;
|
||||
import appeng.util.prioritylist.IPartitionList;
|
||||
|
||||
|
||||
public class ItemRepo
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
@@ -108,11 +107,7 @@ public class FacadeDispatcherBakedModel implements IBakedModel
|
||||
|
||||
ItemFacade itemFacade = (ItemFacade) stack.getItem();
|
||||
|
||||
Block block = itemFacade.getBlock( stack );
|
||||
int meta = itemFacade.getMeta( stack );
|
||||
|
||||
// This is kinda fascinating, how do we get the meta from the itemblock
|
||||
IBlockState state = block.getStateFromMeta( meta );
|
||||
IBlockState state = itemFacade.getTextureBlockState( stack );
|
||||
|
||||
return new FacadeWithBlockBakedModel( baseModel, state, format );
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ package appeng.client.render.cablebus;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -42,6 +43,8 @@ import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.util.AEAxisAlignedBB;
|
||||
@@ -62,8 +65,11 @@ public class FacadeBuilder
|
||||
private final VertexFormat format;
|
||||
|
||||
private final TextureAtlasSprite facadeTexture;
|
||||
|
||||
private final BlockRendererDispatcher blockRendererDispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
|
||||
|
||||
private static final Set<ResourceLocation> warnedFor = new HashSet<>();
|
||||
|
||||
FacadeBuilder( VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
|
||||
{
|
||||
this.format = format;
|
||||
@@ -100,23 +106,66 @@ public class FacadeBuilder
|
||||
|
||||
public static TextureAtlasSprite getSprite( IBakedModel blockModel, IBlockState state, EnumFacing facing, long rand)
|
||||
{
|
||||
for( BakedQuad bakedQuad : blockModel.getQuads( state, facing, rand ) )
|
||||
{
|
||||
return bakedQuad.getSprite();
|
||||
}
|
||||
|
||||
TextureAtlasSprite firstFound = null;
|
||||
for( BakedQuad bakedQuad : blockModel.getQuads( state, null, rand ) )
|
||||
BlockRenderLayer orgLayer = MinecraftForgeClient.getRenderLayer();
|
||||
|
||||
try
|
||||
{
|
||||
if( firstFound == null )
|
||||
// Some other mods also distinguish between layers, so we're doing this in a loop from most likely to least likely
|
||||
for( BlockRenderLayer layer : BlockRenderLayer.values() )
|
||||
{
|
||||
firstFound = bakedQuad.getSprite();
|
||||
}
|
||||
if( bakedQuad.getFace() == facing )
|
||||
{
|
||||
return bakedQuad.getSprite();
|
||||
|
||||
ForgeHooksClient.setRenderLayer( layer );
|
||||
|
||||
for( BakedQuad bakedQuad : blockModel.getQuads( state, facing, rand ) )
|
||||
{
|
||||
return bakedQuad.getSprite();
|
||||
}
|
||||
|
||||
for( BakedQuad bakedQuad : blockModel.getQuads( state, null, rand ) )
|
||||
{
|
||||
if( firstFound == null )
|
||||
{
|
||||
firstFound = bakedQuad.getSprite();
|
||||
}
|
||||
if( bakedQuad.getFace() == facing )
|
||||
{
|
||||
return bakedQuad.getSprite();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
if( warnedFor.add( state.getBlock().getRegistryName() ) )
|
||||
{
|
||||
AELog.warn( "Unable to get facade sprite for blockstate %s. Supressing further warnings for this block.", state );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
ForgeHooksClient.setRenderLayer( orgLayer );
|
||||
}
|
||||
|
||||
// Fall back to the particle texture, if we havent found anything else so far.
|
||||
if( firstFound == null )
|
||||
{
|
||||
try
|
||||
{
|
||||
return blockModel.getParticleTexture();
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
if( warnedFor.add( state.getBlock().getRegistryName() ) )
|
||||
{
|
||||
AELog.warn( "Unable to get facade sprite particle texture fallback for blockstate %s. Supressing further warnings for this block.", state );
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return firstFound;
|
||||
}
|
||||
|
||||
|
||||
@@ -88,8 +88,23 @@ public class AutoRotatingModel implements IBakedModel
|
||||
builder.setQuadOrientation( null );
|
||||
|
||||
}
|
||||
BakedQuad q = builder.build();
|
||||
rotated.add( q );
|
||||
BakedQuad unpackedQuad = builder.build();
|
||||
|
||||
// Make a copy of it to resolve the vertex data and throw away the unpacked stuff
|
||||
// This also fixes a bug in Forge's UnpackedBakedQuad, which unpacks a byte-based normal like 0,0,-1
|
||||
// to 0,0,-0.99607843. We replace these normals with the proper 0,0,-1 when rotation, which
|
||||
// causes a bug in the AO lighter, if an unpacked quad pipes this value back to it.
|
||||
// Packing it back to the vanilla vertex format will fix this inconsistency because it converts
|
||||
// the normal back to a byte-based format, which then re-applies Forge's own bug when piping it
|
||||
// to the AO lighter, thus fixing our problem.
|
||||
BakedQuad packedQuad = new BakedQuad( unpackedQuad.getVertexData(),
|
||||
quad.getTintIndex(),
|
||||
unpackedQuad.getFace(),
|
||||
quad.getSprite(),
|
||||
quad.shouldApplyDiffuseLighting(),
|
||||
quad.getFormat()
|
||||
);
|
||||
rotated.add( packedQuad );
|
||||
}
|
||||
return rotated;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package appeng.client.render.tesr;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.model.ModelChest;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
@@ -70,14 +71,8 @@ public class SkyChestTESR extends TileEntitySpecialRenderer<TileSkyChest>
|
||||
}
|
||||
else
|
||||
{
|
||||
if( te != null )
|
||||
{
|
||||
this.bindTexture( ( (BlockSkyChest) te.getBlockType() ).type == SkyChestType.STONE ? TEXTURE_STONE : TEXTURE_BLOCK );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.bindTexture( TEXTURE_BLOCK );
|
||||
}
|
||||
SkyChestType chestType = getChestType( te );
|
||||
this.bindTexture( chestType == SkyChestType.STONE ? TEXTURE_STONE : TEXTURE_BLOCK );
|
||||
}
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
@@ -128,4 +123,20 @@ public class SkyChestTESR extends TileEntitySpecialRenderer<TileSkyChest>
|
||||
}
|
||||
}
|
||||
|
||||
// Defensively determine the sky chest type
|
||||
private static SkyChestType getChestType( TileSkyChest te )
|
||||
{
|
||||
if( te == null )
|
||||
{
|
||||
return SkyChestType.BLOCK;
|
||||
}
|
||||
|
||||
Block blockType = te.getBlockType();
|
||||
if( blockType instanceof BlockSkyChest )
|
||||
{
|
||||
return ( (BlockSkyChest) blockType ).type;
|
||||
}
|
||||
return SkyChestType.BLOCK;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ public abstract class AEBaseContainer extends Container
|
||||
final ItemStack a = stack == null ? null : stack.getItemStack();
|
||||
final ItemStack b = this.clientRequestedTargetItem == null ? null : this.clientRequestedTargetItem.getItemStack();
|
||||
|
||||
if( Platform.isSameItemPrecise( a, b ) )
|
||||
if( Platform.itemComparisons().isSameItem( a, b ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -438,13 +438,11 @@ public abstract class AEBaseContainer extends Container
|
||||
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
for( final Object crafter : this.listeners )
|
||||
for( final IContainerListener listener : this.listeners )
|
||||
{
|
||||
final IContainerListener IContainerListener = (IContainerListener) crafter;
|
||||
|
||||
for( final SyncData sd : this.syncData.values() )
|
||||
{
|
||||
sd.tick( IContainerListener );
|
||||
sd.tick( listener );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -545,7 +543,7 @@ public abstract class AEBaseContainer extends Container
|
||||
|
||||
if( !( cs.isPlayerSide() ) && cs instanceof SlotFake )
|
||||
{
|
||||
if( Platform.isSameItemPrecise( destination, tis ) )
|
||||
if( Platform.itemComparisons().isSameItem( destination, tis ) )
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -577,7 +575,7 @@ public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
final ItemStack t = d.getStack();
|
||||
|
||||
if( Platform.isSameItemPrecise( tis, t ) ) // t.isItemEqual(tis))
|
||||
if( Platform.itemComparisons().isSameItem( tis, t ) ) // t.isItemEqual(tis))
|
||||
{
|
||||
int maxSize = t.getMaxStackSize();
|
||||
if( maxSize > d.getSlotStackLimit() )
|
||||
@@ -629,7 +627,7 @@ public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
final ItemStack t = d.getStack();
|
||||
|
||||
if( Platform.isSameItemPrecise( t, tis ) )
|
||||
if( Platform.itemComparisons().isSameItem( t, tis ) )
|
||||
{
|
||||
int maxSize = t.getMaxStackSize();
|
||||
if( d.getSlotStackLimit() < maxSize )
|
||||
@@ -929,7 +927,7 @@ public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
liftQty = 0;
|
||||
}
|
||||
if( !Platform.isSameItemPrecise( slotItem.getItemStack(), item ) )
|
||||
if( !Platform.itemComparisons().isSameItem( slotItem.getItemStack(), item ) )
|
||||
{
|
||||
liftQty = 0;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IContainerListener;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
@@ -151,22 +152,24 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
this.setValidContainer( false );
|
||||
}
|
||||
|
||||
for( final Object crafter : this.listeners )
|
||||
for( final IContainerListener listener : this.listeners )
|
||||
{
|
||||
final IContainerListener IContainerListener = (IContainerListener) crafter;
|
||||
|
||||
if( this.prevStack != is )
|
||||
{
|
||||
// if the bars changed an item was probably made, so just send shit!
|
||||
for( final Object s : this.inventorySlots )
|
||||
for( final Slot s : this.inventorySlots )
|
||||
{
|
||||
if( s instanceof OptionalSlotRestrictedInput )
|
||||
{
|
||||
final OptionalSlotRestrictedInput sri = (OptionalSlotRestrictedInput) s;
|
||||
IContainerListener.sendSlotContents( this, sri.slotNumber, sri.getStack() );
|
||||
listener.sendSlotContents( this, sri.slotNumber, sri.getStack() );
|
||||
}
|
||||
}
|
||||
( (EntityPlayerMP) IContainerListener ).isChangingQuantityOnly = false;
|
||||
|
||||
if( listener instanceof EntityPlayerMP )
|
||||
{
|
||||
( (EntityPlayerMP) listener ).isChangingQuantityOnly = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
|
||||
{
|
||||
for( final ItemStack optional : AEApi.instance().registries().inscriber().getOptionals() )
|
||||
{
|
||||
if( Platform.isSameItemPrecise( optional, is ) )
|
||||
if( Platform.itemComparisons().isSameItem( optional, is ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -126,18 +126,18 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
|
||||
|
||||
for( final IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() )
|
||||
{
|
||||
final boolean matchA = ( top == null && !recipe.getTopOptional().isPresent() ) || ( Platform.isSameItemPrecise( top, recipe.getTopOptional().orElse( null ) ) ) && // and...
|
||||
( bot == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.isSameItemPrecise( bot, recipe.getBottomOptional().orElse( null ) ) );
|
||||
final boolean matchA = ( top == null && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( top, recipe.getTopOptional().orElse( null ) ) ) && // and...
|
||||
( bot == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.itemComparisons().isSameItem( bot, recipe.getBottomOptional().orElse( null ) ) );
|
||||
|
||||
final boolean matchB = ( bot == null && !recipe.getTopOptional().isPresent() ) || ( Platform.isSameItemPrecise( bot, recipe.getTopOptional().orElse( null ) ) ) && // and...
|
||||
( top == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.isSameItemPrecise( top, recipe.getBottomOptional().orElse( null ) ) );
|
||||
final boolean matchB = ( bot == null && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( bot, recipe.getTopOptional().orElse( null ) ) ) && // and...
|
||||
( top == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.itemComparisons().isSameItem( top, recipe.getBottomOptional().orElse( null ) ) );
|
||||
|
||||
if( matchA || matchB )
|
||||
{
|
||||
matches = true;
|
||||
for( final ItemStack option : recipe.getInputs() )
|
||||
{
|
||||
if( Platform.isSameItemPrecise( is, option ) )
|
||||
if( Platform.itemComparisons().isSameItem( is, option ) )
|
||||
{
|
||||
found = true;
|
||||
}
|
||||
@@ -174,13 +174,13 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
|
||||
boolean isValid = false;
|
||||
for( final IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() )
|
||||
{
|
||||
if( Platform.isSameItemPrecise( recipe.getTopOptional().orElse( null ), otherSlot ) )
|
||||
if( Platform.itemComparisons().isSameItem( recipe.getTopOptional().orElse( null ), otherSlot ) )
|
||||
{
|
||||
isValid = Platform.isSameItemPrecise( is, recipe.getBottomOptional().orElse( null ) );
|
||||
isValid = Platform.itemComparisons().isSameItem( is, recipe.getBottomOptional().orElse( null ) );
|
||||
}
|
||||
else if( Platform.isSameItemPrecise( recipe.getBottomOptional().orElse( null ), otherSlot ) )
|
||||
else if( Platform.itemComparisons().isSameItem( recipe.getBottomOptional().orElse( null ), otherSlot ) )
|
||||
{
|
||||
isValid = Platform.isSameItemPrecise( is, recipe.getTopOptional().orElse( null ) );
|
||||
isValid = Platform.itemComparisons().isSameItem( is, recipe.getTopOptional().orElse( null ) );
|
||||
}
|
||||
|
||||
if( isValid )
|
||||
|
||||
@@ -67,7 +67,7 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable
|
||||
{
|
||||
if( currentItem != null )
|
||||
{
|
||||
if( Platform.isSameItem( this.civ.getItemStack(), currentItem ) )
|
||||
if( Platform.itemComparisons().isEqualItem( this.civ.getItemStack(), currentItem ) )
|
||||
{
|
||||
this.getPlayerInv().setInventorySlotContents( this.getPlayerInv().currentItem, this.civ.getItemStack() );
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class ContainerNetworkTool extends AEBaseContainer
|
||||
{
|
||||
if( currentItem != null )
|
||||
{
|
||||
if( Platform.isSameItem( this.toolInv.getItemStack(), currentItem ) )
|
||||
if( Platform.itemComparisons().isEqualItem( this.toolInv.getItemStack(), currentItem ) )
|
||||
{
|
||||
this.getPlayerInv().setInventorySlotContents( this.getPlayerInv().currentItem, this.toolInv.getItemStack() );
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
if( output != null && !this.isPattern( output ) )
|
||||
{
|
||||
return;
|
||||
}// if nothing is there we should snag a new pattern.
|
||||
} // if nothing is there we should snag a new pattern.
|
||||
else if( output == null )
|
||||
{
|
||||
output = this.patternSlotIN.getStack();
|
||||
@@ -414,7 +414,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
|
||||
final IRecipe rr = Platform.findMatchingRecipe( real, p.worldObj );
|
||||
|
||||
if( rr == r && Platform.isSameItemPrecise( rr.getCraftingResult( real ), is ) )
|
||||
if( rr == r && Platform.itemComparisons().isSameItem( rr.getCraftingResult( real ), is ) )
|
||||
{
|
||||
final SlotCrafting sc = new SlotCrafting( p, real, this.cOut, 0, 0, 0 );
|
||||
sc.onPickupFromSlot( p, is );
|
||||
@@ -483,19 +483,19 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
{
|
||||
if( s == this.patternSlotOUT && Platform.isServer() )
|
||||
{
|
||||
for( final Object crafter : this.listeners )
|
||||
for( final IContainerListener listener : this.listeners )
|
||||
{
|
||||
final IContainerListener IContainerListener = (IContainerListener) crafter;
|
||||
|
||||
for( final Object g : this.inventorySlots )
|
||||
for( final Slot slot : this.inventorySlots )
|
||||
{
|
||||
if( g instanceof OptionalSlotFake || g instanceof SlotFakeCraftingMatrix )
|
||||
if( slot instanceof OptionalSlotFake || slot instanceof SlotFakeCraftingMatrix )
|
||||
{
|
||||
final Slot sri = (Slot) g;
|
||||
IContainerListener.sendSlotContents( this, sri.slotNumber, sri.getStack() );
|
||||
listener.sendSlotContents( this, slot.slotNumber, slot.getStack() );
|
||||
}
|
||||
}
|
||||
( (EntityPlayerMP) IContainerListener ).isChangingQuantityOnly = false;
|
||||
if( listener instanceof EntityPlayerMP )
|
||||
{
|
||||
( (EntityPlayerMP) listener ).isChangingQuantityOnly = false;
|
||||
}
|
||||
}
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
|
||||
{
|
||||
if( currentItem != null )
|
||||
{
|
||||
if( Platform.isSameItem( this.toolInv.getItemStack(), currentItem ) )
|
||||
if( Platform.itemComparisons().isEqualItem( this.toolInv.getItemStack(), currentItem ) )
|
||||
{
|
||||
this.getPlayerInv().setInventorySlotContents( this.getPlayerInv().currentItem, this.toolInv.getItemStack() );
|
||||
}
|
||||
|
||||
@@ -168,11 +168,10 @@ public class ContainerSecurityStation extends ContainerMEMonitorable implements
|
||||
this.wirelessOut.putStack( term );
|
||||
|
||||
// update the two slots in question...
|
||||
for( final Object crafter : this.listeners )
|
||||
for( final IContainerListener listener : this.listeners )
|
||||
{
|
||||
final IContainerListener IContainerListener = (IContainerListener) crafter;
|
||||
IContainerListener.sendSlotContents( this, this.wirelessIn.slotNumber, this.wirelessIn.getStack() );
|
||||
IContainerListener.sendSlotContents( this, this.wirelessOut.slotNumber, this.wirelessOut.getStack() );
|
||||
listener.sendSlotContents( this, this.wirelessIn.slotNumber, this.wirelessIn.getStack() );
|
||||
listener.sendSlotContents( this, this.wirelessOut.slotNumber, this.wirelessOut.getStack() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
|
||||
{
|
||||
if( currentItem != null )
|
||||
{
|
||||
if( Platform.isSameItem( this.tbInventory.getItemStack(), currentItem ) )
|
||||
if( Platform.itemComparisons().isEqualItem( this.tbInventory.getItemStack(), currentItem ) )
|
||||
{
|
||||
this.getPlayerInv().setInventorySlotContents( this.tbSlot, this.tbInventory.getItemStack() );
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
// update crafting matrix...
|
||||
ItemStack is = this.getStack();
|
||||
|
||||
if( is != null && Platform.isSameItem( request, is ) )
|
||||
if( is != null && Platform.itemComparisons().isEqualItem( request, is ) )
|
||||
{
|
||||
final ItemStack[] set = new ItemStack[this.getPattern().getSizeInventory()];
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ public class SlotRestrictedInput extends AppEngSlot
|
||||
|
||||
for( final ItemStack optional : AEApi.instance().registries().inscriber().getOptionals() )
|
||||
{
|
||||
if( Platform.isSameItemPrecise( optional, i ) )
|
||||
if( Platform.itemComparisons().isSameItem( optional, i ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -258,7 +258,7 @@ public class SlotRestrictedInput extends AppEngSlot
|
||||
|
||||
public static boolean isMetalIngot( final ItemStack i )
|
||||
{
|
||||
if( Platform.isSameItemPrecise( i, new ItemStack( Items.IRON_INGOT ) ) )
|
||||
if( Platform.itemComparisons().isSameItem( i, new ItemStack( Items.IRON_INGOT ) ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -267,7 +267,7 @@ public class SlotRestrictedInput extends AppEngSlot
|
||||
{
|
||||
for( final ItemStack ingot : OreDictionary.getOres( "ingot" + name ) )
|
||||
{
|
||||
if( Platform.isSameItemPrecise( i, ingot ) )
|
||||
if( Platform.itemComparisons().isSameItem( i, ingot ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -25,10 +25,10 @@ import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
@@ -113,7 +113,7 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
||||
super( configFile );
|
||||
this.configFile = configFile;
|
||||
|
||||
FMLCommonHandler.instance().bus().register( this );
|
||||
MinecraftForge.EVENT_BUS.register( this );
|
||||
|
||||
final double DEFAULT_IC2_EXCHANGE = 2.0;
|
||||
PowerUnits.EU.conversionRatio = this.get( "PowerRatios", "IC2", DEFAULT_IC2_EXCHANGE ).getDouble( DEFAULT_IC2_EXCHANGE );
|
||||
|
||||
@@ -22,7 +22,6 @@ package appeng.core;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.base.Stopwatch;
|
||||
@@ -197,10 +196,17 @@ public final class AppEng
|
||||
|
||||
if( this.exportConfig.isExportingItemNamesEnabled() )
|
||||
{
|
||||
final ExportProcess process = new ExportProcess( this.recipeDirectory, this.exportConfig );
|
||||
final Thread exportProcessThread = new Thread( process );
|
||||
if( FMLCommonHandler.instance().getSide().isClient() )
|
||||
{
|
||||
final ExportProcess process = new ExportProcess( this.recipeDirectory, this.exportConfig );
|
||||
final Thread exportProcessThread = new Thread( process );
|
||||
|
||||
this.startService( "AE2 CSV Export", exportProcessThread );
|
||||
this.startService( "AE2 CSV Export", exportProcessThread );
|
||||
}
|
||||
else
|
||||
{
|
||||
AELog.info( "Disabling item.csv export for custom recipes, since creative tab information is only available on the client." );
|
||||
}
|
||||
}
|
||||
|
||||
this.registration.initialize( event, this.recipeDirectory, this.customRecipeConfig );
|
||||
|
||||
@@ -22,7 +22,6 @@ package appeng.core;
|
||||
import java.io.File;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
@@ -30,7 +29,6 @@ import com.google.common.base.Preconditions;
|
||||
import net.minecraft.world.DimensionType;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
@@ -267,7 +265,6 @@ public final class Registration
|
||||
// "li.cil.oc.api.network.SidedEnvironment" );
|
||||
// }
|
||||
|
||||
FMLCommonHandler.instance().bus().register( TickHandler.INSTANCE );
|
||||
MinecraftForge.EVENT_BUS.register( TickHandler.INSTANCE );
|
||||
|
||||
|
||||
@@ -300,7 +297,7 @@ public final class Registration
|
||||
|
||||
this.recipeHandler.injectRecipes();
|
||||
|
||||
final PlayerStatsRegistration registration = new PlayerStatsRegistration( FMLCommonHandler.instance().bus(), AEConfig.instance );
|
||||
final PlayerStatsRegistration registration = new PlayerStatsRegistration( MinecraftForge.EVENT_BUS, AEConfig.instance );
|
||||
registration.registerAchievementHandlers();
|
||||
registration.registerAchievements();
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ public class ItemDefinition implements IItemDefinition
|
||||
@Override
|
||||
public final boolean isSameAs( final ItemStack comparableStack )
|
||||
{
|
||||
return isEnabled() && Platform.isSameItemType( comparableStack, this.maybeStack( 1 ).get() );
|
||||
return isEnabled() && Platform.itemComparisons().isEqualItemType( comparableStack, this.maybeStack( 1 ).get() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
{
|
||||
for( final IGrinderEntry gr : this.recipes )
|
||||
{
|
||||
if( Platform.isSameItemPrecise( gr.getInput(), appEngGrinderRecipe.getInput() ) )
|
||||
if( Platform.itemComparisons().isSameItem( gr.getInput(), appEngGrinderRecipe.getInput() ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -151,7 +151,7 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
{
|
||||
for( final IGrinderEntry r : this.recipes )
|
||||
{
|
||||
if( Platform.isSameItem( input, r.getInput() ) )
|
||||
if( Platform.itemComparisons().isEqualItem( input, r.getInput() ) )
|
||||
{
|
||||
this.log( "Recipe for " + input.getUnlocalizedName() + " found " + Platform.getItemDisplayName( r.getOutput() ) );
|
||||
return r;
|
||||
|
||||
@@ -52,7 +52,7 @@ public class MatterCannonAmmoRegistry implements IOreListener, IMatterCannonAmmo
|
||||
{
|
||||
for( final ItemStack o : this.DamageModifiers.keySet() )
|
||||
{
|
||||
if( Platform.isSameItem( o, is ) )
|
||||
if( Platform.itemComparisons().isEqualItem( o, is ) )
|
||||
{
|
||||
return this.DamageModifiers.get( o ).floatValue();
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
|
||||
return this.tunnels.get( is );
|
||||
}
|
||||
|
||||
if( Platform.isSameItem( is, trigger ) )
|
||||
if( Platform.itemComparisons().isEqualItem( is, trigger ) )
|
||||
{
|
||||
return this.tunnels.get( is );
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ public enum WailaText
|
||||
|
||||
DeviceOnline, DeviceOffline, DeviceMissingChannel,
|
||||
|
||||
P2PUnlinked, P2PInputOneOutput, P2PInputManyOutputs, P2POutput,
|
||||
|
||||
Locked, Unlocked, Showing,
|
||||
|
||||
Contains, Channels;
|
||||
|
||||
@@ -54,7 +54,7 @@ public class AchievementCraftingHandler
|
||||
switch( achievement.getType() )
|
||||
{
|
||||
case Craft:
|
||||
if( Platform.isSameItemPrecise( achievement.getStack(), event.crafting ) )
|
||||
if( Platform.itemComparisons().isSameItem( achievement.getStack(), event.crafting ) )
|
||||
{
|
||||
achievement.addToPlayer( event.player );
|
||||
return;
|
||||
|
||||
@@ -54,7 +54,7 @@ public class AchievementPickupHandler
|
||||
|
||||
for( final Achievements achievement : Achievements.values() )
|
||||
{
|
||||
if( achievement.getType() == AchievementType.Pickup && Platform.isSameItemPrecise( achievement.getStack(), is ) )
|
||||
if( achievement.getType() == AchievementType.Pickup && Platform.itemComparisons().isSameItem( achievement.getStack(), is ) )
|
||||
{
|
||||
achievement.addToPlayer( event.player );
|
||||
return;
|
||||
|
||||
@@ -59,7 +59,7 @@ import appeng.items.storage.ItemViewCell;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import appeng.util.prioitylist.IPartitionList;
|
||||
import appeng.util.prioritylist.IPartitionList;
|
||||
|
||||
|
||||
public class PacketJEIRecipe extends AppEngPacket
|
||||
@@ -167,7 +167,7 @@ public class PacketJEIRecipe extends AppEngPacket
|
||||
final ItemStack newItemStack = r.matches( testInv, pmp.worldObj ) ? r.getCraftingResult( testInv ) : null;
|
||||
testInv.setInventorySlotContents( x, patternItem );
|
||||
|
||||
if( newItemStack == null || !Platform.isSameItemPrecise( newItemStack, is ) )
|
||||
if( newItemStack == null || !Platform.itemComparisons().isSameItem( newItemStack, is ) )
|
||||
{
|
||||
final IAEItemStack in = AEItemStack.create( currentItem );
|
||||
if( in != null )
|
||||
|
||||
@@ -77,7 +77,7 @@ public final class EntityChargedQuartz extends AEBaseEntityItem
|
||||
this.delay++;
|
||||
|
||||
final int j = MathHelper.floor_double( this.posX );
|
||||
final int i = MathHelper.floor_double( this.posY );
|
||||
final int i = MathHelper.floor_double( (this.getEntityBoundingBox().minY + this.getEntityBoundingBox().maxY) / 2.0D );
|
||||
final int k = MathHelper.floor_double( this.posZ );
|
||||
|
||||
IBlockState state = this.worldObj.getBlockState( new BlockPos( j, i, k ) );
|
||||
@@ -119,12 +119,12 @@ public final class EntityChargedQuartz extends AEBaseEntityItem
|
||||
final ItemStack other = ( (EntityItem) e ).getEntityItem();
|
||||
if( other != null && other.stackSize > 0 )
|
||||
{
|
||||
if( Platform.isSameItem( other, new ItemStack( Items.REDSTONE ) ) )
|
||||
if( Platform.itemComparisons().isEqualItem( other, new ItemStack( Items.REDSTONE ) ) )
|
||||
{
|
||||
redstone = (EntityItem) e;
|
||||
}
|
||||
|
||||
if( Platform.isSameItem( other, new ItemStack( Items.QUARTZ ) ) )
|
||||
if( Platform.itemComparisons().isEqualItem( other, new ItemStack( Items.QUARTZ ) ) )
|
||||
{
|
||||
netherQuartz = (EntityItem) e;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public final class EntityGrowingCrystal extends EntityItem
|
||||
if( gc instanceof IGrowableCrystal ) // if it changes this just stops being an issue...
|
||||
{
|
||||
final int j = MathHelper.floor_double( this.posX );
|
||||
final int i = MathHelper.floor_double( this.posY );
|
||||
final int i = MathHelper.floor_double( (this.getEntityBoundingBox().minY + this.getEntityBoundingBox().maxY) / 2.0D );
|
||||
final int k = MathHelper.floor_double( this.posZ );
|
||||
|
||||
final IBlockState state = this.worldObj.getBlockState( new BlockPos( j, i, k ) );
|
||||
|
||||
@@ -21,12 +21,11 @@ package appeng.facade;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -121,10 +120,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
||||
return true;
|
||||
}
|
||||
|
||||
final ItemStack is = this.getTextureItem();
|
||||
final Block blk = Block.getBlockFromItem( is.getItem() );
|
||||
|
||||
return !blk.isOpaqueCube( blk.getDefaultState() );
|
||||
return this.getBlockState().isOpaqueCube();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -147,25 +143,17 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
||||
@Override
|
||||
public IBlockState getBlockState()
|
||||
{
|
||||
ItemStack itemStack = getTextureItem();
|
||||
final Item maybeFacade = this.facade.getItem();
|
||||
|
||||
if( !(itemStack.getItem() instanceof ItemBlock ) )
|
||||
// AE Facade
|
||||
if( maybeFacade instanceof IFacadeItem )
|
||||
{
|
||||
return null;
|
||||
final IFacadeItem facade = (IFacadeItem) maybeFacade;
|
||||
|
||||
return facade.getTextureBlockState( this.facade );
|
||||
}
|
||||
|
||||
ItemBlock itemBlock = (ItemBlock) itemStack.getItem();
|
||||
|
||||
// Try to get the block state based on the item stack's meta. If this fails, don't consider it for a facade
|
||||
// This for example fails for Pistons because they hardcoded an invalid meta value in vanilla
|
||||
try
|
||||
{
|
||||
return itemBlock.getBlock().getStateFromMeta( itemStack.getItemDamage() );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return Blocks.GLASS.getDefaultState();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package appeng.facade;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
@@ -32,7 +32,6 @@ public interface IFacadeItem
|
||||
|
||||
ItemStack getTextureItem( ItemStack is );
|
||||
|
||||
int getMeta( ItemStack is );
|
||||
IBlockState getTextureBlockState( ItemStack is );
|
||||
|
||||
Block getBlock( ItemStack is );
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
{
|
||||
final ItemStack testOutput = this.standardRecipe.getCraftingResult( this.testFrame );
|
||||
|
||||
if( Platform.isSameItemPrecise( this.correctOutput, testOutput ) )
|
||||
if( Platform.itemComparisons().isSameItem( this.correctOutput, testOutput ) )
|
||||
{
|
||||
this.testFrame.setInventorySlotContents( slotIndex, this.crafting.getStackInSlot( slotIndex ) );
|
||||
this.markItemAs( slotIndex, i, TestStatus.ACCEPT );
|
||||
@@ -256,7 +256,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
{
|
||||
final ItemStack testOutput = CraftingManager.getInstance().findMatchingRecipe( this.testFrame, w );
|
||||
|
||||
if( Platform.isSameItemPrecise( this.correctOutput, testOutput ) )
|
||||
if( Platform.itemComparisons().isSameItem( this.correctOutput, testOutput ) )
|
||||
{
|
||||
this.testFrame.setInventorySlotContents( slotIndex, this.crafting.getStackInSlot( slotIndex ) );
|
||||
this.markItemAs( slotIndex, i, TestStatus.ACCEPT );
|
||||
|
||||
@@ -20,17 +20,11 @@ package appeng.integration.abstraction;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
|
||||
public interface IIC2
|
||||
{
|
||||
|
||||
void addToEnergyNet( TileEntity appEngTile );
|
||||
|
||||
void removeFromEnergyNet( TileEntity appEngTile );
|
||||
|
||||
ItemStack getItem( String string );
|
||||
|
||||
void maceratorRecipe( ItemStack in, ItemStack out );
|
||||
|
||||
}
|
||||
|
||||
@@ -21,22 +21,36 @@ package appeng.integration.modules;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import ic2.api.recipe.RecipeInputItemStack;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.TunnelType;
|
||||
import appeng.api.features.IP2PTunnelRegistry;
|
||||
import appeng.helpers.Reflected;
|
||||
import appeng.integration.IIntegrationModule;
|
||||
import appeng.integration.IntegrationHelper;
|
||||
import appeng.integration.abstraction.IIC2;
|
||||
import appeng.integration.modules.ic2.IC2PowerSink;
|
||||
import appeng.integration.modules.ic2.IC2PowerSinkAdapter;
|
||||
import appeng.integration.modules.ic2.IC2PowerSinkStub;
|
||||
import appeng.tile.powersink.IExternalPowerSink;
|
||||
|
||||
|
||||
public class IC2 implements IIntegrationModule
|
||||
public class IC2 implements IIntegrationModule, IIC2
|
||||
{
|
||||
|
||||
@Reflected
|
||||
public static IC2 instance;
|
||||
|
||||
public IC2()
|
||||
{
|
||||
IntegrationHelper.testClassExistence( this, ic2.api.energy.tile.IEnergyTile.class );
|
||||
IntegrationHelper.testClassExistence( this, ic2.api.recipe.RecipeInputItemStack.class );
|
||||
}
|
||||
|
||||
private static BiFunction<TileEntity, IExternalPowerSink, IC2PowerSink> powerSinkFactory = ( ( te, sink ) -> IC2PowerSinkStub.INSTANCE );
|
||||
|
||||
@Override
|
||||
@@ -48,6 +62,23 @@ public class IC2 implements IIntegrationModule
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
final IP2PTunnelRegistry reg = AEApi.instance().registries().p2pTunnel();
|
||||
reg.addNewAttunement( this.getItem( "copperCableItem" ), TunnelType.IC2_POWER );
|
||||
reg.addNewAttunement( this.getItem( "insulatedCopperCableItem" ), TunnelType.IC2_POWER );
|
||||
reg.addNewAttunement( this.getItem( "goldCableItem" ), TunnelType.IC2_POWER );
|
||||
reg.addNewAttunement( this.getItem( "insulatedGoldCableItem" ), TunnelType.IC2_POWER );
|
||||
reg.addNewAttunement( this.getItem( "ironCableItem" ), TunnelType.IC2_POWER );
|
||||
reg.addNewAttunement( this.getItem( "insulatedIronCableItem" ), TunnelType.IC2_POWER );
|
||||
reg.addNewAttunement( this.getItem( "insulatedTinCableItem" ), TunnelType.IC2_POWER );
|
||||
reg.addNewAttunement( this.getItem( "glassFiberCableItem" ), TunnelType.IC2_POWER );
|
||||
reg.addNewAttunement( this.getItem( "tinCableItem" ), TunnelType.IC2_POWER );
|
||||
reg.addNewAttunement( this.getItem( "detectorCableItem" ), TunnelType.IC2_POWER );
|
||||
reg.addNewAttunement( this.getItem( "splitterCableItem" ), TunnelType.IC2_POWER );
|
||||
}
|
||||
|
||||
public ItemStack getItem( final String name )
|
||||
{
|
||||
return ic2.api.item.IC2Items.getItem( name );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,4 +88,11 @@ public class IC2 implements IIntegrationModule
|
||||
{
|
||||
return powerSinkFactory.apply( tileEntity, externalSink );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void maceratorRecipe( ItemStack in, ItemStack out )
|
||||
{
|
||||
ic2.api.recipe.Recipes.macerator.addRecipe( new RecipeInputItemStack( in, in.stackSize ), null, false, out );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.integration.modules.waila.part.ChannelWailaDataProvider;
|
||||
import appeng.integration.modules.waila.part.IPartWailaDataProvider;
|
||||
import appeng.integration.modules.waila.part.P2PStateWailaDataProvider;
|
||||
import appeng.integration.modules.waila.part.PartAccessor;
|
||||
import appeng.integration.modules.waila.part.PartStackWailaDataProvider;
|
||||
import appeng.integration.modules.waila.part.PowerStateWailaDataProvider;
|
||||
@@ -78,9 +79,10 @@ public final class PartWailaDataProvider implements IWailaDataProvider
|
||||
final IPartWailaDataProvider channel = new ChannelWailaDataProvider();
|
||||
final IPartWailaDataProvider storageMonitor = new StorageMonitorWailaDataProvider();
|
||||
final IPartWailaDataProvider powerState = new PowerStateWailaDataProvider();
|
||||
final IPartWailaDataProvider p2pState = new P2PStateWailaDataProvider();
|
||||
final IPartWailaDataProvider partStack = new PartStackWailaDataProvider();
|
||||
|
||||
this.providers = Lists.newArrayList( channel, storageMonitor, powerState, partStack );
|
||||
this.providers = Lists.newArrayList( channel, storageMonitor, powerState, partStack, p2pState );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.waila.part;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Iterators;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.core.localization.WailaText;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.parts.p2p.PartP2PTunnel;
|
||||
|
||||
|
||||
/**
|
||||
* Provides information about a P2P tunnel to WAILA.
|
||||
*/
|
||||
public final class P2PStateWailaDataProvider extends BasePartWailaDataProvider
|
||||
{
|
||||
|
||||
private static final int STATE_UNLINKED = 0;
|
||||
private static final int STATE_OUTPUT = 1;
|
||||
private static final int STATE_INPUT = 2;
|
||||
public static final String TAG_P2P_STATE = "p2p_state";
|
||||
|
||||
/**
|
||||
* Adds state to the tooltip
|
||||
*
|
||||
* @param part part with state
|
||||
* @param currentToolTip to be added to tooltip
|
||||
* @param accessor wrapper for various information
|
||||
* @param config config settings
|
||||
*
|
||||
* @return modified tooltip
|
||||
*/
|
||||
@Override
|
||||
public List<String> getWailaBody( final IPart part, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
{
|
||||
if( part instanceof PartP2PTunnel )
|
||||
{
|
||||
NBTTagCompound nbtData = accessor.getNBTData();
|
||||
if( nbtData.hasKey( TAG_P2P_STATE ) )
|
||||
{
|
||||
int[] stateArr = nbtData.getIntArray( TAG_P2P_STATE );
|
||||
if( stateArr.length == 2 )
|
||||
{
|
||||
int state = stateArr[0];
|
||||
int outputs = stateArr[1];
|
||||
|
||||
switch( state )
|
||||
{
|
||||
case STATE_UNLINKED:
|
||||
currentToolTip.add( WailaText.P2PUnlinked.getLocal() );
|
||||
break;
|
||||
case STATE_OUTPUT:
|
||||
currentToolTip.add( WailaText.P2POutput.getLocal() );
|
||||
break;
|
||||
case STATE_INPUT:
|
||||
currentToolTip.add( getOutputText( outputs ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData( EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound tag, World world, BlockPos pos )
|
||||
{
|
||||
if( part instanceof PartP2PTunnel )
|
||||
{
|
||||
PartP2PTunnel tunnel = (PartP2PTunnel) part;
|
||||
|
||||
// The default state
|
||||
int state = STATE_UNLINKED;
|
||||
int outputCount = 0;
|
||||
|
||||
if( !tunnel.isOutput() )
|
||||
{
|
||||
outputCount = getOutputCount( tunnel );
|
||||
if( outputCount > 0 )
|
||||
{
|
||||
// Only set it to INPUT if we know there are any outputs
|
||||
state = STATE_INPUT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PartP2PTunnel input = tunnel.getInput();
|
||||
if( input != null )
|
||||
{
|
||||
state = STATE_OUTPUT;
|
||||
}
|
||||
}
|
||||
|
||||
tag.setIntArray( TAG_P2P_STATE, new int[] {
|
||||
state,
|
||||
outputCount
|
||||
} );
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
private static int getOutputCount( PartP2PTunnel tunnel )
|
||||
{
|
||||
try
|
||||
{
|
||||
return Iterators.size( tunnel.getOutputs().iterator() );
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
{
|
||||
// Well... unknown size it is!
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private static String getOutputText( int outputs )
|
||||
{
|
||||
if( outputs <= 1 )
|
||||
{
|
||||
return WailaText.P2PInputOneOutput.getLocal();
|
||||
}
|
||||
else
|
||||
{
|
||||
return String.format( WailaText.P2PInputManyOutputs.getLocal(), outputs );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,7 +42,6 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.exceptions.MissingDefinition;
|
||||
@@ -59,6 +58,9 @@ import appeng.items.AEBaseItem;
|
||||
public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassItem
|
||||
{
|
||||
|
||||
private static final String TAG_ITEM_ID = "item";
|
||||
private static final String TAG_DAMAGE = "damage";
|
||||
|
||||
private List<ItemStack> subTypes = null;
|
||||
|
||||
public ItemFacade()
|
||||
@@ -109,6 +111,10 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
try
|
||||
{
|
||||
final Item item = Item.getItemFromBlock( b );
|
||||
if( item == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final List<ItemStack> tmpList = new ArrayList<ItemStack>( 100 );
|
||||
b.getSubBlocks( item, b.getCreativeTabToDisplayOn(), tmpList );
|
||||
@@ -186,13 +192,8 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
|
||||
final ItemStack is = new ItemStack( this );
|
||||
final NBTTagCompound data = new NBTTagCompound();
|
||||
final int[] ds = new int[2];
|
||||
ds[0] = Item.getIdFromItem( l.getItem() );
|
||||
ds[1] = metadata;
|
||||
data.setIntArray( "x", ds );
|
||||
final ResourceLocation ui = Item.REGISTRY.getNameForObject( l.getItem() );
|
||||
data.setString( "modid", ui.getResourceDomain() );
|
||||
data.setString( "itemname", ui.getResourcePath() );
|
||||
data.setString( TAG_ITEM_ID, l.getItem().getRegistryName().toString() );
|
||||
data.setInteger( TAG_DAMAGE, l.getItemDamage() );
|
||||
is.setTagCompound( data );
|
||||
return is;
|
||||
}
|
||||
@@ -211,56 +212,82 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getTextureItem( final ItemStack is )
|
||||
public ItemStack getTextureItem( ItemStack is )
|
||||
{
|
||||
final Block blk = this.getBlock( is );
|
||||
if( blk != null )
|
||||
|
||||
NBTTagCompound nbt = is.getTagCompound();
|
||||
|
||||
if( nbt == null )
|
||||
{
|
||||
return new ItemStack( blk, 1, this.getMeta( is ) );
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
|
||||
ResourceLocation itemId;
|
||||
int itemDamage;
|
||||
|
||||
// Handle legacy facades
|
||||
if( nbt.hasKey( "x" ) )
|
||||
{
|
||||
int[] data = nbt.getIntArray( "x" );
|
||||
if( data.length != 2 )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Item item = Item.REGISTRY.getObjectById( data[0] );
|
||||
if ( item == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
itemId = item.getRegistryName();
|
||||
itemDamage = data[1];
|
||||
} else {
|
||||
// First item is numeric item id, second is damage
|
||||
itemId = new ResourceLocation( nbt.getString( TAG_ITEM_ID ) );
|
||||
itemDamage = nbt.getInteger( TAG_DAMAGE );
|
||||
}
|
||||
|
||||
Item baseItem = Item.REGISTRY.getObject( itemId );
|
||||
|
||||
if( baseItem == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ItemStack( baseItem, 1, itemDamage );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMeta( final ItemStack is )
|
||||
public IBlockState getTextureBlockState( ItemStack is )
|
||||
{
|
||||
final NBTTagCompound data = is.getTagCompound();
|
||||
if( data != null )
|
||||
{
|
||||
final int[] blk = data.getIntArray( "x" );
|
||||
if( blk != null && blk.length == 2 )
|
||||
{
|
||||
return blk[1];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getBlock( final ItemStack is )
|
||||
{
|
||||
final NBTTagCompound data = is.getTagCompound();
|
||||
if( data != null )
|
||||
{
|
||||
if( data.hasKey( "modid" ) && data.hasKey( "itemname" ) )
|
||||
{
|
||||
if( data.getString( "modid" ).equals( "minecraft" ) )
|
||||
{
|
||||
return Block.getBlockFromName( data.getString( "itemname" ) );
|
||||
}
|
||||
ItemStack baseItemStack = getTextureItem( is );
|
||||
|
||||
return GameRegistry.findBlock( data.getString( "modid" ), data.getString( "itemname" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
final int[] blk = data.getIntArray( "x" );
|
||||
if( blk != null && blk.length == 2 )
|
||||
{
|
||||
return Block.getBlockById( blk[0] );
|
||||
}
|
||||
}
|
||||
if( baseItemStack == null )
|
||||
{
|
||||
return Blocks.GLASS.getDefaultState();
|
||||
}
|
||||
return Blocks.GLASS;
|
||||
|
||||
Block block = Block.getBlockFromItem( baseItemStack.getItem() );
|
||||
|
||||
if( block == null )
|
||||
{
|
||||
return Blocks.GLASS.getDefaultState();
|
||||
}
|
||||
|
||||
int metadata = baseItemStack.getItem().getMetadata( baseItemStack );
|
||||
|
||||
try
|
||||
{
|
||||
return block.getStateFromMeta( metadata );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
AELog.warn( "Block %s has broken getStateFromMeta method for meta %d", block.getRegistryName().toString(), baseItemStack.getItemDamage() );
|
||||
return Blocks.GLASS.getDefaultState();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<ItemStack> getFacades()
|
||||
@@ -284,8 +311,15 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
ItemStack facadeStack = AEApi.instance().definitions().items().facade().maybeStack( 1 )
|
||||
.orElseThrow( () -> new MissingDefinition( "Tried to create a facade, while facades are being deactivated." ) );
|
||||
|
||||
// Convert back to a registry name...
|
||||
Item item = Item.REGISTRY.getObjectById( ids[0] );
|
||||
if ( item == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final NBTTagCompound facadeTag = new NBTTagCompound();
|
||||
facadeTag.setIntArray( "x", ids.clone() );
|
||||
facadeTag.setString( TAG_ITEM_ID, item.getRegistryName().toString() );
|
||||
facadeTag.setInteger( TAG_DAMAGE, ids[1] );
|
||||
facadeStack.setTagCompound( facadeTag );
|
||||
|
||||
return facadeStack;
|
||||
@@ -294,19 +328,14 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
@Override
|
||||
public boolean useAlphaPass( final ItemStack is )
|
||||
{
|
||||
final ItemStack out = this.getTextureItem( is );
|
||||
IBlockState blockState = this.getTextureBlockState( is );
|
||||
|
||||
if( out == null || out.getItem() == null )
|
||||
if( blockState == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final Block blk = Block.getBlockFromItem( out.getItem() );
|
||||
if( blk != null && blk.canRenderInLayer( BlockRenderLayer.TRANSLUCENT ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
Block blk = blockState.getBlock();
|
||||
return blk.canRenderInLayer( BlockRenderLayer.TRANSLUCENT );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,10 +34,10 @@ import appeng.items.contents.CellConfig;
|
||||
import appeng.items.contents.CellUpgrades;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import appeng.util.prioitylist.FuzzyPriorityList;
|
||||
import appeng.util.prioitylist.IPartitionList;
|
||||
import appeng.util.prioitylist.MergedPriorityList;
|
||||
import appeng.util.prioitylist.PrecisePriorityList;
|
||||
import appeng.util.prioritylist.FuzzyPriorityList;
|
||||
import appeng.util.prioritylist.IPartitionList;
|
||||
import appeng.util.prioritylist.MergedPriorityList;
|
||||
import appeng.util.prioritylist.PrecisePriorityList;
|
||||
|
||||
|
||||
public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
|
||||
|
||||
@@ -27,6 +27,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.PowerUnits;
|
||||
@@ -145,27 +146,6 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
|
||||
return currentStorage;
|
||||
}
|
||||
|
||||
/**
|
||||
* inject external
|
||||
*/
|
||||
double injectExternalPower( final PowerUnits input, final ItemStack is, final double amount, final boolean simulate )
|
||||
{
|
||||
if( simulate )
|
||||
{
|
||||
final int requiredEU = (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( is ) - this.getAECurrentPower( is ) );
|
||||
if( amount < requiredEU )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return amount - requiredEU;
|
||||
}
|
||||
else
|
||||
{
|
||||
final double powerRemainder = this.injectAEPower( is, PowerUnits.EU.convertTo( PowerUnits.AE, amount ) );
|
||||
return PowerUnits.AE.convertTo( PowerUnits.EU, powerRemainder );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double injectAEPower( final ItemStack is, final double amt )
|
||||
{
|
||||
@@ -196,6 +176,12 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
|
||||
return AccessRestriction.WRITE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICapabilityProvider initCapabilities( ItemStack stack, NBTTagCompound nbt )
|
||||
{
|
||||
return new PoweredItemCapabilities( stack, this );
|
||||
}
|
||||
|
||||
private enum batteryOperation
|
||||
{
|
||||
STORAGE, INJECT, EXTRACT
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.items.tools.powered.powersink;
|
||||
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.darkhax.tesla.api.ITeslaConsumer;
|
||||
import net.darkhax.tesla.api.ITeslaHolder;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||
import appeng.capabilities.Capabilities;
|
||||
|
||||
|
||||
/**
|
||||
* The capability provider to expose chargable items to other mods.
|
||||
*/
|
||||
class PoweredItemCapabilities implements ICapabilityProvider, IEnergyStorage
|
||||
{
|
||||
|
||||
private final ItemStack is;
|
||||
|
||||
private final IAEItemPowerStorage item;
|
||||
|
||||
private final Object teslaAdapter;
|
||||
|
||||
PoweredItemCapabilities( ItemStack is, IAEItemPowerStorage item )
|
||||
{
|
||||
this.is = is;
|
||||
this.item = item;
|
||||
if( Capabilities.TESLA_CONSUMER != null || Capabilities.TESLA_HOLDER != null )
|
||||
{
|
||||
this.teslaAdapter = new TeslaAdapter();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.teslaAdapter = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability( Capability<?> capability, @Nullable EnumFacing facing )
|
||||
{
|
||||
return capability == CapabilityEnergy.ENERGY
|
||||
|| capability == Capabilities.TESLA_CONSUMER
|
||||
|| capability == Capabilities.TESLA_HOLDER;
|
||||
}
|
||||
|
||||
@SuppressWarnings( "unchecked" )
|
||||
@Override
|
||||
public <T> T getCapability( Capability<T> capability, @Nullable EnumFacing facing )
|
||||
{
|
||||
if( capability == CapabilityEnergy.ENERGY )
|
||||
{
|
||||
return (T) this;
|
||||
}
|
||||
else if( capability == Capabilities.TESLA_CONSUMER || capability == Capabilities.TESLA_HOLDER )
|
||||
{
|
||||
return (T) teslaAdapter;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int receiveEnergy( int maxReceive, boolean simulate )
|
||||
{
|
||||
|
||||
if( simulate )
|
||||
{
|
||||
final int required = (int) PowerUnits.AE.convertTo( PowerUnits.RF, item.getAEMaxPower( is ) - item.getAECurrentPower( is ) );
|
||||
if( maxReceive < required )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return maxReceive - required;
|
||||
}
|
||||
else
|
||||
{
|
||||
final double powerRemainder = item.injectAEPower( is, PowerUnits.RF.convertTo( PowerUnits.AE, maxReceive ) );
|
||||
return (int) PowerUnits.AE.convertTo( PowerUnits.RF, powerRemainder );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy( int maxExtract, boolean simulate )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored()
|
||||
{
|
||||
return (int) PowerUnits.AE.convertTo( PowerUnits.RF, item.getAECurrentPower( is ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored()
|
||||
{
|
||||
return (int) PowerUnits.AE.convertTo( PowerUnits.RF, item.getAEMaxPower( is ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtract()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReceive()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private class TeslaAdapter implements ITeslaConsumer, ITeslaHolder
|
||||
{
|
||||
|
||||
@Override
|
||||
public long givePower( long power, boolean simulated )
|
||||
{
|
||||
return receiveEnergy( (int) power, simulated );
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getStoredPower()
|
||||
{
|
||||
return getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getCapacity()
|
||||
{
|
||||
return getMaxEnergyStored();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.items.tools.powered.powersink;
|
||||
|
||||
|
||||
//import java.util.Optional;
|
||||
//
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//
|
||||
//import cofh.api.energy.IEnergyContainerItem;
|
||||
//
|
||||
//import appeng.api.config.PowerUnits;
|
||||
//import appeng.integration.IntegrationType;
|
||||
//import appeng.transformer.annotations.Integration.Interface;
|
||||
//
|
||||
//
|
||||
//@Interface( iface = "cofh.api.energy.IEnergyContainerItem", iname = IntegrationType.RFItem )
|
||||
//public abstract class RedstoneFlux extends IC2 implements IEnergyContainerItem
|
||||
//{
|
||||
// public RedstoneFlux( double powerCapacity, Optional<String> subName )
|
||||
// {
|
||||
// super( powerCapacity, subName );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int receiveEnergy( ItemStack is, int maxReceive, boolean simulate )
|
||||
// {
|
||||
// return maxReceive - (int) this.injectExternalPower( PowerUnits.RF, is, maxReceive, simulate );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int extractEnergy( ItemStack container, int maxExtract, boolean simulate )
|
||||
// {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getEnergyStored( ItemStack is )
|
||||
// {
|
||||
// return (int) PowerUnits.AE.convertTo( PowerUnits.RF, this.getAECurrentPower( is ) );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getMaxEnergyStored( ItemStack is )
|
||||
// {
|
||||
// return (int) PowerUnits.AE.convertTo( PowerUnits.RF, this.getAEMaxPower( is ) );
|
||||
// }
|
||||
// }
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.items.tools.powered.powersink;
|
||||
|
||||
|
||||
/*
|
||||
@Interface(iface = "universalelectricity.core.item.IItemElectric", modid = "IC2")
|
||||
public class UniversalElectricity extends ThermalExpansion implements IItemElectric
|
||||
{
|
||||
*
|
||||
* public UniversalElectricity(Class c, String subName) { super( c, subName ); }
|
||||
*
|
||||
* @Override public float recharge(ItemStack is, float energy, boolean
|
||||
* doRecharge) { return (float) (energy - injectExternalPower( PowerUnits.KJ,
|
||||
* is, energy, !doRecharge )); }
|
||||
*
|
||||
* @Override public float discharge(ItemStack is, float energy, boolean
|
||||
* doDischarge) { return 0; }
|
||||
*
|
||||
* @Override public float getElectricityStored(ItemStack is) { return (int)
|
||||
* PowerUnits.AE.convertTo( PowerUnits.KJ, getAECurrentPower( is ) ); }
|
||||
*
|
||||
* @Override public float getMaxElectricityStored(ItemStack is) { return (int)
|
||||
* PowerUnits.AE.convertTo( PowerUnits.KJ, getAEMaxPower( is ) ); }
|
||||
*
|
||||
* @Override public void setElectricity(ItemStack is, float joules) { double
|
||||
* currentPower = getAECurrentPower( is ); double targetPower =
|
||||
* PowerUnits.KJ.convertTo( PowerUnits.AE, joules ); if ( targetPower >
|
||||
* currentPower ) injectAEPower( is, targetPower - currentPower ); else
|
||||
* extractAEPower( is, currentPower - targetPower ); }
|
||||
*
|
||||
* @Override public float getTransfer(ItemStack is) { return (float)
|
||||
* PowerUnits.AE.convertTo( PowerUnits.KJ, getAEMaxPower( is ) -
|
||||
* getAECurrentPower( is ) ); }
|
||||
*
|
||||
* @Override public float getVoltage(ItemStack itemStack) { return 120; }
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -36,8 +36,8 @@ import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import appeng.util.prioitylist.FuzzyPriorityList;
|
||||
import appeng.util.prioitylist.PrecisePriorityList;
|
||||
import appeng.util.prioritylist.FuzzyPriorityList;
|
||||
import appeng.util.prioritylist.PrecisePriorityList;
|
||||
|
||||
|
||||
public class CellInventoryHandler extends MEInventoryHandler<IAEItemStack> implements ICellInventoryHandler
|
||||
|
||||
@@ -28,8 +28,8 @@ import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.util.prioitylist.DefaultPriorityList;
|
||||
import appeng.util.prioitylist.IPartitionList;
|
||||
import appeng.util.prioritylist.DefaultPriorityList;
|
||||
import appeng.util.prioritylist.IPartitionList;
|
||||
|
||||
|
||||
public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHandler<T>
|
||||
|
||||
@@ -237,7 +237,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>, ITickingMo
|
||||
return true;
|
||||
}
|
||||
|
||||
return !Platform.isSameItemPrecise( a, b );
|
||||
return !Platform.itemComparisons().isSameItem( a, b );
|
||||
}
|
||||
|
||||
private void postDifference( final Iterable<IAEItemStack> a )
|
||||
|
||||
@@ -1066,7 +1066,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
|
||||
final ItemStack current = p == null ? null : p.getItemStack( PartItemStack.WORLD );
|
||||
|
||||
if( Platform.isSameItemType( iss, current ) )
|
||||
if( Platform.itemComparisons().isEqualItemType( iss, current ) )
|
||||
{
|
||||
p.readFromNBT( extra );
|
||||
}
|
||||
|
||||
@@ -172,6 +172,7 @@ public class PartPlacement
|
||||
{
|
||||
if( host.getFacadeContainer().addFacade( fp ) )
|
||||
{
|
||||
host.markForSave();
|
||||
host.markForUpdate();
|
||||
if( !player.capabilities.isCreativeMode )
|
||||
{
|
||||
|
||||
@@ -135,6 +135,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
||||
}
|
||||
|
||||
bch.addBox( 5, 5, 14, 11, 11, 15 );
|
||||
// The smaller collision hitbox here is needed to allow for the entity collision event
|
||||
bch.addBox( minX, minY, 15, maxX, maxY, bch.isBBCollision() ? 15 : 16 );
|
||||
}
|
||||
|
||||
@@ -232,6 +233,9 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
||||
boolean capture = false;
|
||||
final BlockPos pos = this.getTile().getPos();
|
||||
|
||||
// This is the middle point of the entities BB, which is better suited for comparisons that don't rely on it "touching" the plane
|
||||
double posYMiddle = (entity.getEntityBoundingBox().minY + entity.getEntityBoundingBox().maxY) / 2.0D;
|
||||
|
||||
switch( this.getSide() )
|
||||
{
|
||||
case DOWN:
|
||||
@@ -251,7 +255,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
||||
case NORTH:
|
||||
if( entity.posX > pos.getX() && entity.posX < pos.getX() + 1 )
|
||||
{
|
||||
if( entity.posY > pos.getY() && entity.posY < pos.getY() + 1 )
|
||||
if( posYMiddle > pos.getY() && posYMiddle < pos.getY() + 1 )
|
||||
{
|
||||
if( ( entity.posZ > pos.getZ() + 0.9 && this.getSide() == AEPartLocation.SOUTH ) || ( entity.posZ < pos.getZ() + 0.1 && this.getSide() == AEPartLocation.NORTH ) )
|
||||
{
|
||||
@@ -264,7 +268,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
||||
case WEST:
|
||||
if( entity.posZ > pos.getZ() && entity.posZ < pos.getZ() + 1 )
|
||||
{
|
||||
if( entity.posY > pos.getY() && entity.posY < pos.getY() + 1 )
|
||||
if( posYMiddle > pos.getY() && posYMiddle < pos.getY() + 1 )
|
||||
{
|
||||
if( ( entity.posX > pos.getX() + 0.9 && this.getSide() == AEPartLocation.EAST ) || ( entity.posX < pos.getX() + 0.1 && this.getSide() == AEPartLocation.WEST ) )
|
||||
{
|
||||
|
||||
@@ -80,8 +80,8 @@ import appeng.me.storage.MEInventoryHandler;
|
||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.prioitylist.FuzzyPriorityList;
|
||||
import appeng.util.prioitylist.PrecisePriorityList;
|
||||
import appeng.util.prioritylist.FuzzyPriorityList;
|
||||
import appeng.util.prioritylist.PrecisePriorityList;
|
||||
|
||||
|
||||
public class PartFormationPlane extends PartUpgradeable implements ICellContainer, IPriorityHost, IMEInventory<IAEItemStack>
|
||||
|
||||
@@ -43,7 +43,7 @@ public class StackUpgradeInventory extends UpgradeInventory
|
||||
|
||||
for( final ItemStack is : upgrades.getSupported().keySet() )
|
||||
{
|
||||
if( Platform.isSameItem( this.stack, is ) )
|
||||
if( Platform.itemComparisons().isEqualItem( this.stack, is ) )
|
||||
{
|
||||
max = upgrades.getSupported().get( is );
|
||||
break;
|
||||
|
||||
@@ -111,7 +111,7 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
|
||||
{
|
||||
ItemStack sub = itemHandler.getStackInSlot( i );
|
||||
|
||||
if( !Platform.isSameItem( sub, req ) )
|
||||
if( !Platform.itemComparisons().isSameItem( sub, req ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -275,7 +275,7 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
|
||||
return false;
|
||||
}
|
||||
|
||||
return a == null || b == null || !Platform.isSameItemPrecise( a, b );
|
||||
return a == null || b == null || !Platform.itemComparisons().isSameItem( a, b );
|
||||
}
|
||||
|
||||
private void postDifference( Iterable<IAEItemStack> a )
|
||||
|
||||
@@ -88,8 +88,8 @@ import appeng.parts.automation.PartUpgradeable;
|
||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.prioitylist.FuzzyPriorityList;
|
||||
import appeng.util.prioitylist.PrecisePriorityList;
|
||||
import appeng.util.prioritylist.FuzzyPriorityList;
|
||||
import appeng.util.prioritylist.PrecisePriorityList;
|
||||
|
||||
|
||||
public class PartStorageBus extends PartUpgradeable implements IGridTickable, ICellContainer, IMEMonitorHandlerReceiver<IAEItemStack>, IPriorityHost
|
||||
|
||||
@@ -100,7 +100,7 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
|
||||
final TileEntity te = this.getTile();
|
||||
final World w = te.getWorld();
|
||||
|
||||
final int newLevel = w.getLight( te.getPos().offset( this.getSide().getFacing() ) );
|
||||
final int newLevel = w.getLightFromNeighbors( te.getPos().offset( this.getSide().getFacing() ) );
|
||||
|
||||
if( this.lastValue != newLevel && this.getProxy().isActive() )
|
||||
{
|
||||
|
||||
@@ -73,7 +73,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
return null;
|
||||
}
|
||||
|
||||
T getInput()
|
||||
public T getInput()
|
||||
{
|
||||
if( this.getFrequency() == 0 )
|
||||
{
|
||||
@@ -95,7 +95,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
return null;
|
||||
}
|
||||
|
||||
TunnelCollection<T> getOutputs() throws GridAccessException
|
||||
public TunnelCollection<T> getOutputs() throws GridAccessException
|
||||
{
|
||||
if( this.getProxy().isActive() )
|
||||
{
|
||||
@@ -270,7 +270,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
break;
|
||||
}
|
||||
|
||||
if( newType != null && !Platform.isSameItem( newType, this.getItemStack() ) )
|
||||
if( newType != null && !Platform.itemComparisons().isEqualItem( newType, this.getItemStack() ) )
|
||||
{
|
||||
final boolean oldOutput = this.isOutput();
|
||||
final long myFreq = this.getFrequency();
|
||||
|
||||
@@ -79,7 +79,7 @@ public class Ingredient implements IIngredient
|
||||
{
|
||||
int sel = 0;
|
||||
|
||||
if( this.nameSpace.equals( "oreDictionary" ) )
|
||||
if( this.nameSpace.equalsIgnoreCase( "oreDictionary" ) )
|
||||
{
|
||||
if( parts.length == 3 )
|
||||
{
|
||||
|
||||
@@ -32,7 +32,6 @@ import java.util.Map.Entry;
|
||||
import java.util.Optional;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
@@ -371,65 +370,52 @@ public class RecipeHandler implements IRecipeHandler
|
||||
}
|
||||
|
||||
final Map<Class, Integer> processed = new HashMap<Class, Integer>();
|
||||
try
|
||||
for( final ICraftHandler ch : this.data.handlers )
|
||||
{
|
||||
for( final ICraftHandler ch : this.data.handlers )
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
ch.register();
|
||||
ch.register();
|
||||
|
||||
final Class clz = ch.getClass();
|
||||
final Integer i = processed.get( clz );
|
||||
if( i == null )
|
||||
{
|
||||
processed.put( clz, 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
processed.put( clz, i + 1 );
|
||||
}
|
||||
}
|
||||
catch( final RegistrationError e )
|
||||
final Class clz = ch.getClass();
|
||||
final Integer i = processed.get( clz );
|
||||
if( i == null )
|
||||
{
|
||||
AELog.warn( "Unable to register a recipe: " + e.getMessage() );
|
||||
processed.put( clz, 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
processed.put( clz, i + 1 );
|
||||
}
|
||||
}
|
||||
catch( final MissingIngredientError e )
|
||||
{
|
||||
if( this.data.errorOnMissing )
|
||||
{
|
||||
AELog.warn( "Unable to register a recipe:" + e.getMessage() );
|
||||
if( this.data.exceptions )
|
||||
{
|
||||
AELog.debug( e );
|
||||
}
|
||||
if( this.data.crash )
|
||||
{
|
||||
throw e;
|
||||
throw new IllegalStateException( e );
|
||||
}
|
||||
}
|
||||
catch( final MissingIngredientError e )
|
||||
}
|
||||
catch( final Throwable e )
|
||||
{
|
||||
AELog.warn( "Unable to register a recipe: " + e.getMessage() );
|
||||
if( this.data.exceptions )
|
||||
{
|
||||
if( this.data.errorOnMissing )
|
||||
{
|
||||
AELog.warn( "Unable to register a recipe:" + e.getMessage() );
|
||||
if( this.data.exceptions )
|
||||
{
|
||||
AELog.debug( e );
|
||||
}
|
||||
if( this.data.crash )
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
AELog.debug( e );
|
||||
}
|
||||
if( this.data.crash )
|
||||
{
|
||||
throw new IllegalStateException( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( final Throwable e )
|
||||
{
|
||||
if( this.data.exceptions )
|
||||
{
|
||||
AELog.debug( e );
|
||||
}
|
||||
if( this.data.crash )
|
||||
{
|
||||
throw new IllegalStateException( e );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for( final Entry<Class, Integer> e : processed.entrySet() )
|
||||
{
|
||||
|
||||
@@ -87,6 +87,6 @@ public class Crusher implements ICraftHandler, IWebsiteSerializer
|
||||
@Override
|
||||
public boolean canCraft( final ItemStack output ) throws RegistrationError, MissingIngredientError
|
||||
{
|
||||
return Platform.isSameItemPrecise( this.pro_output[0].getItemStack(), output );
|
||||
return Platform.itemComparisons().isSameItem( this.pro_output[0].getItemStack(), output );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,6 +73,6 @@ public class Grind implements ICraftHandler, IWebsiteSerializer
|
||||
@Override
|
||||
public boolean canCraft( final ItemStack output ) throws RegistrationError, MissingIngredientError
|
||||
{
|
||||
return Platform.isSameItemPrecise( this.pro_output[0].getItemStack(), output );
|
||||
return Platform.itemComparisons().isSameItem( this.pro_output[0].getItemStack(), output );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +87,6 @@ public class GrindFZ implements ICraftHandler, IWebsiteSerializer
|
||||
@Override
|
||||
public boolean canCraft( final ItemStack output ) throws RegistrationError, MissingIngredientError
|
||||
{
|
||||
return Platform.isSameItemPrecise( this.pro_output[0].getItemStack(), output );
|
||||
return Platform.itemComparisons().isSameItem( this.pro_output[0].getItemStack(), output );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,6 +96,6 @@ public class HCCrusher implements ICraftHandler, IWebsiteSerializer
|
||||
@Override
|
||||
public boolean canCraft( final ItemStack output ) throws RegistrationError, MissingIngredientError
|
||||
{
|
||||
return Platform.isSameItemPrecise( this.pro_output[0].getItemStack(), output );
|
||||
return Platform.itemComparisons().isSameItem( this.pro_output[0].getItemStack(), output );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public abstract class InscriberProcess implements ICraftHandler, IWebsiteSeriali
|
||||
@Override
|
||||
public boolean canCraft( final ItemStack reqOutput ) throws RegistrationError, MissingIngredientError
|
||||
{
|
||||
return this.output != null && Platform.isSameItemPrecise( this.output.getItemStack(), reqOutput );
|
||||
return this.output != null && Platform.itemComparisons().isSameItem( this.output.getItemStack(), reqOutput );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -87,6 +87,6 @@ public class Macerator implements ICraftHandler, IWebsiteSerializer
|
||||
@Override
|
||||
public boolean canCraft( final ItemStack output ) throws RegistrationError, MissingIngredientError
|
||||
{
|
||||
return Platform.isSameItemPrecise( this.pro_output[0].getItemStack(), output );
|
||||
return Platform.itemComparisons().isSameItem( this.pro_output[0].getItemStack(), output );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,6 +88,6 @@ public class MekCrusher implements ICraftHandler, IWebsiteSerializer
|
||||
@Override
|
||||
public boolean canCraft( final ItemStack output ) throws RegistrationError, MissingIngredientError
|
||||
{
|
||||
return Platform.isSameItemPrecise( this.pro_output[0].getItemStack(), output );
|
||||
return Platform.itemComparisons().isSameItem( this.pro_output[0].getItemStack(), output );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +87,6 @@ public class MekEnrichment implements ICraftHandler, IWebsiteSerializer
|
||||
@Override
|
||||
public boolean canCraft( final ItemStack output ) throws RegistrationError, MissingIngredientError
|
||||
{
|
||||
return Platform.isSameItemPrecise( this.pro_output[0].getItemStack(), output );
|
||||
return Platform.itemComparisons().isSameItem( this.pro_output[0].getItemStack(), output );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,6 +82,6 @@ public class Pulverizer implements ICraftHandler, IWebsiteSerializer
|
||||
@Override
|
||||
public boolean canCraft( final ItemStack output ) throws RegistrationError, MissingIngredientError
|
||||
{
|
||||
return Platform.isSameItemPrecise( this.pro_output[0].getItemStack(), output );
|
||||
return Platform.itemComparisons().isSameItem( this.pro_output[0].getItemStack(), output );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ public class Shaped implements ICraftHandler, IWebsiteSerializer
|
||||
{
|
||||
for( final ItemStack r : i.getItemStackSet() )
|
||||
{
|
||||
if( Platform.isSameItemPrecise( r, reqOutput ) )
|
||||
if( Platform.itemComparisons().isSameItem( r, reqOutput ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -171,6 +171,6 @@ public class Shaped implements ICraftHandler, IWebsiteSerializer
|
||||
}
|
||||
}
|
||||
|
||||
return Platform.isSameItemPrecise( this.output.getItemStack(), reqOutput );
|
||||
return Platform.itemComparisons().isSameItem( this.output.getItemStack(), reqOutput );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public class Shapeless implements ICraftHandler, IWebsiteSerializer
|
||||
{
|
||||
for( final ItemStack r : i.getItemStackSet() )
|
||||
{
|
||||
if( Platform.isSameItemPrecise( r, reqOutput ) )
|
||||
if( Platform.itemComparisons().isSameItem( r, reqOutput ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -136,6 +136,6 @@ public class Shapeless implements ICraftHandler, IWebsiteSerializer
|
||||
}
|
||||
}
|
||||
|
||||
return Platform.isSameItemPrecise( this.output.getItemStack(), reqOutput );
|
||||
return Platform.itemComparisons().isSameItem( this.output.getItemStack(), reqOutput );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,6 +81,6 @@ public class Smelt implements ICraftHandler, IWebsiteSerializer
|
||||
@Override
|
||||
public boolean canCraft( final ItemStack reqOutput ) throws RegistrationError, MissingIngredientError
|
||||
{
|
||||
return Platform.isSameItemPrecise( this.out.getItemStack(), reqOutput );
|
||||
return Platform.itemComparisons().isSameItem( this.out.getItemStack(), reqOutput );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
|
||||
if( is != null && is.getItem() instanceof ItemEncodedPattern )
|
||||
{
|
||||
if( !Platform.isSameItem( is, this.myPattern ) )
|
||||
if( !Platform.itemComparisons().isEqualItem( is, this.myPattern ) )
|
||||
{
|
||||
final World w = this.getWorld();
|
||||
final ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
|
||||
|
||||
@@ -194,7 +194,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
|
||||
ItemStack removed = oldStack;
|
||||
ItemStack added = newItemStack;
|
||||
|
||||
if( oldStack != null && newItemStack != null && Platform.isSameItem( oldStack, newItemStack ) )
|
||||
if( oldStack != null && newItemStack != null && Platform.itemComparisons().isEqualItem( oldStack, newItemStack ) )
|
||||
{
|
||||
if( oldStack.stackSize > newItemStack.stackSize )
|
||||
{
|
||||
|
||||
@@ -124,7 +124,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
|
||||
ItemStack removed = oldStack;
|
||||
ItemStack added = newItemStack;
|
||||
|
||||
if( oldStack != null && newItemStack != null && Platform.isSameItem( oldStack, newItemStack ) )
|
||||
if( oldStack != null && newItemStack != null && Platform.itemComparisons().isEqualItem( oldStack, newItemStack ) )
|
||||
{
|
||||
if( oldStack.stackSize > newItemStack.stackSize )
|
||||
{
|
||||
|
||||
@@ -135,7 +135,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
|
||||
private boolean canAddOutput( final ItemStack output )
|
||||
{
|
||||
final ItemStack outputStack = this.getStackInSlot( 1 );
|
||||
return outputStack == null || ( Platform.isSameItem( outputStack, output ) && outputStack.stackSize < outputStack.getMaxStackSize() );
|
||||
return outputStack == null || ( Platform.itemComparisons().isEqualItem( outputStack, output ) && outputStack.stackSize < outputStack.getMaxStackSize() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -256,7 +256,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
|
||||
for( final ItemStack optionals : AEApi.instance().registries().inscriber().getOptionals() )
|
||||
{
|
||||
if( Platform.isSameItemPrecise( optionals, itemstack ) )
|
||||
if( Platform.itemComparisons().isSameItem( optionals, itemstack ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -410,17 +410,17 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
for( final IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() )
|
||||
{
|
||||
|
||||
final boolean matchA = ( plateA == null && !recipe.getTopOptional().isPresent() ) || ( Platform.isSameItemPrecise( plateA, recipe.getTopOptional().orElse( null ) ) ) && // and...
|
||||
( plateB == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.isSameItemPrecise( plateB, recipe.getBottomOptional().orElse( null ) ) );
|
||||
final boolean matchA = ( plateA == null && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( plateA, recipe.getTopOptional().orElse( null ) ) ) && // and...
|
||||
( plateB == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.itemComparisons().isSameItem( plateB, recipe.getBottomOptional().orElse( null ) ) );
|
||||
|
||||
final boolean matchB = ( plateB == null && !recipe.getTopOptional().isPresent() ) || ( Platform.isSameItemPrecise( plateB, recipe.getTopOptional().orElse( null ) ) ) && // and...
|
||||
( plateA == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.isSameItemPrecise( plateA, recipe.getBottomOptional().orElse( null ) ) );
|
||||
final boolean matchB = ( plateB == null && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( plateB, recipe.getTopOptional().orElse( null ) ) ) && // and...
|
||||
( plateA == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.itemComparisons().isSameItem( plateA, recipe.getBottomOptional().orElse( null ) ) );
|
||||
|
||||
if( matchA || matchB )
|
||||
{
|
||||
for( final ItemStack option : recipe.getInputs() )
|
||||
{
|
||||
if( Platform.isSameItemPrecise( option, this.getStackInSlot( 2 ) ) )
|
||||
if( Platform.itemComparisons().isSameItem( option, this.getStackInSlot( 2 ) ) )
|
||||
{
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
|
||||
if( newLV != this.oldLV )
|
||||
{
|
||||
this.oldLV = newLV;
|
||||
this.worldObj.getLight( this.pos );
|
||||
this.worldObj.checkLight( this.pos );
|
||||
// worldObj.updateAllLightTypes( xCoord, yCoord, zCoord );
|
||||
}
|
||||
|
||||
|
||||
@@ -22,11 +22,9 @@ package appeng.tile.powersink;
|
||||
import java.util.EnumSet;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.darkhax.tesla.api.ITeslaConsumer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
|
||||
@@ -36,6 +34,7 @@ import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.api.networking.energy.IAEPowerStorage;
|
||||
import appeng.api.networking.events.MENetworkPowerStorage.PowerEventType;
|
||||
import appeng.capabilities.Capabilities;
|
||||
import appeng.integration.modules.IC2;
|
||||
import appeng.integration.modules.ic2.IC2PowerSink;
|
||||
import appeng.tile.AEBaseInvTile;
|
||||
@@ -45,8 +44,6 @@ import appeng.tile.events.TileEventType;
|
||||
|
||||
public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowerStorage, IExternalPowerSink
|
||||
{
|
||||
@CapabilityInject(ITeslaConsumer.class)
|
||||
private static Capability<ITeslaConsumer> teslaConsumerCapability;
|
||||
|
||||
// values that determine general function, are set by inheriting classes if
|
||||
// needed. These should generally remain static.
|
||||
@@ -64,7 +61,7 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
|
||||
public AERootPoweredTile()
|
||||
{
|
||||
forgeEnergyAdapter = new ForgeEnergyAdapter( this );
|
||||
if( teslaConsumerCapability != null )
|
||||
if( Capabilities.TESLA_CONSUMER != null )
|
||||
{
|
||||
teslaEnergyAdapter = new TeslaEnergyAdapter( this );
|
||||
}
|
||||
@@ -293,7 +290,7 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if( capability == teslaConsumerCapability )
|
||||
else if( capability == Capabilities.TESLA_CONSUMER )
|
||||
{
|
||||
if( this.getPowerSides().contains( facing ) )
|
||||
{
|
||||
@@ -315,7 +312,7 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
|
||||
return (T) forgeEnergyAdapter;
|
||||
}
|
||||
}
|
||||
else if( capability == teslaConsumerCapability )
|
||||
else if( capability == Capabilities.TESLA_CONSUMER )
|
||||
{
|
||||
if( this.getPowerSides().contains( facing ) )
|
||||
{
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.tile.powersink;
|
||||
|
||||
|
||||
//import java.util.EnumSet;
|
||||
//
|
||||
//import net.minecraft.tileentity.TileEntity;
|
||||
//import net.minecraftforge.common.util.ForgeDirection;
|
||||
//
|
||||
//import ic2.api.energy.tile.IEnergySink;
|
||||
//
|
||||
//import appeng.api.config.PowerUnits;
|
||||
//import appeng.integration.IntegrationRegistry;
|
||||
//import appeng.integration.IntegrationType;
|
||||
//import appeng.integration.abstraction.IIC2;
|
||||
//import appeng.transformer.annotations.Integration.Interface;
|
||||
//import appeng.util.Platform;
|
||||
//
|
||||
//
|
||||
//@Interface( iname = IntegrationType.IC2, iface = "ic2.api.energy.tile.IEnergySink" )
|
||||
//public abstract class IC2 extends AERootPoweredTile implements IEnergySink
|
||||
//{
|
||||
//
|
||||
// boolean isInIC2 = false;
|
||||
//
|
||||
// @Override
|
||||
// public final boolean acceptsEnergyFrom( TileEntity emitter, ForgeDirection direction )
|
||||
// {
|
||||
// return this.getPowerSides().contains( direction );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public final double getDemandedEnergy()
|
||||
// {
|
||||
// return this.getExternalPowerDemand( PowerUnits.EU, Double.MAX_VALUE );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public final int getSinkTier()
|
||||
// {
|
||||
// return Integer.MAX_VALUE;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public final double injectEnergy( ForgeDirection directionFrom, double amount, double voltage )
|
||||
// {
|
||||
// // just store the excess in the current block, if I return the waste,
|
||||
// // IC2 will just disintegrate it - Oct 20th 2013
|
||||
// double overflow = PowerUnits.EU.convertTo( PowerUnits.AE, this.injectExternalPower( PowerUnits.EU, amount ) );
|
||||
// this.internalCurrentPower += overflow;
|
||||
// return 0; // see above comment.
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void invalidate()
|
||||
// {
|
||||
// super.invalidate();
|
||||
// this.removeFromENet();
|
||||
// }
|
||||
//
|
||||
// private void removeFromENet()
|
||||
// {
|
||||
// if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.IC2 ) )
|
||||
// {
|
||||
// IIC2 ic2Integration = (IIC2) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.IC2 );
|
||||
// if( this.isInIC2 && Platform.isServer() && ic2Integration != null )
|
||||
// {
|
||||
// ic2Integration.removeFromEnergyNet( this );
|
||||
// this.isInIC2 = false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onChunkUnload()
|
||||
// {
|
||||
// super.onChunkUnload();
|
||||
// this.removeFromENet();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onReady()
|
||||
// {
|
||||
// super.onReady();
|
||||
// this.addToENet();
|
||||
// }
|
||||
//
|
||||
// private void addToENet()
|
||||
// {
|
||||
// if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.IC2 ) )
|
||||
// {
|
||||
// IIC2 ic2Integration = (IIC2) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.IC2 );
|
||||
// if( !this.isInIC2 && Platform.isServer() && ic2Integration != null )
|
||||
// {
|
||||
// ic2Integration.addToEnergyNet( this );
|
||||
// this.isInIC2 = true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void setPowerSides( EnumSet<ForgeDirection> sides )
|
||||
// {
|
||||
// super.setPowerSides( sides );
|
||||
// this.removeFromENet();
|
||||
// this.addToENet();
|
||||
// }
|
||||
// }
|
||||
@@ -467,7 +467,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
||||
|
||||
this.lastStateChange = this.worldObj.getTotalWorldTime();
|
||||
|
||||
return oldPaintedColor != this.paintedColor || ( this.state & 0xDB6DB6DB ) != ( oldState & 0xDB6DB6DB ) || !Platform.isSameItemPrecise( oldType, this.storageType );
|
||||
return oldPaintedColor != this.paintedColor || ( this.state & 0xDB6DB6DB ) != ( oldState & 0xDB6DB6DB ) || !Platform.itemComparisons().isSameItem( oldType, this.storageType );
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.WORLD_NBT_READ )
|
||||
|
||||
@@ -206,15 +206,16 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
|
||||
|
||||
private void recalculateDisplay()
|
||||
{
|
||||
|
||||
final boolean currentActive = this.getProxy().isActive();
|
||||
int newState = this.state;
|
||||
|
||||
if( currentActive )
|
||||
{
|
||||
this.state |= 0x80000000;
|
||||
newState |= 0x80000000;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.state &= ~0x80000000;
|
||||
newState &= ~0x80000000;
|
||||
}
|
||||
|
||||
if( this.wasActive != currentActive )
|
||||
@@ -232,12 +233,12 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
|
||||
|
||||
for( int x = 0; x < this.getCellCount(); x++ )
|
||||
{
|
||||
this.state |= ( this.getCellStatus( x ) << ( 3 * x ) );
|
||||
newState |= ( this.getCellStatus( x ) << ( 3 * x ) );
|
||||
}
|
||||
|
||||
final int oldState = 0;
|
||||
if( oldState != this.state )
|
||||
if( newState != this.state )
|
||||
{
|
||||
this.state = newState;
|
||||
this.markForUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
package appeng.util;
|
||||
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.security.InvalidParameterException;
|
||||
import java.text.DecimalFormat;
|
||||
@@ -30,8 +29,8 @@ import java.util.EnumSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -55,11 +54,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTPrimitive;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.network.play.server.SPacketChunkData;
|
||||
import net.minecraft.server.management.PlayerChunkMap;
|
||||
import net.minecraft.server.management.PlayerChunkMapEntry;
|
||||
@@ -90,7 +85,6 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.api.config.SearchBoxMode;
|
||||
@@ -137,11 +131,10 @@ import appeng.integration.IntegrationType;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.GridNode;
|
||||
import appeng.me.helpers.AENetworkProxy;
|
||||
import appeng.util.helpers.ItemComparisonHelper;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import appeng.util.item.AESharedNBT;
|
||||
import appeng.util.item.OreHelper;
|
||||
import appeng.util.item.OreReference;
|
||||
import appeng.util.prioitylist.IPartitionList;
|
||||
import appeng.util.prioritylist.IPartitionList;
|
||||
|
||||
|
||||
/**
|
||||
@@ -162,9 +155,15 @@ public class Platform
|
||||
*/
|
||||
private static final Random RANDOM_GENERATOR = new Random();
|
||||
private static final WeakHashMap<World, EntityPlayer> FAKE_PLAYERS = new WeakHashMap<World, EntityPlayer>();
|
||||
private static Field tagList;
|
||||
private static Method getEntry;
|
||||
|
||||
private static final ItemComparisonHelper ITEM_COMPARISON_HELPER = new ItemComparisonHelper();
|
||||
|
||||
public static ItemComparisonHelper itemComparisons()
|
||||
{
|
||||
return ITEM_COMPARISON_HELPER;
|
||||
}
|
||||
|
||||
public static Random getRandom()
|
||||
{
|
||||
return RANDOM_GENERATOR;
|
||||
@@ -423,251 +422,6 @@ public class Platform
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Lots of silliness to try and account for weird tag related junk, basically requires that two tags have at least
|
||||
* something in their tags before it wasts its time comparing them.
|
||||
*/
|
||||
private static boolean sameStackStags( final ItemStack a, final ItemStack b )
|
||||
{
|
||||
if( a == null && b == null )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if( a == null || b == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if( a == b )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
final NBTTagCompound ta = a.getTagCompound();
|
||||
final NBTTagCompound tb = b.getTagCompound();
|
||||
if( ta == tb )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if( ( ta == null && tb == null ) || ( ta != null && ta.hasNoTags() && tb == null ) || ( tb != null && tb.hasNoTags() && ta == null ) || ( ta != null && ta.hasNoTags() && tb != null && tb.hasNoTags() ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if( ( ta == null && tb != null ) || ( ta != null && tb == null ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// if both tags are shared this is easy...
|
||||
if( AESharedNBT.isShared( ta ) && AESharedNBT.isShared( tb ) )
|
||||
{
|
||||
return ta == tb;
|
||||
}
|
||||
|
||||
return NBTEqualityTest( ta, tb );
|
||||
}
|
||||
|
||||
/*
|
||||
* recursive test for NBT Equality, this was faster then trying to compare / generate hashes, its also more reliable
|
||||
* then the vanilla version which likes to fail when NBT Compound data changes order, it is pretty expensive
|
||||
* performance wise, so try an use shared tag compounds as long as the system remains in AE.
|
||||
*/
|
||||
public static boolean NBTEqualityTest( final NBTBase left, final NBTBase right )
|
||||
{
|
||||
// same type?
|
||||
final byte id = left.getId();
|
||||
if( id == right.getId() )
|
||||
{
|
||||
switch( id )
|
||||
{
|
||||
case 10:
|
||||
{
|
||||
final NBTTagCompound ctA = (NBTTagCompound) left;
|
||||
final NBTTagCompound ctB = (NBTTagCompound) right;
|
||||
|
||||
final Set<String> cA = ctA.getKeySet();
|
||||
final Set<String> cB = ctB.getKeySet();
|
||||
|
||||
if( cA.size() != cB.size() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for( final String name : cA )
|
||||
{
|
||||
final NBTBase tag = ctA.getTag( name );
|
||||
final NBTBase aTag = ctB.getTag( name );
|
||||
if( aTag == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !NBTEqualityTest( tag, aTag ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
case 9: // ) // A instanceof NBTTagList )
|
||||
{
|
||||
final NBTTagList lA = (NBTTagList) left;
|
||||
final NBTTagList lB = (NBTTagList) right;
|
||||
if( lA.tagCount() != lB.tagCount() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final List<NBTBase> tag = tagList( lA );
|
||||
final List<NBTBase> aTag = tagList( lB );
|
||||
if( tag.size() != aTag.size() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for( int x = 0; x < tag.size(); x++ )
|
||||
{
|
||||
if( aTag.get( x ) == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !NBTEqualityTest( tag.get( x ), aTag.get( x ) ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
case 1: // ( A instanceof NBTTagByte )
|
||||
return ( (NBTPrimitive) left ).getByte() == ( (NBTPrimitive) right ).getByte();
|
||||
|
||||
case 4: // else if ( A instanceof NBTTagLong )
|
||||
return ( (NBTPrimitive) left ).getLong() == ( (NBTPrimitive) right ).getLong();
|
||||
|
||||
case 8: // else if ( A instanceof NBTTagString )
|
||||
return ( (NBTTagString) left ).getString().equals( ( (NBTTagString) right ).getString() ) || ( (NBTTagString) left ).getString().equals( ( (NBTTagString) right ).getString() );
|
||||
|
||||
case 6: // else if ( A instanceof NBTTagDouble )
|
||||
return ( (NBTPrimitive) left ).getDouble() == ( (NBTPrimitive) right ).getDouble();
|
||||
|
||||
case 5: // else if ( A instanceof NBTTagFloat )
|
||||
return ( (NBTPrimitive) left ).getFloat() == ( (NBTPrimitive) right ).getFloat();
|
||||
|
||||
case 3: // else if ( A instanceof NBTTagInt )
|
||||
return ( (NBTPrimitive) left ).getInt() == ( (NBTPrimitive) right ).getInt();
|
||||
|
||||
default:
|
||||
return left.equals( right );
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static List<NBTBase> tagList( final NBTTagList lB )
|
||||
{
|
||||
if( tagList == null )
|
||||
{
|
||||
try
|
||||
{
|
||||
tagList = lB.getClass().getDeclaredField( "tagList" );
|
||||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
try
|
||||
{
|
||||
tagList = lB.getClass().getDeclaredField( "field_74747_a" );
|
||||
}
|
||||
catch( final Throwable z )
|
||||
{
|
||||
AELog.debug( t );
|
||||
AELog.debug( z );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
tagList.setAccessible( true );
|
||||
return (List<NBTBase>) tagList.get( lB );
|
||||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
AELog.debug( t );
|
||||
}
|
||||
|
||||
return new ArrayList<NBTBase>();
|
||||
}
|
||||
|
||||
/*
|
||||
* Orderless hash on NBT Data, used to work thought huge piles fast, but ignores the order just in case MC decided
|
||||
* to change it... WHICH IS BAD...
|
||||
*/
|
||||
public static int NBTOrderlessHash( final NBTBase nbt )
|
||||
{
|
||||
// same type?
|
||||
int hash = 0;
|
||||
final byte id = nbt.getId();
|
||||
hash += id;
|
||||
switch( id )
|
||||
{
|
||||
case 10:
|
||||
{
|
||||
final NBTTagCompound ctA = (NBTTagCompound) nbt;
|
||||
|
||||
final Set<String> cA = ctA.getKeySet();
|
||||
|
||||
for( final String name : cA )
|
||||
{
|
||||
hash += name.hashCode() ^ NBTOrderlessHash( ctA.getTag( name ) );
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
case 9: // ) // A instanceof NBTTagList )
|
||||
{
|
||||
final NBTTagList lA = (NBTTagList) nbt;
|
||||
hash += 9 * lA.tagCount();
|
||||
|
||||
final List<NBTBase> l = tagList( lA );
|
||||
for( int x = 0; x < l.size(); x++ )
|
||||
{
|
||||
hash += ( (Integer) x ).hashCode() ^ NBTOrderlessHash( l.get( x ) );
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
case 1: // ( A instanceof NBTTagByte )
|
||||
return hash + ( (NBTPrimitive) nbt ).getByte();
|
||||
|
||||
case 4: // else if ( A instanceof NBTTagLong )
|
||||
return hash + (int) ( (NBTPrimitive) nbt ).getLong();
|
||||
|
||||
case 8: // else if ( A instanceof NBTTagString )
|
||||
return hash + ( (NBTTagString) nbt ).getString().hashCode();
|
||||
|
||||
case 6: // else if ( A instanceof NBTTagDouble )
|
||||
return hash + (int) ( (NBTPrimitive) nbt ).getDouble();
|
||||
|
||||
case 5: // else if ( A instanceof NBTTagFloat )
|
||||
return hash + (int) ( (NBTPrimitive) nbt ).getFloat();
|
||||
|
||||
case 3: // else if ( A instanceof NBTTagInt )
|
||||
return hash + ( (NBTPrimitive) nbt ).getInt();
|
||||
|
||||
default:
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The usual version of this returns an ItemStack, this version returns the recipe.
|
||||
*/
|
||||
@@ -1127,7 +881,7 @@ public class Platform
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
public static int findEmpty( final Object[] l )
|
||||
{
|
||||
for( int x = 0; x < l.length; x++ )
|
||||
@@ -1142,6 +896,7 @@ public class Platform
|
||||
|
||||
/**
|
||||
* Returns a random element from the given collection.
|
||||
*
|
||||
* @return null if the collection is empty
|
||||
*/
|
||||
@Nullable
|
||||
@@ -1371,102 +1126,6 @@ public class Platform
|
||||
return I18n.translateToLocal( string );
|
||||
}
|
||||
|
||||
public static boolean isSameItemPrecise( @Nullable final ItemStack is, @Nullable final ItemStack filter )
|
||||
{
|
||||
return isSameItem( is, filter ) && sameStackStags( is, filter );
|
||||
}
|
||||
|
||||
public static boolean isSameItemFuzzy( final ItemStack a, final ItemStack b, final FuzzyMode mode )
|
||||
{
|
||||
if( a == null && b == null )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if( a == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( b == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* if ( a.itemID != 0 && b.itemID != 0 && a.isItemStackDamageable() && ! a.getHasSubtypes() && a.itemID ==
|
||||
* b.itemID ) { return (a.getItemDamage() > 0) == (b.getItemDamage() > 0); }
|
||||
*/
|
||||
|
||||
// test damageable items..
|
||||
if( a.getItem() != null && b.getItem() != null && a.getItem().isDamageable() && a.getItem() == b.getItem() )
|
||||
{
|
||||
try
|
||||
{
|
||||
if( mode == FuzzyMode.IGNORE_ALL )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if( mode == FuzzyMode.PERCENT_99 )
|
||||
{
|
||||
final Item ai = a.getItem();
|
||||
final Item bi = b.getItem();
|
||||
|
||||
return ( ai.getDurabilityForDisplay( a ) > 1 ) == ( bi.getDurabilityForDisplay( b ) > 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
final Item ai = a.getItem();
|
||||
final Item bi = b.getItem();
|
||||
|
||||
final float percentDamagedOfA = 1.0f - (float) ai.getDurabilityForDisplay( a );
|
||||
final float percentDamagedOfB = 1.0f - (float) bi.getDurabilityForDisplay( b );
|
||||
|
||||
return ( percentDamagedOfA > mode.breakPoint ) == ( percentDamagedOfB > mode.breakPoint );
|
||||
}
|
||||
}
|
||||
catch( final Throwable e )
|
||||
{
|
||||
if( mode == FuzzyMode.IGNORE_ALL )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if( mode == FuzzyMode.PERCENT_99 )
|
||||
{
|
||||
return ( a.getItemDamage() > 1 ) == ( b.getItemDamage() > 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
final float percentDamagedOfA = (float) a.getItemDamage() / (float) a.getMaxDamage();
|
||||
final float percentDamagedOfB = (float) b.getItemDamage() / (float) b.getMaxDamage();
|
||||
|
||||
return ( percentDamagedOfA > mode.breakPoint ) == ( percentDamagedOfB > mode.breakPoint );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final OreReference aOR = OreHelper.INSTANCE.isOre( a );
|
||||
final OreReference bOR = OreHelper.INSTANCE.isOre( b );
|
||||
|
||||
if( OreHelper.INSTANCE.sameOre( aOR, bOR ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* // test ore dictionary.. int OreID = getOreID( a ); if ( OreID != -1 ) return OreID == getOreID( b );
|
||||
* if ( Mode != FuzzyMode.IGNORE_ALL ) { if ( a.hasTagCompound() && !isShared( a.getTagCompound() ) ) { a =
|
||||
* Platform.getSharedItemStack( AEItemStack.create( a ) ); }
|
||||
* if ( b.hasTagCompound() && !isShared( b.getTagCompound() ) ) { b = Platform.getSharedItemStack(
|
||||
* AEItemStack.create( b ) ); }
|
||||
* // test regular items with damage values and what not... if ( isShared( a.getTagCompound() ) && isShared(
|
||||
* b.getTagCompound() ) && a.itemID == b.itemID ) { return ((AppEngSharedNBTTagCompound)
|
||||
* a.getTagCompound()).compareFuzzyWithRegistry( (AppEngSharedNBTTagCompound) b.getTagCompound() ); } }
|
||||
*/
|
||||
|
||||
return a.isItemEqual( b );
|
||||
}
|
||||
|
||||
public static LookDirection getPlayerRay( final EntityPlayer playerIn, final float eyeOffset )
|
||||
{
|
||||
double reachDistance = 5.0d;
|
||||
@@ -1982,12 +1641,12 @@ public class Platform
|
||||
for( final IAEItemStack x : items )
|
||||
{
|
||||
final ItemStack sh = x.getItemStack();
|
||||
if( ( Platform.isSameItemType( providedTemplate, sh ) || ae_req.sameOre( x ) ) && !Platform.isSameItem( sh, output ) )
|
||||
if( ( Platform.itemComparisons().isEqualItemType( providedTemplate, sh ) || ae_req.sameOre( x ) ) && !Platform.itemComparisons().isEqualItem( sh, output ) )
|
||||
{ // Platform.isSameItemType( sh, providedTemplate )
|
||||
final ItemStack cp = Platform.cloneItemStack( sh );
|
||||
cp.stackSize = 1;
|
||||
ci.setInventorySlotContents( slot, cp );
|
||||
if( r.matches( ci, w ) && Platform.isSameItem( r.getCraftingResult( ci ), output ) )
|
||||
if( r.matches( ci, w ) && Platform.itemComparisons().isEqualItem( r.getCraftingResult( ci ), output ) )
|
||||
{
|
||||
final IAEItemStack ax = x.copy();
|
||||
ax.setStackSize( 1 );
|
||||
@@ -2009,24 +1668,6 @@ public class Platform
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isSameItemType( final ItemStack that, final ItemStack other )
|
||||
{
|
||||
if( that != null && other != null && that.getItem() == other.getItem() )
|
||||
{
|
||||
if( that.isItemStackDamageable() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return that.getItemDamage() == other.getItemDamage();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isSameItem( @Nullable final ItemStack left, @Nullable final ItemStack right )
|
||||
{
|
||||
return left != null && right != null && left.isItemEqual( right );
|
||||
}
|
||||
|
||||
public static ItemStack cloneItemStack( final ItemStack a )
|
||||
{
|
||||
return a.copy();
|
||||
@@ -2097,22 +1738,22 @@ public class Platform
|
||||
{
|
||||
if( parts.cableGlass().sameAs( AEColor.TRANSPARENT, stack ) )
|
||||
{
|
||||
return Collections.singletonList(stack);
|
||||
return Collections.singletonList( stack );
|
||||
}
|
||||
|
||||
if( parts.cableCovered().sameAs( AEColor.TRANSPARENT, stack ) )
|
||||
{
|
||||
return Collections.singletonList(stack);
|
||||
return Collections.singletonList( stack );
|
||||
}
|
||||
|
||||
if( parts.cableSmart().sameAs( AEColor.TRANSPARENT, stack ) )
|
||||
{
|
||||
return Collections.singletonList(stack);
|
||||
return Collections.singletonList( stack );
|
||||
}
|
||||
|
||||
if( parts.cableDense().sameAs( AEColor.TRANSPARENT, stack ) )
|
||||
{
|
||||
return Collections.singletonList(stack);
|
||||
return Collections.singletonList( stack );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,443 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.util.helpers;
|
||||
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTPrimitive;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.core.AELog;
|
||||
import appeng.util.item.AESharedNBT;
|
||||
import appeng.util.item.OreHelper;
|
||||
import appeng.util.item.OreReference;
|
||||
|
||||
|
||||
/**
|
||||
* A helper class for comparing {@link Item}, {@link ItemStack} or NBT
|
||||
*
|
||||
*/
|
||||
public class ItemComparisonHelper
|
||||
{
|
||||
|
||||
private static Field tagList;
|
||||
|
||||
/**
|
||||
* Compare the two {@link ItemStack}s based on the same {@link Item} and damage value.
|
||||
*
|
||||
* In case of the item being damageable, only the {@link Item} will be considered.
|
||||
* If not it will also compare both damage values.
|
||||
*
|
||||
* Ignores NBT.
|
||||
*
|
||||
* @return true, if both are equal.
|
||||
*/
|
||||
public boolean isEqualItemType( final ItemStack that, final ItemStack other )
|
||||
{
|
||||
if( that != null && other != null && that.getItem() == other.getItem() )
|
||||
{
|
||||
if( that.isItemStackDamageable() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return that.getItemDamage() == other.getItemDamage();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* A wrapper around {@link ItemStack#isItemEqual(ItemStack)}.
|
||||
*
|
||||
* The benefit is to compare two null item stacks, without any additional null checks.
|
||||
*
|
||||
* Ignores NBT.
|
||||
*
|
||||
* @return true, if both are equal.
|
||||
*/
|
||||
public boolean isEqualItem( @Nullable final ItemStack left, @Nullable final ItemStack right )
|
||||
{
|
||||
return left != null && right != null && left.isItemEqual( right );
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares two {@link ItemStack} and their NBT tag for equality.
|
||||
*
|
||||
* Use this when a precise check is required and the same item is required.
|
||||
* Not just something with different NBT tags.
|
||||
*
|
||||
* @return true, if both are identical.
|
||||
*/
|
||||
public boolean isSameItem( @Nullable final ItemStack is, @Nullable final ItemStack filter )
|
||||
{
|
||||
return isEqualItem( is, filter ) && hasSameNbtTag( is, filter );
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to {@link ItemComparisonHelper#isEqualItem(ItemStack, ItemStack)},
|
||||
* but it can further check, if both match the same {@link FuzzyMode}
|
||||
* or are considered equal by the {@link OreDictionary}
|
||||
*
|
||||
* @param mode how to compare the two {@link ItemStack}s
|
||||
* @return true, if both are matching the mode or considered equal by the {@link OreDictionary}
|
||||
*/
|
||||
public boolean isFuzzyEqualItem( final ItemStack a, final ItemStack b, final FuzzyMode mode )
|
||||
{
|
||||
if( a == null && b == null )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if( a == null || b == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* if ( a.itemID != 0 && b.itemID != 0 && a.isItemStackDamageable() && ! a.getHasSubtypes() && a.itemID ==
|
||||
* b.itemID ) { return (a.getItemDamage() > 0) == (b.getItemDamage() > 0); }
|
||||
*/
|
||||
|
||||
// test damageable items..
|
||||
if( a.getItem() != null && b.getItem() != null && a.getItem().isDamageable() && a.getItem() == b.getItem() )
|
||||
{
|
||||
try
|
||||
{
|
||||
if( mode == FuzzyMode.IGNORE_ALL )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if( mode == FuzzyMode.PERCENT_99 )
|
||||
{
|
||||
final Item ai = a.getItem();
|
||||
final Item bi = b.getItem();
|
||||
|
||||
return ( ai.getDurabilityForDisplay( a ) > 1 ) == ( bi.getDurabilityForDisplay( b ) > 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
final Item ai = a.getItem();
|
||||
final Item bi = b.getItem();
|
||||
|
||||
final float percentDamagedOfA = 1.0f - (float) ai.getDurabilityForDisplay( a );
|
||||
final float percentDamagedOfB = 1.0f - (float) bi.getDurabilityForDisplay( b );
|
||||
|
||||
return ( percentDamagedOfA > mode.breakPoint ) == ( percentDamagedOfB > mode.breakPoint );
|
||||
}
|
||||
}
|
||||
catch( final Throwable e )
|
||||
{
|
||||
if( mode == FuzzyMode.IGNORE_ALL )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if( mode == FuzzyMode.PERCENT_99 )
|
||||
{
|
||||
return ( a.getItemDamage() > 1 ) == ( b.getItemDamage() > 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
final float percentDamagedOfA = (float) a.getItemDamage() / (float) a.getMaxDamage();
|
||||
final float percentDamagedOfB = (float) b.getItemDamage() / (float) b.getMaxDamage();
|
||||
|
||||
return ( percentDamagedOfA > mode.breakPoint ) == ( percentDamagedOfB > mode.breakPoint );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final OreReference aOR = OreHelper.INSTANCE.isOre( a );
|
||||
final OreReference bOR = OreHelper.INSTANCE.isOre( b );
|
||||
|
||||
if( OreHelper.INSTANCE.sameOre( aOR, bOR ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* // test ore dictionary.. int OreID = getOreID( a ); if ( OreID != -1 ) return OreID == getOreID( b );
|
||||
* if ( Mode != FuzzyMode.IGNORE_ALL ) { if ( a.hasTagCompound() && !isShared( a.getTagCompound() ) ) { a =
|
||||
* Platform.getSharedItemStack( AEItemStack.create( a ) ); }
|
||||
* if ( b.hasTagCompound() && !isShared( b.getTagCompound() ) ) { b = Platform.getSharedItemStack(
|
||||
* AEItemStack.create( b ) ); }
|
||||
* // test regular items with damage values and what not... if ( isShared( a.getTagCompound() ) && isShared(
|
||||
* b.getTagCompound() ) && a.itemID == b.itemID ) { return ((AppEngSharedNBTTagCompound)
|
||||
* a.getTagCompound()).compareFuzzyWithRegistry( (AppEngSharedNBTTagCompound) b.getTagCompound() ); } }
|
||||
*/
|
||||
|
||||
return a.isItemEqual( b );
|
||||
}
|
||||
|
||||
/**
|
||||
* recursive test for NBT Equality, this was faster then trying to compare / generate hashes, its also more reliable
|
||||
* then the vanilla version which likes to fail when NBT Compound data changes order, it is pretty expensive
|
||||
* performance wise, so try an use shared tag compounds as long as the system remains in AE.
|
||||
*/
|
||||
public boolean isNbtTagEqual( final NBTBase left, final NBTBase right )
|
||||
{
|
||||
// same type?
|
||||
final byte id = left.getId();
|
||||
if( id == right.getId() )
|
||||
{
|
||||
switch( id )
|
||||
{
|
||||
case 10:
|
||||
{
|
||||
final NBTTagCompound ctA = (NBTTagCompound) left;
|
||||
final NBTTagCompound ctB = (NBTTagCompound) right;
|
||||
|
||||
final Set<String> cA = ctA.getKeySet();
|
||||
final Set<String> cB = ctB.getKeySet();
|
||||
|
||||
if( cA.size() != cB.size() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for( final String name : cA )
|
||||
{
|
||||
final NBTBase tag = ctA.getTag( name );
|
||||
final NBTBase aTag = ctB.getTag( name );
|
||||
if( aTag == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !isNbtTagEqual( tag, aTag ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
case 9: // ) // A instanceof NBTTagList )
|
||||
{
|
||||
final NBTTagList lA = (NBTTagList) left;
|
||||
final NBTTagList lB = (NBTTagList) right;
|
||||
if( lA.tagCount() != lB.tagCount() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final List<NBTBase> tag = tagList( lA );
|
||||
final List<NBTBase> aTag = tagList( lB );
|
||||
if( tag.size() != aTag.size() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for( int x = 0; x < tag.size(); x++ )
|
||||
{
|
||||
if( aTag.get( x ) == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !isNbtTagEqual( tag.get( x ), aTag.get( x ) ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
case 1: // NBTTagByte
|
||||
return ( (NBTPrimitive) left ).getByte() == ( (NBTPrimitive) right ).getByte();
|
||||
|
||||
case 4: // NBTTagLong
|
||||
return ( (NBTPrimitive) left ).getLong() == ( (NBTPrimitive) right ).getLong();
|
||||
|
||||
case 8: // NBTTagString
|
||||
return ( (NBTTagString) left ).getString().equals( ( (NBTTagString) right ).getString() );
|
||||
|
||||
case 6: // NBTTagDouble
|
||||
return ( (NBTPrimitive) left ).getDouble() == ( (NBTPrimitive) right ).getDouble();
|
||||
|
||||
case 5: // NBTTagFloat
|
||||
return ( (NBTPrimitive) left ).getFloat() == ( (NBTPrimitive) right ).getFloat();
|
||||
|
||||
case 3: // NBTTagInt
|
||||
return ( (NBTPrimitive) left ).getInt() == ( (NBTPrimitive) right ).getInt();
|
||||
|
||||
default:
|
||||
return left.equals( right );
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unordered hash of NBT Data, used to work thought huge piles fast, but ignores the order just in case MC
|
||||
* decided to change it... WHICH IS BAD...
|
||||
*/
|
||||
public int createUnorderedNbtHash( final NBTBase nbt )
|
||||
{
|
||||
// same type?
|
||||
int hash = 0;
|
||||
final byte id = nbt.getId();
|
||||
hash += id;
|
||||
switch( id )
|
||||
{
|
||||
case 10:
|
||||
{
|
||||
final NBTTagCompound ctA = (NBTTagCompound) nbt;
|
||||
|
||||
final Set<String> cA = ctA.getKeySet();
|
||||
|
||||
for( final String name : cA )
|
||||
{
|
||||
hash += name.hashCode() ^ createUnorderedNbtHash( ctA.getTag( name ) );
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
case 9: // ) // A instanceof NBTTagList )
|
||||
{
|
||||
final NBTTagList lA = (NBTTagList) nbt;
|
||||
hash += 9 * lA.tagCount();
|
||||
|
||||
final List<NBTBase> l = tagList( lA );
|
||||
for( int x = 0; x < l.size(); x++ )
|
||||
{
|
||||
hash += ( (Integer) x ).hashCode() ^ createUnorderedNbtHash( l.get( x ) );
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
case 1: // NBTTagByte
|
||||
return hash + ( (NBTPrimitive) nbt ).getByte();
|
||||
|
||||
case 4: // NBTTagLong
|
||||
return hash + (int) ( (NBTPrimitive) nbt ).getLong();
|
||||
|
||||
case 8: // NBTTagString
|
||||
return hash + ( (NBTTagString) nbt ).getString().hashCode();
|
||||
|
||||
case 6: // NBTTagDouble
|
||||
return hash + (int) ( (NBTPrimitive) nbt ).getDouble();
|
||||
|
||||
case 5: // NBTTagFloat
|
||||
return hash + (int) ( (NBTPrimitive) nbt ).getFloat();
|
||||
|
||||
case 3: // NBTTagInt
|
||||
return hash + ( (NBTPrimitive) nbt ).getInt();
|
||||
|
||||
default:
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Lots of silliness to try and account for weird tag related junk, basically requires that two tags have at least
|
||||
* something in their tags before it wastes its time comparing them.
|
||||
*/
|
||||
private boolean hasSameNbtTag( final ItemStack a, final ItemStack b )
|
||||
{
|
||||
if( a == null && b == null )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if( a == null || b == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if( a == b )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
final NBTTagCompound ta = a.getTagCompound();
|
||||
final NBTTagCompound tb = b.getTagCompound();
|
||||
if( ta == tb )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if( ( ta == null && tb == null ) || ( ta != null && ta.hasNoTags() && tb == null ) || ( tb != null && tb.hasNoTags() && ta == null ) || ( ta != null && ta.hasNoTags() && tb != null && tb.hasNoTags() ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if( ( ta == null && tb != null ) || ( ta != null && tb == null ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// if both tags are shared this is easy...
|
||||
if( AESharedNBT.isShared( ta ) && AESharedNBT.isShared( tb ) )
|
||||
{
|
||||
return ta == tb;
|
||||
}
|
||||
|
||||
return isNbtTagEqual( ta, tb );
|
||||
}
|
||||
|
||||
private List<NBTBase> tagList( final NBTTagList lB )
|
||||
{
|
||||
if( tagList == null )
|
||||
{
|
||||
try
|
||||
{
|
||||
tagList = lB.getClass().getDeclaredField( "tagList" );
|
||||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
try
|
||||
{
|
||||
tagList = lB.getClass().getDeclaredField( "field_74747_a" );
|
||||
}
|
||||
catch( final Throwable z )
|
||||
{
|
||||
AELog.debug( t );
|
||||
AELog.debug( z );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
tagList.setAccessible( true );
|
||||
return (List<NBTBase>) tagList.get( lB );
|
||||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
AELog.debug( t );
|
||||
}
|
||||
|
||||
return new ArrayList<NBTBase>();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -50,7 +50,7 @@ public class AdaptorIInventory extends InventoryAdaptor
|
||||
for( int x = 0; x < s && amount > 0; x++ )
|
||||
{
|
||||
final ItemStack is = this.i.getStackInSlot( x );
|
||||
if( is != null && this.canRemoveStackFromSlot( x, is ) && ( filter == null || Platform.isSameItemPrecise( is, filter ) ) )
|
||||
if( is != null && this.canRemoveStackFromSlot( x, is ) && ( filter == null || Platform.itemComparisons().isSameItem( is, filter ) ) )
|
||||
{
|
||||
int boundAmounts = amount;
|
||||
if( boundAmounts > is.stackSize )
|
||||
@@ -108,7 +108,7 @@ public class AdaptorIInventory extends InventoryAdaptor
|
||||
for( int x = 0; x < s && amount > 0; x++ )
|
||||
{
|
||||
final ItemStack is = this.i.getStackInSlot( x );
|
||||
if( is != null && this.canRemoveStackFromSlot( x, is ) && ( filter == null || Platform.isSameItemPrecise( is, filter ) ) )
|
||||
if( is != null && this.canRemoveStackFromSlot( x, is ) && ( filter == null || Platform.itemComparisons().isSameItem( is, filter ) ) )
|
||||
{
|
||||
int boundAmount = amount;
|
||||
if( boundAmount > is.stackSize )
|
||||
@@ -147,7 +147,7 @@ public class AdaptorIInventory extends InventoryAdaptor
|
||||
for( int x = 0; x < s; x++ )
|
||||
{
|
||||
final ItemStack is = this.i.getStackInSlot( x );
|
||||
if( is != null && this.canRemoveStackFromSlot( x, is ) && ( filter == null || Platform.isSameItemFuzzy( is, filter, fuzzyMode ) ) )
|
||||
if( is != null && this.canRemoveStackFromSlot( x, is ) && ( filter == null || Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) )
|
||||
{
|
||||
int newAmount = amount;
|
||||
if( newAmount > is.stackSize )
|
||||
@@ -197,7 +197,7 @@ public class AdaptorIInventory extends InventoryAdaptor
|
||||
{
|
||||
final ItemStack is = this.i.getStackInSlot( x );
|
||||
|
||||
if( is != null && this.canRemoveStackFromSlot( x, is ) && ( filter == null || Platform.isSameItemFuzzy( is, filter, fuzzyMode ) ) )
|
||||
if( is != null && this.canRemoveStackFromSlot( x, is ) && ( filter == null || Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) )
|
||||
{
|
||||
int boundAmount = amount;
|
||||
if( boundAmount > is.stackSize )
|
||||
@@ -293,7 +293,7 @@ public class AdaptorIInventory extends InventoryAdaptor
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if( Platform.isSameItemPrecise( is, left ) && is.stackSize < perOperationLimit )
|
||||
else if( Platform.itemComparisons().isSameItem( is, left ) && is.stackSize < perOperationLimit )
|
||||
{
|
||||
final int room = perOperationLimit - is.stackSize;
|
||||
final int used = Math.min( left.stackSize, room );
|
||||
|
||||
@@ -47,7 +47,7 @@ public class AdaptorItemHandler extends InventoryAdaptor
|
||||
for( int slot = 0; slot < slots && amount > 0; slot++ )
|
||||
{
|
||||
final ItemStack is = itemHandler.getStackInSlot( slot );
|
||||
if( is == null || ( filter != null && !Platform.isSameItemPrecise( is, filter ) ) )
|
||||
if( is == null || ( filter != null && !Platform.itemComparisons().isSameItem( is, filter ) ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -101,7 +101,7 @@ public class AdaptorItemHandler extends InventoryAdaptor
|
||||
for( int slot = 0; slot < slots && amount > 0; slot++ )
|
||||
{
|
||||
final ItemStack is = itemHandler.getStackInSlot( slot );
|
||||
if( is != null && ( filter == null || Platform.isSameItemPrecise( is, filter ) ) )
|
||||
if( is != null && ( filter == null || Platform.itemComparisons().isSameItem( is, filter ) ) )
|
||||
{
|
||||
ItemStack extracted = itemHandler.extractItem( slot, amount, true );
|
||||
|
||||
@@ -149,7 +149,7 @@ public class AdaptorItemHandler extends InventoryAdaptor
|
||||
for( int slot = 0; slot < slots && extracted == null; slot++ )
|
||||
{
|
||||
final ItemStack is = itemHandler.getStackInSlot( slot );
|
||||
if( is == null || ( filter != null && !Platform.isSameItemFuzzy( is, filter, fuzzyMode ) ) )
|
||||
if( is == null || ( filter != null && !Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -184,7 +184,7 @@ public class AdaptorItemHandler extends InventoryAdaptor
|
||||
for( int slot = 0; slot < slots && extracted == null; slot++ )
|
||||
{
|
||||
final ItemStack is = itemHandler.getStackInSlot( slot );
|
||||
if( is == null || ( filter != null && !Platform.isSameItemFuzzy( is, filter, fuzzyMode ) ) )
|
||||
if( is == null || ( filter != null && !Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -229,7 +229,7 @@ public class AdaptorItemHandler extends InventoryAdaptor
|
||||
{
|
||||
ItemStack is = itemHandler.getStackInSlot( slot );
|
||||
|
||||
if( is == null || Platform.isSameItemPrecise( is, left ) )
|
||||
if( is == null || Platform.itemComparisons().isSameItem( is, left ) )
|
||||
{
|
||||
left = itemHandler.insertItem( slot, left, simulate );
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ public class AdaptorList extends InventoryAdaptor
|
||||
for( int x = 0; x < s; x++ )
|
||||
{
|
||||
final ItemStack is = this.i.get( x );
|
||||
if( is != null && ( filter == null || Platform.isSameItemPrecise( is, filter ) ) )
|
||||
if( is != null && ( filter == null || Platform.itemComparisons().isSameItem( is, filter ) ) )
|
||||
{
|
||||
if( amount > is.stackSize )
|
||||
{
|
||||
@@ -82,7 +82,7 @@ public class AdaptorList extends InventoryAdaptor
|
||||
{
|
||||
for( final ItemStack is : this.i )
|
||||
{
|
||||
if( is != null && ( filter == null || Platform.isSameItemPrecise( is, filter ) ) )
|
||||
if( is != null && ( filter == null || Platform.itemComparisons().isSameItem( is, filter ) ) )
|
||||
{
|
||||
if( amount > is.stackSize )
|
||||
{
|
||||
@@ -111,7 +111,7 @@ public class AdaptorList extends InventoryAdaptor
|
||||
for( int x = 0; x < s; x++ )
|
||||
{
|
||||
final ItemStack is = this.i.get( x );
|
||||
if( is != null && ( filter == null || Platform.isSameItemFuzzy( is, filter, fuzzyMode ) ) )
|
||||
if( is != null && ( filter == null || Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) )
|
||||
{
|
||||
if( amount > is.stackSize )
|
||||
{
|
||||
@@ -146,7 +146,7 @@ public class AdaptorList extends InventoryAdaptor
|
||||
{
|
||||
for( final ItemStack is : this.i )
|
||||
{
|
||||
if( is != null && ( filter == null || Platform.isSameItemFuzzy( is, filter, fuzzyMode ) ) )
|
||||
if( is != null && ( filter == null || Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) )
|
||||
{
|
||||
if( amount > is.stackSize )
|
||||
{
|
||||
@@ -184,7 +184,7 @@ public class AdaptorList extends InventoryAdaptor
|
||||
|
||||
for( final ItemStack is : this.i )
|
||||
{
|
||||
if( Platform.isSameItem( is, left ) )
|
||||
if( Platform.itemComparisons().isEqualItem( is, left ) )
|
||||
{
|
||||
is.stackSize += left.stackSize;
|
||||
return null;
|
||||
|
||||
@@ -52,7 +52,7 @@ public class AdaptorPlayerHand extends InventoryAdaptor
|
||||
return null;
|
||||
}
|
||||
|
||||
if( filter == null || Platform.isSameItemPrecise( filter, hand ) )
|
||||
if( filter == null || Platform.itemComparisons().isSameItem( filter, hand ) )
|
||||
{
|
||||
final ItemStack result = hand.copy();
|
||||
result.stackSize = hand.stackSize > amount ? amount : hand.stackSize;
|
||||
@@ -77,7 +77,7 @@ public class AdaptorPlayerHand extends InventoryAdaptor
|
||||
return null;
|
||||
}
|
||||
|
||||
if( filter == null || Platform.isSameItemPrecise( filter, hand ) )
|
||||
if( filter == null || Platform.itemComparisons().isSameItem( filter, hand ) )
|
||||
{
|
||||
final ItemStack result = hand.copy();
|
||||
result.stackSize = hand.stackSize > amount ? amount : hand.stackSize;
|
||||
@@ -96,7 +96,7 @@ public class AdaptorPlayerHand extends InventoryAdaptor
|
||||
return null;
|
||||
}
|
||||
|
||||
if( filter == null || Platform.isSameItemFuzzy( filter, hand, fuzzyMode ) )
|
||||
if( filter == null || Platform.itemComparisons().isFuzzyEqualItem( filter, hand, fuzzyMode ) )
|
||||
{
|
||||
final ItemStack result = hand.copy();
|
||||
result.stackSize = hand.stackSize > amount ? amount : hand.stackSize;
|
||||
@@ -121,7 +121,7 @@ public class AdaptorPlayerHand extends InventoryAdaptor
|
||||
return null;
|
||||
}
|
||||
|
||||
if( filter == null || Platform.isSameItemFuzzy( filter, hand, fuzzyMode ) )
|
||||
if( filter == null || Platform.itemComparisons().isFuzzyEqualItem( filter, hand, fuzzyMode ) )
|
||||
{
|
||||
final ItemStack result = hand.copy();
|
||||
result.stackSize = hand.stackSize > amount ? amount : hand.stackSize;
|
||||
@@ -154,7 +154,7 @@ public class AdaptorPlayerHand extends InventoryAdaptor
|
||||
|
||||
final ItemStack hand = this.player.inventory.getItemStack();
|
||||
|
||||
if( hand != null && !Platform.isSameItemPrecise( toBeAdded, hand ) )
|
||||
if( hand != null && !Platform.itemComparisons().isSameItem( toBeAdded, hand ) )
|
||||
{
|
||||
return toBeAdded;
|
||||
}
|
||||
@@ -194,7 +194,7 @@ public class AdaptorPlayerHand extends InventoryAdaptor
|
||||
return null;
|
||||
}
|
||||
|
||||
if( hand != null && !Platform.isSameItem( toBeSimulated, hand ) )
|
||||
if( hand != null && !Platform.itemComparisons().isEqualItem( toBeSimulated, hand ) )
|
||||
{
|
||||
return toBeSimulated;
|
||||
}
|
||||
|
||||
@@ -327,7 +327,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
|
||||
return ta == tb;
|
||||
}
|
||||
|
||||
return Platform.NBTEqualityTest( ta, tb );
|
||||
return Platform.itemComparisons().isNbtTagEqual( ta, tb );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -100,7 +100,7 @@ public class AEItemDef
|
||||
|
||||
if( this.getTagCompound() != null && otherStack.hasTagCompound() )
|
||||
{
|
||||
return Platform.NBTEqualityTest( this.getTagCompound(), otherStack.getTagCompound() );
|
||||
return Platform.itemComparisons().isNbtTagEqual( this.getTagCompound(), otherStack.getTagCompound() );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -522,7 +522,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
||||
return ta == tb;
|
||||
}
|
||||
|
||||
return Platform.NBTEqualityTest( ta, tb );
|
||||
return Platform.itemComparisons().isNbtTagEqual( ta, tb );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -136,7 +136,7 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound
|
||||
x.setTag( name, c.getTag( name ).copy() );
|
||||
}
|
||||
|
||||
x.hash = Platform.NBTOrderlessHash( c );
|
||||
x.hash = Platform.itemComparisons().createUnorderedNbtHash( c );
|
||||
|
||||
final ItemStack isc = new ItemStack( itemID, 1, damageValue );
|
||||
isc.setTagCompound( c );
|
||||
|
||||
@@ -36,7 +36,7 @@ public class SharedSearchObject
|
||||
public SharedSearchObject( final Item itemID, final int damageValue, final NBTTagCompound tagCompound )
|
||||
{
|
||||
this.def = ( damageValue << Platform.DEF_OFFSET ) | Item.REGISTRY.getIDForObject( itemID );
|
||||
this.hash = Platform.NBTOrderlessHash( tagCompound );
|
||||
this.hash = Platform.itemComparisons().createUnorderedNbtHash( tagCompound );
|
||||
this.setCompound( tagCompound );
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public class SharedSearchObject
|
||||
final SharedSearchObject other = (SharedSearchObject) obj;
|
||||
if( this.def == other.def && this.hash == other.hash )
|
||||
{
|
||||
return Platform.NBTEqualityTest( this.getCompound(), other.getCompound() );
|
||||
return Platform.itemComparisons().isNbtTagEqual( this.getCompound(), other.getCompound() );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.util.prioitylist;
|
||||
package appeng.util.prioritylist;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.util.prioitylist;
|
||||
package appeng.util.prioritylist;
|
||||
|
||||
|
||||
import java.util.Collection;
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.util.prioitylist;
|
||||
package appeng.util.prioritylist;
|
||||
|
||||
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.util.prioitylist;
|
||||
package appeng.util.prioritylist;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.util.prioitylist;
|
||||
package appeng.util.prioritylist;
|
||||
|
||||
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
@@ -73,17 +73,17 @@ tile.appliedenergistics2.sky_stone_slab.name=Himmelssteinstufe
|
||||
|
||||
// Chat Messages
|
||||
chat.appliedenergistics2.ChestCannotReadStorageCell=ME-Truhe kann die Speicherzelle nicht einlesen.
|
||||
chat.appliedenergistics2.SettingCleared=Einstellung gelöscht.
|
||||
chat.appliedenergistics2.SettingCleared=Speicherkarte geleert.
|
||||
chat.appliedenergistics2.OutOfRange=Drahtloser Zugangspunkt außer Reichweite.
|
||||
chat.appliedenergistics2.InvalidMachine=Ungültige Maschine.
|
||||
chat.appliedenergistics2.LoadedSettings=Einstellungen erfolgreich geladen.
|
||||
chat.appliedenergistics2.LoadedSettings=Geräteeinstellungen von Speicherkarte geladen.
|
||||
chat.appliedenergistics2.DeviceNotPowered=Gerät hat zu wenig Energie
|
||||
chat.appliedenergistics2.DeviceNotWirelessTerminal=Gerät ist keine Drahtloskonsole.
|
||||
chat.appliedenergistics2.DeviceNotLinked=Gerät ist nicht verbunden.
|
||||
chat.appliedenergistics2.StationCanNotBeLocated=Station kann nicht lokalisiert werden.
|
||||
chat.appliedenergistics2.MachineNotPowered=Maschine bekommt keine Energie.
|
||||
chat.appliedenergistics2.CommunicationError=Fehler beim Kommunizieren mit dem Netzwerk.
|
||||
chat.appliedenergistics2.SavedSettings=Einstellungen erfolgreich gespeichert.
|
||||
chat.appliedenergistics2.SavedSettings=Geräteeinstellungen auf Speicherkarte kopiert.
|
||||
chat.appliedenergistics2.AmmoDepleted=Munition verbraucht.
|
||||
chat.appliedenergistics2.isNowLocked=Monitor ist nun gesperrt.
|
||||
chat.appliedenergistics2.isNowUnlocked=Monitor ist nun entsperrt.
|
||||
|
||||
@@ -73,17 +73,17 @@ tile.appliedenergistics2.sky_stone_slab.name=Sky Stone Slabs
|
||||
|
||||
// Chat Messages
|
||||
chat.appliedenergistics2.ChestCannotReadStorageCell=ME Chest cannot read storage cell.
|
||||
chat.appliedenergistics2.SettingCleared=Setting Cleared.
|
||||
chat.appliedenergistics2.SettingCleared=Memory card cleared.
|
||||
chat.appliedenergistics2.OutOfRange=Wireless Out Of Range.
|
||||
chat.appliedenergistics2.InvalidMachine=Invalid Machine.
|
||||
chat.appliedenergistics2.LoadedSettings=Successfully loaded settings.
|
||||
chat.appliedenergistics2.LoadedSettings=Loaded device configuration from memory card.
|
||||
chat.appliedenergistics2.DeviceNotPowered=Device is low on power.
|
||||
chat.appliedenergistics2.DeviceNotWirelessTerminal=Device is not a wireless terminal.
|
||||
chat.appliedenergistics2.DeviceNotLinked=Device is not linked.
|
||||
chat.appliedenergistics2.StationCanNotBeLocated=Station can not be located.
|
||||
chat.appliedenergistics2.MachineNotPowered=Machine is not powered.
|
||||
chat.appliedenergistics2.CommunicationError=Error Communicating with Network.
|
||||
chat.appliedenergistics2.SavedSettings=Successfully saved settings.
|
||||
chat.appliedenergistics2.SavedSettings=Copied device configuration to memory card.
|
||||
chat.appliedenergistics2.AmmoDepleted=Ammo Depleted.
|
||||
chat.appliedenergistics2.isNowLocked=Monitor is now Locked.
|
||||
chat.appliedenergistics2.isNowUnlocked=Monitor is now Unlocked.
|
||||
@@ -360,6 +360,10 @@ waila.appliedenergistics2.Unlocked=Unlocked
|
||||
waila.appliedenergistics2.Showing=Showing
|
||||
waila.appliedenergistics2.Contains=Contains
|
||||
waila.appliedenergistics2.Channels=%1$d of %2$d Channels
|
||||
waila.appliedenergistics2.P2PUnlinked=Unlinked
|
||||
waila.appliedenergistics2.P2PInputOneOutput=Linked (Input Side)
|
||||
waila.appliedenergistics2.P2PInputManyOutputs=Linked (Input Side) - %d Outputs
|
||||
waila.appliedenergistics2.P2POutput=Linked (Output Side)
|
||||
|
||||
// Items
|
||||
item.appliedenergistics2.storage_cell_1k.name=1k ME Storage Cell
|
||||
|
||||
@@ -284,8 +284,8 @@ gui.tooltips.appliedenergistics2.EmitLevelsBelow=Излучать, когда у
|
||||
gui.tooltips.appliedenergistics2.EmitLevelAbove=Излучать, когда уровни выше или равны пределу.
|
||||
gui.tooltips.appliedenergistics2.SearchMode_Auto=Автоматический поиск
|
||||
gui.tooltips.appliedenergistics2.SearchMode_Standard=Обычный поиск
|
||||
gui.tooltips.appliedenergistics2.SearchMode_NEIAuto=Автоматический NEI-синхронизированный поиск
|
||||
gui.tooltips.appliedenergistics2.SearchMode_NEIStandard=Стандартный NEI-синхронизированный поиск
|
||||
gui.tooltips.appliedenergistics2.SearchMode_JEIAuto=Автоматический JEI-синхронизированный поиск
|
||||
gui.tooltips.appliedenergistics2.SearchMode_JEIStandard=Стандартный JEI-синхронизированный поиск
|
||||
gui.tooltips.appliedenergistics2.SearchMode=Режим поля поиска
|
||||
gui.tooltips.appliedenergistics2.PartitionStorageHint=Настраивает раздел на основе текущих хранящихся предметах.
|
||||
gui.tooltips.appliedenergistics2.ClearSettings=Очистить настройки
|
||||
@@ -360,6 +360,10 @@ waila.appliedenergistics2.Unlocked=Разблокировано
|
||||
waila.appliedenergistics2.Showing=Показывает
|
||||
waila.appliedenergistics2.Contains=Содержит
|
||||
waila.appliedenergistics2.Channels=Каналы: %1$d из %2$d
|
||||
waila.appliedenergistics2.P2PUnlinked=Не связанный
|
||||
waila.appliedenergistics2.P2PInputOneOutput=Связанный (Сторона ввода)
|
||||
waila.appliedenergistics2.P2PInputManyOutputs=Связанный (Сторона ввода) - %d выводов
|
||||
waila.appliedenergistics2.P2POutput=Связанный (Сторона вывода)
|
||||
|
||||
// Items
|
||||
item.appliedenergistics2.storage_cell_1k.name=1К МЭ ячейка хранения
|
||||
|
||||
Reference in New Issue
Block a user