From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Mon, 10 Jun 2019 09:36:40 +0100 Subject: [PATCH] Catch exceptions from dispenser entity spawns diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java index dccf689d17bb5a77abf97779663413d01e840c23..67a894a185a3d4a53b3c7f90174b2604dff18257 100644 --- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java @@ -8,6 +8,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.BlockSource; import net.minecraft.core.Direction; import net.minecraft.core.Position; +import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvents; @@ -235,7 +236,14 @@ public interface DispenseItemBehavior { } } + try { // Paper entitytypes.spawn(pointer.getLevel(), stack, (Player) null, pointer.getPos().relative(enumdirection), MobSpawnType.DISPENSER, enumdirection != Direction.UP, false); + // Paper start + } catch (Exception ex){ + MinecraftServer.LOGGER.warn("An exception occurred dispensing entity at {}[{}]", worldserver.getWorld().getName(), pointer.getPos(), ex); + } + // Paper end + // itemstack.subtract(1); // Handled during event processing // CraftBukkit end return stack;