Removed "compare oredict" buttons on Exporter, Importer, etc.
This commit is contained in:
@@ -10,6 +10,7 @@ NOTE: Worlds that used Refined Storage 1.5.x are fully compatible with Refined S
|
||||
- Removed the Wrench (raoulvdberge)
|
||||
- Removed "void excess items or fluids" functionality on storages (raoulvdberge)
|
||||
- Removed the Solderer (raoulvdberge)
|
||||
- Removed "compare oredict" buttons on Exporter, Importer, etc. (raoulvdberge)
|
||||
- Added the Cutting Tool (raoulvdberge)
|
||||
- Renamed "Printed Processors" to "Cut Processors" (raoulvdberge)
|
||||
- Rewrote autocrafting (raoulvdberge)
|
||||
|
||||
@@ -210,18 +210,9 @@ public interface IRSAPI {
|
||||
|
||||
/**
|
||||
* @param stack the stack
|
||||
* @param tag whether the NBT tag of the stack should be calculated in the hashcode, used for performance reasons
|
||||
* @return a hashcode for the given stack
|
||||
*/
|
||||
int getItemStackHashCode(ItemStack stack, boolean tag);
|
||||
|
||||
/**
|
||||
* @param stack the stack
|
||||
* @return a hashcode for the given stack
|
||||
*/
|
||||
default int getItemStackHashCode(ItemStack stack) {
|
||||
return getItemStackHashCode(stack, true);
|
||||
}
|
||||
int getItemStackHashCode(ItemStack stack);
|
||||
|
||||
/**
|
||||
* @param stack the stack
|
||||
|
||||
@@ -12,7 +12,6 @@ public interface IComparer {
|
||||
int COMPARE_DAMAGE = 1;
|
||||
int COMPARE_NBT = 2;
|
||||
int COMPARE_QUANTITY = 4;
|
||||
int COMPARE_OREDICT = 8;
|
||||
|
||||
/**
|
||||
* Compares two stacks by the given flags.
|
||||
@@ -63,14 +62,5 @@ public interface IComparer {
|
||||
* @param right the right stack
|
||||
* @return true if the NBT tags of the two stacks are the same, false otherwise
|
||||
*/
|
||||
boolean isEqualNBT(@Nullable ItemStack left, @Nullable ItemStack right);
|
||||
|
||||
/**
|
||||
* Compares two stacks and checks if they share the same ore dictionary entry.
|
||||
*
|
||||
* @param left the left stack
|
||||
* @param right the right stack
|
||||
* @return true if the two stacks share the same ore dictionary entry
|
||||
*/
|
||||
boolean isEqualOredict(@Nullable ItemStack left, @Nullable ItemStack right);
|
||||
boolean isEqualNbt(@Nullable ItemStack left, @Nullable ItemStack right);
|
||||
}
|
||||
|
||||
@@ -286,22 +286,22 @@ public class API implements IRSAPI {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemStackHashCode(ItemStack stack, boolean tag) {
|
||||
public int getItemStackHashCode(ItemStack stack) {
|
||||
int result = stack.getItem().hashCode();
|
||||
result = 31 * result + (stack.getItemDamage() + 1);
|
||||
|
||||
if (tag && stack.hasTagCompound()) {
|
||||
result = calcHashCode(stack.getTagCompound(), result);
|
||||
if (stack.hasTagCompound()) {
|
||||
result = getHashCode(stack.getTagCompound(), result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private int calcHashCode(NBTBase tag, int result) {
|
||||
private int getHashCode(NBTBase tag, int result) {
|
||||
if (tag instanceof NBTTagCompound) {
|
||||
result = calcHashCode((NBTTagCompound) tag, result);
|
||||
result = getHashCode((NBTTagCompound) tag, result);
|
||||
} else if (tag instanceof NBTTagList) {
|
||||
result = calcHashCode((NBTTagList) tag, result);
|
||||
result = getHashCode((NBTTagList) tag, result);
|
||||
} else {
|
||||
result = 31 * result + tag.hashCode();
|
||||
}
|
||||
@@ -309,18 +309,18 @@ public class API implements IRSAPI {
|
||||
return result;
|
||||
}
|
||||
|
||||
private int calcHashCode(NBTTagCompound tag, int result) {
|
||||
private int getHashCode(NBTTagCompound tag, int result) {
|
||||
for (String key : tag.getKeySet()) {
|
||||
result = 31 * result + key.hashCode();
|
||||
result = calcHashCode(tag.getTag(key), result);
|
||||
result = getHashCode(tag.getTag(key), result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private int calcHashCode(NBTTagList tag, int result) {
|
||||
private int getHashCode(NBTTagList tag, int result) {
|
||||
for (int i = 0; i < tag.tagCount(); ++i) {
|
||||
result = calcHashCode(tag.get(i), result);
|
||||
result = getHashCode(tag.get(i), result);
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -331,7 +331,7 @@ public class API implements IRSAPI {
|
||||
int result = stack.getFluid().hashCode();
|
||||
|
||||
if (stack.tag != null) {
|
||||
result = calcHashCode(stack.tag, result);
|
||||
result = getHashCode(stack.tag, result);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.registry.CraftingTaskFactory;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.util.OneSixMigrationHelper;
|
||||
import com.raoulvdberge.refinedstorage.item.ItemPattern;
|
||||
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
@@ -15,7 +15,7 @@ import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -50,15 +50,23 @@ public class CraftingPattern implements ICraftingPattern {
|
||||
if (input == null) {
|
||||
inputs.add(NonNullList.create());
|
||||
} else if (oredict) {
|
||||
NonNullList<ItemStack> equivalent = NonNullList.create();
|
||||
NonNullList<ItemStack> ores = NonNullList.create();
|
||||
|
||||
equivalent.add(input.copy());
|
||||
ores.add(input.copy());
|
||||
|
||||
for (ItemStack equivalentStack : StackUtils.getEquivalentStacks(input)) {
|
||||
equivalent.add(ItemHandlerHelper.copyStackWithSize(equivalentStack, input.getCount()));
|
||||
for (int id : OreDictionary.getOreIDs(stack)) {
|
||||
String name = OreDictionary.getOreName(id);
|
||||
|
||||
for (ItemStack ore : OreDictionary.getOres(name)) {
|
||||
if (ore.getMetadata() == OreDictionary.WILDCARD_VALUE) {
|
||||
ore.getItem().getSubItems(CreativeTabs.SEARCH, ores);
|
||||
} else {
|
||||
ores.add(ore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inputs.add(equivalent);
|
||||
inputs.add(ores);
|
||||
} else {
|
||||
inputs.add(NonNullList.from(ItemStack.EMPTY, input));
|
||||
}
|
||||
@@ -270,16 +278,16 @@ public class CraftingPattern implements ICraftingPattern {
|
||||
|
||||
for (List<ItemStack> inputs : this.inputs) {
|
||||
for (ItemStack input : inputs) {
|
||||
result = 31 * result + API.instance().getItemStackHashCode(input, true);
|
||||
result = 31 * result + API.instance().getItemStackHashCode(input);
|
||||
}
|
||||
}
|
||||
|
||||
for (ItemStack output : this.outputs) {
|
||||
result = 31 * result + API.instance().getItemStackHashCode(output, true);
|
||||
result = 31 * result + API.instance().getItemStackHashCode(output);
|
||||
}
|
||||
|
||||
for (ItemStack byproduct : this.byproducts) {
|
||||
result = 31 * result + API.instance().getItemStackHashCode(byproduct, true);
|
||||
result = 31 * result + API.instance().getItemStackHashCode(byproduct);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDisk;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDiskContainerContext;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDiskListener;
|
||||
import com.raoulvdberge.refinedstorage.api.util.Action;
|
||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -20,7 +19,6 @@ import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
public class StorageDiskItem implements IStorageDisk<ItemStack> {
|
||||
@@ -131,23 +129,7 @@ public class StorageDiskItem implements IStorageDisk<ItemStack> {
|
||||
@Override
|
||||
@Nullable
|
||||
public ItemStack extract(@Nonnull ItemStack stack, int size, int flags, Action action) {
|
||||
Collection<ItemStack> toAttempt = null;
|
||||
|
||||
if ((flags & IComparer.COMPARE_OREDICT) == IComparer.COMPARE_OREDICT) {
|
||||
for (ItemStack ore : StackUtils.getEquivalentStacks(stack)) {
|
||||
if (toAttempt == null) {
|
||||
toAttempt = new ArrayList<>(stacks.get(ore.getItem()));
|
||||
} else {
|
||||
toAttempt.addAll(stacks.get(ore.getItem()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (toAttempt == null) {
|
||||
toAttempt = stacks.get(stack.getItem());
|
||||
}
|
||||
|
||||
for (ItemStack otherStack : toAttempt) {
|
||||
for (ItemStack otherStack : stacks.get(stack.getItem())) {
|
||||
if (API.instance().getComparer().isEqual(otherStack, stack, flags)) {
|
||||
if (size > otherStack.getCount()) {
|
||||
size = otherStack.getCount();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.raoulvdberge.refinedstorage.apiimpl.util;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
@@ -12,18 +11,12 @@ import javax.annotation.Nullable;
|
||||
public class Comparer implements IComparer {
|
||||
@Override
|
||||
public boolean isEqual(@Nullable ItemStack left, @Nullable ItemStack right, int flags) {
|
||||
EnumActionResult validity = validityCheck(left, right);
|
||||
EnumActionResult validity = getResult(left, right);
|
||||
|
||||
if (validity == EnumActionResult.FAIL || validity == EnumActionResult.SUCCESS) {
|
||||
return validity == EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
if ((flags & COMPARE_OREDICT) == COMPARE_OREDICT) {
|
||||
if (isEqualOredict(left, right)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (left.getItem() != right.getItem()) {
|
||||
return false;
|
||||
}
|
||||
@@ -35,7 +28,7 @@ public class Comparer implements IComparer {
|
||||
}
|
||||
|
||||
if ((flags & COMPARE_NBT) == COMPARE_NBT) {
|
||||
if (!isEqualNBT(left, right)) {
|
||||
if (!isEqualNbt(left, right)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -79,8 +72,8 @@ public class Comparer implements IComparer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEqualNBT(@Nullable ItemStack left, @Nullable ItemStack right) {
|
||||
EnumActionResult validity = validityCheck(left, right);
|
||||
public boolean isEqualNbt(@Nullable ItemStack left, @Nullable ItemStack right) {
|
||||
EnumActionResult validity = getResult(left, right);
|
||||
|
||||
if (validity == EnumActionResult.FAIL || validity == EnumActionResult.SUCCESS) {
|
||||
return validity == EnumActionResult.SUCCESS;
|
||||
@@ -101,18 +94,7 @@ public class Comparer implements IComparer {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEqualOredict(@Nullable ItemStack left, @Nullable ItemStack right) {
|
||||
EnumActionResult validity = validityCheck(left, right);
|
||||
|
||||
if (validity == EnumActionResult.FAIL || validity == EnumActionResult.SUCCESS) {
|
||||
return validity == EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
return StackUtils.areStacksEquivalent(left, right);
|
||||
}
|
||||
|
||||
private EnumActionResult validityCheck(@Nullable ItemStack left, @Nullable ItemStack right) {
|
||||
private EnumActionResult getResult(@Nullable ItemStack left, @Nullable ItemStack right) {
|
||||
if (left == null && right == null) {
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.raoulvdberge.refinedstorage.apiimpl.util;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||
import com.raoulvdberge.refinedstorage.api.util.IStackList;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -58,8 +57,7 @@ public class StackListItem implements IStackList<ItemStack> {
|
||||
@Override
|
||||
@Nullable
|
||||
public ItemStack get(@Nonnull ItemStack stack, int flags) {
|
||||
// When the oredict flag is set all stacks need to be checked not just the ones matching the item
|
||||
for (ItemStack otherStack : (flags & IComparer.COMPARE_OREDICT) == IComparer.COMPARE_OREDICT ? stacks.values() : stacks.get(stack.getItem())) {
|
||||
for (ItemStack otherStack : stacks.get(stack.getItem())) {
|
||||
if (API.instance().getComparer().isEqual(otherStack, stack, flags)) {
|
||||
return otherStack;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ public class GuiConstructor extends GuiBase {
|
||||
|
||||
addSideButton(new SideButtonCompare(this, TileConstructor.COMPARE, IComparer.COMPARE_DAMAGE));
|
||||
addSideButton(new SideButtonCompare(this, TileConstructor.COMPARE, IComparer.COMPARE_NBT));
|
||||
addSideButton(new SideButtonCompare(this, TileConstructor.COMPARE, IComparer.COMPARE_OREDICT));
|
||||
addSideButton(new SideButtonConstuctorDrop(this));
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ public class GuiDestructor extends GuiBase {
|
||||
|
||||
addSideButton(new SideButtonCompare(this, TileDestructor.COMPARE, IComparer.COMPARE_DAMAGE));
|
||||
addSideButton(new SideButtonCompare(this, TileDestructor.COMPARE, IComparer.COMPARE_NBT));
|
||||
addSideButton(new SideButtonCompare(this, TileDestructor.COMPARE, IComparer.COMPARE_OREDICT));
|
||||
|
||||
addSideButton(new SideButtonDestructorPickup(this));
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ public class GuiDetector extends GuiBase {
|
||||
|
||||
addSideButton(new SideButtonCompare(this, TileDetector.COMPARE, IComparer.COMPARE_DAMAGE));
|
||||
addSideButton(new SideButtonCompare(this, TileDetector.COMPARE, IComparer.COMPARE_NBT));
|
||||
addSideButton(new SideButtonCompare(this, TileDetector.COMPARE, IComparer.COMPARE_OREDICT));
|
||||
|
||||
amount = new GuiTextField(0, fontRenderer, x + 41 + 1, y + 23 + 1, 50, fontRenderer.FONT_HEIGHT);
|
||||
amount.setText(String.valueOf(TileDetector.AMOUNT.getValue()));
|
||||
|
||||
@@ -18,7 +18,6 @@ public class GuiDiskManipulator extends GuiBase {
|
||||
addSideButton(new SideButtonMode(this, TileDiskManipulator.MODE));
|
||||
addSideButton(new SideButtonCompare(this, TileDiskManipulator.COMPARE, IComparer.COMPARE_DAMAGE));
|
||||
addSideButton(new SideButtonCompare(this, TileDiskManipulator.COMPARE, IComparer.COMPARE_NBT));
|
||||
addSideButton(new SideButtonCompare(this, TileDiskManipulator.COMPARE, IComparer.COMPARE_OREDICT));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,7 +20,6 @@ public class GuiExporter extends GuiBase {
|
||||
|
||||
addSideButton(new SideButtonCompare(this, TileExporter.COMPARE, IComparer.COMPARE_DAMAGE));
|
||||
addSideButton(new SideButtonCompare(this, TileExporter.COMPARE, IComparer.COMPARE_NBT));
|
||||
addSideButton(new SideButtonCompare(this, TileExporter.COMPARE, IComparer.COMPARE_OREDICT));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,7 +20,6 @@ public class GuiFilter extends GuiBase {
|
||||
|
||||
private GuiCheckBox compareDamage;
|
||||
private GuiCheckBox compareNBT;
|
||||
private GuiCheckBox compareOredict;
|
||||
private GuiCheckBox toggleModFilter;
|
||||
private GuiButton toggleMode;
|
||||
private GuiTextField nameField;
|
||||
@@ -38,7 +37,6 @@ public class GuiFilter extends GuiBase {
|
||||
public void init(int x, int y) {
|
||||
compareDamage = addCheckBox(x + 7, y + 77, t("gui.refinedstorage:filter.compare_damage"), (compare & IComparer.COMPARE_DAMAGE) == IComparer.COMPARE_DAMAGE);
|
||||
compareNBT = addCheckBox(x + 7 + compareDamage.getButtonWidth() + 4, y + 77, t("gui.refinedstorage:filter.compare_nbt"), (compare & IComparer.COMPARE_NBT) == IComparer.COMPARE_NBT);
|
||||
compareOredict = addCheckBox(x + 7 + compareDamage.getButtonWidth() + 4 + compareNBT.getButtonWidth() + 4, y + 77, t("gui.refinedstorage:filter.compare_oredict"), (compare & IComparer.COMPARE_OREDICT) == IComparer.COMPARE_OREDICT);
|
||||
toggleModFilter = addCheckBox(0, y + 71 + 25, t("gui.refinedstorage:filter.mod_filter"), modFilter);
|
||||
toggleMode = addButton(x + 7, y + 71 + 21, 0, 20, "");
|
||||
updateModeButton(mode);
|
||||
@@ -102,8 +100,6 @@ public class GuiFilter extends GuiBase {
|
||||
compare ^= IComparer.COMPARE_DAMAGE;
|
||||
} else if (button == compareNBT) {
|
||||
compare ^= IComparer.COMPARE_NBT;
|
||||
} else if (button == compareOredict) {
|
||||
compare ^= IComparer.COMPARE_OREDICT;
|
||||
} else if (button == toggleMode) {
|
||||
mode = mode == IFilter.MODE_WHITELIST ? IFilter.MODE_BLACKLIST : IFilter.MODE_WHITELIST;
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ public class GuiImporter extends GuiBase {
|
||||
|
||||
addSideButton(new SideButtonCompare(this, TileImporter.COMPARE, IComparer.COMPARE_DAMAGE));
|
||||
addSideButton(new SideButtonCompare(this, TileImporter.COMPARE, IComparer.COMPARE_NBT));
|
||||
addSideButton(new SideButtonCompare(this, TileImporter.COMPARE, IComparer.COMPARE_OREDICT));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,7 +17,6 @@ public class GuiInterface extends GuiBase {
|
||||
|
||||
addSideButton(new SideButtonCompare(this, TileInterface.COMPARE, IComparer.COMPARE_DAMAGE));
|
||||
addSideButton(new SideButtonCompare(this, TileInterface.COMPARE, IComparer.COMPARE_NBT));
|
||||
addSideButton(new SideButtonCompare(this, TileInterface.COMPARE, IComparer.COMPARE_OREDICT));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -50,7 +50,6 @@ public class GuiStorage extends GuiBase {
|
||||
if (gui.getCompareParameter() != null) {
|
||||
addSideButton(new SideButtonCompare(this, gui.getCompareParameter(), IComparer.COMPARE_DAMAGE));
|
||||
addSideButton(new SideButtonCompare(this, gui.getCompareParameter(), IComparer.COMPARE_NBT));
|
||||
addSideButton(new SideButtonCompare(this, gui.getCompareParameter(), IComparer.COMPARE_OREDICT));
|
||||
}
|
||||
|
||||
if (gui.getAccessTypeParameter() != null) {
|
||||
|
||||
@@ -17,7 +17,6 @@ public class GuiStorageMonitor extends GuiBase {
|
||||
|
||||
addSideButton(new SideButtonCompare(this, TileStorageMonitor.COMPARE, IComparer.COMPARE_DAMAGE));
|
||||
addSideButton(new SideButtonCompare(this, TileStorageMonitor.COMPARE, IComparer.COMPARE_NBT));
|
||||
addSideButton(new SideButtonCompare(this, TileStorageMonitor.COMPARE, IComparer.COMPARE_OREDICT));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -38,17 +38,10 @@ public class SideButtonCompare extends SideButton {
|
||||
ty = 80;
|
||||
} else if (mask == IComparer.COMPARE_NBT) {
|
||||
ty = 48;
|
||||
} else if (mask == IComparer.COMPARE_OREDICT) {
|
||||
ty = 224;
|
||||
}
|
||||
|
||||
int tx = (parameter.getValue() & mask) == mask ? 0 : 16;
|
||||
|
||||
// This is reversed in icons.png :D
|
||||
if (mask == IComparer.COMPARE_OREDICT) {
|
||||
tx = tx == 16 ? 0 : 16;
|
||||
}
|
||||
|
||||
gui.drawTexture(x, y, tx, ty, 16, 16);
|
||||
}
|
||||
|
||||
|
||||
@@ -293,7 +293,7 @@ public class EnvironmentNetwork extends AbstractManagedEnvironment {
|
||||
return new Object[]{transferableAmount};
|
||||
}
|
||||
|
||||
@Callback(doc = "function(stack:table[, compareMeta:boolean[, compareNBT:boolean[, compareOreDict:boolean]]]):table -- Gets an item from the network.")
|
||||
@Callback(doc = "function(stack:table[, compareMeta:boolean[, compareNBT:boolean]]):table -- Gets an item from the network.")
|
||||
public Object[] getItem(final Context context, final Arguments args) {
|
||||
if (node.getNetwork() == null) {
|
||||
return new Object[]{null, "not connected"};
|
||||
@@ -302,7 +302,6 @@ public class EnvironmentNetwork extends AbstractManagedEnvironment {
|
||||
ItemStack stack = args.checkItemStack(0);
|
||||
boolean compareMeta = args.optBoolean(1, true);
|
||||
boolean compareNBT = args.optBoolean(2, true);
|
||||
boolean compareOreDict = args.optBoolean(3, false);
|
||||
|
||||
int flags = 0;
|
||||
|
||||
@@ -314,10 +313,6 @@ public class EnvironmentNetwork extends AbstractManagedEnvironment {
|
||||
flags |= IComparer.COMPARE_NBT;
|
||||
}
|
||||
|
||||
if (compareOreDict) {
|
||||
flags |= IComparer.COMPARE_OREDICT;
|
||||
}
|
||||
|
||||
return new Object[]{node.getNetwork().getItemStorageCache().getList().get(stack, flags)};
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.raoulvdberge.refinedstorage.tile.data;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.network.MessageTileDataParameterUpdate;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -21,7 +20,6 @@ public class TileDataManager {
|
||||
private List<TileDataParameter> watchedParameters = new ArrayList<>();
|
||||
|
||||
private List<TileDataWatcher> watchers = new CopyOnWriteArrayList<>();
|
||||
private List<EntityPlayer> playersWatching = new CopyOnWriteArrayList<>();
|
||||
|
||||
public TileDataManager(TileEntity tile) {
|
||||
this.tile = tile;
|
||||
@@ -49,18 +47,12 @@ public class TileDataManager {
|
||||
return watchedParameters;
|
||||
}
|
||||
|
||||
public List<EntityPlayer> getPlayersWatching() {
|
||||
return playersWatching;
|
||||
}
|
||||
|
||||
public void addWatcher(TileDataWatcher listener) {
|
||||
watchers.add(listener);
|
||||
playersWatching.add(listener.getPlayer());
|
||||
}
|
||||
|
||||
public void removeWatcher(TileDataWatcher listener) {
|
||||
watchers.remove(listener);
|
||||
playersWatching.remove(listener.getPlayer());
|
||||
}
|
||||
|
||||
public void sendParameterToWatchers(TileDataParameter parameter) {
|
||||
|
||||
@@ -14,6 +14,7 @@ public class TileDataWatcher {
|
||||
public TileDataWatcher(EntityPlayerMP player, TileDataManager manager) {
|
||||
this.player = player;
|
||||
this.manager = manager;
|
||||
|
||||
if (manager != null) {
|
||||
this.manager.addWatcher(this);
|
||||
this.cache = new Object[manager.getWatchedParameters().size()];
|
||||
|
||||
@@ -3,19 +3,16 @@ package com.raoulvdberge.refinedstorage.util;
|
||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDisk;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDiskProvider;
|
||||
import com.raoulvdberge.refinedstorage.api.util.IStackList;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
@@ -27,15 +24,11 @@ import net.minecraftforge.fluids.capability.IFluidHandlerItem;
|
||||
import net.minecraftforge.fml.common.network.ByteBufUtils;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
public final class StackUtils {
|
||||
@@ -44,61 +37,6 @@ public final class StackUtils {
|
||||
private static final String NBT_INVENTORY = "Inventory_%d";
|
||||
private static final String NBT_SLOT = "Slot";
|
||||
|
||||
private static final Map<Integer, NonNullList<ItemStack>> OREDICT_CACHE = new HashMap<>();
|
||||
private static final Map<Integer, Boolean> OREDICT_EQUIVALENCY_CACHE = new HashMap<>();
|
||||
|
||||
private static final NonNullList<Object> EMPTY_NON_NULL_LIST = NonNullList.create();
|
||||
|
||||
public static NonNullList<ItemStack> getEquivalentStacks(ItemStack stack) {
|
||||
int hash = API.instance().getItemStackHashCode(stack, false);
|
||||
|
||||
if (OREDICT_CACHE.containsKey(hash)) {
|
||||
return OREDICT_CACHE.get(hash);
|
||||
}
|
||||
|
||||
NonNullList<ItemStack> ores = NonNullList.create();
|
||||
|
||||
for (int id : OreDictionary.getOreIDs(stack)) {
|
||||
String name = OreDictionary.getOreName(id);
|
||||
|
||||
for (ItemStack ore : OreDictionary.getOres(name)) {
|
||||
if (ore.getMetadata() == OreDictionary.WILDCARD_VALUE) {
|
||||
ore.getItem().getSubItems(CreativeTabs.SEARCH, ores);
|
||||
} else {
|
||||
ores.add(ore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OREDICT_CACHE.put(hash, ores);
|
||||
|
||||
return ores;
|
||||
}
|
||||
|
||||
public static boolean areStacksEquivalent(ItemStack left, ItemStack right) {
|
||||
int code = API.instance().getItemStackHashCode(left, false);
|
||||
code = 31 * code + API.instance().getItemStackHashCode(right, false);
|
||||
|
||||
if (OREDICT_EQUIVALENCY_CACHE.containsKey(code)) {
|
||||
return OREDICT_EQUIVALENCY_CACHE.get(code);
|
||||
}
|
||||
|
||||
int[] leftIds = OreDictionary.getOreIDs(left);
|
||||
int[] rightIds = OreDictionary.getOreIDs(right);
|
||||
|
||||
for (int i : rightIds) {
|
||||
if (ArrayUtils.contains(leftIds, i)) {
|
||||
OREDICT_EQUIVALENCY_CACHE.put(code, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
OREDICT_EQUIVALENCY_CACHE.put(code, false);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void writeItemStack(ByteBuf buf, ItemStack stack) {
|
||||
buf.writeInt(Item.getIdFromItem(stack.getItem()));
|
||||
buf.writeInt(stack.getCount());
|
||||
@@ -172,11 +110,6 @@ public final class StackUtils {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> NonNullList<T> emptyNonNullList() {
|
||||
return (NonNullList<T>) EMPTY_NON_NULL_LIST;
|
||||
}
|
||||
|
||||
public static void writeItems(IItemHandler handler, int id, NBTTagCompound tag) {
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
|
||||
@@ -247,30 +180,6 @@ public final class StackUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static NBTTagList serializeFluidStackList(IStackList<FluidStack> list) {
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
|
||||
for (FluidStack stack : list.getStacks()) {
|
||||
tagList.appendTag(stack.writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
|
||||
return tagList;
|
||||
}
|
||||
|
||||
public static IStackList<FluidStack> readFluidStackList(NBTTagList tagList) {
|
||||
IStackList<FluidStack> list = API.instance().createFluidStackList();
|
||||
|
||||
for (int i = 0; i < tagList.tagCount(); ++i) {
|
||||
FluidStack stack = FluidStack.loadFluidStackFromNBT(tagList.getCompoundTagAt(i));
|
||||
|
||||
if (stack != null) {
|
||||
list.add(stack, stack.amount);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public static boolean hasFluidBucket(FluidStack stack) {
|
||||
return stack.getFluid() == FluidRegistry.WATER || stack.getFluid() == FluidRegistry.LAVA || stack.getFluid().getName().equals("milk") || FluidRegistry.getBucketFluids().contains(stack.getFluid());
|
||||
}
|
||||
|
||||
@@ -80,7 +80,6 @@ misc.refinedstorage:oredict=Erzverzeichnis
|
||||
|
||||
sidebutton.refinedstorage:compare.1=Vergleiche Schaden
|
||||
sidebutton.refinedstorage:compare.2=Vergleiche NBT
|
||||
sidebutton.refinedstorage:compare.8=Vergleiche Erzverzeichnis
|
||||
|
||||
sidebutton.refinedstorage:redstone_mode=Redstone Modus
|
||||
sidebutton.refinedstorage:redstone_mode.0=Redstonesignal ignorieren
|
||||
|
||||
@@ -41,7 +41,6 @@ gui.refinedstorage:crafter=Crafter
|
||||
gui.refinedstorage:filter=Filter
|
||||
gui.refinedstorage:filter.compare_damage=Damage
|
||||
gui.refinedstorage:filter.compare_nbt=NBT
|
||||
gui.refinedstorage:filter.compare_oredict=Oredict
|
||||
gui.refinedstorage:filter.mod_filter=Mod filter
|
||||
gui.refinedstorage:network_transmitter=Network Transmitter
|
||||
gui.refinedstorage:network_transmitter.distance=%d block(s)
|
||||
@@ -135,7 +134,6 @@ misc.refinedstorage:last_modified.years=Last modified %d years ago by %s
|
||||
|
||||
sidebutton.refinedstorage:compare.1=Use damage
|
||||
sidebutton.refinedstorage:compare.2=Use NBT
|
||||
sidebutton.refinedstorage:compare.8=Use ore dictionary
|
||||
|
||||
sidebutton.refinedstorage:redstone_mode=Redstone mode
|
||||
sidebutton.refinedstorage:redstone_mode.0=Ignore redstone signal
|
||||
|
||||
@@ -37,7 +37,6 @@ gui.refinedstorage:crafter=Fabricador
|
||||
gui.refinedstorage:filter=Filtro
|
||||
gui.refinedstorage:filter.compare_damage=Daño
|
||||
gui.refinedstorage:filter.compare_nbt=NBT
|
||||
gui.refinedstorage:filter.compare_oredict=Oredict
|
||||
gui.refinedstorage:filter.mod_filter=Filtro de Mods
|
||||
gui.refinedstorage:network_transmitter=Emisor de Red
|
||||
gui.refinedstorage:network_transmitter.distance=%d bloque(s)
|
||||
@@ -128,7 +127,6 @@ misc.refinedstorage:last_modified.years=Último cambio %d hace años por %s
|
||||
|
||||
sidebutton.refinedstorage:compare.1=Comparar daño
|
||||
sidebutton.refinedstorage:compare.2=Compare NBT
|
||||
sidebutton.refinedstorage:compare.8=Compare diccionario mineral
|
||||
|
||||
sidebutton.refinedstorage:redstone_mode=Modo de señal
|
||||
sidebutton.refinedstorage:redstone_mode.0=Ignorar señal de redstone
|
||||
|
||||
@@ -36,7 +36,6 @@ gui.refinedstorage:crafter=Crafteur
|
||||
gui.refinedstorage:filter=Filtre
|
||||
gui.refinedstorage:filter.compare_damage=Dommage
|
||||
gui.refinedstorage:filter.compare_nbt=NBT
|
||||
gui.refinedstorage:filter.compare_oredict=Oredict
|
||||
gui.refinedstorage:filter.mod_filter=Filtre de mod
|
||||
gui.refinedstorage:network_transmitter=Emetteur réseau
|
||||
gui.refinedstorage:network_transmitter.distance=%d bloc(s)
|
||||
@@ -107,7 +106,6 @@ misc.refinedstorage:reader_writer.redstone=Redstone strength: %d
|
||||
|
||||
sidebutton.refinedstorage:compare.1=Compare les dommages
|
||||
sidebutton.refinedstorage:compare.2=Compare la NBT
|
||||
sidebutton.refinedstorage:compare.8=Compare l'ore dictionary
|
||||
|
||||
sidebutton.refinedstorage:redstone_mode=Mode Redstone
|
||||
sidebutton.refinedstorage:redstone_mode.0=Ignore le signal de redstone
|
||||
|
||||
@@ -35,7 +35,6 @@ gui.refinedstorage:crafter=조합기
|
||||
gui.refinedstorage:filter=필터
|
||||
gui.refinedstorage:filter.compare_damage=데미지
|
||||
gui.refinedstorage:filter.compare_nbt=NBT
|
||||
gui.refinedstorage:filter.compare_oredict=Ore Dictionary
|
||||
gui.refinedstorage:filter.mod_filter=모드 필터
|
||||
gui.refinedstorage:network_transmitter=네트워크 송신기
|
||||
gui.refinedstorage:network_transmitter.distance=%d블럭
|
||||
@@ -105,7 +104,6 @@ misc.refinedstorage:reader_writer.redstone=레드스톤 강도: %d
|
||||
|
||||
sidebutton.refinedstorage:compare.1=데미지 비교
|
||||
sidebutton.refinedstorage:compare.2=NBT 데이터 비교
|
||||
sidebutton.refinedstorage:compare.8=Ore Dictionary 비교
|
||||
|
||||
sidebutton.refinedstorage:redstone_mode=레드스톤 모드
|
||||
sidebutton.refinedstorage:redstone_mode.0=신호와 상관 없이 작동
|
||||
|
||||
@@ -36,7 +36,6 @@ gui.refinedstorage:crafter=Fabricador
|
||||
gui.refinedstorage:filter=Filtro
|
||||
gui.refinedstorage:filter.compare_damage=Dano
|
||||
gui.refinedstorage:filter.compare_nbt=NBT
|
||||
gui.refinedstorage:filter.compare_oredict=Oredict
|
||||
gui.refinedstorage:filter.mod_filter=Filtrar Mod
|
||||
gui.refinedstorage:network_transmitter=Transmissor de Rede
|
||||
gui.refinedstorage:network_transmitter.distance=%d Blocos
|
||||
@@ -107,7 +106,6 @@ misc.refinedstorage:reader_writer.redstone=Força de redstone: %d
|
||||
|
||||
sidebutton.refinedstorage:compare.1=Comparar Danos
|
||||
sidebutton.refinedstorage:compare.2=Comparar NBT
|
||||
sidebutton.refinedstorage:compare.8=Comparar Ore dictionary
|
||||
|
||||
sidebutton.refinedstorage:redstone_mode=Modo de redstone
|
||||
sidebutton.refinedstorage:redstone_mode.0=Ignorar o sinal de redstone
|
||||
|
||||
@@ -37,7 +37,6 @@ gui.refinedstorage:crafter=Крафтер
|
||||
gui.refinedstorage:filter=Сортировка
|
||||
gui.refinedstorage:filter.compare_damage=Урон предмета
|
||||
gui.refinedstorage:filter.compare_nbt=NBT
|
||||
gui.refinedstorage:filter.compare_oredict=Словарь руды
|
||||
gui.refinedstorage:filter.mod_filter=Фильтр оп моду
|
||||
gui.refinedstorage:network_transmitter=Сетевой передатчик
|
||||
gui.refinedstorage:network_transmitter.distance=%d блоков
|
||||
@@ -129,7 +128,6 @@ misc.refinedstorage:last_modified.years=Последнее изменение %d
|
||||
|
||||
sidebutton.refinedstorage:compare.1=Сравнить урон
|
||||
sidebutton.refinedstorage:compare.2=Сравнить NBT
|
||||
sidebutton.refinedstorage:compare.8=Сравнить словарь руды
|
||||
|
||||
sidebutton.refinedstorage:redstone_mode=Режим редстоуна
|
||||
sidebutton.refinedstorage:redstone_mode.0=Игнорировать редстоун сигнал
|
||||
|
||||
@@ -37,7 +37,6 @@ gui.refinedstorage:crafter=装配室
|
||||
gui.refinedstorage:filter=终端过滤
|
||||
gui.refinedstorage:filter.compare_damage=耐久
|
||||
gui.refinedstorage:filter.compare_nbt=NBT
|
||||
gui.refinedstorage:filter.compare_oredict=矿物辞典
|
||||
gui.refinedstorage:filter.mod_filter=Mod过滤
|
||||
gui.refinedstorage:network_transmitter=网络变送器
|
||||
gui.refinedstorage:network_transmitter.distance=%d 个方块
|
||||
@@ -108,7 +107,6 @@ misc.refinedstorage:reader_writer.redstone=红石强度:%d
|
||||
|
||||
sidebutton.refinedstorage:compare.1=耐久匹配
|
||||
sidebutton.refinedstorage:compare.2=NBT匹配
|
||||
sidebutton.refinedstorage:compare.8=矿物辞典匹配
|
||||
|
||||
sidebutton.refinedstorage:redstone_mode=红石模式
|
||||
sidebutton.refinedstorage:redstone_mode.0=忽略红石信号
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.5 KiB |
Reference in New Issue
Block a user