All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.nukkit.block.BlockPotato Maven / Gradle / Ivy

Go to download

A Minecraft Bedrock Edition server software implementation made in Java from scratch which supports all new features.

There is a newer version: 1.6.0.1-PN
Show newest version
package cn.nukkit.block;

import cn.nukkit.item.Item;
import cn.nukkit.item.ItemPotato;

import java.util.Random;

/**
 * @author Pub4Game
 * @since 15.01.2016
 */
public class BlockPotato extends BlockCrops {

    public BlockPotato(int meta) {
        super(meta);
    }

    public BlockPotato() {
        this(0);
    }

    @Override
    public String getName() {
        return "Potato Block";
    }

    @Override
    public int getId() {
        return POTATO_BLOCK;
    }

    @Override
    public Item toItem() {
        return new ItemPotato();
    }

    @Override
    public Item[] getDrops(Item item) {
        if (getDamage() >= 0x07) {
            return new Item[]{
                    new ItemPotato(0, new Random().nextInt(3) + 1)
            };
        } else {
            return new Item[]{
                    new ItemPotato()
            };
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy