Fix parsing of render queue with chroma key (fixes #564)
By simply replacing the private field with a concrete type, so we do not need to manually register one when constructing the gson instance (which is evidently too easy to forget about).
This commit is contained in:
@@ -4,6 +4,7 @@ import com.google.gson.annotations.JsonAdapter;
|
|||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import com.replaymod.core.utils.FileTypeAdapter;
|
import com.replaymod.core.utils.FileTypeAdapter;
|
||||||
import com.replaymod.core.versions.MCVer;
|
import com.replaymod.core.versions.MCVer;
|
||||||
|
import de.johni0702.minecraft.gui.utils.lwjgl.Color;
|
||||||
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableColor;
|
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableColor;
|
||||||
import net.minecraft.client.resource.language.I18n;
|
import net.minecraft.client.resource.language.I18n;
|
||||||
import net.minecraft.util.Util;
|
import net.minecraft.util.Util;
|
||||||
@@ -153,7 +154,7 @@ public class RenderSettings {
|
|||||||
private final boolean stabilizeYaw;
|
private final boolean stabilizeYaw;
|
||||||
private final boolean stabilizePitch;
|
private final boolean stabilizePitch;
|
||||||
private final boolean stabilizeRoll;
|
private final boolean stabilizeRoll;
|
||||||
private final ReadableColor chromaKeyingColor;
|
private final Color chromaKeyingColor;
|
||||||
private final int sphericalFovX;
|
private final int sphericalFovX;
|
||||||
private final int sphericalFovY;
|
private final int sphericalFovY;
|
||||||
private final boolean injectSphericalMetadata;
|
private final boolean injectSphericalMetadata;
|
||||||
@@ -207,7 +208,7 @@ public class RenderSettings {
|
|||||||
this.stabilizeYaw = stabilizeYaw;
|
this.stabilizeYaw = stabilizeYaw;
|
||||||
this.stabilizePitch = stabilizePitch;
|
this.stabilizePitch = stabilizePitch;
|
||||||
this.stabilizeRoll = stabilizeRoll;
|
this.stabilizeRoll = stabilizeRoll;
|
||||||
this.chromaKeyingColor = chromaKeyingColor;
|
this.chromaKeyingColor = chromaKeyingColor == null ? null : new Color(chromaKeyingColor);
|
||||||
this.sphericalFovX = sphericalFovX;
|
this.sphericalFovX = sphericalFovX;
|
||||||
this.sphericalFovY = sphericalFovY;
|
this.sphericalFovY = sphericalFovY;
|
||||||
this.injectSphericalMetadata = injectSphericalMetadata;
|
this.injectSphericalMetadata = injectSphericalMetadata;
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import de.johni0702.minecraft.gui.utils.Consumer;
|
|||||||
import de.johni0702.minecraft.gui.utils.Utils;
|
import de.johni0702.minecraft.gui.utils.Utils;
|
||||||
import de.johni0702.minecraft.gui.utils.lwjgl.Color;
|
import de.johni0702.minecraft.gui.utils.lwjgl.Color;
|
||||||
import de.johni0702.minecraft.gui.utils.lwjgl.Dimension;
|
import de.johni0702.minecraft.gui.utils.lwjgl.Dimension;
|
||||||
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableColor;
|
|
||||||
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
|
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
|
||||||
import net.minecraft.client.gui.screen.NoticeScreen;
|
import net.minecraft.client.gui.screen.NoticeScreen;
|
||||||
import net.minecraft.client.resource.language.I18n;
|
import net.minecraft.client.resource.language.I18n;
|
||||||
@@ -333,7 +332,6 @@ public class GuiRenderSettings extends AbstractGuiPopup<GuiRenderSettings> {
|
|||||||
try {
|
try {
|
||||||
settings = new GsonBuilder()
|
settings = new GsonBuilder()
|
||||||
.registerTypeAdapter(RenderSettings.class, (InstanceCreator<RenderSettings>) type -> getDefaultRenderSettings())
|
.registerTypeAdapter(RenderSettings.class, (InstanceCreator<RenderSettings>) type -> getDefaultRenderSettings())
|
||||||
.registerTypeAdapter(ReadableColor.class, new Gson().getAdapter(Color.class))
|
|
||||||
.create().fromJson(json, RenderSettings.class);
|
.create().fromJson(json, RenderSettings.class);
|
||||||
} catch (JsonSyntaxException e) {
|
} catch (JsonSyntaxException e) {
|
||||||
LOGGER.error("Parsing render settings:", e);
|
LOGGER.error("Parsing render settings:", e);
|
||||||
|
|||||||
Reference in New Issue
Block a user