cn.nukkit.block.BlockGlowstone 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.ItemGlowstoneDust;
import cn.nukkit.item.enchantment.Enchantment;
import cn.nukkit.math.MathHelper;
import cn.nukkit.utils.BlockColor;
import java.util.Random;
/**
* @author xtypr
* @since 2015/12/6
*/
public class BlockGlowstone extends BlockTransparent {
public BlockGlowstone() {
}
@Override
public String getName() {
return "Glowstone";
}
@Override
public int getId() {
return GLOWSTONE_BLOCK;
}
@Override
public double getResistance() {
return 1.5;
}
@Override
public double getHardness() {
return 0.3;
}
@Override
public int getLightLevel() {
return 15;
}
@Override
public Item[] getDrops(Item item) {
Random random = new Random();
int count = 2 + random.nextInt(3);
Enchantment fortune = item.getEnchantment(Enchantment.ID_FORTUNE_DIGGING);
if (fortune != null && fortune.getLevel() >= 1) {
count += random.nextInt(fortune.getLevel() + 1);
}
return new Item[]{
new ItemGlowstoneDust(0, MathHelper.clamp(count, 1, 4))
};
}
@Override
public BlockColor getColor() {
return BlockColor.SAND_BLOCK_COLOR;
}
@Override
public boolean canSilkTouch() {
return true;
}
}