mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-22 00:19:17 +00:00
添加special model报错
This commit is contained in:
@@ -158,6 +158,15 @@ warning.config.item.model.select.block_state.missing_property: "<yellow>Issue fo
|
|||||||
warning.config.item.model.select.local_time.missing_pattern: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is missing the required 'pattern' argument for property 'minecraft:local_time'.</yellow>"
|
warning.config.item.model.select.local_time.missing_pattern: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is missing the required 'pattern' argument for property 'minecraft:local_time'.</yellow>"
|
||||||
warning.config.item.model.special.missing_type: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is missing the required 'type' argument for model 'minecraft:special'.</yellow>"
|
warning.config.item.model.special.missing_type: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is missing the required 'type' argument for model 'minecraft:special'.</yellow>"
|
||||||
warning.config.item.model.special.invalid_type: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is using an invalid type '<arg:2>' for model 'minecraft:special'.</yellow>"
|
warning.config.item.model.special.invalid_type: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is using an invalid type '<arg:2>' for model 'minecraft:special'.</yellow>"
|
||||||
|
warning.config.item.model.special.banner.missing_color: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is missing the required 'color' argument for special model 'minecraft:banner'.</yellow>"
|
||||||
|
warning.config.item.model.special.sign.missing_wood_type: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is missing the required 'wood-type' argument for special model 'minecraft:hanging_sign'/'minecraft:standing_sign'.</yellow>"
|
||||||
|
warning.config.item.model.special.sign.missing_texture: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is missing the required 'texture' argument for special model 'minecraft:hanging_sign'/'minecraft:standing_sign'.</yellow>"
|
||||||
|
warning.config.item.model.special.chest.missing_texture: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is missing the required 'texture' argument for special model 'minecraft:chest'.</yellow>"
|
||||||
|
warning.config.item.model.special.chest.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:chest'. Valid range '0~1.'</yellow>"
|
||||||
|
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.head.missing_texture: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is missing the required 'texture' argument for special model 'minecraft:head'.</yellow>"
|
||||||
warning.config.block.duplicate: "<yellow>Issue found in file <arg:0> - Duplicated block '<arg:1>'.</yellow>"
|
warning.config.block.duplicate: "<yellow>Issue found in file <arg:0> - Duplicated block '<arg:1>'.</yellow>"
|
||||||
warning.config.block.missing_state: "<yellow>Issue found in file <arg:0> - The block '<arg:1>' is missing the required 'state' argument.</yellow>"
|
warning.config.block.missing_state: "<yellow>Issue found in file <arg:0> - The block '<arg:1>' is missing the required 'state' argument.</yellow>"
|
||||||
warning.config.block.state.property.missing_type: "<yellow>Issue found in file <arg:0> - The block '<arg:1>' is missing the required 'type' argument for property '<arg:2>'.</yellow>"
|
warning.config.block.state.property.missing_type: "<yellow>Issue found in file <arg:0> - The block '<arg:1>' is missing the required 'type' argument for property '<arg:2>'.</yellow>"
|
||||||
|
|||||||
@@ -131,16 +131,6 @@ public abstract class AbstractPackManager implements PackManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadInternalPng(String path, Consumer<byte[]> callback) {
|
|
||||||
try (InputStream inputStream = this.plugin.resourceStream(path)) {
|
|
||||||
if (inputStream != null) {
|
|
||||||
callback.accept(inputStream.readAllBytes());
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
this.plugin.logger().warn("Failed to load " + path, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Path resourcePackPath() {
|
public Path resourcePackPath() {
|
||||||
return this.plugin.dataFolderPath()
|
return this.plugin.dataFolderPath()
|
||||||
@@ -1156,7 +1146,7 @@ public abstract class AbstractPackManager implements PackManager {
|
|||||||
if (Files.exists(sourceFolder)) {
|
if (Files.exists(sourceFolder)) {
|
||||||
Files.walkFileTree(sourceFolder, new SimpleFileVisitor<>() {
|
Files.walkFileTree(sourceFolder, new SimpleFileVisitor<>() {
|
||||||
@Override
|
@Override
|
||||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
|
public @NotNull FileVisitResult visitFile(@NotNull Path file, @NotNull BasicFileAttributes attrs) throws IOException {
|
||||||
Path relative = sourceFolder.relativize(file);
|
Path relative = sourceFolder.relativize(file);
|
||||||
Path targetPath = targetFolder.resolve(relative);
|
Path targetPath = targetFolder.resolve(relative);
|
||||||
List<Path> conflicts = conflictChecker.computeIfAbsent(relative, k -> new ArrayList<>());
|
List<Path> conflicts = conflictChecker.computeIfAbsent(relative, k -> new ArrayList<>());
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.momirealms.craftengine.core.pack.model.special;
|
package net.momirealms.craftengine.core.pack.model.special;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
import net.momirealms.craftengine.core.plugin.locale.LocalizedResourceConfigException;
|
||||||
import net.momirealms.craftengine.core.util.Key;
|
import net.momirealms.craftengine.core.util.Key;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -31,8 +32,11 @@ public class BannerSpecialModel implements SpecialModel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SpecialModel create(Map<String, Object> arguments) {
|
public SpecialModel create(Map<String, Object> arguments) {
|
||||||
String color = Objects.requireNonNull(arguments.get("color"), "color").toString();
|
Object color = arguments.get("color");
|
||||||
return new BannerSpecialModel(color);
|
if (color == null) {
|
||||||
|
throw new LocalizedResourceConfigException("");
|
||||||
|
}
|
||||||
|
return new BannerSpecialModel(color.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
package net.momirealms.craftengine.core.pack.model.special;
|
package net.momirealms.craftengine.core.pack.model.special;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
import net.momirealms.craftengine.core.plugin.locale.LocalizedResourceConfigException;
|
||||||
import net.momirealms.craftengine.core.util.Key;
|
import net.momirealms.craftengine.core.util.Key;
|
||||||
import net.momirealms.craftengine.core.util.ResourceConfigUtils;
|
import net.momirealms.craftengine.core.util.ResourceConfigUtils;
|
||||||
|
import software.amazon.awssdk.services.s3.endpoints.internal.Value;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -36,11 +38,14 @@ public class ChestSpecialModel implements SpecialModel {
|
|||||||
@Override
|
@Override
|
||||||
public SpecialModel create(Map<String, Object> arguments) {
|
public SpecialModel create(Map<String, Object> arguments) {
|
||||||
float openness = ResourceConfigUtils.getAsFloat(arguments.getOrDefault("openness", 0), "openness");
|
float openness = ResourceConfigUtils.getAsFloat(arguments.getOrDefault("openness", 0), "openness");
|
||||||
String texture = Objects.requireNonNull(arguments.get("texture"), "texture").toString();
|
Object texture = arguments.get("texture");
|
||||||
if (openness > 1 || openness < 0) {
|
if (texture == null) {
|
||||||
throw new IllegalArgumentException("Invalid openness: " + openness + ". Valid range 0~1");
|
throw new LocalizedResourceConfigException("warning.config.item.model.special.chest.missing_texture");
|
||||||
}
|
}
|
||||||
return new ChestSpecialModel(texture, openness);
|
if (openness > 1 || openness < 0) {
|
||||||
|
throw new LocalizedResourceConfigException("warning.config.item.model.special.chest.invalid_openness", String.valueOf(openness));
|
||||||
|
}
|
||||||
|
return new ChestSpecialModel(texture.toString(), openness);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package net.momirealms.craftengine.core.pack.model.special;
|
package net.momirealms.craftengine.core.pack.model.special;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
import net.momirealms.craftengine.core.plugin.locale.LocalizedResourceConfigException;
|
||||||
import net.momirealms.craftengine.core.util.Key;
|
import net.momirealms.craftengine.core.util.Key;
|
||||||
import net.momirealms.craftengine.core.util.ResourceConfigUtils;
|
import net.momirealms.craftengine.core.util.ResourceConfigUtils;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class HeadSpecialModel implements SpecialModel {
|
public class HeadSpecialModel implements SpecialModel {
|
||||||
public static final Factory FACTORY = new Factory();
|
public static final Factory FACTORY = new Factory();
|
||||||
@@ -38,10 +38,16 @@ public class HeadSpecialModel implements SpecialModel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SpecialModel create(Map<String, Object> arguments) {
|
public SpecialModel create(Map<String, Object> arguments) {
|
||||||
String kind = Objects.requireNonNull(arguments.get("kind"), "kind").toString();
|
Object kind = arguments.get("kind");
|
||||||
String texture = Objects.requireNonNull(arguments.get("texture"), "texture").toString();
|
if (kind == null) {
|
||||||
|
throw new LocalizedResourceConfigException("warning.config.item.model.special.head.missing_kind");
|
||||||
|
}
|
||||||
|
Object texture = arguments.get("texture");
|
||||||
|
if (texture == null) {
|
||||||
|
throw new LocalizedResourceConfigException("warning.config.item.model.special.head.missing_texture");
|
||||||
|
}
|
||||||
int animation = ResourceConfigUtils.getAsInt(arguments.getOrDefault("animation", 0), "animation");
|
int animation = ResourceConfigUtils.getAsInt(arguments.getOrDefault("animation", 0), "animation");
|
||||||
return new HeadSpecialModel(kind, texture, animation);
|
return new HeadSpecialModel(kind.toString(), texture.toString(), animation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.momirealms.craftengine.core.pack.model.special;
|
package net.momirealms.craftengine.core.pack.model.special;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
import net.momirealms.craftengine.core.plugin.locale.LocalizedResourceConfigException;
|
||||||
import net.momirealms.craftengine.core.util.Direction;
|
import net.momirealms.craftengine.core.util.Direction;
|
||||||
import net.momirealms.craftengine.core.util.Key;
|
import net.momirealms.craftengine.core.util.Key;
|
||||||
import net.momirealms.craftengine.core.util.ResourceConfigUtils;
|
import net.momirealms.craftengine.core.util.ResourceConfigUtils;
|
||||||
@@ -41,12 +42,15 @@ public class ShulkerBoxSpecialModel implements SpecialModel {
|
|||||||
@Override
|
@Override
|
||||||
public SpecialModel create(Map<String, Object> arguments) {
|
public SpecialModel create(Map<String, Object> arguments) {
|
||||||
float openness = ResourceConfigUtils.getAsFloat(arguments.getOrDefault("openness", 0), "openness");
|
float openness = ResourceConfigUtils.getAsFloat(arguments.getOrDefault("openness", 0), "openness");
|
||||||
String texture = Objects.requireNonNull(arguments.get("texture"), "texture").toString();
|
Object texture = arguments.get("texture");
|
||||||
|
if (texture == null) {
|
||||||
|
throw new LocalizedResourceConfigException("warning.config.item.model.special.shulker_box.missing_texture");
|
||||||
|
}
|
||||||
Direction orientation = Direction.valueOf(arguments.getOrDefault("orientation", "down").toString().toUpperCase(Locale.ENGLISH));
|
Direction orientation = Direction.valueOf(arguments.getOrDefault("orientation", "down").toString().toUpperCase(Locale.ENGLISH));
|
||||||
if (openness > 1 || openness < 0) {
|
if (openness > 1 || openness < 0) {
|
||||||
throw new IllegalArgumentException("Invalid openness: " + openness + ". Valid range 0~1");
|
throw new LocalizedResourceConfigException("warning.config.item.model.special.shulker_box.invalid_openness", String.valueOf(openness));
|
||||||
}
|
}
|
||||||
return new ShulkerBoxSpecialModel(texture, openness, orientation);
|
return new ShulkerBoxSpecialModel(texture.toString(), openness, orientation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.momirealms.craftengine.core.pack.model.special;
|
package net.momirealms.craftengine.core.pack.model.special;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
import net.momirealms.craftengine.core.plugin.locale.LocalizedResourceConfigException;
|
||||||
import net.momirealms.craftengine.core.util.Key;
|
import net.momirealms.craftengine.core.util.Key;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -37,9 +38,15 @@ public class SignSpecialModel implements SpecialModel {
|
|||||||
@Override
|
@Override
|
||||||
public SpecialModel create(Map<String, Object> arguments) {
|
public SpecialModel create(Map<String, Object> arguments) {
|
||||||
Key type = Key.of(arguments.get("type").toString());
|
Key type = Key.of(arguments.get("type").toString());
|
||||||
String woodType = Objects.requireNonNull(arguments.get("wood-type"), "lack wood-type").toString();
|
Object woodType = arguments.get("wood-type");
|
||||||
String texture = Objects.requireNonNull(arguments.get("texture"), "lack texture").toString();
|
if (woodType == null) {
|
||||||
return new SignSpecialModel(type, woodType, texture);
|
throw new LocalizedResourceConfigException("warning.config.item.model.special.sign.missing_wood_type");
|
||||||
|
}
|
||||||
|
Object texture = arguments.get("texture");
|
||||||
|
if (texture == null) {
|
||||||
|
throw new LocalizedResourceConfigException("warning.config.item.model.special.sign.missing_texture");
|
||||||
|
}
|
||||||
|
return new SignSpecialModel(type, woodType.toString(), texture.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package net.momirealms.craftengine.core.world.chunk;
|
package net.momirealms.craftengine.core.world.chunk;
|
||||||
|
|
||||||
import net.momirealms.craftengine.core.block.ImmutableBlockState;
|
|
||||||
|
|
||||||
import java.util.function.IntConsumer;
|
import java.util.function.IntConsumer;
|
||||||
|
|
||||||
public class PackedIntegerArray implements PaletteStorage {
|
public class PackedIntegerArray implements PaletteStorage {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package net.momirealms.craftengine.mod;
|
package net.momirealms.craftengine.mod;
|
||||||
|
|
||||||
import net.minecraft.world.level.chunk.PalettedContainer;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
|||||||
Reference in New Issue
Block a user