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:
yueh
2016-11-04 09:27:52 +01:00
committed by GitHub
parent f85ab7ddc2
commit 1e20086799
53 changed files with 555 additions and 471 deletions
@@ -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 );
}
@@ -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;
@@ -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 )