Bad Fuzzy Logic for Non-Damageable Items.
This commit is contained in:
parent
0f781cebba
commit
569ed2f99e
2 changed files with 37 additions and 34 deletions
|
@ -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();
|
||||
|
|
|
@ -20,27 +20,27 @@ public final class ItemList<StackType extends IAEStack> implements IItemList<Sta
|
|||
|
||||
private final TreeMap<StackType, StackType> records = new TreeMap();
|
||||
private final Class<? extends IAEStack> clz;
|
||||
|
||||
|
||||
// private int currentPriority = Integer.MIN_VALUE;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
synchronized public void add(StackType option)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -198,7 +198,7 @@ public final class ItemList<StackType extends IAEStack> implements IItemList<Sta
|
|||
{
|
||||
if ( checkStackType( filter ) )
|
||||
return new ArrayList();
|
||||
|
||||
|
||||
if ( filter instanceof IAEFluidStack )
|
||||
return filter.equals( this ) ? (List<StackType>) Arrays.asList( new IAEFluidStack[] { (IAEFluidStack) filter } ) : (List<StackType>) Arrays
|
||||
.asList( new IAEFluidStack[] {} );
|
||||
|
|
Loading…
Reference in a new issue