mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2026-01-04 15:41:38 +00:00
添加copper_golem_statue
This commit is contained in:
@@ -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