From 1f4b6a690501989e7dafdb8c2f82848e0fc41bdf Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Sat, 27 Oct 2018 17:59:11 +0200 Subject: [PATCH] Fix DMob trigger ID usage --- src/main/java/de/erethon/dungeonsxl/mob/DMob.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/erethon/dungeonsxl/mob/DMob.java b/src/main/java/de/erethon/dungeonsxl/mob/DMob.java index ee37f072..23c3716b 100644 --- a/src/main/java/de/erethon/dungeonsxl/mob/DMob.java +++ b/src/main/java/de/erethon/dungeonsxl/mob/DMob.java @@ -17,6 +17,8 @@ package de.erethon.dungeonsxl.mob; import de.erethon.caliburn.mob.ExMob; +import de.erethon.caliburn.mob.VanillaMob; +import de.erethon.caliburn.util.compatibility.Version; import de.erethon.dungeonsxl.event.dmob.DMobDeathEvent; import de.erethon.dungeonsxl.event.dmob.DMobSpawnEvent; import de.erethon.dungeonsxl.game.Game; @@ -42,7 +44,7 @@ public class DMob { private String trigger; - public DMob(LivingEntity entity, DGameWorld gameWorld) { + private DMob(LivingEntity entity, DGameWorld gameWorld) { gameWorld.addDMob(this); this.entity = entity; @@ -54,6 +56,9 @@ public class DMob { this.entity.getEquipment().setLeggingsDropChance(0); this.entity.getEquipment().setBootsDropChance(0); this.entity.getEquipment().setItemInHandDropChance(0); + if (Version.isAtLeast(Version.MC1_9)) { + this.entity.getEquipment().setItemInOffHandDropChance(0); + } } DMobSpawnEvent event = new DMobSpawnEvent(this, entity); @@ -72,10 +77,12 @@ public class DMob { public DMob(LivingEntity entity, DGameWorld gameWorld, ExMob type) { this(entity, gameWorld); this.type = type; + this.trigger = type.getId(); } public DMob(LivingEntity entity, DGameWorld gameWorld, ExMob type, String trigger) { - this(entity, gameWorld, type); + this(entity, gameWorld); + this.type = type; this.trigger = trigger; } @@ -137,13 +144,13 @@ public class DMob { } } - name = type.getName(); + name = type.getId(); } else if (isExternalMob() && trigger != null) { name = trigger; } else { - name = victim.getType().getName(); + name = VanillaMob.get(victim.getType()).getId(); } MobTrigger mobTrigger = MobTrigger.getByName(name, gameWorld);