Java Code Examples for cn.nukkit.item.Item#SHEARS

The following examples show how to use cn.nukkit.item.Item#SHEARS . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EntitySheep.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onInteract(Player player, Item item) {
    if (item.getId() == Item.DYE) {
        this.setColor(((ItemDye) item).getDyeColor().getDyedData());
        return true;
    }

    return item.getId() == Item.SHEARS && shear();
}
 
Example 2
Source File: BlockTripWire.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onBreak(Item item) {
    if (item.getId() == Item.SHEARS) {
        this.setDisarmed(true);
        this.level.setBlock(this, this, true, false);
        this.updateHook(false);
        this.getLevel().setBlock(this, new BlockAir(), true, true);
    } else {
        this.setPowered(true);
        this.getLevel().setBlock(this, new BlockAir(), true, true);
        this.updateHook(true);
    }

    return true;
}
 
Example 3
Source File: EntitySheep.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onInteract(Player player, Item item, Vector3 clickedPos) {
    if (item.getId() == Item.DYE) {
        this.setColor(((ItemDye) item).getDyeColor().getWoolData());
        return true;
    }

    return item.getId() == Item.SHEARS && shear();
}
 
Example 4
Source File: BlockTripWire.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onBreak(Item item) {
    if (item.getId() == Item.SHEARS) {
        this.setDisarmed(true);
        this.level.setBlock(this, this, true, false);
        this.updateHook(false);
        this.getLevel().setBlock(this, Block.get(BlockID.AIR), true, true);
    } else {
        this.setPowered(true);
        this.getLevel().setBlock(this, Block.get(BlockID.AIR), true, true);
        this.updateHook(true);
    }

    return true;
}
 
Example 5
Source File: EntitySheep.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onInteract(Player player, Item item) {
    if (item.getId() == Item.DYE) {
        this.setColor(((ItemDye) item).getDyeColor().getWoolData());
        return true;
    }

    return item.getId() == Item.SHEARS && shear();
}
 
Example 6
Source File: BlockTripWire.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onBreak(Item item) {
    if (item.getId() == Item.SHEARS) {
        this.setDisarmed(true);
        this.level.setBlock(this, this, true, false);
        this.updateHook(false);
        this.getLevel().setBlock(this, new BlockAir(), true, true);
    } else {
        this.setPowered(true);
        this.getLevel().setBlock(this, new BlockAir(), true, true);
        this.updateHook(true);
    }

    return true;
}