mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-25 14:36:29 +01:00
Add materials to track graph
This commit is contained in:
parent
726bfaf0b5
commit
fca02ae4bf
13 changed files with 171 additions and 28 deletions
|
@ -265,13 +265,17 @@ public class GlobalRailwayManager {
|
|||
public void clientTick() {
|
||||
if (isTrackGraphDebugActive())
|
||||
for (TrackGraph trackGraph : trackNetworks.values())
|
||||
TrackGraphVisualizer.debugViewGraph(trackGraph);
|
||||
TrackGraphVisualizer.debugViewGraph(trackGraph, isTrackGraphDebugExtended());
|
||||
}
|
||||
|
||||
private static boolean isTrackGraphDebugActive() {
|
||||
return KineticDebugger.isF3DebugModeActive() && AllConfigs.CLIENT.showTrackGraphOnF3.get();
|
||||
}
|
||||
|
||||
private static boolean isTrackGraphDebugExtended() {
|
||||
return AllConfigs.CLIENT.showExtendedTrackGraphOnF3.get();
|
||||
}
|
||||
|
||||
public GlobalRailwayManager sided(LevelAccessor level) {
|
||||
if (level != null && !level.isClientSide())
|
||||
return this;
|
||||
|
|
|
@ -25,6 +25,7 @@ import net.minecraft.resources.ResourceKey;
|
|||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
@ -74,22 +75,42 @@ public interface ITrackBlock {
|
|||
getTrackAxes(world, pos, state).forEach(axis -> {
|
||||
addToListIfConnected(connectedTo, list, (d, b) -> axis.scale(b ? d : -d)
|
||||
.add(center), b -> shape.getNormal(), b -> world instanceof Level l ? l.dimension() : Level.OVERWORLD,
|
||||
axis, null);
|
||||
axis, null, (b, v) -> getMaterialSimple(world, v));
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public static TrackMaterial getMaterialSimple(BlockGetter world, Vec3 pos) {
|
||||
return getMaterialSimple(world, pos, TrackMaterial.ANDESITE);
|
||||
}
|
||||
|
||||
public static TrackMaterial getMaterialSimple(BlockGetter world, Vec3 pos, TrackMaterial defaultMaterial) {
|
||||
if (defaultMaterial == null)
|
||||
defaultMaterial = TrackMaterial.ANDESITE;
|
||||
if (world != null) {
|
||||
Block block = world.getBlockState(new BlockPos(pos)).getBlock();
|
||||
if (block instanceof ITrackBlock track) {
|
||||
return track.getMaterial();
|
||||
}
|
||||
}
|
||||
return defaultMaterial;
|
||||
}
|
||||
|
||||
public static void addToListIfConnected(@Nullable TrackNodeLocation fromEnd, Collection<DiscoveredLocation> list,
|
||||
BiFunction<Double, Boolean, Vec3> offsetFactory, Function<Boolean, Vec3> normalFactory,
|
||||
Function<Boolean, ResourceKey<Level>> dimensionFactory, Vec3 axis, BezierConnection viaTurn) {
|
||||
Function<Boolean, ResourceKey<Level>> dimensionFactory, Vec3 axis, BezierConnection viaTurn, BiFunction<Boolean, Vec3, TrackMaterial> materialFactory) {
|
||||
|
||||
DiscoveredLocation firstLocation =
|
||||
new DiscoveredLocation(dimensionFactory.apply(true), offsetFactory.apply(0.5d, true)).viaTurn(viaTurn)
|
||||
.materialA(materialFactory.apply(true, offsetFactory.apply(0.0d, true)))
|
||||
.materialB(materialFactory.apply(true, offsetFactory.apply(1.0d, true)))
|
||||
.withNormal(normalFactory.apply(true))
|
||||
.withDirection(axis);
|
||||
DiscoveredLocation secondLocation =
|
||||
new DiscoveredLocation(dimensionFactory.apply(false), offsetFactory.apply(0.5d, false)).viaTurn(viaTurn)
|
||||
.materialA(materialFactory.apply(false, offsetFactory.apply(0.0d, false)))
|
||||
.materialB(materialFactory.apply(false, offsetFactory.apply(1.0d, false)))
|
||||
.withNormal(normalFactory.apply(false))
|
||||
.withDirection(axis);
|
||||
|
||||
|
|
|
@ -22,13 +22,19 @@ public class TrackEdge {
|
|||
BezierConnection turn;
|
||||
EdgeData edgeData;
|
||||
boolean interDimensional;
|
||||
TrackMaterial trackMaterial;
|
||||
|
||||
public TrackEdge(TrackNode node1, TrackNode node2, BezierConnection turn) {
|
||||
public TrackEdge(TrackNode node1, TrackNode node2, BezierConnection turn, TrackMaterial trackMaterial) {
|
||||
this.interDimensional = !node1.location.dimension.equals(node2.location.dimension);
|
||||
this.edgeData = new EdgeData(this);
|
||||
this.node1 = node1;
|
||||
this.node2 = node2;
|
||||
this.turn = turn;
|
||||
this.trackMaterial = trackMaterial;
|
||||
}
|
||||
|
||||
public TrackMaterial getTrackMaterial() {
|
||||
return trackMaterial;
|
||||
}
|
||||
|
||||
public boolean isTurn() {
|
||||
|
@ -181,13 +187,15 @@ public class TrackEdge {
|
|||
public CompoundTag write(DimensionPalette dimensions) {
|
||||
CompoundTag baseCompound = isTurn() ? turn.write(BlockPos.ZERO) : new CompoundTag();
|
||||
baseCompound.put("Signals", edgeData.write(dimensions));
|
||||
baseCompound.putString("Material", getTrackMaterial().id.toString());
|
||||
return baseCompound;
|
||||
}
|
||||
|
||||
public static TrackEdge read(TrackNode node1, TrackNode node2, CompoundTag tag, TrackGraph graph,
|
||||
DimensionPalette dimensions) {
|
||||
TrackEdge trackEdge =
|
||||
new TrackEdge(node1, node2, tag.contains("Positions") ? new BezierConnection(tag, BlockPos.ZERO) : null);
|
||||
new TrackEdge(node1, node2, tag.contains("Positions") ? new BezierConnection(tag, BlockPos.ZERO) : null,
|
||||
TrackMaterial.deserialize(tag.getString("Material")));
|
||||
trackEdge.edgeData = EdgeData.read(tag.getCompound("Signals"), trackEdge, graph, dimensions);
|
||||
return trackEdge;
|
||||
}
|
||||
|
|
|
@ -393,14 +393,15 @@ public class TrackGraph {
|
|||
return connectionsFrom.get(nodes.getSecond());
|
||||
}
|
||||
|
||||
public void connectNodes(LevelAccessor reader, TrackNodeLocation location, TrackNodeLocation location2,
|
||||
public void connectNodes(LevelAccessor reader, DiscoveredLocation location, DiscoveredLocation location2,
|
||||
@Nullable BezierConnection turn) {
|
||||
TrackNode node1 = nodes.get(location);
|
||||
TrackNode node2 = nodes.get(location2);
|
||||
|
||||
boolean bezier = turn != null;
|
||||
TrackEdge edge = new TrackEdge(node1, node2, turn);
|
||||
TrackEdge edge2 = new TrackEdge(node2, node1, bezier ? turn.secondary() : null);
|
||||
TrackMaterial material = bezier ? turn.getMaterial() : location2.materialA;
|
||||
TrackEdge edge = new TrackEdge(node1, node2, turn, material);
|
||||
TrackEdge edge2 = new TrackEdge(node2, node1, bezier ? turn.secondary() : null, material);
|
||||
|
||||
for (TrackGraph graph : Create.RAILWAYS.trackNetworks.values()) {
|
||||
for (TrackNode otherNode1 : graph.nodes.values()) {
|
||||
|
|
|
@ -60,7 +60,7 @@ public class TrackGraphSync {
|
|||
public void edgeAdded(TrackGraph graph, TrackNode node1, TrackNode node2, TrackEdge edge) {
|
||||
flushGraphPacket(graph);
|
||||
currentGraphSyncPacket.addedEdges
|
||||
.add(Pair.of(Couple.create(node1.getNetId(), node2.getNetId()), edge.getTurn()));
|
||||
.add(Pair.of(Pair.of(Couple.create(node1.getNetId(), node2.getNetId()), edge.getTrackMaterial()), edge.getTurn()));
|
||||
currentPayload++;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ public class TrackGraphSync {
|
|||
if (currentGraphSyncPacket.addedNodes.remove(nodeId) == null)
|
||||
currentGraphSyncPacket.removedNodes.add(nodeId);
|
||||
currentGraphSyncPacket.addedEdges.removeIf(pair -> {
|
||||
Couple<Integer> ids = pair.getFirst();
|
||||
Couple<Integer> ids = pair.getFirst().getFirst();
|
||||
return ids.getFirst()
|
||||
.intValue() == nodeId
|
||||
|| ids.getSecond()
|
||||
|
@ -156,7 +156,7 @@ public class TrackGraphSync {
|
|||
graph.connectionsByNode.get(node)
|
||||
.forEach((node2, edge) -> {
|
||||
Couple<Integer> key = Couple.create(node.getNetId(), node2.getNetId());
|
||||
currentPacket.addedEdges.add(Pair.of(key, edge.getTurn()));
|
||||
currentPacket.addedEdges.add(Pair.of(Pair.of(key, edge.getTrackMaterial()), edge.getTurn()));
|
||||
currentPacket.syncEdgeData(node, node2, edge);
|
||||
});
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import net.minecraft.world.phys.Vec3;
|
|||
public class TrackGraphSyncPacket extends TrackGraphPacket {
|
||||
|
||||
Map<Integer, Pair<TrackNodeLocation, Vec3>> addedNodes;
|
||||
List<Pair<Couple<Integer>, BezierConnection>> addedEdges;
|
||||
List<Pair<Pair<Couple<Integer>, TrackMaterial>, BezierConnection>> addedEdges;
|
||||
List<Integer> removedNodes;
|
||||
List<TrackEdgePoint> addedEdgePoints;
|
||||
List<UUID> removedEdgePoints;
|
||||
|
@ -79,7 +79,7 @@ public class TrackGraphSyncPacket extends TrackGraphPacket {
|
|||
size = buffer.readVarInt();
|
||||
for (int i = 0; i < size; i++)
|
||||
addedEdges.add(
|
||||
Pair.of(Couple.create(buffer::readVarInt), buffer.readBoolean() ? new BezierConnection(buffer) : null));
|
||||
Pair.of(Pair.of(Couple.create(buffer::readVarInt), TrackMaterial.deserialize(buffer.readUtf())), buffer.readBoolean() ? new BezierConnection(buffer) : null));
|
||||
|
||||
size = buffer.readVarInt();
|
||||
for (int i = 0; i < size; i++)
|
||||
|
@ -134,8 +134,9 @@ public class TrackGraphSyncPacket extends TrackGraphPacket {
|
|||
|
||||
buffer.writeVarInt(addedEdges.size());
|
||||
addedEdges.forEach(pair -> {
|
||||
pair.getFirst()
|
||||
pair.getFirst().getFirst()
|
||||
.forEach(buffer::writeVarInt);
|
||||
buffer.writeUtf(pair.getFirst().getSecond().id.toString());
|
||||
BezierConnection turn = pair.getSecond();
|
||||
buffer.writeBoolean(turn != null);
|
||||
if (turn != null)
|
||||
|
@ -192,13 +193,13 @@ public class TrackGraphSyncPacket extends TrackGraphPacket {
|
|||
graph.loadNode(nodeLocation.getFirst(), nodeId, nodeLocation.getSecond());
|
||||
}
|
||||
|
||||
for (Pair<Couple<Integer>, BezierConnection> pair : addedEdges) {
|
||||
Couple<TrackNode> nodes = pair.getFirst()
|
||||
for (Pair<Pair<Couple<Integer>, TrackMaterial>, BezierConnection> pair : addedEdges) {
|
||||
Couple<TrackNode> nodes = pair.getFirst().getFirst()
|
||||
.map(graph::getNode);
|
||||
TrackNode node1 = nodes.getFirst();
|
||||
TrackNode node2 = nodes.getSecond();
|
||||
if (node1 != null && node2 != null)
|
||||
graph.putConnection(node1, node2, new TrackEdge(node1, node2, pair.getSecond()));
|
||||
graph.putConnection(node1, node2, new TrackEdge(node1, node2, pair.getSecond(), pair.getFirst().getSecond()));
|
||||
}
|
||||
|
||||
for (TrackEdgePoint edgePoint : addedEdgePoints)
|
||||
|
|
|
@ -5,6 +5,15 @@ import java.util.Map;
|
|||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ItemTransforms;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
import net.minecraft.world.item.Items;
|
||||
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import com.simibubi.create.AllKeys;
|
||||
|
@ -209,7 +218,7 @@ public class TrackGraphVisualizer {
|
|||
}
|
||||
}
|
||||
|
||||
public static void debugViewGraph(TrackGraph graph) {
|
||||
public static void debugViewGraph(TrackGraph graph, boolean extended) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
Entity cameraEntity = mc.cameraEntity;
|
||||
if (cameraEntity == null)
|
||||
|
@ -262,6 +271,13 @@ public class TrackGraphVisualizer {
|
|||
|
||||
yOffset = new Vec3(0, (other.hashCode() > hashCode ? 6 : 4) / 16f, 0);
|
||||
if (!edge.isTurn()) {
|
||||
if (extended) {
|
||||
Vec3 materialPos = edge.getPosition(0.5).add(0, 1, 0);
|
||||
CreateClient.OUTLINER.showItem(Pair.of(edge, edge.edgeData), materialPos,
|
||||
new ItemStack(edge.getTrackMaterial().trackBlock.get().get()));
|
||||
CreateClient.OUTLINER.showAABB(edge.edgeData, AABB.ofSize(materialPos, 1, 1, 1))
|
||||
.colored(graph.color);
|
||||
}
|
||||
CreateClient.OUTLINER.showLine(edge, edge.getPosition(0)
|
||||
.add(yOffset),
|
||||
edge.getPosition(1)
|
||||
|
@ -273,6 +289,13 @@ public class TrackGraphVisualizer {
|
|||
|
||||
Vec3 previous = null;
|
||||
BezierConnection turn = edge.getTurn();
|
||||
if (extended) {
|
||||
Vec3 materialPos = edge.getPosition(0.5).add(0, 1, 0);
|
||||
CreateClient.OUTLINER.showItem(Pair.of(edge, edge.edgeData), materialPos,
|
||||
new ItemStack(edge.getTrackMaterial().trackBlock.get().get()));
|
||||
CreateClient.OUTLINER.showAABB(edge.edgeData, AABB.ofSize(materialPos, 1, 1, 1))
|
||||
.colored(graph.color);
|
||||
}
|
||||
for (int i = 0; i <= turn.getSegmentCount(); i++) {
|
||||
Vec3 current = edge.getPosition(i * 1f / turn.getSegmentCount());
|
||||
if (previous != null)
|
||||
|
|
|
@ -24,8 +24,8 @@ public class TrackNodeLocation extends Vec3i {
|
|||
this(vec.x, vec.y, vec.z);
|
||||
}
|
||||
|
||||
public TrackNodeLocation(double p_121865_, double p_121866_, double p_121867_) {
|
||||
super(Math.round(p_121865_ * 2), Math.floor(p_121866_ * 2), Math.round(p_121867_ * 2));
|
||||
public TrackNodeLocation(double x, double y, double z) {
|
||||
super(Math.round(x * 2), Math.floor(y * 2), Math.round(z * 2));
|
||||
}
|
||||
|
||||
public TrackNodeLocation in(Level level) {
|
||||
|
@ -116,9 +116,11 @@ public class TrackNodeLocation extends Vec3i {
|
|||
boolean forceNode = false;
|
||||
Vec3 direction;
|
||||
Vec3 normal;
|
||||
TrackMaterial materialA;
|
||||
TrackMaterial materialB;
|
||||
|
||||
public DiscoveredLocation(Level level, double p_121865_, double p_121866_, double p_121867_) {
|
||||
super(p_121865_, p_121866_, p_121867_);
|
||||
public DiscoveredLocation(Level level, double x, double y, double z) {
|
||||
super(x, y, z);
|
||||
in(level);
|
||||
}
|
||||
|
||||
|
@ -131,6 +133,22 @@ public class TrackNodeLocation extends Vec3i {
|
|||
this(level.dimension(), vec);
|
||||
}
|
||||
|
||||
public DiscoveredLocation materialA(TrackMaterial material) {
|
||||
this.materialA = material;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DiscoveredLocation materialB(TrackMaterial material) {
|
||||
this.materialB = material;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DiscoveredLocation materials(TrackMaterial materialA, TrackMaterial materialB) {
|
||||
this.materialA = materialA;
|
||||
this.materialB = materialB;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DiscoveredLocation viaTurn(BezierConnection turn) {
|
||||
this.turn = turn;
|
||||
if (turn != null)
|
||||
|
@ -165,6 +183,10 @@ public class TrackNodeLocation extends Vec3i {
|
|||
return forceNode;
|
||||
}
|
||||
|
||||
public boolean differentMaterials() {
|
||||
return materialA != materialB;
|
||||
}
|
||||
|
||||
public boolean notInLineWith(Vec3 direction) {
|
||||
return this.direction != null
|
||||
&& Math.max(direction.dot(this.direction), direction.dot(this.direction.scale(-1))) < 7 / 8f;
|
||||
|
|
|
@ -234,6 +234,8 @@ public class TrackPropagator {
|
|||
return true;
|
||||
if (location.shouldForceNode())
|
||||
return true;
|
||||
if (location.differentMaterials())
|
||||
return true;
|
||||
if (next.stream()
|
||||
.anyMatch(DiscoveredLocation::shouldForceNode))
|
||||
return true;
|
||||
|
|
|
@ -391,7 +391,7 @@ public class TrackBlock extends Block
|
|||
(d, b) -> axis.scale(b ? 0 : fromCenter ? -d : d)
|
||||
.add(center),
|
||||
b -> shape.getNormal(), b -> world instanceof Level l ? l.dimension() : Level.OVERWORLD, axis,
|
||||
null);
|
||||
null, (b, v) -> ITrackBlock.getMaterialSimple(world, v));
|
||||
} else
|
||||
list = ITrackBlock.super.getConnected(world, pos, state, linear, connectedTo);
|
||||
|
||||
|
@ -407,7 +407,7 @@ public class TrackBlock extends Block
|
|||
Map<BlockPos, BezierConnection> connections = trackTE.getConnections();
|
||||
connections.forEach((connectedPos, bc) -> ITrackBlock.addToListIfConnected(connectedTo, list,
|
||||
(d, b) -> d == 1 ? Vec3.atLowerCornerOf(bc.tePositions.get(b)) : bc.starts.get(b), bc.normals::get,
|
||||
b -> world instanceof Level l ? l.dimension() : Level.OVERWORLD, null, bc));
|
||||
b -> world instanceof Level l ? l.dimension() : Level.OVERWORLD, null, bc, (b, v) -> ITrackBlock.getMaterialSimple(world, v, bc.getMaterial())));
|
||||
|
||||
if (trackTE.boundLocation == null || !(world instanceof ServerLevel level))
|
||||
return list;
|
||||
|
@ -433,7 +433,7 @@ public class TrackBlock extends Block
|
|||
getTrackAxes(world, pos, state).forEach(axis -> {
|
||||
ITrackBlock.addToListIfConnected(connectedTo, list, (d, b) -> (b ? axis : boundAxis).scale(d)
|
||||
.add(b ? center : boundCenter), b -> (b ? shape : boundShape).getNormal(),
|
||||
b -> b ? level.dimension() : otherLevel.dimension(), axis, null);
|
||||
b -> b ? level.dimension() : otherLevel.dimension(), axis, null, (b, v) -> ITrackBlock.getMaterialSimple(b ? level : otherLevel, v));
|
||||
});
|
||||
|
||||
return list;
|
||||
|
|
|
@ -77,6 +77,7 @@ public class CClient extends ConfigBase {
|
|||
public final ConfigGroup trains = group(1, "trains", Comments.trains);
|
||||
public final ConfigFloat mountedZoomMultiplier = f(3, 0, "mountedZoomMultiplier", Comments.mountedZoomMultiplier);
|
||||
public final ConfigBool showTrackGraphOnF3 = b(false, "showTrackGraphOnF3", Comments.showTrackGraphOnF3);
|
||||
public final ConfigBool showExtendedTrackGraphOnF3 = b(false, "showExtendedTrackGraphOnF3", Comments.showExtendedTrackGraphOnF3);
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
|
@ -147,6 +148,7 @@ public class CClient extends ConfigBase {
|
|||
static String trains = "Railway related settings";
|
||||
static String mountedZoomMultiplier = "How far away the Camera should zoom when seated on a train";
|
||||
static String showTrackGraphOnF3 = "Display nodes and edges of a Railway Network while f3 debug mode is active";
|
||||
static String showExtendedTrackGraphOnF3 = "Additionally display materials of a Rail Network while f3 debug mode is active";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package com.simibubi.create.foundation.utility.outliner;
|
||||
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.simibubi.create.AllSpecialTextures;
|
||||
import com.simibubi.create.foundation.render.RenderTypes;
|
||||
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.block.model.ItemTransforms;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.core.Direction.AxisDirection;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class ItemOutline extends Outline {
|
||||
|
||||
protected Vec3 pos;
|
||||
protected ItemStack stack;
|
||||
|
||||
public ItemOutline(Vec3 pos, ItemStack stack) {
|
||||
this.pos = pos;
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack ms, SuperRenderTypeBuffer buffer, float pt) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
ms.pushPose();
|
||||
|
||||
TransformStack.cast(ms)
|
||||
.translate(pos)
|
||||
.scale(params.alpha);
|
||||
|
||||
mc.getItemRenderer().render(stack, ItemTransforms.TransformType.FIXED, false, ms,
|
||||
buffer, LightTexture.FULL_BRIGHT, OverlayTexture.NO_OVERLAY,
|
||||
mc.getItemRenderer().getModel(stack, null, null, 0));
|
||||
|
||||
ms.popPose();
|
||||
}
|
||||
}
|
|
@ -14,6 +14,7 @@ import com.simibubi.create.foundation.utility.outliner.Outline.OutlineParams;
|
|||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
|
@ -81,6 +82,13 @@ public class Outliner {
|
|||
.getParams();
|
||||
}
|
||||
|
||||
public OutlineParams showItem(Object slot, Vec3 pos, ItemStack stack) {
|
||||
ItemOutline outline = new ItemOutline(pos, stack);
|
||||
OutlineEntry entry = new OutlineEntry(outline);
|
||||
outlines.put(slot, entry);
|
||||
return entry.getOutline().getParams();
|
||||
}
|
||||
|
||||
public void keep(Object slot) {
|
||||
if (outlines.containsKey(slot))
|
||||
outlines.get(slot).ticksTillRemoval = 1;
|
||||
|
|
Loading…
Reference in a new issue