Extracts item comparison from Platform into their own helper. (#2555)
* Extracts item comparison from Platform into their own helper. Renamed methods to be more more fitting for the actual comparison. Added documentation about each methods behaviour.
This commit is contained in:
@@ -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() );
|
||||
}
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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() );
|
||||
}
|
||||
|
||||
@@ -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() );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user