Fixed Weird fuzzy business

This commit is contained in:
AlgorithmX2
2014-01-06 00:55:16 -06:00
parent 57a91c2969
commit 88bb735ed8
3 changed files with 21 additions and 16 deletions
+1
View File
@@ -128,6 +128,7 @@ public class AdaptorIInventory extends InventoryAdaptor
if ( rv == null ) if ( rv == null )
{ {
rv = is.copy(); rv = is.copy();
filter = rv;
rv.stackSize = lhow_many; rv.stackSize = lhow_many;
how_many -= lhow_many; how_many -= lhow_many;
} }
+7
View File
@@ -39,6 +39,7 @@ public class AEItemDef
t.damageValue = damageValue; t.damageValue = damageValue;
t.dspDamage = dspDamage; t.dspDamage = dspDamage;
t.maxDamage = maxDamage; t.maxDamage = maxDamage;
t.tagCompound = tagCompound;
return t; return t;
} }
@@ -71,4 +72,10 @@ public class AEItemDef
} }
return false; return false;
} }
public void reHash()
{
def = item.itemID << Platform.DEF_OFFSET | damageValue;
myHash = def ^ (tagCompound == null ? 0 : System.identityHashCode( tagCompound ));
}
} }
+13 -16
View File
@@ -73,8 +73,6 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
* Kinda Hacky * Kinda Hacky
*/ */
def.damageValue = def.getDamageValueHack( is ); def.damageValue = def.getDamageValueHack( is );
def.def = is.itemID << Platform.DEF_OFFSET | def.damageValue;
def.dspDamage = is.getItemDamageForDisplay(); def.dspDamage = is.getItemDamageForDisplay();
def.maxDamage = is.getMaxDamage(); def.maxDamage = is.getMaxDamage();
@@ -86,7 +84,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
setCraftable( false ); setCraftable( false );
setCountRequestable( 0 ); setCountRequestable( 0 );
def.myHash = def.def ^ (def.tagCompound == null ? 0 : System.identityHashCode( def.tagCompound )); def.reHash();
} }
public static AEItemStack create(Object a) public static AEItemStack create(Object a)
@@ -243,9 +241,6 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
int dv = def.damageValue - b.def.damageValue; int dv = def.damageValue - b.def.damageValue;
int dspv = def.dspDamage - b.def.dspDamage; int dspv = def.dspDamage - b.def.dspDamage;
int dif = id == 0 ? (dv == 0 ? (dspv == 0 ? ((def.tagCompound == null ? 0 : def.tagCompound.hashCode()) - (b.def.tagCompound == null ? 0
: b.def.tagCompound.hashCode())) : dspv) : dv) : id;
return id == 0 ? (dv == 0 ? (dspv == 0 ? ((def.tagCompound == null ? 0 : def.tagCompound.hashCode()) - (b.def.tagCompound == null ? 0 return id == 0 ? (dv == 0 ? (dspv == 0 ? ((def.tagCompound == null ? 0 : def.tagCompound.hashCode()) - (b.def.tagCompound == null ? 0
: b.def.tagCompound.hashCode())) : dspv) : dv) : id; : b.def.tagCompound.hashCode())) : dspv) : dv) : id;
} }
@@ -476,42 +471,44 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
public IAEItemStack getLow(FuzzyMode fuzzy) public IAEItemStack getLow(FuzzyMode fuzzy)
{ {
AEItemStack bottom = new AEItemStack( this ); AEItemStack bottom = new AEItemStack( this );
bottom.def = bottom.def.copy(); AEItemDef newDef = bottom.def = bottom.def.copy();
if ( fuzzy == FuzzyMode.IGNORE_ALL ) if ( fuzzy == FuzzyMode.IGNORE_ALL )
{ {
bottom.def.dspDamage = 0; newDef.dspDamage = 0;
} }
else else
{ {
int low = fuzzy.calculateBreakPoint( def.maxDamage ); int low = fuzzy.calculateBreakPoint( def.maxDamage );
bottom.def.dspDamage = low < def.dspDamage ? low : 0; newDef.dspDamage = low < def.dspDamage ? low : 0;
} }
if ( bottom.def.item.isDamageable() ) if ( newDef.item.isDamageable() )
bottom.def.damageValue = bottom.def.dspDamage; newDef.damageValue = newDef.dspDamage;
newDef.reHash();
return bottom; return bottom;
} }
public IAEItemStack getHigh(FuzzyMode fuzzy) public IAEItemStack getHigh(FuzzyMode fuzzy)
{ {
AEItemStack top = new AEItemStack( this ); AEItemStack top = new AEItemStack( this );
top.def = top.def.copy(); AEItemDef newDef = top.def = top.def.copy();
if ( fuzzy == FuzzyMode.IGNORE_ALL ) if ( fuzzy == FuzzyMode.IGNORE_ALL )
{ {
top.def.dspDamage = def.maxDamage + 1; newDef.dspDamage = def.maxDamage + 1;
} }
else else
{ {
int high = fuzzy.calculateBreakPoint( def.maxDamage ) + 1; int high = fuzzy.calculateBreakPoint( def.maxDamage ) + 1;
top.def.dspDamage = high > def.dspDamage ? high : def.maxDamage + 1; newDef.dspDamage = high > def.dspDamage ? high : def.maxDamage + 1;
} }
if ( top.def.item.isDamageable() ) if ( newDef.item.isDamageable() )
top.def.damageValue = top.def.dspDamage; newDef.damageValue = top.def.dspDamage;
newDef.reHash();
return top; return top;
} }