geforkt von Mirrors/FastAsyncWorldEdit
Fix more NBT mutability issues
Dieser Commit ist enthalten in:
Ursprung
1b870c5d78
Commit
7afddcc411
@ -112,7 +112,7 @@ public class BlockBagChangeSet extends AbstractDelegateChangeSet {
|
|||||||
@Override
|
@Override
|
||||||
public void addTileCreate(CompoundTag nbt) {
|
public void addTileCreate(CompoundTag nbt) {
|
||||||
if (nbt.containsKey("items")) {
|
if (nbt.containsKey("items")) {
|
||||||
Map<String, Tag> map = nbt.getValue();
|
Map<String, Tag> map = new HashMap<>(nbt.getValue());
|
||||||
map.remove("items");
|
map.remove("items");
|
||||||
}
|
}
|
||||||
super.addTileCreate(nbt);
|
super.addTileCreate(nbt);
|
||||||
|
@ -13,6 +13,7 @@ import com.sk89q.worldedit.world.NbtValued;
|
|||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@ -55,10 +56,11 @@ public class StripNBTExtent extends AbstractDelegateExtent {
|
|||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
CompoundTag nbt = localBlock.getNbtData();
|
CompoundTag nbt = localBlock.getNbtData();
|
||||||
Map<String, Tag> value = nbt.getValue();
|
Map<String, Tag> value = new HashMap<>(nbt.getValue());
|
||||||
for (String key : strip) {
|
for (String key : strip) {
|
||||||
value.remove(key);
|
value.remove(key);
|
||||||
}
|
}
|
||||||
|
localBlock.setNbtData(new CompoundTag(value));
|
||||||
return (B) localBlock;
|
return (B) localBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,10 +69,11 @@ public class StripNBTExtent extends AbstractDelegateExtent {
|
|||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
CompoundTag nbt = entity.getNbtData();
|
CompoundTag nbt = entity.getNbtData();
|
||||||
Map<String, Tag> value = nbt.getValue();
|
Map<String, Tag> value = new HashMap<>(nbt.getValue());
|
||||||
for (String key : strip) {
|
for (String key : strip) {
|
||||||
value.remove(key);
|
value.remove(key);
|
||||||
}
|
}
|
||||||
|
entity.setNbtData(new CompoundTag(value));
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
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);
|
Direction newDirection = Direction.findClosest(applyAbsolute, Direction.Flag.CARDINAL | Direction.Flag.ORDINAL | Direction.Flag.SECONDARY_ORDINAL);
|
||||||
|
|
||||||
if (newDirection != null) {
|
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)));
|
values.put("Rot", new ByteTag((byte) MCDirections.toRotation(newDirection)));
|
||||||
|
tag = new CompoundTag(values);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren