Bad Fuzzy Logic for Non-Damageable Items.

This commit is contained in:
AlgorithmX2 2014-05-21 21:08:13 -05:00
parent 0f781cebba
commit 569ed2f99e
2 changed files with 37 additions and 34 deletions

View file

@ -18,7 +18,6 @@ import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAETagCompound;
import appeng.util.Platform;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -329,7 +328,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
data.readBytes( bd );
ByteArrayInputStream di = new ByteArrayInputStream( bd );
d.setTag( "tag", CompressedStreamTools.read( new DataInputStream( di) ) );
d.setTag( "tag", CompressedStreamTools.read( new DataInputStream( di ) ) );
}
// long priority = getPacketValue( PriorityType, data );
@ -483,18 +482,20 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
return bottom;
}
if ( fuzzy == FuzzyMode.IGNORE_ALL )
{
newDef.dspDamage = 0;
}
else
{
int low = fuzzy.calculateBreakPoint( def.maxDamage );
newDef.dspDamage = low < def.dspDamage ? low : 0;
}
if ( newDef.item.isDamageable() )
{
if ( fuzzy == FuzzyMode.IGNORE_ALL )
{
newDef.dspDamage = 0;
}
else
{
int low = fuzzy.calculateBreakPoint( def.maxDamage );
newDef.dspDamage = low < def.dspDamage ? low : 0;
}
newDef.damageValue = newDef.dspDamage;
}
newDef.tagCompound = AEItemDef.lowTag;
newDef.reHash();
@ -513,18 +514,20 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
return top;
}
if ( fuzzy == FuzzyMode.IGNORE_ALL )
{
newDef.dspDamage = def.maxDamage + 1;
}
else
{
int high = fuzzy.calculateBreakPoint( def.maxDamage ) + 1;
newDef.dspDamage = high > def.dspDamage ? high : def.maxDamage + 1;
}
if ( newDef.item.isDamageable() )
{
if ( fuzzy == FuzzyMode.IGNORE_ALL )
{
newDef.dspDamage = def.maxDamage + 1;
}
else
{
int high = fuzzy.calculateBreakPoint( def.maxDamage ) + 1;
newDef.dspDamage = high > def.dspDamage ? high : def.maxDamage + 1;
}
newDef.damageValue = top.def.dspDamage;
}
newDef.tagCompound = AEItemDef.highTag;
newDef.reHash();

View file

@ -26,17 +26,17 @@ public final class ItemList<StackType extends IAEStack> implements IItemList<Sta
int iteration = Integer.MIN_VALUE;
public Throwable stacktrace;
public ItemList( Class<? extends IAEStack> cla) {
public ItemList(Class<? extends IAEStack> cla) {
clz = cla;
}
private boolean checkStackType( StackType st )
private boolean checkStackType(StackType st)
{
if ( st == null)
if ( st == null )
return true;
if ( !clz.isInstance(st) )
throw new RuntimeException("WRONG TYPE - got "+st.getClass().getName()+" expected "+clz.getName() );
if ( !clz.isInstance( st ) )
throw new RuntimeException( "WRONG TYPE - got " + st.getClass().getName() + " expected " + clz.getName() );
return false;
}
@ -190,7 +190,7 @@ public final class ItemList<StackType extends IAEStack> implements IItemList<Sta
{
StackType low = (StackType) filter.getLow( fuzzy, ignoreMeta );
StackType high = (StackType) filter.getHigh( fuzzy, ignoreMeta );
return records.subMap( low, high ).values();
return records.subMap( low, true, high, true ).values();
}
@Override