cn.nukkit.block.BlockCobweb Maven / Gradle / Ivy
package cn.nukkit.block;
import cn.nukkit.api.PowerNukkitOnly;
import cn.nukkit.api.Since;
import cn.nukkit.blockproperty.BlockProperties;
import cn.nukkit.blockproperty.CommonBlockProperties;
import cn.nukkit.entity.Entity;
import cn.nukkit.item.Item;
import cn.nukkit.item.ItemString;
import cn.nukkit.item.ItemTool;
import cn.nukkit.utils.BlockColor;
import javax.annotation.Nonnull;
/**
* @author xtypr
* @since 2015/12/2
*/
public class BlockCobweb extends BlockFlowable {
public BlockCobweb() {
this(0);
}
public BlockCobweb(int meta) {
super(0);
}
@Override
public String getName() {
return "Cobweb";
}
@Override
public int getId() {
return COBWEB;
}
@Since("1.4.0.0-PN")
@PowerNukkitOnly
@Nonnull
@Override
public BlockProperties getProperties() {
return CommonBlockProperties.EMPTY_PROPERTIES;
}
@Override
public double getHardness() {
return 4;
}
@Override
public double getResistance() {
return 20;
}
@Override
public int getToolType() {
return ItemTool.TYPE_SWORD;
}
@PowerNukkitOnly
@Override
public int getWaterloggingLevel() {
return 1;
}
@Override
public void onEntityCollide(Entity entity) {
entity.resetFallDistance();
}
@Override
public Item[] getDrops(Item item) {
if (item.isShears()) {
return new Item[]{
this.toItem()
};
} else if (item.isSword()) {
return new Item[]{
new ItemString()
};
} else {
return Item.EMPTY_ARRAY;
}
}
@Override
public BlockColor getColor() {
return BlockColor.CLOTH_BLOCK_COLOR;
}
@Override
public boolean canHarvestWithHand() {
return false;
}
@PowerNukkitOnly
@Override
public boolean diffusesSkyLight() {
return true;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy