public void attackTarget(LivingEntity target) { double range = 5; Player player = getPlayer(); for (Entity entity : player.getNearbyEntities(range, range, range)) { if (entity.getType() != EntityType.WOLF) { continue; } Wolf wolf = (Wolf) entity; if (!wolf.isTamed() || (wolf.getOwner() != player) || wolf.isSitting()) { continue; } wolf.setTarget(target); } }
public void convertWolf(Wolf wolf, TagCompound properties) { properties.getCompoundData().put("Sitting", new TagByte(wolf.isSitting())); properties.getCompoundData().put("Tamed", new TagByte(wolf.isTamed())); properties.getCompoundData().put("CollarColor", new TagByte(wolf.getCollarColor().getWoolData())); } }
public static void processHolyHound(Wolf wolf, double damage) { double modifiedHealth = Math.min(wolf.getHealth() + damage, wolf.getMaxHealth()); wolf.setHealth(modifiedHealth); wolf.playEffect(EntityEffect.WOLF_HEARTS); }
Wolf w = (Wolf) ent; Wolf wolf = (Wolf) l.getWorld().spawnEntity(l, EntityType.WOLF); wolf.setTicksLived(w.getTicksLived()); if ((!w.isAdult())) { wolf.setBaby(); wolf.setCustomName(wolfname); wolf.setSitting(w.isSitting()); wolf.setCollarColor(w.getCollarColor()); double health = (w.getHealth() > 8D) ? 8D : w.getHealth(); wolf.setHealth(health); ent.remove();
/** * Makes all nearby wolves sit if their owner is the given player. */ public static void sitPets(Player p) { if (p == null) return; List<Entity> entities = p.getNearbyEntities(80, 40, 80); for (Entity e : entities) { if (e instanceof Wolf) { Wolf w = (Wolf) e; if (w.isTamed() && w.getOwner() != null && w.getOwner().equals(p)) w.setSitting(true); } else if (e instanceof Ocelot) { Ocelot o = (Ocelot) e; if (o.isTamed() && o.getOwner() != null && o.getOwner().equals(p)) o.setSitting(true); } } }
@Override public boolean isSitting() { return w.isSitting(); }
registerModified(entity); Wolf wolf = (Wolf)entity; DyeColor wolfColor = wolf.getCollarColor(); DyeColor[] wolfColorValues = DyeColor.values(); wolfColor = wolfColorValues[(wolfColor.ordinal() + 1) % wolfColorValues.length]; wolf.setCollarColor(wolfColor); break; case SHEEP:
public void removePets(Player p) { for (Wolf w : petWolves) { if (w == null || !(w.getOwner() instanceof Player) || !w.getOwner().getName().equals(p.getName())) continue; w.setOwner(null); w.remove(); } for (Ocelot o : petOcelots) { if (o == null || !(o.getOwner() instanceof Player) || !o.getOwner().getName().equals(p.getName())) continue; o.setOwner(null); o.remove(); } }
case WOLF: if (specialType.matches("(?i)angry")) { ((Wolf) creature).setAngry(true); } else if (specialType.matches("(?i)sit(ting)?")) { ((Wolf) creature).setSitting(true);
case WOLF: Wolf wolf = (Wolf) ent; wolf.setCollarColor(pet.getColour()); wolf.setSitting(pet.getSitting()); wolf.setAge(pet.getAge()); if (pet.isBaby()) { wolf.setBaby();
/** * Apply the Fast Food Service ability. * * @param wolf The wolf using the ability * @param damage The damage being absorbed by the wolf */ public void fastFoodService(Wolf wolf, double damage) { //static chance (3rd param) if (!RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_STATIC_CHANCE, SubSkillType.TAMING_FAST_FOOD_SERVICE, getPlayer())) { return; } double health = wolf.getHealth(); double maxHealth = wolf.getMaxHealth(); if (health < maxHealth) { double newHealth = health + damage; wolf.setHealth(Math.min(newHealth, maxHealth)); } }
private void spawnWolfPets(Player player, Arena arena) { if (wolfMaterial == null) { return; } PlayerInventory inv = player.getInventory(); int index = inv.first(wolfMaterial); if (index == -1) { return; } int amount = inv.getItem(index).getAmount(); for (int i = 0; i < amount; i++) { Wolf wolf = (Wolf) arena.getWorld().spawnEntity(player.getLocation(), EntityType.WOLF); wolf.setTamed(true); wolf.setOwner(player); arena.getMonsterManager().addPet(wolf); } inv.setItem(index, null); }
try { color = DyeColor.valueOf(variantName.toUpperCase()); wolf.setTamed(true); } catch (Exception ignored) { wolf.setCollarColor(color);