cn.nukkit.block.BlockCarrot Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of powernukkit Show documentation
Show all versions of powernukkit Show documentation
A Minecraft Bedrock Edition server software implementation made in Java from scratch which supports all new features.
package cn.nukkit.block;
import cn.nukkit.item.Item;
import cn.nukkit.item.ItemCarrot;
import java.util.Random;
/**
* @author Nukkit Project Team
*/
public class BlockCarrot extends BlockCrops {
public BlockCarrot(int meta) {
super(meta);
}
public BlockCarrot() {
this(0);
}
@Override
public String getName() {
return "Carrot Block";
}
@Override
public int getId() {
return CARROT_BLOCK;
}
@Override
public Item[] getDrops(Item item) {
if (getDamage() >= 0x07) {
return new Item[]{
new ItemCarrot(0, new Random().nextInt(3) + 1)
};
}
return new Item[]{
new ItemCarrot()
};
}
@Override
public Item toItem() {
return new ItemCarrot();
}
}