mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-28 19:39:11 +00:00
完善entity-renderer选项
This commit is contained in:
@@ -3,6 +3,7 @@ package net.momirealms.craftengine.bukkit.compatibility.model.bettermodel;
|
||||
import kr.toxicity.model.api.BetterModel;
|
||||
import kr.toxicity.model.api.data.renderer.ModelRenderer;
|
||||
import kr.toxicity.model.api.tracker.DummyTracker;
|
||||
import kr.toxicity.model.api.tracker.TrackerModifier;
|
||||
import net.momirealms.craftengine.core.block.entity.render.element.BlockEntityElement;
|
||||
import net.momirealms.craftengine.core.entity.player.Player;
|
||||
import net.momirealms.craftengine.core.world.BlockPos;
|
||||
@@ -27,7 +28,11 @@ public class BetterModelBlockEntityElement implements BlockEntityElement {
|
||||
if (modelRenderer == null) {
|
||||
return null;
|
||||
} else {
|
||||
return modelRenderer.create(this.location);
|
||||
return modelRenderer.create(this.location, TrackerModifier.builder()
|
||||
.viewRange(this.config.viewRange())
|
||||
.sightTrace(this.config.sightTrace())
|
||||
.shadow(this.config.shadow())
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ 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;
|
||||
@@ -15,28 +16,52 @@ 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) {
|
||||
public BetterModelBlockEntityElementConfig(String model,
|
||||
Vector3f position,
|
||||
float yaw,
|
||||
float pitch,
|
||||
float viewRange,
|
||||
boolean sightTrace,
|
||||
boolean shadow) {
|
||||
this.pitch = pitch;
|
||||
this.position = position;
|
||||
this.yaw = yaw;
|
||||
this.model = model;
|
||||
this.viewRange = viewRange;
|
||||
this.sightTrace = sightTrace;
|
||||
this.shadow = shadow;
|
||||
}
|
||||
|
||||
public String model() {
|
||||
return model;
|
||||
return this.model;
|
||||
}
|
||||
|
||||
public float pitch() {
|
||||
return pitch;
|
||||
return this.pitch;
|
||||
}
|
||||
|
||||
public Vector3f position() {
|
||||
return position;
|
||||
return this.position;
|
||||
}
|
||||
|
||||
public float yaw() {
|
||||
return yaw;
|
||||
return this.yaw;
|
||||
}
|
||||
|
||||
public float viewRange() {
|
||||
return this.viewRange;
|
||||
}
|
||||
|
||||
public boolean sightTrace() {
|
||||
return this.sightTrace;
|
||||
}
|
||||
|
||||
public boolean shadow() {
|
||||
return this.shadow;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -59,7 +84,10 @@ public class BetterModelBlockEntityElementConfig implements BlockEntityElementCo
|
||||
model,
|
||||
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("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")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public class ItemDisplayBlockEntityElementConfig implements BlockEntityElementCo
|
||||
if (previousRotation.x != 0 || previousRotation.y != 0 || previousRotation.z != 0 || previousRotation.w != 1) {
|
||||
return null;
|
||||
}
|
||||
return new ItemDisplayBlockEntityElement(this, pos, previous.entityId, previous.config.yRot != this.yRot || !previous.config.position.equals(this.position));
|
||||
return new ItemDisplayBlockEntityElement(this, pos, previous.entityId, previous.config.yRot != this.yRot || previous.config.xRot != this.xRot || !previous.config.position.equals(this.position));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -72,7 +72,7 @@ public class TextDisplayBlockEntityElementConfig implements BlockEntityElementCo
|
||||
if (previousRotation.x != 0 || previousRotation.y != 0 || previousRotation.z != 0 || previousRotation.w != 1) {
|
||||
return null;
|
||||
}
|
||||
return new TextDisplayBlockEntityElement(this, pos, previous.entityId, previous.config.yRot != this.yRot || !previous.config.position.equals(this.position));
|
||||
return new TextDisplayBlockEntityElement(this, pos, previous.entityId, previous.config.yRot != this.yRot || previous.config.xRot != this.xRot || !previous.config.position.equals(this.position));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,7 +4,6 @@ import net.momirealms.craftengine.core.block.ImmutableBlockState;
|
||||
import net.momirealms.craftengine.core.item.context.BlockPlaceContext;
|
||||
import net.momirealms.craftengine.core.util.Direction;
|
||||
import net.momirealms.craftengine.core.util.HorizontalDirection;
|
||||
import net.momirealms.craftengine.core.util.MiscUtils;
|
||||
import net.momirealms.craftengine.core.util.SegmentedAngle;
|
||||
import net.momirealms.sparrow.nbt.Tag;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
Reference in New Issue
Block a user