mirror of
https://github.com/GTNewHorizons/StorageDrawers.git
synced 2026-11-13 00:47:31 +00:00
Fix conversion rate bug in compacting drawers for some descending lookups; add more debug logging.
This commit is contained in:
1 parent
db064d0cb6
commit
f4ea33db4e
2 files changed
+25
-4
No files matched your search
+1
-1
@@ -17,7 +17,7 @@ buildscript {
|
||||
|
||||
apply plugin: 'forge'
|
||||
|
||||
version = "1.7.10-1.5.11"
|
||||
version = "1.7.10-1.5.12"
|
||||
group= "com.jaquadro.minecraft.storagedrawers" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = "StorageDrawers"
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.jaquadro.minecraft.storagedrawers.config.CompTierRegistry;
|
||||
import com.jaquadro.minecraft.storagedrawers.config.ConfigManager;
|
||||
import com.jaquadro.minecraft.storagedrawers.network.CountUpdateMessage;
|
||||
import com.jaquadro.minecraft.storagedrawers.storage.*;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
@@ -19,9 +20,12 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class TileEntityDrawersComp extends TileEntityDrawers
|
||||
{
|
||||
@@ -181,6 +185,9 @@ public class TileEntityDrawersComp extends TileEntityDrawers
|
||||
|
||||
ItemStack lTier1 = findLowerTier(stack);
|
||||
if (lTier1 != null) {
|
||||
if (!worldObj.isRemote && StorageDrawers.config.cache.debugTrace)
|
||||
FMLLog.log(StorageDrawers.MOD_ID, Level.INFO, "Picked candidate " + lTier1.toString() + " with conv=" + lookupSizeResult);
|
||||
|
||||
populateSlot(index++, lTier1, 1);
|
||||
for (int i = 0; i < index - 1; i++)
|
||||
convRate[i] *= lookupSizeResult;
|
||||
@@ -191,6 +198,9 @@ public class TileEntityDrawersComp extends TileEntityDrawers
|
||||
|
||||
ItemStack lTier2 = findLowerTier(lTier1);
|
||||
if (lTier2 != null) {
|
||||
if (!worldObj.isRemote && StorageDrawers.config.cache.debugTrace)
|
||||
FMLLog.log(StorageDrawers.MOD_ID, Level.INFO, "Picked candidate " + lTier2.toString() + " with conv=" + lookupSizeResult);
|
||||
|
||||
populateSlot(index++, lTier2, 1);
|
||||
for (int i = 0; i < index - 1; i++)
|
||||
convRate[i] *= lookupSizeResult;
|
||||
@@ -246,6 +256,7 @@ public class TileEntityDrawersComp extends TileEntityDrawers
|
||||
List recipeList = cm.getRecipeList();
|
||||
|
||||
List<ItemStack> candidates = new ArrayList<ItemStack>();
|
||||
Map<ItemStack, Integer> candidatesRate = new HashMap<ItemStack, Integer>();
|
||||
|
||||
for (int i = 0, n = recipeList.size(); i < n; i++) {
|
||||
IRecipe recipe = (IRecipe) recipeList.get(i);
|
||||
@@ -278,16 +289,26 @@ public class TileEntityDrawersComp extends TileEntityDrawers
|
||||
if (DrawerData.areItemsEqual(match, comp) && comp.stackSize == recipe.getRecipeSize()) {
|
||||
lookupSizeResult = recipe.getRecipeSize();
|
||||
candidates.add(match);
|
||||
candidatesRate.put(match, lookupSizeResult);
|
||||
|
||||
if (!worldObj.isRemote && StorageDrawers.config.cache.debugTrace)
|
||||
FMLLog.log(StorageDrawers.MOD_ID, Level.INFO, "Found descending candidate for " + stack.toString() + ": " + match.toString() + " size=" + lookupSizeResult + ", inverse=" + comp.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack modMatch = findMatchingModCandidate(stack, candidates);
|
||||
if (modMatch != null)
|
||||
if (modMatch != null) {
|
||||
lookupSizeResult = candidatesRate.get(modMatch);
|
||||
return modMatch;
|
||||
}
|
||||
|
||||
if (candidates.size() > 0)
|
||||
return candidates.get(0);
|
||||
if (candidates.size() > 0) {
|
||||
ItemStack match = candidates.get(0);
|
||||
lookupSizeResult = candidatesRate.get(match);
|
||||
|
||||
return match;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user