Java Code Examples for cn.nukkit.item.Item#get()
The following examples show how to use
cn.nukkit.item.Item#get() .
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: BlockItemFrame.java From Nukkit with GNU General Public License v3.0 | 5 votes |
@Override public Item[] getDrops(Item item) { BlockEntity blockEntity = this.getLevel().getBlockEntity(this); BlockEntityItemFrame itemFrame = (BlockEntityItemFrame) blockEntity; int chance = new Random().nextInt(100) + 1; if (itemFrame != null && chance <= (itemFrame.getItemDropChance() * 100)) { return new Item[]{ toItem(), Item.get(itemFrame.getItem().getId(), itemFrame.getItem().getDamage(), 1) }; } else { return new Item[]{ toItem() }; } }
Example 2
Source File: BinaryStream.java From Jupiter with GNU General Public License v3.0 | 5 votes |
public Item getSlot() { int id = this.getVarInt(); if (id <= 0) { return Item.get(0, 0, 0); } int auxValue = this.getVarInt(); int data = auxValue >> 8; if (data == Short.MAX_VALUE) { data = -1; } int cnt = auxValue & 0xff; int nbtLen = this.getLShort(); byte[] nbt = new byte[0]; if (nbtLen > 0) { nbt = this.get(nbtLen); } //TODO int canPlaceOn = this.getVarInt(); if(canPlaceOn > 0){ for(int i = 0; i < canPlaceOn; ++i){ this.getString(); } } //TODO int canDestroy = this.getVarInt(); if(canDestroy > 0){ for(int i = 0; i < canDestroy; ++i){ this.getString(); } } return Item.get( id, data, cnt, nbt ); }
Example 3
Source File: BlockBricksStone.java From Nukkit with GNU General Public License v3.0 | 5 votes |
@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 4
Source File: BlockDoubleSlab.java From Nukkit with GNU General Public License v3.0 | 5 votes |
@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 5
Source File: BlockBricksNether.java From Nukkit with GNU General Public License v3.0 | 5 votes |
@Override public Item[] getDrops(Item item) { if (item.isPickaxe() && item.getTier() >= ItemTool.TIER_WOODEN) { return new Item[]{ Item.get(Item.NETHER_BRICKS, 0, 1) }; } else { return new Item[0]; } }
Example 6
Source File: BlockOreGold.java From Nukkit with GNU General Public License v3.0 | 5 votes |
@Override public Item[] getDrops(Item item) { if (item.isPickaxe() && item.getTier() >= ItemTool.TIER_IRON) { return new Item[]{ Item.get(GOLD_ORE) }; } else { return new Item[0]; } }
Example 7
Source File: BlockDoubleSlab.java From Nukkit with GNU General Public License v3.0 | 5 votes |
@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 8
Source File: BlockDoubleSlabStone.java From Jupiter with GNU General Public License v3.0 | 5 votes |
@Override public Item[] getDrops(Item item) { if (item.isPickaxe() && item.getTier() >= ItemTool.TIER_WOODEN) { return new Item[]{ Item.get(Item.SLAB, this.meta & 0x07, 2) }; } else { return new Item[0]; } }
Example 9
Source File: BlockFenceGateDarkOak.java From Nukkit with GNU General Public License v3.0 | 4 votes |
@Override public Item toItem() { return Item.get(Item.FENCE_GATE_DARK_OAK, 0, 1); }
Example 10
Source File: BlockFenceGateSpruce.java From Nukkit with GNU General Public License v3.0 | 4 votes |
@Override public Item toItem() { return Item.get(Item.FENCE_GATE_SPRUCE,0, 1); }
Example 11
Source File: BlockLeaves.java From Nukkit with GNU General Public License v3.0 | 4 votes |
protected Item getSapling() { return Item.get(BlockID.SAPLING, this.getDamage() & 0x03); }
Example 12
Source File: EntityStray.java From Nukkit with GNU General Public License v3.0 | 4 votes |
@Override public Item[] getDrops() { return new Item[]{Item.get(Item.BONE, Item.ARROW)}; }
Example 13
Source File: BlockRailDetector.java From Nukkit with GNU General Public License v3.0 | 4 votes |
@Override public Item[] getDrops(Item item) { return new Item[]{ Item.get(Item.DETECTOR_RAIL, 0, 1) }; }
Example 14
Source File: EntitySkeleton.java From Nukkit with GNU General Public License v3.0 | 4 votes |
@Override public Item[] getDrops() { return new Item[]{Item.get(Item.BONE, Item.ARROW)}; }
Example 15
Source File: EntityMooshroom.java From Nukkit with GNU General Public License v3.0 | 4 votes |
@Override public Item[] getDrops() { return new Item[]{Item.get(Item.LEATHER), Item.get(Item.RAW_BEEF)}; }
Example 16
Source File: Sheep.java From Actaeon with MIT License | 4 votes |
@Override public Item[] getDrops(){ return new Item[]{Item.get(Item.WOOL, 0, new Random().nextInt(2) + 1)}; }
Example 17
Source File: EntityPig.java From Nukkit with GNU General Public License v3.0 | 4 votes |
@Override public Item[] getDrops() { return new Item[]{Item.get(Item.RAW_PORKCHOP)}; }
Example 18
Source File: EntityZombieHorse.java From Nukkit with GNU General Public License v3.0 | 4 votes |
@Override public Item[] getDrops() { return new Item[]{Item.get(Item.ROTTEN_FLESH, 1, 1)}; }
Example 19
Source File: BlockLadder.java From Nukkit with GNU General Public License v3.0 | 4 votes |
@Override public Item[] getDrops(Item item) { return new Item[]{ Item.get(Item.LADDER, 0, 1) }; }
Example 20
Source File: EntityMooshroom.java From Nukkit with GNU General Public License v3.0 | 4 votes |
@Override public Item[] getDrops() { return new Item[]{Item.get(Item.LEATHER), Item.get(Item.RAW_BEEF)}; }