cn.nukkit.block.BlockOreRedstoneGlowing 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.event.block.BlockFadeEvent;
import cn.nukkit.item.Item;
import cn.nukkit.item.ItemBlock;
import cn.nukkit.level.Level;
//和pm源码有点出入,这里参考了wiki
/**
* @author xtypr
* @since 2015/12/6
*/
public class BlockOreRedstoneGlowing extends BlockOreRedstone {
public BlockOreRedstoneGlowing() {
}
@Override
public String getName() {
return "Glowing Redstone Ore";
}
@Override
public int getId() {
return GLOWING_REDSTONE_ORE;
}
@Override
public int getLightLevel() {
return 9;
}
@Override
public Item toItem() {
return new ItemBlock(Block.get(BlockID.REDSTONE_ORE));
}
@Override
public int onUpdate(int type) {
if (type == Level.BLOCK_UPDATE_SCHEDULED || type == Level.BLOCK_UPDATE_RANDOM) {
BlockFadeEvent event = new BlockFadeEvent(this, get(REDSTONE_ORE));
level.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
level.setBlock(this, event.getNewState(), false, true);
}
return Level.BLOCK_UPDATE_WEAK;
}
return 0;
}
@Override
public boolean canHarvestWithHand() {
return false;
}
@Override
public boolean canSilkTouch() {
return true;
}
}