Initialize the Blacklist Registry in Init

Rename ItemHelper to ItemStackUtils
Change the way OreStack identifies an OreStack from a list of itemstacks. Resolves #923
Added some more test cases to VanillaTestSuite
This commit is contained in:
Pahimar 2016-05-27 16:03:14 -04:00
parent 6d2e1337b1
commit 437470f9e7
26 changed files with 329 additions and 330 deletions

View File

@ -88,6 +88,9 @@ public class EquivalentExchange3
// Register the GUI Handler
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
// Initialize the blacklist registry
BlacklistRegistry.INSTANCE.load();
// Initialize mod tile entities
TileEntities.init();
@ -110,8 +113,6 @@ public class EquivalentExchange3
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
// Initialize the blacklist registry
BlacklistRegistry.INSTANCE.load();
Abilities.init();
// Initialize our test files

View File

@ -3,16 +3,16 @@ package com.pahimar.ee3.api.recipe;
import com.pahimar.ee3.EquivalentExchange3;
import cpw.mods.fml.common.Mod;
import java.util.Arrays;
import java.util.List;
public final class RecipeRegistryProxy {
/**
*
* @param recipeOutput
* @param recipeInputList
*/
public static void addRecipe(Object recipeOutput, List<?> recipeInputList) {
public static void addRecipe(Object recipeOutput, Object ... recipeInputs) { // TODO 1.9, List -> Collection
addRecipe(recipeOutput, Arrays.asList(recipeInputs));
}
public static void addRecipe(Object recipeOutput, List<?> recipeInputList) { // TODO 1.9, List -> Collection
init();

View File

@ -226,11 +226,9 @@ public class BlacklistRegistry {
if (shouldSave) {
if (blacklist == Blacklist.KNOWLEDGE) {
LogHelper.trace(BLACKLIST_MARKER, "Saving player knowledge blacklist to {}", knowledgeBlacklistFile.getAbsolutePath());
SerializationHelper.writeJsonFile(knowledgeBlacklistFile, SerializationHelper.GSON.toJson(knowledgeBlacklist));
}
else if (blacklist == Blacklist.EXCHANGE) {
LogHelper.trace(BLACKLIST_MARKER, "Saving exchange blacklist to {}", exchangeBlacklistFile.getAbsolutePath());
SerializationHelper.writeJsonFile(exchangeBlacklistFile, SerializationHelper.GSON.toJson(exchangeBlacklist));
}
}

View File

@ -10,7 +10,7 @@ import com.pahimar.ee3.inventory.ContainerResearchStation;
import com.pahimar.ee3.inventory.ContainerTransmutationTablet;
import com.pahimar.ee3.reference.Messages;
import com.pahimar.ee3.util.IOwnable;
import com.pahimar.ee3.util.ItemHelper;
import com.pahimar.ee3.util.ItemStackUtils;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -74,13 +74,13 @@ public class ItemTooltipEventHandler {
if (event.itemStack.getItem() instanceof IOwnable) {
UUID playerUUID = ItemHelper.getOwnerUUID(event.itemStack);
UUID playerUUID = ItemStackUtils.getOwnerUUID(event.itemStack);
if (playerUUID != null && UsernameCache.containsUUID(playerUUID)) {
event.toolTip.add(StatCollector.translateToLocalFormatted(Messages.Tooltips.ITEM_BELONGS_TO, UsernameCache.getLastKnownUsername(playerUUID)));
}
else if (ItemHelper.hasOwnerName(event.itemStack)) {
event.toolTip.add(StatCollector.translateToLocalFormatted(Messages.Tooltips.ITEM_BELONGS_TO, ItemHelper.getOwnerName(event.itemStack)));
else if (ItemStackUtils.getOwnerName(event.itemStack) != null) {
event.toolTip.add(StatCollector.translateToLocalFormatted(Messages.Tooltips.ITEM_BELONGS_TO, ItemStackUtils.getOwnerName(event.itemStack)));
}
}
}

View File

@ -115,6 +115,10 @@ public class EnergyValueRegistry {
if (valueMap != null && !valueMap.isEmpty()) {
// First check for a direct energy value mapping to the wrapped object
/**
* FIXME If the object being checked has a WILD_CARD meta value, then it will match any similar object.
* We must ensure that it returns the LOWEST possible value from the map
*/
if (valueMap.containsKey(wrappedStack)) {
return valueMap.get(wrappedStack);
}
@ -449,7 +453,7 @@ public class EnergyValueRegistry {
*/
private static Set<ItemStack> getStacksInRange(Map<WrappedStack, EnergyValue> valueMap, EnergyValue energyValueBound, boolean isUpperBound) {
Set itemStacks = FilterUtils.filterForItemStacks(valueMap.keySet());
Set itemStacks = filterForItemStacks(valueMap.keySet());
if (valueMap != null) {
if (energyValueBound != null) {
@ -570,7 +574,11 @@ public class EnergyValueRegistry {
.forEach(wrappedStack -> stackValueMap.put(wrappedStack, preCalculationStackValueMap.get(wrappedStack)));
// Calculate values from the known methods to create items, and the pre-calculation value mappings
stackValueMap.putAll(calculateStackValueMap(stackValueMap));
Map<WrappedStack, EnergyValue> computedStackValueMap = calculateStackValueMap(stackValueMap);
for (WrappedStack wrappedStack : computedStackValueMap.keySet()) {
stackValueMap.put(wrappedStack, computedStackValueMap.get(wrappedStack));
}
// stackValueMap.putAll(calculateStackValueMap(stackValueMap));
// Load in post calculation value assignments from file
fileValueMap = null;
@ -633,25 +641,26 @@ public class EnergyValueRegistry {
tempComputedMap = new TreeMap<>(computedMap);
for (WrappedStack recipeOutput : RecipeRegistry.INSTANCE.getRecipeMappings().keySet()) {
WrappedStack unitWrappedStack = WrappedStack.wrap(recipeOutput, 1);
// We won't attempt to recalculate values that already have a pre-calculation value assignment
if (!stackValueMap.containsKey(WrappedStack.wrap(recipeOutput, 1))) {
if (!stackValueMap.containsKey(unitWrappedStack)) {
for (Set<WrappedStack> recipeInputs : RecipeRegistry.INSTANCE.getRecipeMappings().get(recipeOutput)) {
EnergyValue currentOutputValue = getEnergyValue(tempComputedMap, WrappedStack.wrap(recipeOutput, 1), false);
EnergyValue currentOutputValue = getEnergyValue(tempComputedMap, unitWrappedStack, false);
EnergyValue computedOutputValue = computeFromInputs(tempComputedMap, recipeOutput, recipeInputs);
if (computedOutputValue != null && computedOutputValue.compareTo(currentOutputValue) < 0) {
uncomputedStacks.remove(WrappedStack.wrap(recipeOutput, 1));
uncomputedStacks.remove(unitWrappedStack);
if (ConfigurationHandler.Settings.energyValueDebugLoggingEnabled) {
LogHelper.info(ENERGY_VALUE_MARKER, "Pass {}: Calculated value {} for object {} with recipe inputs {} and output {}", passNumber, computedOutputValue, WrappedStack.wrap(recipeOutput, 1), recipeInputs, recipeOutput);
LogHelper.info(ENERGY_VALUE_MARKER, "Pass {}: Calculated value {} for object {} with recipe inputs {} and output {}", passNumber, computedOutputValue, unitWrappedStack, recipeInputs, recipeOutput);
}
tempComputedMap.put(WrappedStack.wrap(recipeOutput), computedOutputValue);
tempComputedMap.put(unitWrappedStack, computedOutputValue);
}
else if (computedOutputValue != null) {
uncomputedStacks.add(WrappedStack.wrap(recipeOutput, 1));
uncomputedStacks.add(unitWrappedStack);
}
}
}
@ -693,6 +702,22 @@ public class EnergyValueRegistry {
valueStackMap = ImmutableSortedMap.copyOf(tempValueMap);
}
private static Set<ItemStack> filterForItemStacks(Set<WrappedStack> wrappedStacks) {
Set<ItemStack> itemStacks = new TreeSet<>(Comparators.ID_COMPARATOR);
for (WrappedStack wrappedStack : wrappedStacks) {
if (wrappedStack.getWrappedObject() instanceof ItemStack) {
itemStacks.add((ItemStack) wrappedStack.getWrappedObject());
}
else if (wrappedStack.getWrappedObject() instanceof OreStack) {
itemStacks.addAll(OreDictionary.getOres(((OreStack) wrappedStack.getWrappedObject()).oreName));
}
}
return itemStacks;
}
/**
* Saves the pre-calculation, post-calculation, and calculated energy value maps to disk
*/

View File

@ -1,12 +1,13 @@
package com.pahimar.ee3.exchange;
import com.pahimar.ee3.reference.Comparators;
import com.pahimar.ee3.util.OreDictionaryHelper;
import net.minecraft.item.ItemStack;
import com.pahimar.ee3.util.FilterUtils;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.oredict.OreDictionary;
import java.util.*;
import java.util.stream.Collectors;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
public final class OreStack implements Comparable<OreStack> {
@ -60,39 +61,16 @@ public final class OreStack implements Comparable<OreStack> {
return false;
}
public static OreStack getOreStackFromList(Object... objects) {
return getOreStackFromList(Arrays.asList(objects));
public static OreStack getOreStackFrom(Object... objects) {
return getOreStackFrom(Arrays.asList(objects));
}
public static OreStack getOreStackFromList(List<?> objectList) {
public static OreStack getOreStackFrom(Collection<?> objects) {
if (objectList.size() > 0) {
Map<String, Integer> oreNameCountMap = new TreeMap<>(Comparators.STRING_COMPARATOR);
for (Object listElement : objectList) {
if (listElement instanceof ItemStack) {
ItemStack itemStack = (ItemStack) listElement;
for (String oreName : OreDictionaryHelper.getOreNames(itemStack)) {
if (oreNameCountMap.containsKey(oreName)) {
oreNameCountMap.put(oreName, oreNameCountMap.get(oreName) + 1);
}
else {
oreNameCountMap.put(oreName, 1);
}
}
}
for (String oreName : OreDictionary.getOreNames()) {
if (Comparators.ITEM_STACK_COLLECTION_COMPARATOR.compare(FilterUtils.filterForItemStacks(objects), OreDictionary.getOres(oreName)) == 0) {
return new OreStack(oreName, 1);
}
List<OreStack> candidateOreStacks = oreNameCountMap.keySet().stream()
.filter(oreName -> oreNameCountMap.get(oreName) == objectList.size())
.map(OreStack::new)
.collect(Collectors.toList());
if (candidateOreStacks.size() == 1) {
return candidateOreStacks.get(0);
}
return null;
}
return null;

View File

@ -1,7 +1,7 @@
package com.pahimar.ee3.exchange;
import com.pahimar.ee3.util.FluidHelper;
import com.pahimar.ee3.util.ItemHelper;
import com.pahimar.ee3.util.ItemStackUtils;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@ -40,7 +40,7 @@ public final class WrappedStack implements Comparable<WrappedStack> {
if (((ItemStack) object).getItem() != null) {
stackSize = ((ItemStack) object).stackSize;
wrappedStack = ItemHelper.clone((ItemStack) object, 1);
wrappedStack = ItemStackUtils.clone((ItemStack) object, 1);
}
else {
@ -59,7 +59,7 @@ public final class WrappedStack implements Comparable<WrappedStack> {
ArrayList<?> objectList = (ArrayList<?>) object;
OreStack possibleOreStack = OreStack.getOreStackFromList(objectList);
OreStack possibleOreStack = OreStack.getOreStackFrom(objectList);
if (possibleOreStack != null) {
@ -120,7 +120,7 @@ public final class WrappedStack implements Comparable<WrappedStack> {
if (object instanceof ItemStack) {
this.stackSize = stackSize;
wrappedStack = ItemHelper.clone((ItemStack) object, 1);
wrappedStack = ItemStackUtils.clone((ItemStack) object, 1);
}
else if (object instanceof OreStack) {
@ -133,7 +133,7 @@ public final class WrappedStack implements Comparable<WrappedStack> {
ArrayList<?> objectList = (ArrayList<?>) object;
OreStack possibleOreStack = OreStack.getOreStackFromList(objectList);
OreStack possibleOreStack = OreStack.getOreStackFrom(objectList);
if (possibleOreStack != null) {
@ -199,7 +199,7 @@ public final class WrappedStack implements Comparable<WrappedStack> {
}
else if (object instanceof List) {
if (OreStack.getOreStackFromList((List<?>) object) != null) {
if (OreStack.getOreStackFrom((List<?>) object) != null) {
return true;
}
}
@ -302,7 +302,7 @@ public final class WrappedStack implements Comparable<WrappedStack> {
if (wrappedStack2.wrappedStack instanceof ItemStack) {
int compareResult = ItemHelper.compare((ItemStack) wrappedStack1.wrappedStack, (ItemStack) wrappedStack2.wrappedStack);
int compareResult = ItemStackUtils.compare((ItemStack) wrappedStack1.wrappedStack, (ItemStack) wrappedStack2.wrappedStack);
if (compareResult == 0) {
return wrappedStack1.stackSize - wrappedStack2.stackSize;

View File

@ -2,7 +2,7 @@ package com.pahimar.ee3.handler;
import com.pahimar.ee3.item.crafting.RecipesAlchemicalBagDyes;
import com.pahimar.ee3.util.IOwnable;
import com.pahimar.ee3.util.ItemHelper;
import com.pahimar.ee3.util.ItemStackUtils;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import net.minecraft.item.crafting.CraftingManager;
@ -17,7 +17,7 @@ public class CraftingHandler
@SubscribeEvent
public void onItemCraftedEvent(PlayerEvent.ItemCraftedEvent event) {
if (event.crafting.getItem() instanceof IOwnable) {
ItemHelper.setOwner(event.crafting, event.player);
ItemStackUtils.setOwner(event.crafting, event.player);
}
}
}

View File

@ -12,15 +12,15 @@ import static com.pahimar.ee3.api.exchange.EnergyValueRegistryProxy.Phase;
public class EnergyValues {
private static final String[] DYES = {"Black", "Red", "Green", "Brown", "Blue", "Purple", "Cyan", "LightGray", "Gray", "Pink", "Lime", "Yellow", "LightBlue", "Magenta", "Orange", "White"};
public static void init() {
// OreDictionary assignment
EnergyValueRegistryProxy.setEnergyValue(new OreStack("cobblestone"), 1, Phase.PRE_CALCULATION);
EnergyValueRegistryProxy.setEnergyValue(new OreStack("dustRedstone"), 32, Phase.PRE_CALCULATION);
String[] dyes = {"Black", "Red", "Green", "Brown", "Blue", "Purple", "Cyan", "LightGray", "Gray", "Pink", "Lime", "Yellow", "LightBlue", "Magenta", "Orange", "White"};
for (int i = 0; i < dyes.length; i++)
{
EnergyValueRegistryProxy.setEnergyValue(new OreStack("dye" + dyes[i]), 16, Phase.PRE_CALCULATION);
for (int i = 0; i < DYES.length; i++) {
EnergyValueRegistryProxy.setEnergyValue(new OreStack("dye" + DYES[i]), 16, Phase.PRE_CALCULATION);
}
EnergyValueRegistryProxy.setEnergyValue(new OreStack("gemDiamond"), 8192, Phase.PRE_CALCULATION);
EnergyValueRegistryProxy.setEnergyValue(new OreStack("gemEmerald"), 8192, Phase.PRE_CALCULATION);

View File

@ -6,7 +6,7 @@ import com.pahimar.ee3.inventory.element.IElementTextFieldHandler;
import com.pahimar.ee3.item.ItemAlchenomicon;
import com.pahimar.ee3.reference.Comparators;
import com.pahimar.ee3.util.FilterUtils;
import com.pahimar.ee3.util.ItemHelper;
import com.pahimar.ee3.util.ItemStackUtils;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
@ -32,9 +32,8 @@ public class ContainerAlchenomicon extends ContainerEE implements IElementButton
{
TreeSet<ItemStack> knownTransmutations = new TreeSet<>(Comparators.DISPLAY_NAME_COMPARATOR);
if (itemStack.getItem() instanceof ItemAlchenomicon && ItemHelper.hasOwnerName(itemStack))
{
String playerName = ItemHelper.getOwnerName(itemStack);
if (itemStack.getItem() instanceof ItemAlchenomicon && ItemStackUtils.getOwnerName(itemStack) != null) {
String playerName = ItemStackUtils.getOwnerName(itemStack);
knownTransmutations.addAll(PlayerKnowledgeRegistryProxy.getKnownItemStacks(playerName));
}

View File

@ -1,6 +1,6 @@
package com.pahimar.ee3.inventory;
import com.pahimar.ee3.util.ItemHelper;
import com.pahimar.ee3.util.ItemStackUtils;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
@ -26,7 +26,7 @@ public abstract class ContainerEE extends Container
slot = (Slot) this.inventorySlots.get(currentSlotIndex);
stackInSlot = slot.getStack();
if (slot.isItemValid(itemStack) && ItemHelper.equalsIgnoreStackSize(itemStack, stackInSlot))
if (slot.isItemValid(itemStack) && ItemStackUtils.equalsIgnoreStackSize(itemStack, stackInSlot))
{
int combinedStackSize = stackInSlot.stackSize + itemStack.stackSize;
int slotStackSizeLimit = Math.min(stackInSlot.getMaxStackSize(), slot.getSlotStackLimit());
@ -62,7 +62,7 @@ public abstract class ContainerEE extends Container
if (slot.isItemValid(itemStack) && stackInSlot == null)
{
slot.putStack(ItemHelper.clone(itemStack, Math.min(itemStack.stackSize, slot.getSlotStackLimit())));
slot.putStack(ItemStackUtils.clone(itemStack, Math.min(itemStack.stackSize, slot.getSlotStackLimit())));
slot.onSlotChanged();
if (slot.getStack() != null)

View File

@ -15,7 +15,7 @@ import com.pahimar.ee3.network.message.MessagePlayerKnowledge;
import com.pahimar.ee3.reference.Comparators;
import com.pahimar.ee3.tileentity.TileEntityTransmutationTablet;
import com.pahimar.ee3.util.FilterUtils;
import com.pahimar.ee3.util.ItemHelper;
import com.pahimar.ee3.util.ItemStackUtils;
import com.pahimar.repackage.cofh.lib.util.helpers.MathHelper;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
@ -48,9 +48,8 @@ public class ContainerTransmutationTablet extends ContainerEE implements IElemen
if (tileEntityTransmutationTablet.getStackInSlot(TileEntityTransmutationTablet.ALCHENOMICON_INDEX) != null)
{
ItemStack itemStack = tileEntityTransmutationTablet.getStackInSlot(TileEntityTransmutationTablet.ALCHENOMICON_INDEX);
if (itemStack.getItem() instanceof ItemAlchenomicon && ItemHelper.hasOwnerName(itemStack))
{
knownTransmutations.addAll(PlayerKnowledgeRegistryProxy.getKnownItemStacks(ItemHelper.getOwnerName(itemStack)));
if (itemStack.getItem() instanceof ItemAlchenomicon && ItemStackUtils.getOwnerName(itemStack) != null) {
knownTransmutations.addAll(PlayerKnowledgeRegistryProxy.getKnownItemStacks(ItemStackUtils.getOwnerName(itemStack)));
}
}
inventoryTransmutationTablet = new InventoryTransmutationTablet(knownTransmutations);
@ -348,7 +347,7 @@ public class ContainerTransmutationTablet extends ContainerEE implements IElemen
itemStack1.stackSize = 0;
slot.onSlotChanged();
}
else if (slot.isItemValid(itemStack1) && ItemHelper.equalsIgnoreStackSize(itemStack1, stackInSlot)) {
else if (slot.isItemValid(itemStack1) && ItemStackUtils.equalsIgnoreStackSize(itemStack1, stackInSlot)) {
int slotStackSizeLimit = Math.min(stackInSlot.getMaxStackSize(), slot.getSlotStackLimit());
int combinedStackSize = stackInSlot.stackSize + itemStack1.stackSize;
@ -373,7 +372,7 @@ public class ContainerTransmutationTablet extends ContainerEE implements IElemen
}
// transmutationOutputSlot.onPickupFromSlot(entityPlayer, new ItemStack(itemStack.getItem(), numTransmuted));
transmutationOutputSlot.onPickupFromSlot(entityPlayer, ItemHelper.clone(itemStack, numTransmuted));
transmutationOutputSlot.onPickupFromSlot(entityPlayer, ItemStackUtils.clone(itemStack, numTransmuted));
return false;
}
@ -476,7 +475,7 @@ public class ContainerTransmutationTablet extends ContainerEE implements IElemen
this.containerTransmutationTablet.inventoryTransmutationTablet = new InventoryTransmutationTablet();
this.containerTransmutationTablet.updateInventory();
if (!this.tileEntityTransmutationTablet.getWorldObj().isRemote && itemStack != null && itemStack.getItem() instanceof ItemAlchenomicon && ItemHelper.hasOwnerUUID(itemStack))
if (!this.tileEntityTransmutationTablet.getWorldObj().isRemote && itemStack != null && itemStack.getItem() instanceof ItemAlchenomicon && ItemStackUtils.getOwnerUUID(itemStack) != null)
{
PacketHandler.INSTANCE.sendToAllAround(new MessagePlayerKnowledge(this.containerTransmutationTablet.tileEntityTransmutationTablet, null), new NetworkRegistry.TargetPoint(this.tileEntityTransmutationTablet.getWorldObj().provider.dimensionId, (double) this.tileEntityTransmutationTablet.xCoord, (double) this.tileEntityTransmutationTablet.yCoord, (double) this.tileEntityTransmutationTablet.zCoord, 5d));
}
@ -487,9 +486,9 @@ public class ContainerTransmutationTablet extends ContainerEE implements IElemen
{
super.putStack(itemStack);
if (!this.tileEntityTransmutationTablet.getWorldObj().isRemote && itemStack != null && itemStack.getItem() instanceof ItemAlchenomicon && ItemHelper.hasOwnerName(itemStack))
if (!this.tileEntityTransmutationTablet.getWorldObj().isRemote && itemStack != null && itemStack.getItem() instanceof ItemAlchenomicon && ItemStackUtils.getOwnerName(itemStack) != null)
{
Set<ItemStack> knownTransmutations = PlayerKnowledgeRegistryProxy.getKnownItemStacks(ItemHelper.getOwnerName(itemStack));
Set<ItemStack> knownTransmutations = PlayerKnowledgeRegistryProxy.getKnownItemStacks(ItemStackUtils.getOwnerName(itemStack));
this.containerTransmutationTablet.inventoryTransmutationTablet = new InventoryTransmutationTablet(knownTransmutations);
this.containerTransmutationTablet.updateInventory();
PacketHandler.INSTANCE.sendToAllAround(new MessagePlayerKnowledge(this.containerTransmutationTablet.tileEntityTransmutationTablet, knownTransmutations), new NetworkRegistry.TargetPoint(this.tileEntityTransmutationTablet.getWorldObj().provider.dimensionId, (double) this.tileEntityTransmutationTablet.xCoord, (double) this.tileEntityTransmutationTablet.yCoord, (double) this.tileEntityTransmutationTablet.zCoord, 5d));

View File

@ -7,7 +7,7 @@ import com.pahimar.ee3.reference.Names;
import com.pahimar.ee3.reference.Textures;
import com.pahimar.ee3.util.ColorHelper;
import com.pahimar.ee3.util.IOwnable;
import com.pahimar.ee3.util.ItemHelper;
import com.pahimar.ee3.util.ItemStackUtils;
import com.pahimar.ee3.util.NBTHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -99,12 +99,12 @@ public class ItemAlchemicalBag extends ItemEE implements IOwnable
if (!world.isRemote) {
// Set the owner of the bag if one doesn't exist already
if (!ItemHelper.hasOwnerUUID(itemStack)) {
ItemHelper.setOwner(itemStack, entityPlayer);
if (ItemStackUtils.getOwnerUUID(itemStack) == null) {
ItemStackUtils.setOwner(itemStack, entityPlayer);
}
// Set an UUID on the bag if one doesn't exist already
if (!NBTHelper.hasUUID(itemStack)) {
if (NBTHelper.getUUID(itemStack) == null) {
NBTHelper.setUUID(itemStack, UUID.randomUUID());
}

View File

@ -9,7 +9,7 @@ import com.pahimar.ee3.reference.GUIs;
import com.pahimar.ee3.reference.Messages;
import com.pahimar.ee3.reference.Names;
import com.pahimar.ee3.util.IOwnable;
import com.pahimar.ee3.util.ItemHelper;
import com.pahimar.ee3.util.ItemStackUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentTranslation;
@ -34,9 +34,9 @@ public class ItemAlchenomicon extends ItemEE implements IOwnable, IEnergyValuePr
{
if (!world.isRemote)
{
if (!ItemHelper.hasOwnerUUID(itemStack))
if (ItemStackUtils.getOwnerUUID(itemStack) == null)
{
ItemHelper.setOwner(itemStack, entityPlayer);
ItemStackUtils.setOwner(itemStack, entityPlayer);
entityPlayer.addChatComponentMessage(new ChatComponentTranslation(Messages.OWNER_SET_TO_SELF, new Object[]{itemStack.func_151000_E()}));
}
else

View File

@ -1,7 +1,7 @@
package com.pahimar.ee3.knowledge;
import com.pahimar.ee3.reference.Comparators;
import com.pahimar.ee3.util.ItemHelper;
import com.pahimar.ee3.util.ItemStackUtils;
import net.minecraft.item.ItemStack;
import java.util.Collection;
@ -35,7 +35,7 @@ public class PlayerKnowledge {
public boolean isKnown(Object object) {
if (object instanceof ItemStack) {
return knownItemStacks.contains(ItemHelper.clone((ItemStack) object, 1));
return knownItemStacks.contains(ItemStackUtils.clone((ItemStack) object, 1));
}
return false;
@ -48,7 +48,7 @@ public class PlayerKnowledge {
public void learn(Object object) {
if (object instanceof ItemStack) {
ItemStack unitItemStack = ItemHelper.clone((ItemStack) object, 1);
ItemStack unitItemStack = ItemStackUtils.clone((ItemStack) object, 1);
knownItemStacks.add(unitItemStack);
}
}
@ -65,7 +65,7 @@ public class PlayerKnowledge {
public void forget(Object object) {
if (object instanceof ItemStack) {
ItemStack unitItemStack = ItemHelper.clone((ItemStack) object, 1);
ItemStack unitItemStack = ItemStackUtils.clone((ItemStack) object, 1);
knownItemStacks.remove(unitItemStack);
}
}
@ -90,7 +90,7 @@ public class PlayerKnowledge {
stringBuilder.append("[");
for (ItemStack itemStack : knownItemStacks) {
stringBuilder.append(String.format("%s, ", ItemHelper.toString(itemStack)));
stringBuilder.append(String.format("%s, ", ItemStackUtils.toString(itemStack)));
}
stringBuilder.append("]");

View File

@ -69,9 +69,9 @@ public class RecipeRegistry {
public void registerVanillaRecipes() {
RecipesVanilla.registerRecipes();
RecipesFluidContainers.registerRecipes();
RecipesPotions.registerRecipes();
new RecipesVanilla().registerRecipes();
new RecipesFluidContainers().registerRecipes();
new RecipesPotions().registerRecipes();
}
public Multimap<WrappedStack, Set<WrappedStack>> getRecipeMappings() {

View File

@ -4,20 +4,13 @@ import com.pahimar.ee3.api.recipe.RecipeRegistryProxy;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
import java.util.Arrays;
public class RecipesFluidContainers {
public class RecipesFluidContainers
{
public static void registerRecipes()
{
for (FluidContainerData fluidContainerData : FluidContainerRegistry.getRegisteredFluidContainerData())
{
if (fluidContainerData.fluid != null)
{
if (fluidContainerData.filledContainer != null && fluidContainerData.emptyContainer != null)
{
RecipeRegistryProxy.addRecipe(fluidContainerData.filledContainer.copy(), Arrays.asList(fluidContainerData.fluid.copy(), fluidContainerData.emptyContainer.copy()));
}
public void registerRecipes() {
for (FluidContainerData fluidContainerData : FluidContainerRegistry.getRegisteredFluidContainerData()) {
if (fluidContainerData.fluid != null && fluidContainerData.filledContainer != null && fluidContainerData.emptyContainer != null) {
RecipeRegistryProxy.addRecipe(fluidContainerData.filledContainer.copy(), fluidContainerData.fluid.copy(), fluidContainerData.emptyContainer.copy());
}
}
}

View File

@ -6,8 +6,6 @@ import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import java.util.Arrays;
public class RecipesPotions
{
private static WrappedStack reagentWater = WrappedStack.wrap(new ItemStack(Blocks.water));
@ -154,181 +152,181 @@ public class RecipesPotions
private static WrappedStack potionInvisibilitySplashExtended = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16462));
private static WrappedStack potionInvisibilitySplashExtendedOutput = WrappedStack.wrap(new ItemStack(Items.potionitem, 3, 16462));
public static void registerRecipes()
{
RecipeRegistryProxy.addRecipe(bottleWater, Arrays.asList(bottleEmpty, reagentWater));
public void registerRecipes() {
RecipeRegistryProxy.addRecipe(potionAwkwardOutput, Arrays.asList(bottleWater, reagentNetherWart));
RecipeRegistryProxy.addRecipe(bottleWater, bottleEmpty, reagentWater);
RecipeRegistryProxy.addRecipe(potionNightVisionOutput, Arrays.asList(potionAwkward, reagentGoldenCarrot));
RecipeRegistryProxy.addRecipe(potionNightVisionOutput, Arrays.asList(potionNightVisionExtended, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionNightVisionSplashOutput, Arrays.asList(potionNightVisionSplashExtended, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionNightVisionSplashOutput, Arrays.asList(potionNightVision, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionAwkwardOutput, bottleWater, reagentNetherWart);
RecipeRegistryProxy.addRecipe(potionNightVisionExtendedOutput, Arrays.asList(potionNightVision, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionNightVisionSplashExtendedOutput, Arrays.asList(potionNightVisionSplash, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionNightVisionSplashExtendedOutput, Arrays.asList(potionNightVisionExtended, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionNightVisionOutput, potionAwkward, reagentGoldenCarrot);
RecipeRegistryProxy.addRecipe(potionNightVisionOutput, potionNightVisionExtended, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionNightVisionSplashOutput, potionNightVisionSplashExtended, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionNightVisionSplashOutput, potionNightVision, reagentGunpowder);
RecipeRegistryProxy.addRecipe(potionInvisibilityOutput, Arrays.asList(potionNightVision, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionInvisibilityOutput, Arrays.asList(potionInvisibilityExtended, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionInvisibilitySplashOutput, Arrays.asList(potionNightVisionSplash, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionInvisibilitySplashOutput, Arrays.asList(potionInvisibilitySplashExtended, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionInvisibilitySplashOutput, Arrays.asList(potionInvisibility, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionNightVisionExtendedOutput, potionNightVision, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionNightVisionSplashExtendedOutput, potionNightVisionSplash, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionNightVisionSplashExtendedOutput, potionNightVisionExtended, reagentGunpowder);
RecipeRegistryProxy.addRecipe(potionInvisibilityExtendedOutput, Arrays.asList(potionInvisibility, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionInvisibilityExtendedOutput, Arrays.asList(potionNightVisionExtended, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionInvisibilitySplashExtendedOutput, Arrays.asList(potionInvisibilitySplash, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionInvisibilitySplashExtendedOutput, Arrays.asList(potionNightVisionSplashExtended, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionInvisibilitySplashExtendedOutput, Arrays.asList(potionInvisibilityExtended, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionInvisibilityOutput, potionNightVision, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionInvisibilityOutput, potionInvisibilityExtended, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionInvisibilitySplashOutput, potionNightVisionSplash, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionInvisibilitySplashOutput, potionInvisibilitySplashExtended, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionInvisibilitySplashOutput, potionInvisibility, reagentGunpowder);
RecipeRegistryProxy.addRecipe(potionFireResistOutput, Arrays.asList(potionAwkward, reagentMagmaCream));
RecipeRegistryProxy.addRecipe(potionFireResistOutput, Arrays.asList(potionFireResistExtended, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionFireResistSplashOutput, Arrays.asList(potionFireResistSplashExtended, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionFireResistSplashOutput, Arrays.asList(potionFireResist, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionInvisibilityExtendedOutput, potionInvisibility, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionInvisibilityExtendedOutput, potionNightVisionExtended, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionInvisibilitySplashExtendedOutput, potionInvisibilitySplash, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionInvisibilitySplashExtendedOutput, potionNightVisionSplashExtended, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionInvisibilitySplashExtendedOutput, potionInvisibilityExtended, reagentGunpowder);
RecipeRegistryProxy.addRecipe(potionFireResistExtendedOutput, Arrays.asList(potionFireResist, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionFireResistSplashExtendedOutput, Arrays.asList(potionFireResistSplash, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionFireResistSplashExtendedOutput, Arrays.asList(potionFireResistExtended, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionFireResistOutput, potionAwkward, reagentMagmaCream);
RecipeRegistryProxy.addRecipe(potionFireResistOutput, potionFireResistExtended, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionFireResistSplashOutput, potionFireResistSplashExtended, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionFireResistSplashOutput, potionFireResist, reagentGunpowder);
RecipeRegistryProxy.addRecipe(potionSlownessOutput, Arrays.asList(potionFireResist, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionSlownessOutput, Arrays.asList(potionSlownessExtended, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionSlownessOutput, Arrays.asList(potionSwiftness, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionSlownessOutput, Arrays.asList(potionSwiftnessExtended, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionSlownessSplashOutput, Arrays.asList(potionFireResistSplash, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionSlownessSplashOutput, Arrays.asList(potionSlownessSplashExtended, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionSlownessSplashOutput, Arrays.asList(potionSwiftnessSplash, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionSlownessSplashOutput, Arrays.asList(potionSwiftnessSplashExtended, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionSlownessSplashOutput, Arrays.asList(potionSlowness, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionFireResistExtendedOutput, potionFireResist, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionFireResistSplashExtendedOutput, potionFireResistSplash, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionFireResistSplashExtendedOutput, potionFireResistExtended, reagentGunpowder);
RecipeRegistryProxy.addRecipe(potionSlownessExtendedOutput, Arrays.asList(potionFireResistExtended, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionSlownessExtendedOutput, Arrays.asList(potionSwiftnessEnhanced, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionSlownessSplashExtendedOutput, Arrays.asList(potionFireResistSplashExtended, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionSlownessSplashExtendedOutput, Arrays.asList(potionSwiftnessSplashEnhanced, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionSlownessSplashExtendedOutput, Arrays.asList(potionSlownessExtended, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionSlownessOutput, potionFireResist, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionSlownessOutput, potionSlownessExtended, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionSlownessOutput, potionSwiftness, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionSlownessOutput, potionSwiftnessExtended, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionSlownessSplashOutput, potionFireResistSplash, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionSlownessSplashOutput, potionSlownessSplashExtended, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionSlownessSplashOutput, potionSwiftnessSplash, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionSlownessSplashOutput, potionSwiftnessSplashExtended, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionSlownessSplashOutput, potionSlowness, reagentGunpowder);
RecipeRegistryProxy.addRecipe(potionSwiftnessOutput, Arrays.asList(potionAwkward, reagentSugar));
RecipeRegistryProxy.addRecipe(potionSwiftnessSplashOutput, Arrays.asList(potionSwiftness, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionSlownessExtendedOutput, potionFireResistExtended, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionSlownessExtendedOutput, potionSwiftnessEnhanced, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionSlownessSplashExtendedOutput, potionFireResistSplashExtended, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionSlownessSplashExtendedOutput, potionSwiftnessSplashEnhanced, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionSlownessSplashExtendedOutput, potionSlownessExtended, reagentGunpowder);
RecipeRegistryProxy.addRecipe(potionSwiftnessExtendedOutput, Arrays.asList(potionSwiftness, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionSwiftnessExtendedOutput, Arrays.asList(potionSwiftnessEnhanced, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionSwiftnessSplashExtendedOutput, Arrays.asList(potionSwiftnessSplash, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionSwiftnessSplashExtendedOutput, Arrays.asList(potionSwiftnessSplashEnhanced, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionSwiftnessSplashExtendedOutput, Arrays.asList(potionSwiftnessExtended, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionSwiftnessOutput, potionAwkward, reagentSugar);
RecipeRegistryProxy.addRecipe(potionSwiftnessSplashOutput, potionSwiftness, reagentGunpowder);
RecipeRegistryProxy.addRecipe(potionSwiftnessEnhancedOutput, Arrays.asList(potionSwiftness, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionSwiftnessEnhancedOutput, Arrays.asList(potionSwiftnessExtended, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionSwiftnessSplashEnhancedOutput, Arrays.asList(potionSwiftnessSplash, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionSwiftnessSplashEnhancedOutput, Arrays.asList(potionSwiftnessSplashExtended, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionSwiftnessSplashEnhancedOutput, Arrays.asList(potionSwiftnessEnhanced, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionSwiftnessExtendedOutput, potionSwiftness, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionSwiftnessExtendedOutput, potionSwiftnessEnhanced, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionSwiftnessSplashExtendedOutput, potionSwiftnessSplash, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionSwiftnessSplashExtendedOutput, potionSwiftnessSplashEnhanced, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionSwiftnessSplashExtendedOutput, potionSwiftnessExtended, reagentGunpowder);
RecipeRegistryProxy.addRecipe(potionHealingOutput, Arrays.asList(potionAwkward, reagentGlisteringMelon));
RecipeRegistryProxy.addRecipe(potionHealingOutput, Arrays.asList(potionHealingEnhanced, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionHealingSplashOutput, Arrays.asList(potionHealingSplashEnhanced, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionHealingSplashOutput, Arrays.asList(potionHealing, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionSwiftnessEnhancedOutput, potionSwiftness, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionSwiftnessEnhancedOutput, potionSwiftnessExtended, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionSwiftnessSplashEnhancedOutput, potionSwiftnessSplash, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionSwiftnessSplashEnhancedOutput, potionSwiftnessSplashExtended, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionSwiftnessSplashEnhancedOutput, potionSwiftnessEnhanced, reagentGunpowder);
RecipeRegistryProxy.addRecipe(potionHealingEnhancedOutput, Arrays.asList(potionHealing, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionHealingSplashEnhancedOutput, Arrays.asList(potionHealingSplash, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionHealingSplashEnhancedOutput, Arrays.asList(potionHealingEnhanced, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionHealingOutput, potionAwkward, reagentGlisteringMelon);
RecipeRegistryProxy.addRecipe(potionHealingOutput, potionHealingEnhanced, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionHealingSplashOutput, potionHealingSplashEnhanced, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionHealingSplashOutput, potionHealing, reagentGunpowder);
RecipeRegistryProxy.addRecipe(potionHarmingOutput, Arrays.asList(potionHealing, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionHarmingOutput, Arrays.asList(potionPoison, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionHarmingOutput, Arrays.asList(potionPoisonExtended, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionHarmingOutput, Arrays.asList(potionHarmingEnhanced, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionHarmingSplashOutput, Arrays.asList(potionHealingSplash, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionHarmingSplashOutput, Arrays.asList(potionPoisonSplash, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionHarmingSplashOutput, Arrays.asList(potionPoisonSplashExtended, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionHarmingSplashOutput, Arrays.asList(potionHarmingSplashEnhanced, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionHarmingSplashOutput, Arrays.asList(potionHarming, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionHealingEnhancedOutput, potionHealing, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionHealingSplashEnhancedOutput, potionHealingSplash, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionHealingSplashEnhancedOutput, potionHealingEnhanced, reagentGunpowder);
RecipeRegistryProxy.addRecipe(potionHarmingEnhancedOutput, Arrays.asList(potionHealingEnhanced, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionHarmingEnhancedOutput, Arrays.asList(potionHarming, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionHarmingEnhancedOutput, Arrays.asList(potionPoisonEnhanced, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionHarmingSplashEnhancedOutput, Arrays.asList(potionHealingSplashEnhanced, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionHarmingSplashEnhancedOutput, Arrays.asList(potionHarmingSplash, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionHarmingSplashEnhancedOutput, Arrays.asList(potionPoisonSplashEnhanced, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionHarmingSplashEnhancedOutput, Arrays.asList(potionHarmingEnhanced, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionHarmingOutput, potionHealing, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionHarmingOutput, potionPoison, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionHarmingOutput, potionPoisonExtended, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionHarmingOutput, potionHarmingEnhanced, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionHarmingSplashOutput, potionHealingSplash, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionHarmingSplashOutput, potionPoisonSplash, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionHarmingSplashOutput, potionPoisonSplashExtended, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionHarmingSplashOutput, potionHarmingSplashEnhanced, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionHarmingSplashOutput, potionHarming, reagentGunpowder);
RecipeRegistryProxy.addRecipe(potionPoisonOutput, Arrays.asList(potionAwkward, reagentSpiderEye));
RecipeRegistryProxy.addRecipe(potionPoisonSplashOutput, Arrays.asList(potionPoison, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionHarmingEnhancedOutput, potionHealingEnhanced, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionHarmingEnhancedOutput, potionHarming, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionHarmingEnhancedOutput, potionPoisonEnhanced, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionHarmingSplashEnhancedOutput, potionHealingSplashEnhanced, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionHarmingSplashEnhancedOutput, potionHarmingSplash, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionHarmingSplashEnhancedOutput, potionPoisonSplashEnhanced, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionHarmingSplashEnhancedOutput, potionHarmingEnhanced, reagentGunpowder);
RecipeRegistryProxy.addRecipe(potionPoisonExtendedOutput, Arrays.asList(potionPoisonExtended, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionPoisonExtendedOutput, Arrays.asList(potionPoisonEnhanced, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionPoisonSplashExtendedOutput, Arrays.asList(potionPoisonSplashExtended, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionPoisonSplashExtendedOutput, Arrays.asList(potionPoisonSplashEnhanced, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionPoisonSplashExtendedOutput, Arrays.asList(potionPoisonExtended, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionPoisonOutput, potionAwkward, reagentSpiderEye);
RecipeRegistryProxy.addRecipe(potionPoisonSplashOutput, potionPoison, reagentGunpowder);
RecipeRegistryProxy.addRecipe(potionPoisonEnhancedOutput, Arrays.asList(potionPoison, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionPoisonEnhancedOutput, Arrays.asList(potionPoisonExtended, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionPoisonSplashEnhancedOutput, Arrays.asList(potionPoisonSplash, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionPoisonSplashEnhancedOutput, Arrays.asList(potionPoisonSplashExtended, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionPoisonSplashEnhancedOutput, Arrays.asList(potionPoisonEnhanced, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionPoisonExtendedOutput, potionPoisonExtended, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionPoisonExtendedOutput, potionPoisonEnhanced, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionPoisonSplashExtendedOutput, potionPoisonSplashExtended, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionPoisonSplashExtendedOutput, potionPoisonSplashEnhanced, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionPoisonSplashExtendedOutput, potionPoisonExtended, reagentGunpowder);
RecipeRegistryProxy.addRecipe(potionRegenerationOutput, Arrays.asList(potionAwkward, reagentGhastTear));
RecipeRegistryProxy.addRecipe(potionRegenerationSplashOutput, Arrays.asList(potionRegeneration, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionPoisonEnhancedOutput, potionPoison, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionPoisonEnhancedOutput, potionPoisonExtended, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionPoisonSplashEnhancedOutput, potionPoisonSplash, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionPoisonSplashEnhancedOutput, potionPoisonSplashExtended, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionPoisonSplashEnhancedOutput, potionPoisonEnhanced, reagentGunpowder);
RecipeRegistryProxy.addRecipe(potionRegenerationExtendedOutput, Arrays.asList(potionRegeneration, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionRegenerationExtendedOutput, Arrays.asList(potionRegenerationEnhanced, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionRegenerationSplashExtendedOutput, Arrays.asList(potionRegenerationSplash, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionRegenerationSplashExtendedOutput, Arrays.asList(potionRegenerationSplashEnhanced, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionRegenerationSplashExtendedOutput, Arrays.asList(potionRegenerationExtended, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionRegenerationOutput, potionAwkward, reagentGhastTear);
RecipeRegistryProxy.addRecipe(potionRegenerationSplashOutput, potionRegeneration, reagentGunpowder);
RecipeRegistryProxy.addRecipe(potionRegenerationEnhancedOutput, Arrays.asList(potionRegeneration, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionRegenerationEnhancedOutput, Arrays.asList(potionRegenerationExtended, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionRegenerationSplashEnhancedOutput, Arrays.asList(potionRegenerationSplash, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionRegenerationSplashEnhancedOutput, Arrays.asList(potionRegenerationSplashExtended, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionRegenerationSplashEnhancedOutput, Arrays.asList(potionRegenerationEnhanced, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionRegenerationExtendedOutput, potionRegeneration, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionRegenerationExtendedOutput, potionRegenerationEnhanced, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionRegenerationSplashExtendedOutput, potionRegenerationSplash, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionRegenerationSplashExtendedOutput, potionRegenerationSplashEnhanced, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionRegenerationSplashExtendedOutput, potionRegenerationExtended, reagentGunpowder);
RecipeRegistryProxy.addRecipe(potionWeaknessOutput, Arrays.asList(potionAwkward, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionWeaknessOutput, Arrays.asList(potionRegeneration, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionWeaknessOutput, Arrays.asList(potionRegenerationEnhanced, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionWeaknessOutput, Arrays.asList(potionStrength, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionWeaknessOutput, Arrays.asList(potionStrengthEnhanced, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionWeaknessOutput, Arrays.asList(potionMundane, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionWeaknessOutput, Arrays.asList(potionWeaknessExtended, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionWeaknessSplashOutput, Arrays.asList(potionRegenerationSplash, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionWeaknessSplashOutput, Arrays.asList(potionRegenerationSplashEnhanced, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionWeaknessSplashOutput, Arrays.asList(potionStrengthSplash, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionWeaknessSplashOutput, Arrays.asList(potionStrengthSplashEnhanced, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionWeaknessSplashOutput, Arrays.asList(potionMundaneSplash, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionWeaknessSplashOutput, Arrays.asList(potionWeaknessSplashExtended, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionWeaknessSplashOutput, Arrays.asList(potionWeakness, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionRegenerationEnhancedOutput, potionRegeneration, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionRegenerationEnhancedOutput, potionRegenerationExtended, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionRegenerationSplashEnhancedOutput, potionRegenerationSplash, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionRegenerationSplashEnhancedOutput, potionRegenerationSplashExtended, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionRegenerationSplashEnhancedOutput, potionRegenerationEnhanced, reagentGunpowder);
RecipeRegistryProxy.addRecipe(potionWeaknessExtendedOutput, Arrays.asList(potionWeakness, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionWeaknessExtendedOutput, Arrays.asList(potionRegenerationExtended, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionWeaknessExtendedOutput, Arrays.asList(potionStrengthExtended, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionWeaknessExtendedOutput, Arrays.asList(potionMundaneExtended, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionWeaknessSplashExtendedOutput, Arrays.asList(potionWeaknessSplash, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionWeaknessSplashExtendedOutput, Arrays.asList(potionRegenerationSplashExtended, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionWeaknessSplashExtendedOutput, Arrays.asList(potionStrengthSplashExtended, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionWeaknessSplashExtendedOutput, Arrays.asList(potionMundaneSplashExtended, reagentFermentedSpiderEye));
RecipeRegistryProxy.addRecipe(potionWeaknessSplashExtendedOutput, Arrays.asList(potionWeaknessExtended, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionWeaknessOutput, potionAwkward, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionWeaknessOutput, potionRegeneration, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionWeaknessOutput, potionRegenerationEnhanced, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionWeaknessOutput, potionStrength, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionWeaknessOutput, potionStrengthEnhanced, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionWeaknessOutput, potionMundane, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionWeaknessOutput, potionWeaknessExtended, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionWeaknessSplashOutput, potionRegenerationSplash, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionWeaknessSplashOutput, potionRegenerationSplashEnhanced, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionWeaknessSplashOutput, potionStrengthSplash, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionWeaknessSplashOutput, potionStrengthSplashEnhanced, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionWeaknessSplashOutput, potionMundaneSplash, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionWeaknessSplashOutput, potionWeaknessSplashExtended, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionWeaknessSplashOutput, potionWeakness, reagentGunpowder);
RecipeRegistryProxy.addRecipe(potionStrengthOutput, Arrays.asList(potionAwkward, reagentBlazePowder));
RecipeRegistryProxy.addRecipe(potionStrengthSplashOutput, Arrays.asList(potionStrength, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionWeaknessExtendedOutput, potionWeakness, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionWeaknessExtendedOutput, potionRegenerationExtended, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionWeaknessExtendedOutput, potionStrengthExtended, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionWeaknessExtendedOutput, potionMundaneExtended, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionWeaknessSplashExtendedOutput, potionWeaknessSplash, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionWeaknessSplashExtendedOutput, potionRegenerationSplashExtended, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionWeaknessSplashExtendedOutput, potionStrengthSplashExtended, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionWeaknessSplashExtendedOutput, potionMundaneSplashExtended, reagentFermentedSpiderEye);
RecipeRegistryProxy.addRecipe(potionWeaknessSplashExtendedOutput, potionWeaknessExtended, reagentGunpowder);
RecipeRegistryProxy.addRecipe(potionStrengthEnhancedOutput, Arrays.asList(potionStrength, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionStrengthEnhancedOutput, Arrays.asList(potionStrengthExtended, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionStrengthSplashEnhancedOutput, Arrays.asList(potionStrengthSplash, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionStrengthSplashEnhancedOutput, Arrays.asList(potionStrengthSplashExtended, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionStrengthSplashEnhancedOutput, Arrays.asList(potionStrengthEnhanced, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionStrengthOutput, potionAwkward, reagentBlazePowder);
RecipeRegistryProxy.addRecipe(potionStrengthSplashOutput, potionStrength, reagentGunpowder);
RecipeRegistryProxy.addRecipe(potionStrengthExtendedOutput, Arrays.asList(potionStrength, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionStrengthExtendedOutput, Arrays.asList(potionStrengthEnhanced, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionStrengthSplashExtendedOutput, Arrays.asList(potionStrengthSplash, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionStrengthSplashExtendedOutput, Arrays.asList(potionStrengthSplashEnhanced, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionStrengthSplashExtendedOutput, Arrays.asList(potionStrengthExtended, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionStrengthEnhancedOutput, potionStrength, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionStrengthEnhancedOutput, potionStrengthExtended, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionStrengthSplashEnhancedOutput, potionStrengthSplash, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionStrengthSplashEnhancedOutput, potionStrengthSplashExtended, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionStrengthSplashEnhancedOutput, potionStrengthEnhanced, reagentGunpowder);
RecipeRegistryProxy.addRecipe(potionThickOutput, Arrays.asList(bottleWater, reagentGlowstoneDust));
RecipeRegistryProxy.addRecipe(potionStrengthExtendedOutput, potionStrength, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionStrengthExtendedOutput, potionStrengthEnhanced, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionStrengthSplashExtendedOutput, potionStrengthSplash, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionStrengthSplashExtendedOutput, potionStrengthSplashEnhanced, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionStrengthSplashExtendedOutput, potionStrengthExtended, reagentGunpowder);
RecipeRegistryProxy.addRecipe(potionMundaneOutput, Arrays.asList(bottleWater, reagentSugar));
RecipeRegistryProxy.addRecipe(potionMundaneOutput, Arrays.asList(bottleWater, reagentGlisteringMelon));
RecipeRegistryProxy.addRecipe(potionMundaneOutput, Arrays.asList(bottleWater, reagentSpiderEye));
RecipeRegistryProxy.addRecipe(potionMundaneOutput, Arrays.asList(bottleWater, reagentBlazePowder));
RecipeRegistryProxy.addRecipe(potionMundaneOutput, Arrays.asList(bottleWater, reagentMagmaCream));
RecipeRegistryProxy.addRecipe(potionMundaneOutput, Arrays.asList(bottleWater, reagentGhastTear));
RecipeRegistryProxy.addRecipe(potionMundaneSplashOutput, Arrays.asList(potionMundane, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionThickOutput, bottleWater, reagentGlowstoneDust);
RecipeRegistryProxy.addRecipe(potionMundaneExtendedOutput, Arrays.asList(bottleWater, reagentRedstoneDust));
RecipeRegistryProxy.addRecipe(potionMundaneSplashExtendedOutput, Arrays.asList(potionMundaneExtended, reagentGunpowder));
RecipeRegistryProxy.addRecipe(potionMundaneOutput, bottleWater, reagentSugar);
RecipeRegistryProxy.addRecipe(potionMundaneOutput, bottleWater, reagentGlisteringMelon);
RecipeRegistryProxy.addRecipe(potionMundaneOutput, bottleWater, reagentSpiderEye);
RecipeRegistryProxy.addRecipe(potionMundaneOutput, bottleWater, reagentBlazePowder);
RecipeRegistryProxy.addRecipe(potionMundaneOutput, bottleWater, reagentMagmaCream);
RecipeRegistryProxy.addRecipe(potionMundaneOutput, bottleWater, reagentGhastTear);
RecipeRegistryProxy.addRecipe(potionMundaneSplashOutput, potionMundane, reagentGunpowder);
RecipeRegistryProxy.addRecipe(potionMundaneExtendedOutput, bottleWater, reagentRedstoneDust);
RecipeRegistryProxy.addRecipe(potionMundaneSplashExtendedOutput, potionMundaneExtended, reagentGunpowder);
}
}

View File

@ -17,26 +17,22 @@ import net.minecraftforge.oredict.ShapelessOreRecipe;
import java.util.Arrays;
import java.util.List;
public class RecipesVanilla
{
public static void registerRecipes()
{
for (Object recipeObject : CraftingManager.getInstance().getRecipeList())
{
/**
* Vanilla
*/
if (recipeObject instanceof ShapedRecipes || recipeObject instanceof ShapelessRecipes || recipeObject instanceof ShapedOreRecipe || recipeObject instanceof ShapelessOreRecipe)
{
public class RecipesVanilla {
public void registerRecipes() {
for (Object recipeObject : CraftingManager.getInstance().getRecipeList()) {
// Vanilla
if (recipeObject instanceof ShapedRecipes || recipeObject instanceof ShapelessRecipes || recipeObject instanceof ShapedOreRecipe || recipeObject instanceof ShapelessOreRecipe) {
IRecipe recipe = (IRecipe) recipeObject;
ItemStack recipeOutput = recipe.getRecipeOutput();
if (recipeOutput != null)
{
if (recipeOutput != null) {
List<WrappedStack> recipeInputs = RecipeHelper.getRecipeInputs(recipe);
if (!recipeInputs.isEmpty())
{
if (!recipeInputs.isEmpty()) {
RecipeRegistryProxy.addRecipe(recipeOutput, recipeInputs);
}
}
@ -44,10 +40,6 @@ public class RecipesVanilla
}
// Fixes for OreDictionary entries that may not exist (because the OreDictionary entry has nothing in it)
RecipeRegistryProxy.addRecipe(new ItemStack(Blocks.wool, 1, 11), Arrays.asList(new OreStack("dyeBlue"), Blocks.wool));
RecipeRegistryProxy.addRecipe(new ItemStack(Blocks.stained_hardened_clay, 8, 11), Arrays.asList(new OreStack("dyeBlue"), new ItemStack(Blocks.hardened_clay, 8)));
RecipeRegistryProxy.addRecipe(new ItemStack(Blocks.stained_glass, 8, OreDictionary.WILDCARD_VALUE), Arrays.asList(new OreStack("dye"), new ItemStack(Blocks.glass, 8, OreDictionary.WILDCARD_VALUE)));
RecipeRegistryProxy.addRecipe(new ItemStack(Blocks.stained_glass_pane, 16, OreDictionary.WILDCARD_VALUE), Arrays.asList(new ItemStack(Blocks.stained_glass, 6, OreDictionary.WILDCARD_VALUE)));
RecipeRegistryProxy.addRecipe(new ItemStack(Blocks.daylight_detector), Arrays.asList(new ItemStack(Blocks.glass, 3, OreDictionary.WILDCARD_VALUE), new OreStack("slabWood", 3), new OreStack("gemQuartz", 3)));
}
}

View File

@ -6,11 +6,46 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import java.util.Collection;
import java.util.Comparator;
import java.util.Set;
public class Comparators {
public static final Comparator<Collection<ItemStack>> ITEM_STACK_COLLECTION_COMPARATOR = new Comparator<Collection<ItemStack>>() {
@Override
public int compare(Collection<ItemStack> o1, Collection<ItemStack> o2) {
if (o1 != null && o2 != null) {
if (o1.size() == o2.size()) {
if (o1.containsAll(o2)) {
if (o2.containsAll(o1)) {
return 0;
}
else {
return 1;
}
}
else {
return -1;
}
}
else {
return o1.size() - o2.size();
}
}
else if (o1 != null) {
return -1;
}
else if (o2 != null) {
return 1;
}
else {
return 0;
}
}
};
public static final Comparator<Set<WrappedStack>> WRAPPED_STACK_SET_COMPARATOR = new Comparator<Set<WrappedStack>>() {
@Override
public int compare(Set<WrappedStack> collection1, Set<WrappedStack> collection2) {

View File

@ -272,6 +272,8 @@ public class VanillaTestSuite extends EnergyValueTestSuite {
add(new ItemStack(Blocks.double_plant, 1, 5), 32);
add(Items.painting, 80);
add(Items.sign, 17.333);
add(Items.bed, 168);
add(Items.item_frame, 96);
add(Items.flower_pot, 192);
add(new ItemStack(Blocks.skull, 1, 0), null);
add(new ItemStack(Blocks.skull, 1, 1), null);

View File

@ -5,7 +5,7 @@ import com.pahimar.ee3.api.knowledge.PlayerKnowledgeRegistryProxy;
import com.pahimar.ee3.network.PacketHandler;
import com.pahimar.ee3.network.message.MessageTileEntityResearchStation;
import com.pahimar.ee3.reference.Names;
import com.pahimar.ee3.util.ItemHelper;
import com.pahimar.ee3.util.ItemStackUtils;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
@ -209,7 +209,7 @@ public class TileEntityResearchStation extends TileEntityEE implements IInventor
private boolean canLearnItemStack()
{
ItemStack alchenomicon = inventory[ALCHENOMICON_SLOT_INVENTORY_INDEX];
String playerName = ItemHelper.getOwnerName(alchenomicon);
String playerName = ItemStackUtils.getOwnerName(alchenomicon);
if (alchenomicon != null && playerName != null)
{
@ -222,7 +222,7 @@ public class TileEntityResearchStation extends TileEntityEE implements IInventor
private boolean isItemStackKnown()
{
ItemStack alchenomicon = inventory[ALCHENOMICON_SLOT_INVENTORY_INDEX];
String playerName = ItemHelper.getOwnerName(alchenomicon);
String playerName = ItemStackUtils.getOwnerName(alchenomicon);
if (alchenomicon != null && playerName != null)
{
@ -236,7 +236,7 @@ public class TileEntityResearchStation extends TileEntityEE implements IInventor
{
if (this.canLearnItemStack())
{
PlayerKnowledgeRegistryProxy.teachPlayer(ItemHelper.getOwnerName(inventory[ALCHENOMICON_SLOT_INVENTORY_INDEX]), inventory[ITEM_SLOT_INVENTORY_INDEX]);
PlayerKnowledgeRegistryProxy.teachPlayer(ItemStackUtils.getOwnerName(inventory[ALCHENOMICON_SLOT_INVENTORY_INDEX]), inventory[ITEM_SLOT_INVENTORY_INDEX]);
this.inventory[ITEM_SLOT_INVENTORY_INDEX].stackSize--;

View File

@ -21,7 +21,7 @@ public class DebugUtils
stringBuilder.append(String.format("Ore: %s, ItemStacks: ", oreName));
for (ItemStack itemStack : OreDictionary.getOres(oreName))
{
stringBuilder.append(String.format("%s ", ItemHelper.toString(itemStack)));
stringBuilder.append(String.format("%s ", ItemStackUtils.toString(itemStack)));
}
LogHelper.info(stringBuilder.toString());
}

View File

@ -2,31 +2,15 @@ package com.pahimar.ee3.util;
import com.pahimar.ee3.api.exchange.EnergyValue;
import com.pahimar.ee3.exchange.EnergyValueRegistry;
import com.pahimar.ee3.exchange.OreStack;
import com.pahimar.ee3.exchange.WrappedStack;
import com.pahimar.ee3.reference.Comparators;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import java.util.*;
public class FilterUtils {
public static Set<ItemStack> filterForItemStacks(Set<WrappedStack> wrappedStacks) {
Set<ItemStack> itemStacks = new TreeSet<>(Comparators.ID_COMPARATOR);
for (WrappedStack wrappedStack : wrappedStacks) {
if (wrappedStack.getWrappedObject() instanceof ItemStack) {
itemStacks.add((ItemStack) wrappedStack.getWrappedObject());
}
else if (wrappedStack.getWrappedObject() instanceof OreStack) {
itemStacks.addAll(OreDictionary.getOres(((OreStack) wrappedStack.getWrappedObject()).oreName));
}
}
return itemStacks;
}
public static Set<ItemStack> filterByDisplayName(Set<ItemStack> itemStacks, String filterString) {
return filterByDisplayName(itemStacks, filterString, NameFilterType.STARTS_WITH, null);
@ -114,6 +98,19 @@ public class FilterUtils {
return filteredSet;
}
public static Collection<ItemStack> filterForItemStacks(Collection<?> objects) {
Set<ItemStack> itemStacks = new TreeSet<>(Comparators.ID_COMPARATOR);
for (Object object : objects) {
if (object instanceof ItemStack) {
itemStacks.add((ItemStack) object);
}
}
return itemStacks;
}
public enum NameFilterType {
STARTS_WITH,
CONTAINS

View File

@ -7,7 +7,7 @@ import net.minecraft.item.ItemStack;
import java.util.UUID;
public class ItemHelper {
public class ItemStackUtils {
public static ItemStack clone(ItemStack itemStack, int stackSize) {
@ -55,54 +55,35 @@ public class ItemHelper {
return "null";
}
public static boolean hasOwner(ItemStack itemStack) {
return (NBTHelper.hasKey(itemStack, Names.NBT.OWNER_UUID_MOST_SIG) && NBTHelper.hasKey(itemStack, Names.NBT.OWNER_UUID_LEAST_SIG)) || NBTHelper.hasKey(itemStack, Names.NBT.OWNER);
public static void setOwner(ItemStack itemStack, EntityPlayer entityPlayer) {
setOwnerName(itemStack, entityPlayer);
setOwnerUUID(itemStack, entityPlayer);
}
public static boolean hasOwnerUUID(ItemStack itemStack) {
return NBTHelper.hasKey(itemStack, Names.NBT.OWNER_UUID_MOST_SIG) && NBTHelper.hasKey(itemStack, Names.NBT.OWNER_UUID_LEAST_SIG);
}
public static String getOwnerName(ItemStack itemStack) {
public static boolean hasOwnerName(ItemStack itemStack)
{
return NBTHelper.hasKey(itemStack, Names.NBT.OWNER);
}
public static String getOwnerName(ItemStack itemStack)
{
if (NBTHelper.hasKey(itemStack, Names.NBT.OWNER))
{
if (NBTHelper.hasKey(itemStack, Names.NBT.OWNER)) {
return NBTHelper.getString(itemStack, Names.NBT.OWNER);
}
return null;
}
public static UUID getOwnerUUID(ItemStack itemStack)
{
if (NBTHelper.hasKey(itemStack, Names.NBT.OWNER_UUID_MOST_SIG) && NBTHelper.hasKey(itemStack, Names.NBT.OWNER_UUID_LEAST_SIG))
{
public static UUID getOwnerUUID(ItemStack itemStack) {
if (NBTHelper.getLong(itemStack, Names.NBT.OWNER_UUID_MOST_SIG) != null && NBTHelper.getLong(itemStack, Names.NBT.OWNER_UUID_LEAST_SIG) != null) {
return new UUID(NBTHelper.getLong(itemStack, Names.NBT.OWNER_UUID_MOST_SIG), NBTHelper.getLong(itemStack, Names.NBT.OWNER_UUID_LEAST_SIG));
}
return null;
}
public static void setOwner(ItemStack itemStack, EntityPlayer entityPlayer)
{
setOwnerName(itemStack, entityPlayer);
setOwnerUUID(itemStack, entityPlayer);
}
public static void setOwnerUUID(ItemStack itemStack, EntityPlayer entityPlayer) {
public static void setOwnerUUID(ItemStack itemStack, EntityPlayer entityPlayer)
{
NBTHelper.setLong(itemStack, Names.NBT.OWNER_UUID_MOST_SIG, entityPlayer.getUniqueID().getMostSignificantBits());
NBTHelper.setLong(itemStack, Names.NBT.OWNER_UUID_LEAST_SIG, entityPlayer.getUniqueID().getLeastSignificantBits());
}
public static void setOwnerName(ItemStack itemStack, EntityPlayer entityPlayer)
{
public static void setOwnerName(ItemStack itemStack, EntityPlayer entityPlayer) {
NBTHelper.setString(itemStack, Names.NBT.OWNER, entityPlayer.getDisplayName());
}
}

View File

@ -172,7 +172,7 @@ public class RecipeHelper
{
if (stack.getWrappedObject() instanceof ItemStack && collatedStack.getWrappedObject() instanceof ItemStack)
{
if (ItemHelper.equals((ItemStack) stack.getWrappedObject(), (ItemStack) collatedStack.getWrappedObject()))
if (ItemStackUtils.equals((ItemStack) stack.getWrappedObject(), (ItemStack) collatedStack.getWrappedObject()))
{
collatedStack.setStackSize(collatedStack.getStackSize() + stack.getStackSize());
found = true;
@ -208,6 +208,7 @@ public class RecipeHelper
* @param objects a list of recipe inputs for an OreDictionary recipe
* @return true if there exists no "invalid" (empty) OreDictionary entries in the provided list of recipe inputs
*/
// FIXME This is not working as intended
private static boolean validateOreDictionaryRecipe(List objects)
{
for (Object object : objects)