This commit is contained in:
MattBDev 2021-01-06 13:34:42 -05:00
commit d691cf40f3
3 changed files with 9 additions and 4 deletions

View File

@ -112,7 +112,7 @@ public class BlockBagChangeSet extends AbstractDelegateChangeSet {
@Override
public void addTileCreate(CompoundTag nbt) {
if (nbt.containsKey("items")) {
Map<String, Tag> map = nbt.getValue();
Map<String, Tag> map = new HashMap<>(nbt.getValue());
map.remove("items");
}
super.addTileCreate(nbt);

View File

@ -13,6 +13,7 @@ import com.sk89q.worldedit.world.NbtValued;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
@ -55,10 +56,11 @@ public class StripNBTExtent extends AbstractDelegateExtent {
return block;
}
CompoundTag nbt = localBlock.getNbtData();
Map<String, Tag> value = nbt.getValue();
Map<String, Tag> value = new HashMap<>(nbt.getValue());
for (String key : strip) {
value.remove(key);
}
localBlock.toBaseBlock(new CompoundTag(value));
return (B) localBlock;
}
@ -67,10 +69,11 @@ public class StripNBTExtent extends AbstractDelegateExtent {
return entity;
}
CompoundTag nbt = entity.getNbtData();
Map<String, Tag> value = nbt.getValue();
Map<String, Tag> value = new HashMap<>(nbt.getValue());
for (String key : strip) {
value.remove(key);
}
entity.setNbtData(new CompoundTag(value));
return entity;
}
}

View File

@ -46,6 +46,7 @@ import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@ -336,8 +337,9 @@ public class BlockTransformExtent extends ResettableExtent {
Direction newDirection = Direction.findClosest(applyAbsolute, Direction.Flag.CARDINAL | Direction.Flag.ORDINAL | Direction.Flag.SECONDARY_ORDINAL);
if (newDirection != null) {
Map<String, Tag> values = tag.getValue();
Map<String, Tag> values = new HashMap<>(tag.getValue());
values.put("Rot", new ByteTag((byte) MCDirections.toRotation(newDirection)));
tag = new CompoundTag(values);
}
}
}