Package com.pahimar.ee3.client.handler

Examples of com.pahimar.ee3.client.handler.DrawBlockHighlightEventHandler


            NBTTagList stackMappingTagList = nbtTagCompound.getTagList("stackMappingList", 10);
            for (int i = 0; i < stackMappingTagList.tagCount(); i++)
            {
                NBTTagCompound tagCompound = stackMappingTagList.getCompoundTagAt(i);
                WrappedStack wrappedStack = WrappedStack.fromNBTTagCompound(tagCompound.getCompoundTag("wrappedStack"));
                EnergyValue energyValue = EnergyValue.loadEnergyValueFromNBT(tagCompound.getCompoundTag("energyValue"));
                stackValueMap.put(wrappedStack, energyValue);
            }

            ImmutableSortedMap.Builder<WrappedStack, EnergyValue> stackMappingsBuilder = ImmutableSortedMap.naturalOrder();
            stackMappingsBuilder.putAll(stackValueMap);
            stackMappings = stackMappingsBuilder.build();

            /**
             *  Resolve value stack mappings from the newly loaded stack mappings
             */
            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 stack : stackMappings.keySet())
            {
                if (stack != null)
                {
                    EnergyValue value = stackMappings.get(stack);

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

        if (!jsonElement.isJsonPrimitive())
        {
            JsonObject jsonStackValueMapping = (JsonObject) jsonElement;

            WrappedStack wrappedStack = null;
            EnergyValue energyValue = null;

            if (jsonStackValueMapping.get("wrappedStack") != null)
            {
                wrappedStack = new WrappedStack().deserialize(jsonStackValueMapping.get("wrappedStack").getAsJsonObject(), typeOfT, context);
            }

            if (jsonStackValueMapping.get("energyValue") != null)
            {
                energyValue = new EnergyValue().deserialize(jsonStackValueMapping.get("energyValue").getAsJsonObject(), typeOfT, context);
            }

            if (wrappedStack != null && energyValue != null)
            {
                return new EnergyValueStackMapping(wrappedStack, energyValue);
View Full Code Here

      output = new PositionedStack(outputDust, 101, 19);
     
      inputs = new ArrayList<PositionedStack>();

      minEnergyValue = EnergyValueRegistryProxy.getEnergyValue(outputDust);
      maxEnergyValue = (outputDust.getItemDamage() < (ItemAlchemicalDust.getAlchemicalDusts().size() - 1) ? EnergyValueRegistryProxy.getEnergyValue(ItemAlchemicalDust.getAlchemicalDusts().get(outputDust.getItemDamage() + 1)) : new EnergyValue(Float.MAX_VALUE, EnergyType.CORPOREAL));

      for (Object obj : EnergyValueRegistryProxy.getStacksInRange(minEnergyValue, maxEnergyValue))
      {
        if (obj instanceof ItemStack)
        {
View Full Code Here

      inputs = Arrays.asList(new PositionedStack[] { new PositionedStack(inputStack, 40, 0) });

      output = new PositionedStack(outputDust, 101, 19);

      minEnergyValue = EnergyValueRegistryProxy.getEnergyValue(outputDust);
      maxEnergyValue = (outputDust.getItemDamage() < (ItemAlchemicalDust.getAlchemicalDusts().size() - 1) ? EnergyValueRegistryProxy.getEnergyValue(ItemAlchemicalDust.getAlchemicalDusts().get(outputDust.getItemDamage() + 1)) : new EnergyValue(Float.MAX_VALUE, EnergyType.CORPOREAL));
    }
View Full Code Here

        {
            WrappedStack stack = new WrappedStack(event.itemStack);

            if (EnergyValueRegistry.getInstance().hasEnergyValue(stack))
            {
                EnergyValue energyValue = EnergyValueRegistry.getInstance().getEnergyValue(stack);
                if (stack.getStackSize() > 1)
                {
                    event.toolTip.add("Exchange Energy (Item): " + String.format("%s", energyValueDecimalFormat.format(energyValue.getEnergyValue())));
                    event.toolTip.add("Exchange Energy (Stack): " + String.format("%s", energyValueDecimalFormat.format(stack.getStackSize() * energyValue.getEnergyValue())));
                }
                else
                {
                    event.toolTip.add("Exchange Energy: " + String.format("%s", energyValueDecimalFormat.format(stack.getStackSize() * energyValue.getEnergyValue())));
                }
            }
            else
            {
                event.toolTip.add("No Exchange Energy value");
View Full Code Here

    {
        float computedValue = 0f;

        for (WrappedStack wrappedStack : wrappedStacks)
        {
            EnergyValue wrappedStackValue;
            int stackSize = -1;
            if (wrappedStack.getWrappedStack() instanceof ItemStack)
            {
                ItemStack itemStack = (ItemStack) wrappedStack.getWrappedStack();

                // Check if we are dealing with a potential fluid
                if (FluidContainerRegistry.getFluidForFilledItem(itemStack) != null)
                {
                    if (itemStack.getItem().getContainerItem(itemStack) != null)
                    {
                        stackSize = FluidContainerRegistry.getFluidForFilledItem(itemStack).amount;
                        wrappedStackValue = EnergyValueRegistry.getInstance().getEnergyValue(FluidContainerRegistry.getFluidForFilledItem(itemStack));
                    }
                    else
                    {
                        wrappedStackValue = EnergyValueRegistry.getInstance().getEnergyValue(wrappedStack);
                    }
                }
                // If we are dealing with a "tool" (container item), assume it's value is 0 (since it won't be used up in the recipe)
                else if (itemStack.getItem() != null && itemStack.getItem().getContainerItem(itemStack) != null)
                {
                    wrappedStackValue = new EnergyValue(0);
                }
                else
                {
                    wrappedStackValue = EnergyValueRegistry.getInstance().getEnergyValue(wrappedStack);
                }
            }
            else
            {
                wrappedStackValue = EnergyValueRegistry.getInstance().getEnergyValue(wrappedStack);
            }

            if (wrappedStackValue != null)
            {
                if (stackSize == -1)
                {
                    stackSize = wrappedStack.getStackSize();
                }

                computedValue += wrappedStackValue.getEnergyValue() * stackSize;
            }
            else
            {
                return null;
            }
        }

        return new EnergyValue(computedValue);
    }
View Full Code Here

    public static EnergyValue factorEnergyValue(EnergyValue energyValue, float factor)
    {
        if ((Float.compare(factor, 0f) != 0) && (energyValue != null))
        {
            return new EnergyValue(energyValue.getEnergyValue() * 1f / factor, energyValue.getEnergyType());
        }
        else
        {
            return energyValue;
        }
View Full Code Here

            int facing = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
            ((TileEntityAlchemyArray) world.getTileEntity(x, y, z)).setRotation(chalkSettings.getRotation(), facing);

            ResourceLocation glyphTexture = GlyphTextureRegistry.getInstance().getRegisteredGlyphAt(chalkSettings.getIndex());

            ((TileEntityAlchemyArray) world.getTileEntity(x, y, z)).addGlyphToAlchemyArray(new Glyph(glyphTexture, GlyphTextureRegistry.getInstance().getRegisteredGlyphTextures().get(glyphTexture)), chalkSettings.getSize());

            CommonSoundHelper.playChalkSoundAt((EntityPlayer) entityLiving);
        }
    }
View Full Code Here

                ChalkSettings chalkSettings = new ChalkSettings();
                chalkSettings.readFromNBT(customEntityData);

                ResourceLocation glyphTexture = GlyphTextureRegistry.getInstance().getRegisteredGlyphAt(chalkSettings.getIndex());

                if (tileEntityAlchemyArray.addGlyphToAlchemyArray(new Glyph(glyphTexture, GlyphTextureRegistry.getInstance().getRegisteredGlyphTextures().get(glyphTexture)), chalkSettings.getSize()))
                {
                    world.markBlockForUpdate(x, y, z);
                    world.getTileEntity(x, y, z).markDirty();
                    CommonSoundHelper.playChalkSoundAt(entityPlayer);
                    return true;
View Full Code Here

TOP

Related Classes of com.pahimar.ee3.client.handler.DrawBlockHighlightEventHandler

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.