Clean up some ItemStack copying and fix incorrect stack size in log message

This commit is contained in:
Pahimar 2016-05-19 15:54:59 -04:00
parent f51f3659d6
commit b0544a00ac
2 changed files with 4 additions and 13 deletions

View file

@ -579,7 +579,7 @@ public class EnergyValueRegistry {
uncomputedStacks.removeIf(wrappedStack -> uncomputedStacks.contains(WrappedStack.wrap(recipeOutput, 1)));
if (ConfigurationHandler.Settings.energyValueDebugLoggingEnabled) {
LogHelper.info(ENERGY_VALUE_MARKER, "Pass {}: Calculated value {} for object {}", passNumber, computedOutputValue, recipeOutput);
LogHelper.info(ENERGY_VALUE_MARKER, "Pass {}: Calculated value {} for object {}", passNumber, computedOutputValue, WrappedStack.wrap(recipeOutput, 1));
}
tempComputedMap.put(WrappedStack.wrap(recipeOutput), computedOutputValue);

View file

@ -6,7 +6,6 @@ import com.pahimar.ee3.util.ItemHelper;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
@ -50,15 +49,9 @@ public class WrappedStack implements Comparable<WrappedStack>, JsonDeserializer<
if (((ItemStack) object).getItem() != null)
{
ItemStack itemStackObject = (ItemStack) object;
ItemStack itemStack = new ItemStack(itemStackObject.getItem(), itemStackObject.stackSize, itemStackObject.getItemDamage());
if (itemStackObject.stackTagCompound != null)
{
itemStack.stackTagCompound = (NBTTagCompound) itemStackObject.stackTagCompound.copy();
}
objectType = "itemstack";
stackSize = itemStack.stackSize;
itemStack.stackSize = 1;
wrappedStack = itemStack;
stackSize = ((ItemStack) object).stackSize;
wrappedStack = ItemHelper.clone((ItemStack) object, 1);
}
else
{
@ -145,11 +138,9 @@ public class WrappedStack implements Comparable<WrappedStack>, JsonDeserializer<
if (object instanceof ItemStack)
{
ItemStack itemStack = ((ItemStack) object).copy();
objectType = "itemstack";
this.stackSize = stackSize;
itemStack.stackSize = 1;
wrappedStack = itemStack;
wrappedStack = ItemHelper.clone((ItemStack) object, 1);
}
else if (object instanceof OreStack)
{