From 569ed2f99e67eb42ae4897b4f918951f307387ef Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Wed, 21 May 2014 21:08:13 -0500 Subject: [PATCH] Bad Fuzzy Logic for Non-Damageable Items. --- util/item/AEItemStack.java | 47 ++++++++++++++++++++------------------ util/item/ItemList.java | 24 +++++++++---------- 2 files changed, 37 insertions(+), 34 deletions(-) diff --git a/util/item/AEItemStack.java b/util/item/AEItemStack.java index da3f337a0..64e7d3f8c 100644 --- a/util/item/AEItemStack.java +++ b/util/item/AEItemStack.java @@ -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 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 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 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(); diff --git a/util/item/ItemList.java b/util/item/ItemList.java index dadcdb7a7..97af438b2 100644 --- a/util/item/ItemList.java +++ b/util/item/ItemList.java @@ -20,27 +20,27 @@ public final class ItemList implements IItemList records = new TreeMap(); private final Class clz; - + // private int currentPriority = Integer.MIN_VALUE; int iteration = Integer.MIN_VALUE; public Throwable stacktrace; - - public ItemList( Class cla) { + + public ItemList(Class 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 implements IItemList implements IItemList) Arrays.asList( new IAEFluidStack[] { (IAEFluidStack) filter } ) : (List) Arrays .asList( new IAEFluidStack[] {} );