mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-28 11:29:17 +00:00
item data防呆设计
This commit is contained in:
@@ -37,8 +37,9 @@ dependencies {
|
||||
compileOnly("com.infernalsuite.asp:api:4.0.0-SNAPSHOT")
|
||||
// ModelEngine
|
||||
compileOnly("com.ticxo.modelengine:ModelEngine:R4.0.8")
|
||||
// BetterModels
|
||||
compileOnly("io.github.toxicity188:BetterModel:1.7.0")
|
||||
// BetterModel
|
||||
compileOnly("io.github.toxicity188:bettermodel:1.14.0")
|
||||
compileOnly("com.mojang:authlib:${rootProject.properties["authlib_version"]}")
|
||||
// MMOItems
|
||||
compileOnly("net.Indyuce:MMOItems-API:6.10-SNAPSHOT")
|
||||
compileOnly("io.lumine:MythicLib-dist:1.6.2-SNAPSHOT")
|
||||
|
||||
@@ -24,14 +24,12 @@ public class BetterModelBlockEntityElement implements BlockEntityElement {
|
||||
}
|
||||
|
||||
private DummyTracker createDummyTracker() {
|
||||
ModelRenderer modelRenderer = BetterModel.plugin().modelManager().renderer(this.config.model());
|
||||
ModelRenderer modelRenderer = BetterModel.plugin().modelManager().model(this.config.model());
|
||||
if (modelRenderer == null) {
|
||||
return null;
|
||||
} else {
|
||||
return modelRenderer.create(this.location, TrackerModifier.builder()
|
||||
.viewRange(this.config.viewRange())
|
||||
.sightTrace(this.config.sightTrace())
|
||||
.shadow(this.config.shadow())
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import net.momirealms.craftengine.core.block.entity.render.element.BlockEntityEl
|
||||
import net.momirealms.craftengine.core.util.ResourceConfigUtils;
|
||||
import net.momirealms.craftengine.core.world.BlockPos;
|
||||
import net.momirealms.craftengine.core.world.World;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -16,24 +15,18 @@ public class BetterModelBlockEntityElementConfig implements BlockEntityElementCo
|
||||
private final float yaw;
|
||||
private final float pitch;
|
||||
private final String model;
|
||||
private final float viewRange;
|
||||
private final boolean sightTrace;
|
||||
private final boolean shadow;
|
||||
|
||||
public BetterModelBlockEntityElementConfig(String model,
|
||||
Vector3f position,
|
||||
float yaw,
|
||||
float pitch,
|
||||
float viewRange,
|
||||
boolean sightTrace,
|
||||
boolean shadow) {
|
||||
boolean sightTrace) {
|
||||
this.pitch = pitch;
|
||||
this.position = position;
|
||||
this.yaw = yaw;
|
||||
this.model = model;
|
||||
this.viewRange = viewRange;
|
||||
this.sightTrace = sightTrace;
|
||||
this.shadow = shadow;
|
||||
}
|
||||
|
||||
public String model() {
|
||||
@@ -52,18 +45,10 @@ public class BetterModelBlockEntityElementConfig implements BlockEntityElementCo
|
||||
return this.yaw;
|
||||
}
|
||||
|
||||
public float viewRange() {
|
||||
return this.viewRange;
|
||||
}
|
||||
|
||||
public boolean sightTrace() {
|
||||
return this.sightTrace;
|
||||
}
|
||||
|
||||
public boolean shadow() {
|
||||
return this.shadow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BetterModelBlockEntityElement create(World world, BlockPos pos) {
|
||||
return new BetterModelBlockEntityElement(world, pos, this);
|
||||
@@ -85,9 +70,7 @@ public class BetterModelBlockEntityElementConfig implements BlockEntityElementCo
|
||||
ResourceConfigUtils.getAsVector3f(arguments.getOrDefault("position", 0.5f), "position"),
|
||||
ResourceConfigUtils.getAsFloat(arguments.getOrDefault("yaw", 0f), "yaw"),
|
||||
ResourceConfigUtils.getAsFloat(arguments.getOrDefault("pitch", 0f), "pitch"),
|
||||
ResourceConfigUtils.getAsFloat(arguments.getOrDefault("view-range", (float) Bukkit.getViewDistance() / 4.0F), "view-range"),
|
||||
ResourceConfigUtils.getAsBoolean(arguments.getOrDefault("sight-trace", true), "sight-trace"),
|
||||
ResourceConfigUtils.getAsBoolean(arguments.getOrDefault("shadow", true), "shadow")
|
||||
ResourceConfigUtils.getAsBoolean(arguments.getOrDefault("sight-trace", true), "sight-trace")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.bukkit.entity.Entity;
|
||||
public class BetterModelUtils {
|
||||
|
||||
public static void bindModel(Entity base, String id) {
|
||||
ModelRenderer renderer = BetterModel.plugin().modelManager().renderer(id);
|
||||
ModelRenderer renderer = BetterModel.plugin().modelManager().model(id);
|
||||
if (renderer == null) {
|
||||
throw new NullPointerException("Could not find BetterModel blueprint " + id);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ public final class ItemDataModifiers {
|
||||
public static final Key CUSTOM_NAME = Key.of("craftengine:custom-name");
|
||||
public static final Key CUSTOM_MODEL_DATA = Key.of("craftengine:custom-model-data");
|
||||
public static final Key COMPONENTS = Key.of("craftengine:components");
|
||||
public static final Key COMPONENT = Key.of("craftengine:component");
|
||||
public static final Key ATTRIBUTE_MODIFIERS = Key.of("craftengine:attribute-modifiers");
|
||||
public static final Key ATTRIBUTES = Key.of("craftengine:attributes");
|
||||
public static final Key ARGUMENTS = Key.of("craftengine:arguments");
|
||||
@@ -37,6 +38,7 @@ public final class ItemDataModifiers {
|
||||
public static final Key OVERWRITABLE_ITEM_NAME = Key.of("craftengine:overwritable-item-name");
|
||||
public static final Key JUKEBOX_PLAYABLE = Key.of("craftengine:jukebox-playable");
|
||||
public static final Key REMOVE_COMPONENTS = Key.of("craftengine:remove-components");
|
||||
public static final Key REMOVE_COMPONENT = Key.of("craftengine:remove-component");
|
||||
public static final Key TAGS = Key.of("craftengine:tags");
|
||||
public static final Key NBT = Key.of("craftengine:nbt");
|
||||
public static final Key TOOLTIP_STYLE = Key.of("craftengine:tooltip-style");
|
||||
@@ -84,7 +86,9 @@ public final class ItemDataModifiers {
|
||||
register(ITEM_NAME, ItemNameModifier.FACTORY);
|
||||
register(DISPLAY_NAME, ItemNameModifier.FACTORY);
|
||||
register(COMPONENTS, ComponentsModifier.FACTORY);
|
||||
register(COMPONENT, ComponentsModifier.FACTORY);
|
||||
register(REMOVE_COMPONENTS, RemoveComponentModifier.FACTORY);
|
||||
register(REMOVE_COMPONENT, RemoveComponentModifier.FACTORY);
|
||||
register(FOOD, FoodModifier.FACTORY);
|
||||
register(MAX_DAMAGE, MaxDamageModifier.FACTORY);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user