Package com.pahimar.ee3.block

Examples of com.pahimar.ee3.block.BlockAlchemyArray


        return energyValueRegistry;
    }

    public void addPreAssignedEnergyValue(Object object, float energyValue)
    {
        addPreAssignedEnergyValue(object, new EnergyValue(energyValue));
    }
View Full Code Here


            WrappedStack wrappedStack = new WrappedStack(object);

            if (wrappedStack.getStackSize() > 0)
            {
                WrappedStack factoredWrappedStack = new WrappedStack(wrappedStack, 1);
                EnergyValue factoredEnergyValue = EnergyValueHelper.factorEnergyValue(energyValue, wrappedStack.getStackSize());

                if (preAssignedMappings.containsKey(factoredWrappedStack))
                {
                    if (factoredEnergyValue.compareTo(preAssignedMappings.get(factoredWrappedStack)) < 0)
                    {
                        preAssignedMappings.put(factoredWrappedStack, factoredEnergyValue);
                    }
                }
                else
View Full Code Here

            WrappedStack wrappedStack = new WrappedStack(object);

            if (wrappedStack.getStackSize() > 0)
            {
                WrappedStack factoredWrappedStack = new WrappedStack(wrappedStack, 1);
                EnergyValue factoredEnergyValue = new EnergyValue(energyValue * 1f / wrappedStack.getStackSize(), EnergyValue.EnergyType.CORPOREAL);

                postAssignedMappings.put(factoredWrappedStack, factoredEnergyValue);
            }
        }
    }
View Full Code Here

            WrappedStack wrappedStack = new WrappedStack(object);

            if (wrappedStack.getStackSize() > 0)
            {
                WrappedStack factoredWrappedStack = new WrappedStack(wrappedStack, 1);
                EnergyValue factoredEnergyValue = EnergyValueHelper.factorEnergyValue(energyValue, wrappedStack.getStackSize());

                postAssignedMappings.put(factoredWrappedStack, factoredEnergyValue);
            }
        }
    }
View Full Code Here

        {
            WrappedStack stack = new WrappedStack(object);

            if (stack.getWrappedStack() instanceof ItemStack && ((ItemStack) stack.getWrappedStack()).getItem() instanceof IEnergyValueProvider)
            {
                EnergyValue energyValue = ((IEnergyValueProvider) ((ItemStack) stack.getWrappedStack()).getItem()).getEnergyValue((ItemStack) stack.getWrappedStack());

                if (energyValue != null && energyValue.getEnergyValue() > 0f)
                {
                    return true;
                }
            }
            else
View Full Code Here

        {
            WrappedStack stack = new WrappedStack(object);

            if (stack.getWrappedStack() instanceof ItemStack && ((ItemStack) stack.getWrappedStack()).getItem() instanceof IEnergyValueProvider)
            {
                EnergyValue energyValue = ((IEnergyValueProvider) ((ItemStack) stack.getWrappedStack()).getItem()).getEnergyValue((ItemStack) stack.getWrappedStack());

                if (energyValue != null && energyValue.getEnergyValue() > 0f)
                {
                    return energyValue;
                }
            }
            else
            {
                if (energyValueRegistry.stackMappings.containsKey(new WrappedStack(stack.getWrappedStack())))
                {
                    return energyValueRegistry.stackMappings.get(new WrappedStack(stack.getWrappedStack()));
                }
                else
                {
                    if (!strict)
                    {
                        if (stack.getWrappedStack() instanceof ItemStack)
                        {
                            EnergyValue lowestValue = null;
                            ItemStack wrappedItemStack = (ItemStack) stack.getWrappedStack();

                            if (OreDictionary.getOreIDs(wrappedItemStack).length > 0)
                            {
                                OreStack oreStack = new OreStack(wrappedItemStack);

                                if (energyValueRegistry.stackMappings.containsKey(new WrappedStack(oreStack)))
                                {
                                    return energyValueRegistry.stackMappings.get(new WrappedStack(oreStack));
                                }
                                else
                                {
                                    for (int oreId : OreDictionary.getOreIDs(wrappedItemStack))
                                    {
                                        for (ItemStack itemStack : OreDictionary.getOres(OreDictionary.getOreName(oreId)))
                                        {
                                            if (energyValueRegistry.stackMappings.containsKey(new WrappedStack(itemStack)))
                                            {
                                                if (lowestValue == null)
                                                {
                                                    lowestValue = energyValueRegistry.stackMappings.get(new WrappedStack(itemStack));
                                                }
                                                else
                                                {
                                                    EnergyValue itemValue = energyValueRegistry.stackMappings.get(new WrappedStack(itemStack));

                                                    if (itemValue.compareTo(lowestValue) < 0)
                                                    {
                                                        lowestValue = itemValue;
                                                    }
                                                }
                                            }
                                        }
                                    }

                                    return lowestValue;
                                }
                            }
                            else
                            {
                                for (WrappedStack valuedStack : energyValueRegistry.stackMappings.keySet())
                                {
                                    if (valuedStack.getWrappedStack() instanceof ItemStack)
                                    {
                                        ItemStack valuedItemStack = (ItemStack) valuedStack.getWrappedStack();

                                        if (Item.getIdFromItem(valuedItemStack.getItem()) == Item.getIdFromItem(wrappedItemStack.getItem()))
                                        {
                                            if (valuedItemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE || wrappedItemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE)
                                            {
                                                EnergyValue stackValue = energyValueRegistry.stackMappings.get(valuedStack);

                                                if (stackValue.compareTo(lowestValue) < 0)
                                                {
                                                    lowestValue = stackValue;
                                                }
                                            }
                                            else if (wrappedItemStack.getItem().isDamageable() && wrappedItemStack.isItemDamaged())
                                            {
                                                EnergyValue stackValue = new EnergyValue(energyValueRegistry.stackMappings.get(valuedStack).getEnergyValue() * (1 - (wrappedItemStack.getItemDamage() * 1.0F / wrappedItemStack.getMaxDamage())));

                                                if (stackValue.compareTo(lowestValue) < 0)
                                                {
                                                    lowestValue = stackValue;
                                                }
                                            }
                                        }
View Full Code Here

            // Compute stack mappings from existing stack mappings
            computedStackValues = computeStackMappings();

            for (WrappedStack keyStack : computedStackValues.keySet())
            {
                EnergyValue factoredExchangeEnergyValue = null;
                WrappedStack factoredKeyStack = null;

                if (keyStack != null && keyStack.getWrappedStack() != null && keyStack.getStackSize() > 0)
                {
                    if (computedStackValues.get(keyStack) != null && Float.compare(computedStackValues.get(keyStack).getEnergyValue(), 0f) > 0)
                    {
                        factoredExchangeEnergyValue = EnergyValueHelper.factorEnergyValue(computedStackValues.get(keyStack), keyStack.getStackSize());
                        factoredKeyStack = new WrappedStack(keyStack, 1);
                    }
                }

                if (factoredExchangeEnergyValue != null)
                {
                    if (stackValueMap.containsKey(factoredKeyStack))
                    {
                        if (factoredExchangeEnergyValue.compareTo(stackValueMap.get(factoredKeyStack)) == -1)
                        {
                            stackValueMap.put(factoredKeyStack, factoredExchangeEnergyValue);
                        }
                    }
                    else
                    {
                        stackValueMap.put(factoredKeyStack, factoredExchangeEnergyValue);
                    }
                }
            }
        }

        /*
         *  Post-assigned values
         */
        if (postAssignedMappings != null)
        {
            for (WrappedStack wrappedStack : postAssignedMappings.keySet())
            {
                stackValueMap.put(wrappedStack, postAssignedMappings.get(wrappedStack));
            }
        }
        else
        {
            postAssignedMappings = new HashMap<WrappedStack, EnergyValue>();
        }

        // Grab custom post-assigned values from file
        Map<WrappedStack, EnergyValue> postAssignedValueMap = SerializationHelper.readEnergyValueStackMapFromJsonFile(Files.POST_ASSIGNED_ENERGY_VALUES);
        stackValueMap.putAll(postAssignedValueMap);

        /**
         * Finalize the stack to value map
         */
        stackMappingsBuilder = ImmutableSortedMap.naturalOrder();
        stackMappingsBuilder.putAll(stackValueMap);
        stackMappings = stackMappingsBuilder.build();


        /**
         *  Value map resolution
         */
        SortedMap<EnergyValue, List<WrappedStack>> tempValueMappings = new TreeMap<EnergyValue, List<WrappedStack>>();

        for (WrappedStack stack : stackMappings.keySet())
        {
            if (stack != null)
            {
                EnergyValue value = stackMappings.get(stack);

                if (value != null)
                {
                    if (tempValueMappings.containsKey(value))
                    {
View Full Code Here

        for (WrappedStack recipeOutput : RecipeRegistry.getInstance().getRecipeMappings().keySet())
        {
            if (!hasEnergyValue(recipeOutput.getWrappedStack(), false) && !computedStackMap.containsKey(recipeOutput))
            {
                EnergyValue lowestValue = null;

                for (List<WrappedStack> recipeInputs : RecipeRegistry.getInstance().getRecipeMappings().get(recipeOutput))
                {
                    EnergyValue computedValue = EnergyValueHelper.computeEnergyValueFromList(recipeInputs);
                    computedValue = EnergyValueHelper.factorEnergyValue(computedValue, recipeOutput.getStackSize());

                    if (computedValue != null)
                    {
                        if (computedValue.compareTo(lowestValue) < 0)
                        {
                            lowestValue = computedValue;
                        }
                    }
                }
View Full Code Here

        return computedStackMap;
    }

    public List getStacksInRange(int start, int finish)
    {
        return getStacksInRange(new EnergyValue(start), new EnergyValue(finish));
    }
View Full Code Here

        return getStacksInRange(new EnergyValue(start), new EnergyValue(finish));
    }

    public List getStacksInRange(float start, float finish)
    {
        return getStacksInRange(new EnergyValue(start), new EnergyValue(finish));
    }
View Full Code Here

TOP

Related Classes of com.pahimar.ee3.block.BlockAlchemyArray

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.