Fixed Mobs Suffocating when spawned near Blocks

This commit is contained in:
Sn0wStorm 2013-10-14 19:57:38 +02:00
parent 6249d80bca
commit 12ac14db12

View File

@ -8,6 +8,7 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Skeleton; import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Skeleton.SkeletonType; import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.Location;
import com.dre.dungeonsxl.DMobType; import com.dre.dungeonsxl.DMobType;
import com.dre.dungeonsxl.game.DMob; import com.dre.dungeonsxl.game.DMob;
@ -109,11 +110,12 @@ public class SIGNMob extends DSign {
GameWorld gworld = GameWorld.get(world); GameWorld gworld = GameWorld.get(world);
if (gworld != null) { if (gworld != null) {
Location spawnLoc = sign.sign.getLocation().add(0.5, 0, 0.5);
// Check normal mobs // Check normal mobs
if (EntityType.fromName(sign.mob) != null) { if (EntityType.fromName(sign.mob) != null) {
if (EntityType.fromName(sign.mob).isAlive()) { if (EntityType.fromName(sign.mob).isAlive()) {
LivingEntity entity = (LivingEntity) world.spawnEntity(sign.sign.getLocation(), EntityType.fromName(sign.mob)); LivingEntity entity = (LivingEntity) world.spawnEntity(spawnLoc, EntityType.fromName(sign.mob));
// Add Bow to normal Skeletons // Add Bow to normal Skeletons
if (entity.getType() == EntityType.SKELETON) { if (entity.getType() == EntityType.SKELETON) {
@ -131,7 +133,7 @@ public class SIGNMob extends DSign {
DMobType mobType = DMobType.get(sign.mob, gworld.config.getMobTypes()); DMobType mobType = DMobType.get(sign.mob, gworld.config.getMobTypes());
if (mobType != null) { if (mobType != null) {
mobType.spawn(GameWorld.get(world), sign.sign.getLocation()); mobType.spawn(GameWorld.get(world), spawnLoc);
} }
// Set the amount // Set the amount