Package tconstruct.mechworks.landmine.behavior

Examples of tconstruct.mechworks.landmine.behavior.Behavior


    }

    @Override
    public boolean isItemValid (ItemStack par1ItemStack)
    {
        Behavior b = Behavior.getBehaviorFromStack(par1ItemStack);

        if (b == null)
        {
            return false;
        }

        int stackL = b.getStackLimit(par1ItemStack);

        if (b != null && this.inventory.getStackInSlot(this.slotNumber) != null && !this.inventory.getStackInSlot(this.slotNumber).isItemEqual(par1ItemStack))
        {
            ItemStack is = this.inventory.getStackInSlot(this.slotNumber);
            if (is.stackSize + par1ItemStack.stackSize <= stackL)
View Full Code Here


        tileEntity.isExploding = true;

        for (int i = 0; i < tileEntity.getSizeTriggerInventory(); i++)
        {
            ItemStack currentStack = tileEntity.getStackInSlot(i);
            Behavior b = Behavior.getBehaviorFromStack(currentStack);
            if (b != null)
            {

                if (b.doesBehaviorPreventRemovalOfBlock(currentStack))
                {
                    preventExplode = true;
                }

                if (!b.isBehaviorExchangableWithOffensive(currentStack))
                {
                    isOffensive = false;
                }

                if (b.overridesDefault())
                {
                    cancelDefault = true;
                }

                if (!stacks.isEmpty() && Behavior.arrayContainsEqualStack(stacks, currentStack) && b.effectStacks())
                {
                    stacks.get(Behavior.arrayIndexOfStack(stacks, currentStack)).stackSize += currentStack.stackSize;
                }
                else
                {
                    stacks.add(currentStack.copy());
                }
            }
        }

        LandmineSpecialStackLogic specialStacks = new LandmineSpecialStackLogic(worldObj, x, y, z, triggerer, isOffensive, stacks);
        specialStacks.handleSpecialStacks();

        Iterator<ItemStack> i1 = stacks.iterator();
        while (i1.hasNext())
        {
            ItemStack currentStack = i1.next();
            Behavior b = Behavior.getBehaviorFromStack(currentStack);
            if (b != null)
            {
                if (isOffensive || !b.isOffensive(currentStack))
                {
                    b.executeLogic(worldObj, x, y, z, currentStack, triggerer, !preventExplode);
                    if (b.shouldItemBeRemoved(currentStack, !preventExplode))
                    {
                        if (b.effectStacks())
                        {
                            for (int i = 0; i < tileEntity.getSizeTriggerInventory(); i++)
                            {
                                if (tileEntity.getStackInSlot(i) != null)
                                {
                                    if (tileEntity.getStackInSlot(i).isItemEqual(currentStack))
                                    {
                                        tileEntity.setInventorySlotContents(i, null);
                                    }
                                }
                            }
                        }
                        else
                        {
                            boolean hasRemoved = false;

                            for (int i = 0; i < tileEntity.getSizeTriggerInventory() && !hasRemoved; i++)
                            {
                                if (tileEntity.getStackInSlot(i) != null)
                                {
                                    if (tileEntity.getStackInSlot(i).isItemEqual(currentStack))
                                    {
                                        tileEntity.setInventorySlotContents(i, null);
                                        hasRemoved = true;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

        Behavior defBeh = Behavior.getDefaulBehavior();
        if (defBeh != null && isOffensive && !cancelDefault)
        {
            defBeh.executeLogic(worldObj, x, y, z, null, triggerer, !preventExplode);
        }

        if (hasExploded || defBeh != null && !preventExplode)
        {
            worldObj.removeTileEntity(x, y, z);
View Full Code Here

    @Override
    protected void renderToolTip (ItemStack par1ItemStack, int par2, int par3)
    {
        List list = par1ItemStack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);

        Behavior b = Behavior.getBehaviorFromStack(par1ItemStack);
        if (b != null)
        {
            b.getInformation(par1ItemStack, list);
        }

        for (int k = 0; k < list.size(); ++k)
        {
            if (k == 0)
View Full Code Here

TOP

Related Classes of tconstruct.mechworks.landmine.behavior.Behavior

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.