From e6128ecf63c07e3a022ba04d1b8883cf054ac0c4 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Fri, 3 Aug 2018 13:20:07 +1000 Subject: [PATCH] Also strip for entities --- .../main/java/com/boydti/fawe/object/FaweLimit.java | 2 +- .../boydti/fawe/object/extent/StripNBTExtent.java | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/boydti/fawe/object/FaweLimit.java b/core/src/main/java/com/boydti/fawe/object/FaweLimit.java index bd1fe2b5..43e2b6df 100644 --- a/core/src/main/java/com/boydti/fawe/object/FaweLimit.java +++ b/core/src/main/java/com/boydti/fawe/object/FaweLimit.java @@ -71,7 +71,7 @@ public class FaweLimit { MAX.MAX_EXPRESSION_MS = 50; MAX.FAST_PLACEMENT = true; MAX.CONFIRM_LARGE = true; - MAX.STRIP_NBT = null; + MAX.STRIP_NBT = Collections.emptySet(); } public boolean MAX_CHANGES() { diff --git a/core/src/main/java/com/boydti/fawe/object/extent/StripNBTExtent.java b/core/src/main/java/com/boydti/fawe/object/extent/StripNBTExtent.java index aaa6855f..91f91365 100644 --- a/core/src/main/java/com/boydti/fawe/object/extent/StripNBTExtent.java +++ b/core/src/main/java/com/boydti/fawe/object/extent/StripNBTExtent.java @@ -6,9 +6,14 @@ import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.entity.BaseEntity; +import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.util.Location; +import com.sk89q.worldedit.world.NbtValued; +import javax.annotation.Nullable; import java.util.Iterator; import java.util.Map; import java.util.Set; @@ -37,7 +42,13 @@ public class StripNBTExtent extends AbstractDelegateExtent { return super.setBlock(x, y, z, stripNBT(block)); } - public BaseBlock stripNBT(BaseBlock block) { + @Nullable + @Override + public Entity createEntity(Location location, BaseEntity entity) { + return super.createEntity(location, stripNBT(entity)); + } + + public T stripNBT(T block) { if (!block.hasNbtData()) return block; CompoundTag nbt = block.getNbtData(); Map value = nbt.getValue();