mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 09:47:38 +00:00
Stop writing corrupt tile entities to schematics
also make some stuff definitely immutable.
This commit is contained in:
parent
04ba545aa2
commit
6676d77aaa
Binary file not shown.
@ -159,15 +159,16 @@ public class FastSchematicWriter implements ClipboardWriter {
|
|||||||
if (nbt != null) {
|
if (nbt != null) {
|
||||||
Map<String, Tag> values = nbt.getValue();
|
Map<String, Tag> values = nbt.getValue();
|
||||||
|
|
||||||
values.remove("id"); // Remove 'id' if it exists. We want 'Id'
|
|
||||||
|
|
||||||
// Positions are kept in NBT, we don't want that.
|
// Positions are kept in NBT, we don't want that.
|
||||||
values.remove("x");
|
values.remove("x");
|
||||||
values.remove("y");
|
values.remove("y");
|
||||||
values.remove("z");
|
values.remove("z");
|
||||||
if (!values.containsKey("Id")) {
|
values.put("Id", new StringTag(block.getNbtId()));
|
||||||
values.put("Id", new StringTag(block.getNbtId()));
|
|
||||||
}
|
// Remove 'id' if it exists. We want 'Id'.
|
||||||
|
// Do this after we get "getNbtId" cos otherwise "getNbtId" doesn't work.
|
||||||
|
// Dum.
|
||||||
|
values.remove("id");
|
||||||
values.put("Pos", new IntArrayTag(new int[]{
|
values.put("Pos", new IntArrayTag(new int[]{
|
||||||
pos.getX(),
|
pos.getX(),
|
||||||
pos.getY(),
|
pos.getY(),
|
||||||
|
@ -49,13 +49,8 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
*/
|
*/
|
||||||
public class BaseBlock implements BlockStateHolder<BaseBlock>, TileEntityBlock {
|
public class BaseBlock implements BlockStateHolder<BaseBlock>, TileEntityBlock {
|
||||||
|
|
||||||
private BlockState blockState;
|
private final BlockState blockState;
|
||||||
@Nullable private CompoundTag nbtData;
|
@Nullable private final CompoundTag nbtData;
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public BaseBlock() {
|
|
||||||
this(BlockTypes.AIR.getDefaultState());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a block with the given type and default data.
|
* Construct a block with the given type and default data.
|
||||||
@ -151,6 +146,9 @@ public class BaseBlock implements BlockStateHolder<BaseBlock>, TileEntityBlock {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
Tag idTag = nbtData.getValue().get("id");
|
Tag idTag = nbtData.getValue().get("id");
|
||||||
|
if (idTag == null) {
|
||||||
|
idTag = nbtData.getValue().get("Id");
|
||||||
|
}
|
||||||
if (idTag instanceof StringTag) {
|
if (idTag instanceof StringTag) {
|
||||||
return ((StringTag) idTag).getValue();
|
return ((StringTag) idTag).getValue();
|
||||||
} else {
|
} else {
|
||||||
@ -164,6 +162,11 @@ public class BaseBlock implements BlockStateHolder<BaseBlock>, TileEntityBlock {
|
|||||||
return this.nbtData;
|
return this.nbtData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setNbtData(@Nullable CompoundTag nbtData) {
|
||||||
|
throw new UnsupportedOperationException("This class is immutable.");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether the type ID and data value are equal.
|
* Checks whether the type ID and data value are equal.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user