mirror of
https://github.com/GeyserMC/PackConverter.git
synced 2026-01-03 22:16:16 +00:00
Fix a few schema gen bugs
This commit is contained in:
@@ -6,6 +6,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.geysermc.pack.bedrock.resource.animation_controllers.animationcontroller.animationcontrollers.states.ParticleEffects;
|
||||
import org.geysermc.pack.bedrock.resource.animation_controllers.animationcontroller.animationcontrollers.states.SoundEffects;
|
||||
import org.geysermc.pack.bedrock.resource.animation_controllers.animationcontroller.animationcontrollers.states.Variables;
|
||||
|
||||
@@ -21,6 +22,9 @@ public class States {
|
||||
@SerializedName("blend_via_shortest_path")
|
||||
public boolean blendViaShortestPath;
|
||||
|
||||
@SerializedName("particle_effects")
|
||||
public List<ParticleEffects> particleEffects = new ArrayList<>();
|
||||
|
||||
@SerializedName("sound_effects")
|
||||
public List<SoundEffects> soundEffects = new ArrayList<>();
|
||||
|
||||
@@ -64,6 +68,24 @@ public class States {
|
||||
this.blendViaShortestPath = blendViaShortestPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* The effects to be emitted.
|
||||
*
|
||||
* @return Particle Effects
|
||||
*/
|
||||
public List<ParticleEffects> particleEffects() {
|
||||
return this.particleEffects;
|
||||
}
|
||||
|
||||
/**
|
||||
* The effects to be emitted.
|
||||
*
|
||||
* @param particleEffects Particle Effects
|
||||
*/
|
||||
public void particleEffects(List<ParticleEffects> particleEffects) {
|
||||
this.particleEffects = particleEffects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Collection of sounds to trigger on entry to this animation state.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package org.geysermc.pack.bedrock.resource.animation_controllers.animationcontroller.animationcontrollers.states;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.lang.String;
|
||||
|
||||
public class ParticleEffects {
|
||||
@SerializedName("bind_to_actor")
|
||||
public boolean bindToActor;
|
||||
|
||||
public String effect;
|
||||
|
||||
public String locator;
|
||||
|
||||
@SerializedName("pre_effect_script")
|
||||
public String preEffectScript;
|
||||
|
||||
/**
|
||||
* Set to false to have the effect spawned in the world without being bound to an actor (by default an effect is bound to the actor).
|
||||
*
|
||||
* @return Bind To Actor
|
||||
*/
|
||||
public boolean bindToActor() {
|
||||
return this.bindToActor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set to false to have the effect spawned in the world without being bound to an actor (by default an effect is bound to the actor).
|
||||
*
|
||||
* @param bindToActor Bind To Actor
|
||||
*/
|
||||
public void bindToActor(boolean bindToActor) {
|
||||
this.bindToActor = bindToActor;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of a particle effect that should be played.
|
||||
*
|
||||
* @return Effect
|
||||
*/
|
||||
public String effect() {
|
||||
return this.effect;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of a particle effect that should be played.
|
||||
*
|
||||
* @param effect Effect
|
||||
*/
|
||||
public void effect(String effect) {
|
||||
this.effect = effect;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of a locator on the actor where the effect should be located.
|
||||
*
|
||||
* @return Locator
|
||||
*/
|
||||
public String locator() {
|
||||
return this.locator;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of a locator on the actor where the effect should be located.
|
||||
*
|
||||
* @param locator Locator
|
||||
*/
|
||||
public void locator(String locator) {
|
||||
this.locator = locator;
|
||||
}
|
||||
|
||||
/**
|
||||
* A molang script that will be run when the particle emitter is initialized.
|
||||
*
|
||||
* @return Pre Effect Script
|
||||
*/
|
||||
public String preEffectScript() {
|
||||
return this.preEffectScript;
|
||||
}
|
||||
|
||||
/**
|
||||
* A molang script that will be run when the particle emitter is initialized.
|
||||
*
|
||||
* @param preEffectScript Pre Effect Script
|
||||
*/
|
||||
public void preEffectScript(String preEffectScript) {
|
||||
this.preEffectScript = preEffectScript;
|
||||
}
|
||||
}
|
||||
@@ -2,14 +2,15 @@ package org.geysermc.pack.bedrock.resource.attachables.attachable.description;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.lang.String;
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Scripts
|
||||
*/
|
||||
public class Scripts {
|
||||
private Map<String, String> animate = new HashMap<>();
|
||||
public List<Map<String, String>> animate = new ArrayList<>();
|
||||
|
||||
@SerializedName("parent_setup")
|
||||
public String parentSetup;
|
||||
@@ -19,14 +20,14 @@ public class Scripts {
|
||||
/**
|
||||
* @return Animate
|
||||
*/
|
||||
public Map<String, String> animate() {
|
||||
public List<Map<String, String>> animate() {
|
||||
return this.animate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param animate Animate
|
||||
*/
|
||||
public void animate(Map<String, String> animate) {
|
||||
public void animate(List<Map<String, String>> animate) {
|
||||
this.animate = animate;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,11 @@ import java.util.Map;
|
||||
public class Scripts {
|
||||
public String[] animate;
|
||||
|
||||
public String[] initialize;
|
||||
|
||||
@SerializedName("pre_animation")
|
||||
public String[] preAnimation;
|
||||
|
||||
@SerializedName("parent_setup")
|
||||
public String parentSetup;
|
||||
|
||||
@@ -50,6 +55,42 @@ public class Scripts {
|
||||
this.animate = animate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clientside molang variables that are to be evaluated during the creation of the entity.
|
||||
*
|
||||
* @return Initialize
|
||||
*/
|
||||
public String[] initialize() {
|
||||
return this.initialize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clientside molang variables that are to be evaluated during the creation of the entity.
|
||||
*
|
||||
* @param initialize Initialize
|
||||
*/
|
||||
public void initialize(String[] initialize) {
|
||||
this.initialize = initialize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clientside molang variables that are to be evaluated during the animation.
|
||||
*
|
||||
* @return Pre Animation
|
||||
*/
|
||||
public String[] preAnimation() {
|
||||
return this.preAnimation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clientside molang variables that are to be evaluated during the animation.
|
||||
*
|
||||
* @param preAnimation Pre Animation
|
||||
*/
|
||||
public void preAnimation(String[] preAnimation) {
|
||||
this.preAnimation = preAnimation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Parent Setup
|
||||
*/
|
||||
|
||||
@@ -88,6 +88,12 @@ public class Components {
|
||||
@SerializedName("minecraft:particle_appearance_lighting")
|
||||
public ParticleAppearanceLighting particleAppearanceLighting;
|
||||
|
||||
@SerializedName("minecraft:particle_expire_if_not_in_blocks")
|
||||
public String[] particleExpireIfNotInBlocks;
|
||||
|
||||
@SerializedName("minecraft:particle_expire_if_in_blocks")
|
||||
public String[] particleExpireIfInBlocks;
|
||||
|
||||
@SerializedName("minecraft:particle_initialization")
|
||||
public ParticleInitialization particleInitialization;
|
||||
|
||||
@@ -375,6 +381,34 @@ public class Components {
|
||||
this.particleAppearanceLighting = particleAppearanceLighting;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Particle Expire If Not In Blocks Component For 1.10.0
|
||||
*/
|
||||
public String[] particleExpireIfNotInBlocks() {
|
||||
return this.particleExpireIfNotInBlocks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param particleExpireIfNotInBlocks Particle Expire If Not In Blocks Component For 1.10.0
|
||||
*/
|
||||
public void particleExpireIfNotInBlocks(String[] particleExpireIfNotInBlocks) {
|
||||
this.particleExpireIfNotInBlocks = particleExpireIfNotInBlocks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Particle Expire If Not In Blocks Component For 1.10.0
|
||||
*/
|
||||
public String[] particleExpireIfInBlocks() {
|
||||
return this.particleExpireIfInBlocks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param particleExpireIfInBlocks Particle Expire If Not In Blocks Component For 1.10.0
|
||||
*/
|
||||
public void particleExpireIfInBlocks(String[] particleExpireIfInBlocks) {
|
||||
this.particleExpireIfInBlocks = particleExpireIfInBlocks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Particle Initialization Component For 1.10.0
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,8 @@ package org.geysermc.pack.bedrock.resource.render_controllers.rendercontrollers;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.lang.String;
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -29,7 +30,7 @@ public class RenderControllers {
|
||||
@SerializedName("light_color_multiplier")
|
||||
public String lightColorMultiplier;
|
||||
|
||||
private Map<String, String> materials = new HashMap<>();
|
||||
public List<Map<String, String>> materials = new ArrayList<>();
|
||||
|
||||
@SerializedName("on_fire_color")
|
||||
public OnFireColor onFireColor;
|
||||
@@ -38,7 +39,9 @@ public class RenderControllers {
|
||||
public OverlayColor overlayColor;
|
||||
|
||||
@SerializedName("part_visibility")
|
||||
private Map<String, String> partVisibility = new HashMap<>();
|
||||
public List<Map<String, String>> partVisibility = new ArrayList<>();
|
||||
|
||||
public String[] textures;
|
||||
|
||||
@SerializedName("uv_anim")
|
||||
public UvAnim uvAnim;
|
||||
@@ -164,7 +167,7 @@ public class RenderControllers {
|
||||
*
|
||||
* @return Materials
|
||||
*/
|
||||
public Map<String, String> materials() {
|
||||
public List<Map<String, String>> materials() {
|
||||
return this.materials;
|
||||
}
|
||||
|
||||
@@ -173,7 +176,7 @@ public class RenderControllers {
|
||||
*
|
||||
* @param materials Materials
|
||||
*/
|
||||
public void materials(Map<String, String> materials) {
|
||||
public void materials(List<Map<String, String>> materials) {
|
||||
this.materials = materials;
|
||||
}
|
||||
|
||||
@@ -218,7 +221,7 @@ public class RenderControllers {
|
||||
*
|
||||
* @return Part Visibility
|
||||
*/
|
||||
public Map<String, String> partVisibility() {
|
||||
public List<Map<String, String>> partVisibility() {
|
||||
return this.partVisibility;
|
||||
}
|
||||
|
||||
@@ -227,10 +230,28 @@ public class RenderControllers {
|
||||
*
|
||||
* @param partVisibility Part Visibility
|
||||
*/
|
||||
public void partVisibility(Map<String, String> partVisibility) {
|
||||
public void partVisibility(List<Map<String, String>> partVisibility) {
|
||||
this.partVisibility = partVisibility;
|
||||
}
|
||||
|
||||
/**
|
||||
* The texture to apply, multiple texture can be used as to create an overlay effect, a specific material is required though.
|
||||
*
|
||||
* @return Textures
|
||||
*/
|
||||
public String[] textures() {
|
||||
return this.textures;
|
||||
}
|
||||
|
||||
/**
|
||||
* The texture to apply, multiple texture can be used as to create an overlay effect, a specific material is required though.
|
||||
*
|
||||
* @param textures Textures
|
||||
*/
|
||||
public void textures(String[] textures) {
|
||||
this.textures = textures;
|
||||
}
|
||||
|
||||
/**
|
||||
* The UV animation to apply to the render texture.
|
||||
*
|
||||
|
||||
@@ -250,7 +250,8 @@ public final class JsonTemplateToClassConverter {
|
||||
propertyValue,
|
||||
parentSchema,
|
||||
output,
|
||||
options
|
||||
options,
|
||||
false
|
||||
);
|
||||
if (altSpec != null) {
|
||||
spec = altSpec;
|
||||
@@ -346,15 +347,20 @@ public final class JsonTemplateToClassConverter {
|
||||
private static FieldSpec.Builder createArrayField(@NotNull String input, @NotNull String packageName, @NotNull String fieldName, @NotNull String rootClassName, @NotNull String prevClassName, @NotNull JsonObject parentSchema, @NotNull JsonObject propertyValue, @NotNull Path output, @NotNull ConverterOptions options) {
|
||||
FieldSpec.Builder spec = null;
|
||||
if (propertyValue.getValue("items") instanceof JsonObject items) {
|
||||
ResolvedReference resolvedReference = flattenReference(
|
||||
input,
|
||||
packageName,
|
||||
rootClassName,
|
||||
prevClassName,
|
||||
parentSchema,
|
||||
items,
|
||||
options
|
||||
);
|
||||
ResolvedReference resolvedReference;
|
||||
if (items.containsKey("$ref")) {
|
||||
resolvedReference = parseRef(input, parentSchema, items);
|
||||
} else {
|
||||
resolvedReference = flattenReference(
|
||||
input,
|
||||
packageName,
|
||||
rootClassName,
|
||||
prevClassName,
|
||||
parentSchema,
|
||||
items,
|
||||
options
|
||||
);
|
||||
}
|
||||
|
||||
if (resolvedReference != null) {
|
||||
items = resolvedReference.object();
|
||||
@@ -401,7 +407,8 @@ public final class JsonTemplateToClassConverter {
|
||||
items,
|
||||
parentSchema,
|
||||
output,
|
||||
options
|
||||
options,
|
||||
true
|
||||
);
|
||||
|
||||
if (altSpec != null) {
|
||||
@@ -454,7 +461,7 @@ public final class JsonTemplateToClassConverter {
|
||||
return spec;
|
||||
}
|
||||
|
||||
private static FieldSpec.Builder createObjectField(@NotNull String packageName, @NotNull String input, @NotNull String fieldName, @NotNull String rootClassName, @NotNull String prevClassName, @NotNull JsonObject propertyValue, @NotNull JsonObject parentSchema, @NotNull Path output, @NotNull ConverterOptions options) {
|
||||
private static FieldSpec.Builder createObjectField(@NotNull String packageName, @NotNull String input, @NotNull String fieldName, @NotNull String rootClassName, @NotNull String prevClassName, @NotNull JsonObject propertyValue, @NotNull JsonObject parentSchema, @NotNull Path output, @NotNull ConverterOptions options, boolean arrayModifier) {
|
||||
String className = ConvertUtil.toClassName(fieldName);
|
||||
packageName = ConvertUtil.sanitizePackageName(packageName);
|
||||
|
||||
@@ -558,10 +565,18 @@ public final class JsonTemplateToClassConverter {
|
||||
ClassName.get(String.class),
|
||||
classType);
|
||||
|
||||
return FieldSpec.builder(mainType,
|
||||
fieldName,
|
||||
Modifier.PRIVATE)
|
||||
.initializer(CodeBlock.of("new $T<>()", HashMap.class));
|
||||
if (!arrayModifier) {
|
||||
return FieldSpec.builder(mainType,
|
||||
fieldName,
|
||||
Modifier.PRIVATE)
|
||||
.initializer(CodeBlock.of("new $T<>()", HashMap.class));
|
||||
} else {
|
||||
ParameterizedTypeName arrayType = ParameterizedTypeName.get(ClassName.get(List.class),
|
||||
mainType);
|
||||
|
||||
return FieldSpec.builder(arrayType, fieldName, Modifier.PUBLIC)
|
||||
.initializer(CodeBlock.of("new $T<>()", ArrayList.class));
|
||||
}
|
||||
} else if (propertyValue.getValue("items") instanceof JsonObject object && !object.containsKey("properties")) {
|
||||
ResolvedReference resolvedReference = flattenReference(
|
||||
input,
|
||||
|
||||
Reference in New Issue
Block a user