Java Code Examples for cn.nukkit.item.Item#CARROT
The following examples show how to use
cn.nukkit.item.Item#CARROT .
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: Pig.java From Actaeon with MIT License | 6 votes |
@Override public boolean entityBaseTick(int tickDiff){ if(!this.hasTarget()){ Entity[] entities = this.level.getNearbyEntities(new AxisAlignedBB(this.x, this.y, this.z, this.x, this.y, this.z).expand(7, 7, 7)); Entity near = null; for(Entity entity : entities){ if(entity instanceof Player && (near == null || this.distance(near) < this.distance(entity))){ if(((Player) entity).getInventory().getItemInHand().getId() == Item.CARROT){ near = entity; } } } this.setTarget(near, "Pig"); } return super.entityBaseTick(tickDiff); }
Example 2
Source File: EntityPig.java From Jupiter with GNU General Public License v3.0 | 4 votes |
@Override public boolean isBreedingItem(Item item) { int id = item.getId(); return id == Item.CARROT || id == Item.POTATO || id == Item.BEETROOT; }
Example 3
Source File: EntityPig.java From Nukkit with GNU General Public License v3.0 | 4 votes |
@Override public boolean isBreedingItem(Item item) { int id = item.getId(); return id == Item.CARROT || id == Item.POTATO || id == Item.BEETROOT; }
Example 4
Source File: EntityPig.java From Nukkit with GNU General Public License v3.0 | 4 votes |
@Override public boolean isBreedingItem(Item item) { int id = item.getId(); return id == Item.CARROT || id == Item.POTATO || id == Item.BEETROOT; }