Package tconstruct.library.tools

Examples of tconstruct.library.tools.ToolCore


            }
        }

        if (size == 8)
        {
            ToolCore tool = getValidTool();

            final ItemStack headStack = new ItemStack(tool.getHeadItem(), 1, 17);
            final ItemStack handleStack = new ItemStack(tool.getHandleItem(), 1, 17);
            final ItemStack accessoryStack = tool.getAccessoryItem() != null ? new ItemStack(tool.getAccessoryItem(), 1, 17) : null;
            final ItemStack extraStack = tool.getExtraItem() != null ? new ItemStack(tool.getExtraItem(), 1, 17) : null;

            String loc = "tool." + tool.getToolName().toLowerCase() + ".kingslime"; // special localization the same way as materials
            String name;
            if(StatCollector.canTranslate(loc))
                name = StatCollector.translateToLocal(loc);
            else
                name = StatCollector.translateToLocal("tool.kingslimeprefix") + " " + tool.getLocalizedToolName();

            ItemStack toolStack = ToolBuilder.instance.buildTool(headStack, handleStack, accessoryStack, extraStack, name);

            if (toolStack != null)
            {
                NBTTagCompound tags = toolStack.getTagCompound().getCompoundTag("InfiTool");
                tags.setInteger("Attack", 5 + tool.getDamageVsEntity(null));
                tags.setInteger("TotalDurability", 2500);
                tags.setInteger("BaseDurability", 2500);
                tags.setInteger("MiningSpeed", 1400);

                this.entityDropItem(toolStack, 0f);
View Full Code Here


        }
    }

    ToolCore getValidTool ()
    {
        ToolCore tool = TConstructRegistry.tools.get(rand.nextInt(TConstructRegistry.tools.size()));
        /*if (tool.getExtraItem() != null)
            tool = getValidTool();*/
        return tool;
    }
View Full Code Here

    @Override
    protected boolean canModify (ItemStack tool, ItemStack[] input)
    {
        if (tool.getItem() instanceof ToolCore)
        {
            ToolCore toolItem = (ToolCore) tool.getItem();
            if (!validType(toolItem))
                return false;

            if (matchingAmount(input) > max)
                return false;
View Full Code Here

        int increase = matchingAmount(input);
        int keyPair[] = tags.getIntArray(key);
        keyPair[0] += increase;
        tags.setIntArray(key, keyPair);
        ToolCore toolcore = (ToolCore) tool.getItem();
        String[] types = toolcore.getTraits();
        boolean weapon = false;
        boolean harvest = false;
        for (String s : types)
        {
            if (s.equals("harvest"))
View Full Code Here

    @Override
    protected boolean canModify (ItemStack tool, ItemStack[] input)
    {
        if (tool.getItem() instanceof ToolCore)
        {
            ToolCore toolItem = (ToolCore) tool.getItem();
            if (!validType(toolItem))
                return false;

            NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
            if (!tags.getBoolean("Lava") && !tags.hasKey("Lapis"))
View Full Code Here

    private static final int toolIcons = 10;

    @Override
    public void renderItem (ItemRenderType type, ItemStack item, Object... data)
    {
        ToolCore tool = (ToolCore) item.getItem();

        boolean isInventory = type == ItemRenderType.INVENTORY;
        Entity ent = null;
        if (data.length > 1)
            ent = (Entity) data[1];

        int iconParts = toolIcons;//tool.getRenderPasses(item.getItemDamage());
        // TODO: have the tools define how many render passes they have
        // (requires more logic rewrite than it sounds like)

        IIcon[] tempParts = new IIcon[iconParts];
        label:
        {
            if (!isInventory && ent instanceof EntityPlayer)
            {
                EntityPlayer player = (EntityPlayer) ent;
                ItemStack itemInUse = player.getItemInUse();
                if (itemInUse != null)
                {
                    int useCount = player.getItemInUseCount();
                    for (int i = iconParts; i-- > 0;)
                        tempParts[i] = tool.getIcon(item, i, player, itemInUse, useCount);
                    break label;
                }
            }
            for (int i = iconParts; i-- > 0;)
                tempParts[i] = tool.getIcon(item, i);
        }

        int count = 0;
        IIcon[] parts = new IIcon[iconParts];
        for (int i = 0; i < iconParts; ++i)
View Full Code Here

        tags.setInteger("EnergyMax", maxCharge);
        tags.setInteger("EnergyExtractionRate", maxExtract);
        tags.setInteger("EnergyReceiveRate", maxReceive);

        tags.setInteger(key, 1);
        ToolCore toolcore = (ToolCore) tool.getItem();
        //tool.setItemDamage(1 + (toolcore.getMaxEnergyStored(tool) - charge) * (tool.getMaxDamage() - 1) / toolcore.getMaxEnergyStored(tool));
    }
View Full Code Here

    @Override
    protected boolean canModify (ItemStack tool, ItemStack[] input)
    {
        if (tool.getItem() instanceof ToolCore)
        {
            ToolCore toolItem = (ToolCore) tool.getItem();
            if (!validType(toolItem))
                return false;

            if (matchingAmount(input) > max)
                return false;
View Full Code Here

        int miningSpeed = tags.getInteger("MiningSpeed");
        int boost = 8 + ((current - 1) / 50 * 2);
        Item temp = tool.getItem();
        if (temp instanceof ToolCore)
        {
            ToolCore toolcore = (ToolCore) temp;
            if (toolcore.durabilityTypeHandle() == 2)
                boost += 2;
            if (toolcore.durabilityTypeAccessory() == 2)
                boost += 2;
            if (toolcore.durabilityTypeExtra() == 2)
                boost += 2;
        }
        miningSpeed += (increase * boost);
        tags.setInteger("MiningSpeed", miningSpeed);

View Full Code Here

    @Override
    protected boolean canModify (ItemStack tool, ItemStack[] input)
    {
        if (tool.getItem() instanceof ToolCore)
        {
            ToolCore toolItem = (ToolCore) tool.getItem();
            if (!validType(toolItem))
                return false;

            if (matchingAmount(input) > max)
                return false;
View Full Code Here

TOP

Related Classes of tconstruct.library.tools.ToolCore

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.