Better Duplicate Op Support (json/hjson) + 1 more op (#7355)

* Better support for duplicate ops

* 'Mathf.curve' op
This commit is contained in:
MEEPofFaith
2022-08-13 03:52:46 -07:00
committed by GitHub
parent f9748b2d69
commit 25388ffe5f
2 changed files with 8 additions and 3 deletions

View File

@@ -201,13 +201,14 @@ public class ContentParser{
case "delay" -> base.delay(data.getFloat("amount"));
case "sustain" -> base.sustain(data.getFloat("offset", 0f), data.getFloat("grow", 0f), data.getFloat("sustain"));
case "shorten" -> base.shorten(data.getFloat("amount"));
case "compress" -> base.compress(data.getFloat("start"), data.getFloat("end"));
case "add" -> data.has("amount") ? base.add(data.getFloat("amount")) : base.add(parser.readValue(PartProgress.class, data.get("other")));
case "blend" -> base.blend(parser.readValue(PartProgress.class, data.get("other")), data.getFloat("amount"));
case "mul" -> base.mul(parser.readValue(PartProgress.class, data.get("other")));
case "mul" -> data.has("amount") ? base.mul(data.getFloat("amount")) : base.mul(parser.readValue(PartProgress.class, data.get("other")));
case "min" -> base.min(parser.readValue(PartProgress.class, data.get("other")));
case "sin" -> base.sin(data.getFloat("scl"), data.getFloat("mag"));
case "sin" -> base.sin(data.has("offset") ? data.getFloat("offset") : 0f, data.getFloat("scl"), data.getFloat("mag"));
case "absin" -> base.absin(data.getFloat("scl"), data.getFloat("mag"));
case "curve" -> base.curve(parser.readValue(Interp.class, data.get("interp")));
case "curve" -> data.has("interp") ? base.curve(parser.readValue(Interp.class, data.get("interp"))) : base.curve(data.getFloat("offset"), data.getFloat("duration"));
default -> throw new RuntimeException("Unknown operation '" + op + "', check PartProgress class for a list of methods.");
};
});