mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-19 15:09:15 +00:00
添加copper_golem_statue
This commit is contained in:
@@ -628,6 +628,7 @@ public class RecipeEventListener implements Listener {
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||
public void onCraftingFinish(CraftItemEvent event) {
|
||||
System.out.println(event.isShiftClick());
|
||||
if (!Config.enableRecipeSystem() || !VersionHelper.PREMIUM) return;
|
||||
org.bukkit.inventory.Recipe recipe = event.getRecipe();
|
||||
if (!(recipe instanceof CraftingRecipe craftingRecipe)) return;
|
||||
|
||||
@@ -258,6 +258,8 @@ warning.config.item.model.special.chest.invalid_openness: "<yellow>Issue found i
|
||||
warning.config.item.model.special.shulker_box.missing_texture: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is missing the required 'texture' argument for special model 'minecraft:shulker_box'.</yellow>"
|
||||
warning.config.item.model.special.shulker_box.invalid_openness: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is using an invalid 'openness' value '<arg:2>' for special model 'minecraft:shulker_box'. Valid range '0~1.'</yellow>"
|
||||
warning.config.item.model.special.head.missing_kind: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is missing the required 'kind' argument for special model 'minecraft:head'.</yellow>"
|
||||
warning.config.item.model.special.copper_golem_statue.missing_pose: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is missing the required 'pose' argument for special model 'minecraft:copper_golem_statue'.</yellow>"
|
||||
warning.config.item.model.special.copper_golem_statue.missing_texture: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is missing the required 'texture' argument for special model 'minecraft:copper_golem_statue'.</yellow>"
|
||||
warning.config.item.updater.missing_type: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is missing the required 'type' argument for item updater.</yellow>"
|
||||
warning.config.item.updater.invalid_type: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is using an invalid 'type' argument '<arg:2>' for item updater.</yellow>"
|
||||
warning.config.item.updater.transmute.missing_material: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is missing the required 'material' argument for 'transmute' item updater.</yellow>"
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package net.momirealms.craftengine.core.pack.model.special;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import net.momirealms.craftengine.core.pack.revision.Revision;
|
||||
import net.momirealms.craftengine.core.util.Key;
|
||||
import net.momirealms.craftengine.core.util.MinecraftVersion;
|
||||
import net.momirealms.craftengine.core.util.ResourceConfigUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class CopperGolemStatueSpecialModel implements SpecialModel {
|
||||
public static final Factory FACTORY = new Factory();
|
||||
public static final Reader READER = new Reader();
|
||||
private final String pose;
|
||||
private final String texture;
|
||||
|
||||
public CopperGolemStatueSpecialModel(String pose, String texture) {
|
||||
this.pose = pose;
|
||||
this.texture = texture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Key type() {
|
||||
return SpecialModels.COPPER_GOLEM_STATUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Revision> revisions() {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonObject apply(MinecraftVersion version) {
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("type", type().toString());
|
||||
json.addProperty("pose", this.pose);
|
||||
json.addProperty("texture", this.texture);
|
||||
return json;
|
||||
}
|
||||
|
||||
public static class Factory implements SpecialModelFactory {
|
||||
@Override
|
||||
public SpecialModel create(Map<String, Object> arguments) {
|
||||
String pose = ResourceConfigUtils.requireNonEmptyStringOrThrow(arguments.get("pose"), "warning.config.item.model.special.copper_golem_statue.missing_pose");
|
||||
String texture = ResourceConfigUtils.requireNonEmptyStringOrThrow(arguments.get("texture"), "warning.config.item.model.special.copper_golem_statue.missing_texture");
|
||||
return new CopperGolemStatueSpecialModel(pose, texture);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Reader implements SpecialModelReader {
|
||||
@Override
|
||||
public SpecialModel read(JsonObject json) {
|
||||
String pose = json.get("pose").getAsString();
|
||||
String texture = json.get("texture").getAsString();
|
||||
return new CopperGolemStatueSpecialModel(pose, texture);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@ public class SpecialModels {
|
||||
public static final Key STANDING_SIGN = Key.of("minecraft:standing_sign");
|
||||
public static final Key TRIDENT = Key.of("minecraft:trident");
|
||||
public static final Key PLAYER_HEAD = Key.of("minecraft:player_head");
|
||||
public static final Key COPPER_GOLEM_STATUE = Key.of("minecraft:copper_golem_statue");
|
||||
|
||||
static {
|
||||
registerFactory(TRIDENT, SimpleSpecialModel.FACTORY);
|
||||
@@ -50,6 +51,8 @@ public class SpecialModels {
|
||||
registerReader(HEAD, HeadSpecialModel.READER);
|
||||
registerFactory(SHULKER_BOX, ShulkerBoxSpecialModel.FACTORY);
|
||||
registerReader(SHULKER_BOX, ShulkerBoxSpecialModel.READER);
|
||||
registerFactory(COPPER_GOLEM_STATUE, CopperGolemStatueSpecialModel.FACTORY);
|
||||
registerReader(COPPER_GOLEM_STATUE, CopperGolemStatueSpecialModel.READER);
|
||||
}
|
||||
|
||||
public static void registerFactory(Key key, SpecialModelFactory factory) {
|
||||
|
||||
Reference in New Issue
Block a user