Deprecate ModelBuilder#gui3d, add ModelBuilder#guiLight

This commit is contained in:
tterrag 2020-03-19 23:37:21 -04:00
parent 2f5172f907
commit db3d202c4e
2 changed files with 25 additions and 2 deletions

View file

@ -78,3 +78,11 @@
public boolean func_178300_b(String p_178300_1_) { public boolean func_178300_b(String p_178300_1_) {
return !MissingTextureSprite.func_195675_b().equals(this.func_228816_c_(p_178300_1_).func_229313_b_()); return !MissingTextureSprite.func_195675_b().equals(this.func_228816_c_(p_178300_1_).func_229313_b_());
} }
@@ -373,5 +396,7 @@
public boolean func_230178_a_() {
return this == SIDE;
}
+
+ public String getSerializedName() { return field_230177_c_; }
}
}

View file

@ -43,6 +43,7 @@ import net.minecraft.client.renderer.model.BlockPartFace;
import net.minecraft.client.renderer.model.BlockPartRotation; import net.minecraft.client.renderer.model.BlockPartRotation;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.model.ItemTransformVec3f; import net.minecraft.client.renderer.model.ItemTransformVec3f;
import net.minecraft.client.renderer.model.BlockModel.GuiLight;
import net.minecraft.client.renderer.texture.MissingTextureSprite; import net.minecraft.client.renderer.texture.MissingTextureSprite;
import net.minecraft.resources.ResourcePackType; import net.minecraft.resources.ResourcePackType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
@ -69,7 +70,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
protected final ExistingFileHelper existingFileHelper; protected final ExistingFileHelper existingFileHelper;
protected boolean ambientOcclusion = true; protected boolean ambientOcclusion = true;
protected boolean gui3d = false; protected GuiLight guiLight = null;
protected final List<ElementBuilder> elements = new ArrayList<>(); protected final List<ElementBuilder> elements = new ArrayList<>();
@ -160,8 +161,18 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
return self(); return self();
} }
/**
* @param gui3d
* @return this builder
* @deprecated Unused in 1.15, use {@link #guiLight(GuiLight)} instead.
*/
@Deprecated
public T gui3d(boolean gui3d) { public T gui3d(boolean gui3d) {
this.gui3d = gui3d; return self();
}
public T guiLight(GuiLight light) {
this.guiLight = light;
return self(); return self();
} }
@ -194,6 +205,10 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
root.addProperty("ambientocclusion", this.ambientOcclusion); root.addProperty("ambientocclusion", this.ambientOcclusion);
} }
if (this.guiLight != null) {
root.addProperty("gui_light", this.guiLight.getSerializedName());
}
Map<Perspective, ItemTransformVec3f> transforms = this.transforms.build(); Map<Perspective, ItemTransformVec3f> transforms = this.transforms.build();
if (!transforms.isEmpty()) { if (!transforms.isEmpty()) {
JsonObject display = new JsonObject(); JsonObject display = new JsonObject();