Fix vanilla structures loosing valid flags, And fix error placement for unsaveable structures.

This commit is contained in:
LexManos committed 2019-05-27 13:49:15 -07:00
1 parent 4b5bf760ec
commit c509cac02b
3 files changed
+42 -6

No files matched your search

@@ -0,0 +1,18 @@
--- a/net/minecraft/world/gen/feature/structure/EndCityStructure.java
+++ b/net/minecraft/world/gen/feature/structure/EndCityStructure.java
@@ -110,5 +110,15 @@
public boolean func_75069_d() {
return this.field_186163_c;
}
+
+ //Forge: Fix losing of 'valid' flag on world reload. TODO: Remove in 1.14 as vanilla fixed.
+ public void func_143022_a(net.minecraft.nbt.NBTTagCompound tag) {
+ super.func_143022_a(tag);
+ tag.func_74757_a("Valid", this.field_186163_c);
+ }
+ public void func_143017_b(net.minecraft.nbt.NBTTagCompound tag) {
+ super.func_143017_b(tag);
+ this.field_186163_c = tag.func_74764_b("Valid") && tag.func_74767_n("Valid");
+ }
}
}
@@ -1,15 +1,15 @@
--- a/net/minecraft/world/gen/feature/structure/StructureStart.java
+++ b/net/minecraft/world/gen/feature/structure/StructureStart.java
@@ -70,6 +70,9 @@
}
@@ -72,6 +72,9 @@
public NBTTagCompound func_143021_a(int p_143021_1_, int p_143021_2_) {
+ if (StructureIO.func_143033_a(this) == null) { // FORGE: This is just a more friendly error instead of the 'Null String' below
+ throw new RuntimeException("StructureStart \"" + this.getClass().getName() + "\" missing ID Mapping, Modder see MapGenStructureIO");
+ }
NBTTagCompound nbttagcompound = new NBTTagCompound();
if (this.func_75069_d()) {
+ if (StructureIO.func_143033_a(this) == null) { // FORGE: This is just a more friendly error instead of the 'Null String' below
+ throw new RuntimeException("StructureStart \"" + this.getClass().getName() + "\" missing ID Mapping, Modder see MapGenStructureIO");
+ }
nbttagcompound.func_74778_a("id", StructureIO.func_143033_a(this));
nbttagcompound.func_74778_a("biome", IRegistry.field_212624_m.func_177774_c(this.field_202505_e).toString());
nbttagcompound.func_74768_a("ChunkX", p_143021_1_);
@@ -109,7 +112,8 @@
NBTTagList nbttaglist = p_143020_2_.func_150295_c("Children", 10);
@@ -0,0 +1,18 @@
--- a/net/minecraft/world/gen/feature/structure/WoodlandMansionStructure.java
+++ b/net/minecraft/world/gen/feature/structure/WoodlandMansionStructure.java
@@ -143,5 +143,15 @@
public boolean func_75069_d() {
return this.field_191093_c;
}
+
+ //Forge: Fix losing of 'valid' flag on world reload. TODO: Remove in 1.14 as vanilla fixed.
+ public void func_143022_a(net.minecraft.nbt.NBTTagCompound tag) {
+ super.func_143022_a(tag);
+ tag.func_74757_a("Valid", this.field_191093_c);
+ }
+ public void func_143017_b(net.minecraft.nbt.NBTTagCompound tag) {
+ super.func_143017_b(tag);
+ this.field_191093_c = tag.func_74764_b("Valid") && tag.func_74767_n("Valid");
+ }
}
}