Java Code Examples for cn.nukkit.item.ItemTool#TIER_WOODEN

The following examples show how to use cn.nukkit.item.ItemTool#TIER_WOODEN . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlockOreCoal.java    From Jupiter with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Item[] getDrops(Item item) {
    if (item.isPickaxe() && item.getTier() >= ItemTool.TIER_WOODEN) {
        if (item.isSilkTouch()){
            return new Item[]{
                    this.toItem()
            };
        } else {
            return new Item[]{
                    new ItemCoal()
            };
        }
    } else {
        return new Item[0];
    }
}
 
Example 2
Source File: BlockEnderChest.java    From Jupiter with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Item[] getDrops(Item item) {
    if (item.isPickaxe() && item.getTier() >= ItemTool.TIER_WOODEN) {
        if (item.isSilkTouch()){
            return new Item[]{
                    this.toItem()
            };
        } else {
            return new Item[]{
                    Item.get(Item.OBSIDIAN, 0, 8)
            };
        }
    } else {
        return new Item[0];
    }
}
 
Example 3
Source File: BlockOreCoal.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Item[] getDrops(Item item) {
    if (item.isPickaxe() && item.getTier() >= ItemTool.TIER_WOODEN) {
        int count = 1;
        Enchantment fortune = item.getEnchantment(Enchantment.ID_FORTUNE_DIGGING);
        if (fortune != null && fortune.getLevel() >= 1) {
            int i = ThreadLocalRandom.current().nextInt(fortune.getLevel() + 2) - 1;

            if (i < 0) {
                i = 0;
            }

            count = i + 1;
        }

        return new Item[]{
                new ItemCoal(0, count)
        };
    } else {
        return new Item[0];
    }
}
 
Example 4
Source File: BlockBricksStone.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Item[] getDrops(Item item) {
    if (item.isPickaxe() && item.getTier() >= ItemTool.TIER_WOODEN) {
        return new Item[]{
                Item.get(Item.STONE_BRICKS, this.getDamage() & 0x03, 1)
        };
    } else {
        return new Item[0];
    }
}
 
Example 5
Source File: BlockEndStone.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Item[] getDrops(Item item) {
    if (item.isPickaxe() && item.getTier() >= ItemTool.TIER_WOODEN) {
        return new Item[]{
                toItem()
        };
    } else {
        return new Item[0];
    }
}
 
Example 6
Source File: BlockSnow.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Item[] getDrops(Item item) {
    if (item.isShovel() && item.getTier() >= ItemTool.TIER_WOODEN) {
        return new Item[]{
                new ItemSnowball(0, 4)
        };
    } else {
        return new Item[0];
    }
}
 
Example 7
Source File: BlockFurnaceBurning.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Item[] getDrops(Item item) {
    if (item.isPickaxe() && item.getTier() >= ItemTool.TIER_WOODEN) {
        return new Item[]{
                this.toItem()
        };
    } else {
        return new Item[0];
    }
}
 
Example 8
Source File: BlockDoubleSlab.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Item[] getDrops(Item item) {
    if (item.isPickaxe() && item.getTier() >= ItemTool.TIER_WOODEN) {
        return new Item[]{
                Item.get(Item.SLAB, this.getDamage() & 0x07, 2)
        };
    } else {
        return new Item[0];
    }
}
 
Example 9
Source File: BlockEnchantingTable.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Item[] getDrops(Item item) {
    if (item.isPickaxe() && item.getTier() >= ItemTool.TIER_WOODEN) {
        return new Item[]{
                toItem()
        };
    } else {
        return new Item[0];
    }
}
 
Example 10
Source File: BlockIronBars.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Item[] getDrops(Item item) {
    if (item.isPickaxe() && item.getTier() >= ItemTool.TIER_WOODEN) {
        return new Item[]{
                toItem()
        };
    } else {
        return new Item[0];
    }
}
 
Example 11
Source File: BlockPressurePlateStone.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Item[] getDrops(Item item) {
    if (item.isPickaxe() && item.getTier() >= ItemTool.TIER_WOODEN) {
        return new Item[]{
                toItem()
        };
    } else {
        return new Item[0];
    }
}
 
Example 12
Source File: BlockSnow.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Item[] getDrops(Item item) {
    if (item.isShovel() && item.getTier() >= ItemTool.TIER_WOODEN) {
        return new Item[]{
                new ItemSnowball(0, 4)
        };
    } else {
        return new Item[0];
    }
}
 
Example 13
Source File: BlockNetherrack.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Item[] getDrops(Item item) {
    if (item.isPickaxe() && item.getTier() >= ItemTool.TIER_WOODEN) {
        return new Item[]{
                toItem()
        };
    } else {
        return new Item[0];
    }
}
 
Example 14
Source File: BlockRedstone.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Item[] getDrops(Item item) {
    if (item.isPickaxe() && item.getTier() >= ItemTool.TIER_WOODEN) {
        return new Item[]{
                toItem()
        };
    } else {
        return new Item[0];
    }
}
 
Example 15
Source File: BlockAnvil.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Item[] getDrops(Item item) {
    int damage = this.getDamage();
    if (item.isPickaxe() && item.getTier() >= ItemTool.TIER_WOODEN) {
        Item drop = this.toItem();

        if (damage >= 4 && damage <= 7) { //Slightly Anvil
            drop.setDamage(drop.getDamage() & 0x04);
        } else if (damage >= 8 && damage <= 11) { //Very Damaged Anvil
            drop.setDamage(drop.getDamage() & 0x08);
        }
    }
    return new Item[0];
}
 
Example 16
Source File: BlockSlabStone.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Item[] getDrops(Item item) {
    if (item.isPickaxe() && item.getTier() >= ItemTool.TIER_WOODEN) {
        return new Item[]{
                toItem()
        };
    } else {
        return new Item[0];
    }
}
 
Example 17
Source File: BlockEnderChest.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Item[] getDrops(Item item) {
    if (item.isPickaxe() && item.getTier() >= ItemTool.TIER_WOODEN) {
        return new Item[]{
                Item.get(Item.OBSIDIAN, 0, 8)
        };
    } else {
        return new Item[0];
    }
}
 
Example 18
Source File: Block.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
/**
 * @deprecated This function is lack of Player class and is not accurate enough, use #getBreakTime(Item, Player)
 */
@Deprecated
public double getBreakTime(Item item) {
    double base = this.getHardness() * 1.5;
    if (this.canBeBrokenWith(item)) {
        if (this.getToolType() == ItemTool.TYPE_SHEARS && item.isShears()) {
            base /= 15;
        } else if (
                (this.getToolType() == ItemTool.TYPE_PICKAXE && item.isPickaxe()) ||
                        (this.getToolType() == ItemTool.TYPE_AXE && item.isAxe()) ||
                        (this.getToolType() == ItemTool.TYPE_SHOVEL && item.isShovel())
                ) {
            int tier = item.getTier();
            switch (tier) {
                case ItemTool.TIER_WOODEN:
                    base /= 2;
                    break;
                case ItemTool.TIER_STONE:
                    base /= 4;
                    break;
                case ItemTool.TIER_IRON:
                    base /= 6;
                    break;
                case ItemTool.TIER_DIAMOND:
                    base /= 8;
                    break;
                case ItemTool.TIER_GOLD:
                    base /= 12;
                    break;
            }
        }
    } else {
        base *= 3.33;
    }

    if (item.isSword()) {
        base *= 0.5;
    }

    return base;
}
 
Example 19
Source File: BlockConcrete.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Item[] getDrops(Item item) {
    return item.getTier() >= ItemTool.TIER_WOODEN ? new Item[]{toItem()} : new Item[0];
}
 
Example 20
Source File: BlockDoubleSlabStone.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public double getResistance() {
    return getToolType() > ItemTool.TIER_WOODEN ? 30 : 15;
}