mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-01-27 13:28:00 +01:00
Marking Beziers
- Adjusted station icon positioning on turns
This commit is contained in:
parent
83fbd954cb
commit
8ab66b8da6
2 changed files with 25 additions and 6 deletions
|
@ -9,6 +9,7 @@ import com.jozufozu.flywheel.core.PartialModel;
|
|||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.StructureTransform;
|
||||
import com.simibubi.create.content.logistics.trains.BezierConnection;
|
||||
import com.simibubi.create.content.logistics.trains.DimensionPalette;
|
||||
import com.simibubi.create.content.logistics.trains.GraphLocation;
|
||||
import com.simibubi.create.content.logistics.trains.ITrackBlock;
|
||||
|
@ -19,6 +20,7 @@ import com.simibubi.create.content.logistics.trains.TrackNode;
|
|||
import com.simibubi.create.content.logistics.trains.management.edgePoint.signal.SingleTileEdgePoint;
|
||||
import com.simibubi.create.content.logistics.trains.management.edgePoint.signal.TrackEdgePoint;
|
||||
import com.simibubi.create.content.logistics.trains.track.BezierTrackPointLocation;
|
||||
import com.simibubi.create.content.logistics.trains.track.TrackTileEntity;
|
||||
import com.simibubi.create.content.schematics.SchematicWorld;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||
|
@ -36,6 +38,7 @@ import net.minecraft.core.Direction.AxisDirection;
|
|||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
@ -75,7 +78,7 @@ public class TrackTargetingBehaviour<T extends TrackEdgePoint> extends TileEntit
|
|||
public boolean isSafeNBT() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void write(CompoundTag nbt, boolean clientPacket) {
|
||||
nbt.putUUID("Id", id);
|
||||
|
@ -265,6 +268,21 @@ public class TrackTargetingBehaviour<T extends TrackEdgePoint> extends TileEntit
|
|||
return targetTrack.offset(tileEntity.getBlockPos());
|
||||
}
|
||||
|
||||
public BlockPos getPositionForMapMarker() {
|
||||
BlockPos target = targetTrack.offset(tileEntity.getBlockPos());
|
||||
if (targetBezier != null && getWorld().getBlockEntity(target) instanceof TrackTileEntity tte) {
|
||||
BezierConnection bc = tte.getConnections()
|
||||
.get(targetBezier.curveTarget());
|
||||
if (bc == null)
|
||||
return target;
|
||||
double length = Mth.floor(bc.getLength() * 2);
|
||||
int seg = targetBezier.segment() + 1;
|
||||
double t = seg / length;
|
||||
return new BlockPos(bc.getPosition(t));
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
public AxisDirection getTargetDirection() {
|
||||
return targetDirection;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ import net.minecraft.nbt.CompoundTag;
|
|||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.saveddata.maps.MapDecoration;
|
||||
import net.minecraft.world.level.saveddata.maps.MapItemSavedData;
|
||||
|
@ -52,8 +51,10 @@ public class StationMarker {
|
|||
if (stationOption.isEmpty() || stationOption.get().getStation() == null)
|
||||
return null;
|
||||
|
||||
String name = stationOption.get().getStation().name;
|
||||
return new StationMarker(pos, TileEntityBehaviour.get(stationOption.get(), TrackTargetingBehaviour.TYPE).getGlobalPosition(), new TextComponent(name));
|
||||
String name = stationOption.get()
|
||||
.getStation().name;
|
||||
return new StationMarker(pos, TileEntityBehaviour.get(stationOption.get(), TrackTargetingBehaviour.TYPE)
|
||||
.getPositionForMapMarker(), new TextComponent(name));
|
||||
}
|
||||
|
||||
public CompoundTag save() {
|
||||
|
@ -144,13 +145,13 @@ public class StationMarker {
|
|||
Font font = Minecraft.getInstance().font;
|
||||
Component component = getName();
|
||||
float f6 = (float)font.width(component);
|
||||
float f7 = Mth.clamp(25.0F / f6, 0.0F, 6.0F / 9.0F);
|
||||
// float f7 = Mth.clamp(25.0F / f6, 0.0F, 6.0F / 9.0F);
|
||||
ms.pushPose();
|
||||
//ms.translate((double)(0.0F + (float)getX() / 2.0F + 64.0F / 2.0F), (double)(0.0F + (float)getY() / 2.0F + 64.0F + 4.0F), (double)-0.025F);
|
||||
ms.translate(0, 6.0D, -0.005F);
|
||||
|
||||
ms.scale(0.8f, 0.8f, 1.0F);
|
||||
ms.translate(-f6 / 2f, 0, 0);
|
||||
ms.translate(-f6 / 2f + .5f, 0, 0);
|
||||
//ms.scale(f7, f7, 1.0F);
|
||||
font.drawInBatch(component, 0.0F, 0.0F, -1, false, ms.last().pose(), bufferSource, false, Integer.MIN_VALUE, 15728880);
|
||||
ms.popPose();
|
||||
|
|
Loading…
Reference in a new issue