isFluid/isItem
This commit is contained in:
@@ -16,6 +16,7 @@ import net.minecraft.nbt.NBTTagString;
|
|||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.Fluid;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import appeng.api.config.FuzzyMode;
|
import appeng.api.config.FuzzyMode;
|
||||||
|
import appeng.api.storage.StorageChannel;
|
||||||
import appeng.api.storage.data.IAEFluidStack;
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
import appeng.api.storage.data.IAETagCompound;
|
import appeng.api.storage.data.IAETagCompound;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
@@ -316,4 +317,22 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isItem()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFluid()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StorageChannel getChannel()
|
||||||
|
{
|
||||||
|
return StorageChannel.FLUIDS;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||||||
import net.minecraft.nbt.NBTTagLong;
|
import net.minecraft.nbt.NBTTagLong;
|
||||||
import net.minecraft.nbt.NBTTagShort;
|
import net.minecraft.nbt.NBTTagShort;
|
||||||
import appeng.api.config.FuzzyMode;
|
import appeng.api.config.FuzzyMode;
|
||||||
|
import appeng.api.storage.StorageChannel;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.storage.data.IAETagCompound;
|
import appeng.api.storage.data.IAETagCompound;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
@@ -108,7 +109,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
|||||||
{
|
{
|
||||||
if ( ia instanceof AEItemStack )
|
if ( ia instanceof AEItemStack )
|
||||||
{
|
{
|
||||||
return ((AEItemStack) ia).def == def && def.tagCompound == ((AEItemStack) ia).def.tagCompound;
|
return ((AEItemStack) ia).def.equals( def ) && def.tagCompound == ((AEItemStack) ia).def.tagCompound;
|
||||||
}
|
}
|
||||||
else if ( ia instanceof ItemStack )
|
else if ( ia instanceof ItemStack )
|
||||||
{
|
{
|
||||||
@@ -242,6 +243,9 @@ 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;
|
||||||
}
|
}
|
||||||
@@ -474,8 +478,18 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
|||||||
AEItemStack bottom = new AEItemStack( this );
|
AEItemStack bottom = new AEItemStack( this );
|
||||||
bottom.def = bottom.def.copy();
|
bottom.def = bottom.def.copy();
|
||||||
|
|
||||||
int low = fuzzy.calculateBreakPoint( def.maxDamage );
|
if ( fuzzy == FuzzyMode.IGNORE_ALL )
|
||||||
bottom.def.dspDamage = low < def.dspDamage ? low : 0;
|
{
|
||||||
|
bottom.def.dspDamage = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int low = fuzzy.calculateBreakPoint( def.maxDamage );
|
||||||
|
bottom.def.dspDamage = low < def.dspDamage ? low : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( bottom.def.item.isDamageable() )
|
||||||
|
bottom.def.damageValue = bottom.def.dspDamage;
|
||||||
|
|
||||||
return bottom;
|
return bottom;
|
||||||
}
|
}
|
||||||
@@ -485,8 +499,18 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
|||||||
AEItemStack top = new AEItemStack( this );
|
AEItemStack top = new AEItemStack( this );
|
||||||
top.def = top.def.copy();
|
top.def = top.def.copy();
|
||||||
|
|
||||||
int high = fuzzy.calculateBreakPoint( def.maxDamage );
|
if ( fuzzy == FuzzyMode.IGNORE_ALL )
|
||||||
top.def.dspDamage = high > def.dspDamage ? high : def.maxDamage;
|
{
|
||||||
|
top.def.dspDamage = def.maxDamage + 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int high = fuzzy.calculateBreakPoint( def.maxDamage ) + 1;
|
||||||
|
top.def.dspDamage = high > def.dspDamage ? high : def.maxDamage + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( top.def.item.isDamageable() )
|
||||||
|
top.def.damageValue = top.def.dspDamage;
|
||||||
|
|
||||||
return top;
|
return top;
|
||||||
}
|
}
|
||||||
@@ -514,4 +538,22 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
|||||||
|
|
||||||
return def.isItem( otherStack );
|
return def.isItem( otherStack );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isItem()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFluid()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StorageChannel getChannel()
|
||||||
|
{
|
||||||
|
return StorageChannel.ITEMS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import appeng.api.storage.data.IAEItemStack;
|
|||||||
public class OreHelper
|
public class OreHelper
|
||||||
{
|
{
|
||||||
|
|
||||||
public static OreHelper instance;
|
public static OreHelper instance = new OreHelper();
|
||||||
|
|
||||||
public boolean isOre(IAEItemStack is)
|
public boolean isOre(IAEItemStack is)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user