From 063b4b84ec88f27494345dcb8c615817a98cc803 Mon Sep 17 00:00:00 2001 From: gnembon Date: Mon, 5 Apr 2021 13:42:22 -0300 Subject: [PATCH] deferred creation of a dummy entity for block breaking to when its needed. --- src/main/java/carpet/script/api/WorldAccess.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/carpet/script/api/WorldAccess.java b/src/main/java/carpet/script/api/WorldAccess.java index 46b1cbbe..1d81c5b5 100644 --- a/src/main/java/carpet/script/api/WorldAccess.java +++ b/src/main/java/carpet/script/api/WorldAccess.java @@ -121,8 +121,7 @@ public class WorldAccess { put("unknown", ChunkTicketType.UNKNOWN); // unknown }}; // dummy entity for dummy requirements in the loot tables (see snowball) - private static FallingBlockEntity DUMMY_ENTITY = new FallingBlockEntity(EntityType.FALLING_BLOCK, null); - + private static FallingBlockEntity DUMMY_ENTITY = null; private static LazyValue booleanStateTest( Context c, String name, @@ -930,6 +929,7 @@ public class WorldAccess { { if (how > 0) tool.addEnchantment(Enchantments.FORTUNE, (int) how); + if (DUMMY_ENTITY == null) DUMMY_ENTITY = new FallingBlockEntity(EntityType.FALLING_BLOCK, null); Block.dropStacks(state, world, where, be, DUMMY_ENTITY, tool); } }