diff --git a/README.md b/README.md index 3b1817d1a..54c3f6fba 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,8 @@ max-spawns: skeleton-horse: 0 snow-golem: 0 spider: 0 + squid: 0 + witch: 0 wolf: 1 zombie: 0 zombie-horse: 0 diff --git a/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Chicken.java b/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Chicken.java index 4a43df03e..ec54a154a 100755 --- a/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Chicken.java +++ b/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Chicken.java @@ -57,7 +57,12 @@ public void initEntity() { public boolean targetOption(EntityCreature creature, double distance) { if (creature instanceof Player) { Player player = (Player) creature; - return player.isAlive() && !player.closed && player.getInventory().getItemInHand().getId() == Item.SEEDS && distance <= 49; + return player.isAlive() && !player.closed && + (player.getInventory().getItemInHand().getId() == Item.SEEDS || + player.getInventory().getItemInHand().getId() == Item.BEETROOT_SEEDS || + player.getInventory().getItemInHand().getId() == Item.MELON_SEEDS || + player.getInventory().getItemInHand().getId() == Item.PUMPKIN_SEEDS + )&& distance <= 49; } return false; } diff --git a/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Cow.java b/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Cow.java index 1089a6329..f150f6f83 100755 --- a/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Cow.java +++ b/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Cow.java @@ -51,6 +51,7 @@ public void initEntity() { this.setMaxHealth(10); } + @Override public boolean targetOption(EntityCreature creature, double distance) { if (creature instanceof Player) { Player player = (Player) creature; diff --git a/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Donkey.java b/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Donkey.java index ca028eb64..a0974dbe4 100755 --- a/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Donkey.java +++ b/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Donkey.java @@ -52,7 +52,15 @@ public void initEntity() { public boolean targetOption(EntityCreature creature, double distance) { if (creature instanceof Player) { Player player = (Player) creature; - return player.spawned && player.isAlive() && !player.closed && player.getInventory().getItemInHand().getId() == Item.SEEDS && distance <= 49; + return player.spawned && player.isAlive() && !player.closed + && (player.getInventory().getItemInHand().getId() == Item.WHEAT || + player.getInventory().getItemInHand().getId() == Item.APPLE || + player.getInventory().getItemInHand().getId() == Item.HAY_BALE || + player.getInventory().getItemInHand().getId() == Item.GOLDEN_APPLE || + player.getInventory().getItemInHand().getId() == Item.SUGAR || + player.getInventory().getItemInHand().getId() == Item.BREAD || + player.getInventory().getItemInHand().getId() == Item.GOLDEN_CARROT) + && distance <= 49; } return false; } diff --git a/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Horse.java b/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Horse.java index 28f7649c1..cfbd3b6e9 100755 --- a/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Horse.java +++ b/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Horse.java @@ -5,6 +5,8 @@ */ package de.kniffo80.mobplugin.entities.animal.walking; +import cn.nukkit.Player; +import cn.nukkit.entity.EntityCreature; import cn.nukkit.event.entity.EntityDamageByEntityEvent; import cn.nukkit.item.Item; import cn.nukkit.level.format.FullChunk; @@ -46,6 +48,23 @@ public void initEntity() { this.setMaxHealth(15); } + @Override + public boolean targetOption(EntityCreature creature, double distance) { + if (creature instanceof Player) { + Player player = (Player) creature; + return player.spawned && player.isAlive() && !player.closed + && (player.getInventory().getItemInHand().getId() == Item.WHEAT || + player.getInventory().getItemInHand().getId() == Item.APPLE || + player.getInventory().getItemInHand().getId() == Item.HAY_BALE || + player.getInventory().getItemInHand().getId() == Item.GOLDEN_APPLE || + player.getInventory().getItemInHand().getId() == Item.SUGAR || + player.getInventory().getItemInHand().getId() == Item.BREAD || + player.getInventory().getItemInHand().getId() == Item.GOLDEN_CARROT) + && distance <= 49; + } + return false; + } + @Override public Item[] getDrops() { if (this.lastDamageCause instanceof EntityDamageByEntityEvent) { diff --git a/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Mooshroom.java b/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Mooshroom.java index a8176063d..2fa9652ff 100755 --- a/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Mooshroom.java +++ b/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Mooshroom.java @@ -40,6 +40,7 @@ public void initEntity() { this.setMaxHealth(10); } + @Override public boolean targetOption(EntityCreature creature, double distance) { if (creature instanceof Player) { Player player = (Player) creature; diff --git a/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Mule.java b/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Mule.java index 975ab8763..fa2623af4 100755 --- a/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Mule.java +++ b/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Mule.java @@ -52,7 +52,15 @@ public void initEntity() { public boolean targetOption(EntityCreature creature, double distance) { if (creature instanceof Player) { Player player = (Player) creature; - return player.spawned && player.isAlive() && !player.closed && player.getInventory().getItemInHand().getId() == Item.SEEDS && distance <= 49; + return player.spawned && player.isAlive() && !player.closed + && (player.getInventory().getItemInHand().getId() == Item.WHEAT || + player.getInventory().getItemInHand().getId() == Item.APPLE || + player.getInventory().getItemInHand().getId() == Item.HAY_BALE || + player.getInventory().getItemInHand().getId() == Item.GOLDEN_APPLE || + player.getInventory().getItemInHand().getId() == Item.SUGAR || + player.getInventory().getItemInHand().getId() == Item.BREAD || + player.getInventory().getItemInHand().getId() == Item.GOLDEN_CARROT) + && distance <= 49; } return false; } diff --git a/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Ocelot.java b/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Ocelot.java index 54795c273..4e05736b2 100755 --- a/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Ocelot.java +++ b/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Ocelot.java @@ -42,6 +42,7 @@ protected void initEntity() { this.setMaxHealth(10); } + @Override public boolean targetOption(EntityCreature creature, double distance) { if (creature instanceof Player) { Player player = (Player) creature; diff --git a/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Pig.java b/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Pig.java index e320d1d63..e3a568321 100755 --- a/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Pig.java +++ b/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Pig.java @@ -52,10 +52,16 @@ public void initEntity() { this.setMaxHealth(10); } + @Override public boolean targetOption(EntityCreature creature, double distance) { if (creature instanceof Player) { Player player = (Player) creature; - return player.spawned && player.isAlive() && !player.closed && player.getInventory().getItemInHand().getId() == Item.CARROT && distance <= 49; + return player.spawned && player.isAlive() && !player.closed && + (player.getInventory().getItemInHand().getId() == Item.CARROT || + player.getInventory().getItemInHand().getId() == Item.POTATO || + player.getInventory().getItemInHand().getId() == Item.BEETROOT + ) + && distance <= 49; } return false; } diff --git a/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Rabbit.java b/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Rabbit.java index bd1ab2909..bd6779b53 100755 --- a/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Rabbit.java +++ b/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Rabbit.java @@ -45,10 +45,11 @@ public void initEntity() { this.setMaxHealth(3); } + @Override public boolean targetOption(EntityCreature creature, double distance) { if (creature instanceof Player) { Player player = (Player) creature; - return player.spawned && player.isAlive() && !player.closed && player.getInventory().getItemInHand().getId() == Item.SEEDS && distance <= 49; + return player.spawned && player.isAlive() && !player.closed && player.getInventory().getItemInHand().getId() == Item.CARROT && distance <= 49; } return false; } diff --git a/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Sheep.java b/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Sheep.java index 1a4ec2dcc..57cb67b12 100755 --- a/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Sheep.java +++ b/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/Sheep.java @@ -46,7 +46,7 @@ public void initEntity() { public boolean targetOption(EntityCreature creature, double distance) { if (creature instanceof Player) { Player player = (Player) creature; - return player.spawned && player.isAlive() && !player.closed && player.getInventory().getItemInHand().getId() == Item.SEEDS && distance <= 49; + return player.spawned && player.isAlive() && !player.closed && player.getInventory().getItemInHand().getId() == Item.WHEAT && distance <= 49; } return false; } diff --git a/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/SkeletonHorse.java b/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/SkeletonHorse.java index 700dedd84..3614a7088 100755 --- a/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/SkeletonHorse.java +++ b/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/SkeletonHorse.java @@ -48,15 +48,6 @@ public void initEntity() { this.setMaxHealth(15); } - @Override - public boolean targetOption(EntityCreature creature, double distance) { - if (creature instanceof Player) { - Player player = (Player) creature; - return player.spawned && player.isAlive() && !player.closed && player.getInventory().getItemInHand().getId() == Item.SEEDS && distance <= 49; - } - return false; - } - @Override public Item[] getDrops() { if (this.lastDamageCause instanceof EntityDamageByEntityEvent) { diff --git a/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/ZombieHorse.java b/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/ZombieHorse.java index 44a0853e7..a28b9e3bf 100755 --- a/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/ZombieHorse.java +++ b/src/main/java/de/kniffo80/mobplugin/entities/animal/walking/ZombieHorse.java @@ -48,15 +48,6 @@ public void initEntity() { this.setMaxHealth(15); } - @Override - public boolean targetOption(EntityCreature creature, double distance) { - if (creature instanceof Player) { - Player player = (Player) creature; - return player.spawned && player.isAlive() && !player.closed && player.getInventory().getItemInHand().getId() == Item.SEEDS && distance <= 49; - } - return false; - } - @Override public Item[] getDrops() { if (this.lastDamageCause instanceof EntityDamageByEntityEvent) {