Also strip for entities

This commit is contained in:
Jesse Boyd 2018-08-03 13:20:07 +10:00
parent 1c6097454f
commit e6128ecf63
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 13 additions and 2 deletions

View File

@ -71,7 +71,7 @@ public class FaweLimit {
MAX.MAX_EXPRESSION_MS = 50; MAX.MAX_EXPRESSION_MS = 50;
MAX.FAST_PLACEMENT = true; MAX.FAST_PLACEMENT = true;
MAX.CONFIRM_LARGE = true; MAX.CONFIRM_LARGE = true;
MAX.STRIP_NBT = null; MAX.STRIP_NBT = Collections.emptySet();
} }
public boolean MAX_CHANGES() { public boolean MAX_CHANGES() {

View File

@ -6,9 +6,14 @@ import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseBlock; 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.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.Extent; 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.Iterator;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -37,7 +42,13 @@ public class StripNBTExtent extends AbstractDelegateExtent {
return super.setBlock(x, y, z, stripNBT(block)); 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 extends NbtValued> T stripNBT(T block) {
if (!block.hasNbtData()) return block; if (!block.hasNbtData()) return block;
CompoundTag nbt = block.getNbtData(); CompoundTag nbt = block.getNbtData();
Map<String, Tag> value = nbt.getValue(); Map<String, Tag> value = nbt.getValue();