Under Construction

- Train Navigation can no longer approach or pass through stations currently in assembly mode
- Station screen now displays whether trains can be (dis-)assembled
This commit is contained in:
simibubi 2022-04-14 16:02:56 +02:00
parent b970c0029f
commit 3e744db3dd
26 changed files with 247 additions and 52 deletions

View file

@ -543,22 +543,22 @@ bf2b0310500213ff853c748c236eb5d01f61658e assets/create/blockstates/yellow_toolbo
7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json
b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json
7fbb25c577025ff61388c54c43401d8bb80723dd assets/create/lang/en_ud.json
7cd7e879350cbb56393165c24062fda5676466b9 assets/create/lang/en_us.json
10e938a41280ab88265f59b293cf1a19ea012f18 assets/create/lang/unfinished/de_de.json
8b17b8042e844f53bf2ae605c0a7d5b6f9e470ee assets/create/lang/unfinished/es_cl.json
4bc7d56deb76a73fa7af16e21b7a95d00d1c1b3c assets/create/lang/unfinished/es_es.json
200deeabcf50a3d91387f90528154f3d0ebea8a4 assets/create/lang/unfinished/fr_fr.json
d806ae2e13f9415b79ce7c7928c8e93ec93dd9bb assets/create/lang/unfinished/it_it.json
5a0afa8b1ccc8b9dcbd0b0353aed8a3d14398059 assets/create/lang/unfinished/ja_jp.json
b851295ec91158c2f6e4b8433ff13057367c5694 assets/create/lang/unfinished/ko_kr.json
fe7e927998605dfa186b0bed7c179b0a92e5da5b assets/create/lang/unfinished/nl_nl.json
352ef01578bc2fedd31ad95c8f48069ee2714240 assets/create/lang/unfinished/pl_pl.json
bc5bddb12f2b01c034e7bf8619ebc8ea3136a526 assets/create/lang/unfinished/pt_br.json
67a9b9769fe289213f95c9f9680b4fa2922930de assets/create/lang/unfinished/pt_pt.json
38ec533de9f914ca5c8209e31cba9b3e06c734b7 assets/create/lang/unfinished/ro_ro.json
556d68b3d26152f1a3a25a568cd1b98b844c66a6 assets/create/lang/unfinished/ru_ru.json
4239813d57b74da7eb654a66342769e111679729 assets/create/lang/unfinished/zh_cn.json
78ef5f771b4d1bb62dc2d4eca06124d28696e8b2 assets/create/lang/unfinished/zh_tw.json
21a0ec20b110e23e7a44e31117dc5861a5c44b3e assets/create/lang/en_us.json
16f34e19d584fcaa1182f9fdf2cfc98f44547727 assets/create/lang/unfinished/de_de.json
74ab4c2c55ddcb691701e2cefb4602f6d4c3f605 assets/create/lang/unfinished/es_cl.json
077b360ede4375444a4233fc1f466d7fe4f1c3bc assets/create/lang/unfinished/es_es.json
b56fd9dcde4d86625ee7bac054a1930d261abbfe assets/create/lang/unfinished/fr_fr.json
588c9afc4ef58d978ed0de8ea96cf63bb936b776 assets/create/lang/unfinished/it_it.json
b7bcc397c94d218a543c4c9ce92f76a248f53cdf assets/create/lang/unfinished/ja_jp.json
8fdfe59e7b0b03e8eb630e9a11daaa074c332d2c assets/create/lang/unfinished/ko_kr.json
798baf454ac567a2e45b94455c7deee98c68ae77 assets/create/lang/unfinished/nl_nl.json
8a942df61c06c81ca7cb065acb9209ff67a645ff assets/create/lang/unfinished/pl_pl.json
ddbda3b983cd89129b260ea831e5f84c05521156 assets/create/lang/unfinished/pt_br.json
05dc11303c62b5ed0e86297a32c96e3a9f1c3cae assets/create/lang/unfinished/pt_pt.json
55e83bbfa05e4d524a570fa3da522fb6f094242c assets/create/lang/unfinished/ro_ro.json
a12be55cac22714da6c30770b7f966ad04505c15 assets/create/lang/unfinished/ru_ru.json
99846a9c58ba657a3f7b13a35927a05932125e73 assets/create/lang/unfinished/zh_cn.json
7462a0b282e5233f651aaa618d776201d6260968 assets/create/lang/unfinished/zh_tw.json
487a511a01b2a4531fb672f917922312db78f958 assets/create/models/block/acacia_window.json
b48060cba1a382f373a05bf0039054053eccf076 assets/create/models/block/acacia_window_pane_noside.json
3066db1bf03cffa1a9c7fbacf47ae586632f4eb3 assets/create/models/block/acacia_window_pane_noside_alt.json

View file

@ -1419,6 +1419,12 @@
"create.station.disassemble_train": "Disassemble Train",
"create.station.remove_schedule": "Retrieve Schedule",
"create.station.remove_auto_schedule": "Discard Auto-Schedule",
"create.station.no_assembly_diagonal": "Cannot build trains",
"create.station.no_assembly_diagonal_1": "on diagonal tracks",
"create.station.no_assembly_curve": "Cannot build trains",
"create.station.no_assembly_curve_1": "on curved tracks",
"create.station.train_not_aligned": "Cannot disassemble,",
"create.station.train_not_aligned_1": "not all carriages aligned",
"create.train_assembly.too_many_bogeys": "Too many Bogeys attached: %1$s",
"create.train_assembly.frontmost_bogey_at_station": "Frontmost Bogey must be at Station Marker",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1520",
"_": "Missing Localizations: 1526",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1420,6 +1420,12 @@
"create.station.disassemble_train": "UNLOCALIZED: Disassemble Train",
"create.station.remove_schedule": "UNLOCALIZED: Retrieve Schedule",
"create.station.remove_auto_schedule": "UNLOCALIZED: Discard Auto-Schedule",
"create.station.no_assembly_diagonal": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_diagonal_1": "UNLOCALIZED: on diagonal tracks",
"create.station.no_assembly_curve": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_curve_1": "UNLOCALIZED: on curved tracks",
"create.station.train_not_aligned": "UNLOCALIZED: Cannot disassemble,",
"create.station.train_not_aligned_1": "UNLOCALIZED: not all carriages aligned",
"create.train_assembly.too_many_bogeys": "UNLOCALIZED: Too many Bogeys attached: %1$s",
"create.train_assembly.frontmost_bogey_at_station": "UNLOCALIZED: Frontmost Bogey must be at Station Marker",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 531",
"_": "Missing Localizations: 537",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1420,6 +1420,12 @@
"create.station.disassemble_train": "UNLOCALIZED: Disassemble Train",
"create.station.remove_schedule": "UNLOCALIZED: Retrieve Schedule",
"create.station.remove_auto_schedule": "UNLOCALIZED: Discard Auto-Schedule",
"create.station.no_assembly_diagonal": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_diagonal_1": "UNLOCALIZED: on diagonal tracks",
"create.station.no_assembly_curve": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_curve_1": "UNLOCALIZED: on curved tracks",
"create.station.train_not_aligned": "UNLOCALIZED: Cannot disassemble,",
"create.station.train_not_aligned_1": "UNLOCALIZED: not all carriages aligned",
"create.train_assembly.too_many_bogeys": "UNLOCALIZED: Too many Bogeys attached: %1$s",
"create.train_assembly.frontmost_bogey_at_station": "UNLOCALIZED: Frontmost Bogey must be at Station Marker",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 202",
"_": "Missing Localizations: 208",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1420,6 +1420,12 @@
"create.station.disassemble_train": "UNLOCALIZED: Disassemble Train",
"create.station.remove_schedule": "UNLOCALIZED: Retrieve Schedule",
"create.station.remove_auto_schedule": "UNLOCALIZED: Discard Auto-Schedule",
"create.station.no_assembly_diagonal": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_diagonal_1": "UNLOCALIZED: on diagonal tracks",
"create.station.no_assembly_curve": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_curve_1": "UNLOCALIZED: on curved tracks",
"create.station.train_not_aligned": "UNLOCALIZED: Cannot disassemble,",
"create.station.train_not_aligned_1": "UNLOCALIZED: not all carriages aligned",
"create.train_assembly.too_many_bogeys": "UNLOCALIZED: Too many Bogeys attached: %1$s",
"create.train_assembly.frontmost_bogey_at_station": "UNLOCALIZED: Frontmost Bogey must be at Station Marker",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1782",
"_": "Missing Localizations: 1788",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1420,6 +1420,12 @@
"create.station.disassemble_train": "UNLOCALIZED: Disassemble Train",
"create.station.remove_schedule": "UNLOCALIZED: Retrieve Schedule",
"create.station.remove_auto_schedule": "UNLOCALIZED: Discard Auto-Schedule",
"create.station.no_assembly_diagonal": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_diagonal_1": "UNLOCALIZED: on diagonal tracks",
"create.station.no_assembly_curve": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_curve_1": "UNLOCALIZED: on curved tracks",
"create.station.train_not_aligned": "UNLOCALIZED: Cannot disassemble,",
"create.station.train_not_aligned_1": "UNLOCALIZED: not all carriages aligned",
"create.train_assembly.too_many_bogeys": "UNLOCALIZED: Too many Bogeys attached: %1$s",
"create.train_assembly.frontmost_bogey_at_station": "UNLOCALIZED: Frontmost Bogey must be at Station Marker",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1471",
"_": "Missing Localizations: 1477",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1420,6 +1420,12 @@
"create.station.disassemble_train": "UNLOCALIZED: Disassemble Train",
"create.station.remove_schedule": "UNLOCALIZED: Retrieve Schedule",
"create.station.remove_auto_schedule": "UNLOCALIZED: Discard Auto-Schedule",
"create.station.no_assembly_diagonal": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_diagonal_1": "UNLOCALIZED: on diagonal tracks",
"create.station.no_assembly_curve": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_curve_1": "UNLOCALIZED: on curved tracks",
"create.station.train_not_aligned": "UNLOCALIZED: Cannot disassemble,",
"create.station.train_not_aligned_1": "UNLOCALIZED: not all carriages aligned",
"create.train_assembly.too_many_bogeys": "UNLOCALIZED: Too many Bogeys attached: %1$s",
"create.train_assembly.frontmost_bogey_at_station": "UNLOCALIZED: Frontmost Bogey must be at Station Marker",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 197",
"_": "Missing Localizations: 203",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1420,6 +1420,12 @@
"create.station.disassemble_train": "UNLOCALIZED: Disassemble Train",
"create.station.remove_schedule": "UNLOCALIZED: Retrieve Schedule",
"create.station.remove_auto_schedule": "UNLOCALIZED: Discard Auto-Schedule",
"create.station.no_assembly_diagonal": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_diagonal_1": "UNLOCALIZED: on diagonal tracks",
"create.station.no_assembly_curve": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_curve_1": "UNLOCALIZED: on curved tracks",
"create.station.train_not_aligned": "UNLOCALIZED: Cannot disassemble,",
"create.station.train_not_aligned_1": "UNLOCALIZED: not all carriages aligned",
"create.train_assembly.too_many_bogeys": "UNLOCALIZED: Too many Bogeys attached: %1$s",
"create.train_assembly.frontmost_bogey_at_station": "UNLOCALIZED: Frontmost Bogey must be at Station Marker",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 197",
"_": "Missing Localizations: 203",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1420,6 +1420,12 @@
"create.station.disassemble_train": "UNLOCALIZED: Disassemble Train",
"create.station.remove_schedule": "UNLOCALIZED: Retrieve Schedule",
"create.station.remove_auto_schedule": "UNLOCALIZED: Discard Auto-Schedule",
"create.station.no_assembly_diagonal": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_diagonal_1": "UNLOCALIZED: on diagonal tracks",
"create.station.no_assembly_curve": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_curve_1": "UNLOCALIZED: on curved tracks",
"create.station.train_not_aligned": "UNLOCALIZED: Cannot disassemble,",
"create.station.train_not_aligned_1": "UNLOCALIZED: not all carriages aligned",
"create.train_assembly.too_many_bogeys": "UNLOCALIZED: Too many Bogeys attached: %1$s",
"create.train_assembly.frontmost_bogey_at_station": "UNLOCALIZED: Frontmost Bogey must be at Station Marker",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 2135",
"_": "Missing Localizations: 2141",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1420,6 +1420,12 @@
"create.station.disassemble_train": "UNLOCALIZED: Disassemble Train",
"create.station.remove_schedule": "UNLOCALIZED: Retrieve Schedule",
"create.station.remove_auto_schedule": "UNLOCALIZED: Discard Auto-Schedule",
"create.station.no_assembly_diagonal": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_diagonal_1": "UNLOCALIZED: on diagonal tracks",
"create.station.no_assembly_curve": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_curve_1": "UNLOCALIZED: on curved tracks",
"create.station.train_not_aligned": "UNLOCALIZED: Cannot disassemble,",
"create.station.train_not_aligned_1": "UNLOCALIZED: not all carriages aligned",
"create.train_assembly.too_many_bogeys": "UNLOCALIZED: Too many Bogeys attached: %1$s",
"create.train_assembly.frontmost_bogey_at_station": "UNLOCALIZED: Frontmost Bogey must be at Station Marker",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 570",
"_": "Missing Localizations: 576",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1420,6 +1420,12 @@
"create.station.disassemble_train": "UNLOCALIZED: Disassemble Train",
"create.station.remove_schedule": "UNLOCALIZED: Retrieve Schedule",
"create.station.remove_auto_schedule": "UNLOCALIZED: Discard Auto-Schedule",
"create.station.no_assembly_diagonal": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_diagonal_1": "UNLOCALIZED: on diagonal tracks",
"create.station.no_assembly_curve": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_curve_1": "UNLOCALIZED: on curved tracks",
"create.station.train_not_aligned": "UNLOCALIZED: Cannot disassemble,",
"create.station.train_not_aligned_1": "UNLOCALIZED: not all carriages aligned",
"create.train_assembly.too_many_bogeys": "UNLOCALIZED: Too many Bogeys attached: %1$s",
"create.train_assembly.frontmost_bogey_at_station": "UNLOCALIZED: Frontmost Bogey must be at Station Marker",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1382",
"_": "Missing Localizations: 1388",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1420,6 +1420,12 @@
"create.station.disassemble_train": "UNLOCALIZED: Disassemble Train",
"create.station.remove_schedule": "UNLOCALIZED: Retrieve Schedule",
"create.station.remove_auto_schedule": "UNLOCALIZED: Discard Auto-Schedule",
"create.station.no_assembly_diagonal": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_diagonal_1": "UNLOCALIZED: on diagonal tracks",
"create.station.no_assembly_curve": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_curve_1": "UNLOCALIZED: on curved tracks",
"create.station.train_not_aligned": "UNLOCALIZED: Cannot disassemble,",
"create.station.train_not_aligned_1": "UNLOCALIZED: not all carriages aligned",
"create.train_assembly.too_many_bogeys": "UNLOCALIZED: Too many Bogeys attached: %1$s",
"create.train_assembly.frontmost_bogey_at_station": "UNLOCALIZED: Frontmost Bogey must be at Station Marker",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1754",
"_": "Missing Localizations: 1760",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1420,6 +1420,12 @@
"create.station.disassemble_train": "UNLOCALIZED: Disassemble Train",
"create.station.remove_schedule": "UNLOCALIZED: Retrieve Schedule",
"create.station.remove_auto_schedule": "UNLOCALIZED: Discard Auto-Schedule",
"create.station.no_assembly_diagonal": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_diagonal_1": "UNLOCALIZED: on diagonal tracks",
"create.station.no_assembly_curve": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_curve_1": "UNLOCALIZED: on curved tracks",
"create.station.train_not_aligned": "UNLOCALIZED: Cannot disassemble,",
"create.station.train_not_aligned_1": "UNLOCALIZED: not all carriages aligned",
"create.train_assembly.too_many_bogeys": "UNLOCALIZED: Too many Bogeys attached: %1$s",
"create.train_assembly.frontmost_bogey_at_station": "UNLOCALIZED: Frontmost Bogey must be at Station Marker",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 198",
"_": "Missing Localizations: 204",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1420,6 +1420,12 @@
"create.station.disassemble_train": "UNLOCALIZED: Disassemble Train",
"create.station.remove_schedule": "UNLOCALIZED: Retrieve Schedule",
"create.station.remove_auto_schedule": "UNLOCALIZED: Discard Auto-Schedule",
"create.station.no_assembly_diagonal": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_diagonal_1": "UNLOCALIZED: on diagonal tracks",
"create.station.no_assembly_curve": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_curve_1": "UNLOCALIZED: on curved tracks",
"create.station.train_not_aligned": "UNLOCALIZED: Cannot disassemble,",
"create.station.train_not_aligned_1": "UNLOCALIZED: not all carriages aligned",
"create.train_assembly.too_many_bogeys": "UNLOCALIZED: Too many Bogeys attached: %1$s",
"create.train_assembly.frontmost_bogey_at_station": "UNLOCALIZED: Frontmost Bogey must be at Station Marker",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 575",
"_": "Missing Localizations: 581",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1420,6 +1420,12 @@
"create.station.disassemble_train": "UNLOCALIZED: Disassemble Train",
"create.station.remove_schedule": "UNLOCALIZED: Retrieve Schedule",
"create.station.remove_auto_schedule": "UNLOCALIZED: Discard Auto-Schedule",
"create.station.no_assembly_diagonal": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_diagonal_1": "UNLOCALIZED: on diagonal tracks",
"create.station.no_assembly_curve": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_curve_1": "UNLOCALIZED: on curved tracks",
"create.station.train_not_aligned": "UNLOCALIZED: Cannot disassemble,",
"create.station.train_not_aligned_1": "UNLOCALIZED: not all carriages aligned",
"create.train_assembly.too_many_bogeys": "UNLOCALIZED: Too many Bogeys attached: %1$s",
"create.train_assembly.frontmost_bogey_at_station": "UNLOCALIZED: Frontmost Bogey must be at Station Marker",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 197",
"_": "Missing Localizations: 203",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1420,6 +1420,12 @@
"create.station.disassemble_train": "UNLOCALIZED: Disassemble Train",
"create.station.remove_schedule": "UNLOCALIZED: Retrieve Schedule",
"create.station.remove_auto_schedule": "UNLOCALIZED: Discard Auto-Schedule",
"create.station.no_assembly_diagonal": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_diagonal_1": "UNLOCALIZED: on diagonal tracks",
"create.station.no_assembly_curve": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_curve_1": "UNLOCALIZED: on curved tracks",
"create.station.train_not_aligned": "UNLOCALIZED: Cannot disassemble,",
"create.station.train_not_aligned_1": "UNLOCALIZED: not all carriages aligned",
"create.train_assembly.too_many_bogeys": "UNLOCALIZED: Too many Bogeys attached: %1$s",
"create.train_assembly.frontmost_bogey_at_station": "UNLOCALIZED: Frontmost Bogey must be at Station Marker",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 589",
"_": "Missing Localizations: 595",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1420,6 +1420,12 @@
"create.station.disassemble_train": "UNLOCALIZED: Disassemble Train",
"create.station.remove_schedule": "UNLOCALIZED: Retrieve Schedule",
"create.station.remove_auto_schedule": "UNLOCALIZED: Discard Auto-Schedule",
"create.station.no_assembly_diagonal": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_diagonal_1": "UNLOCALIZED: on diagonal tracks",
"create.station.no_assembly_curve": "UNLOCALIZED: Cannot build trains",
"create.station.no_assembly_curve_1": "UNLOCALIZED: on curved tracks",
"create.station.train_not_aligned": "UNLOCALIZED: Cannot disassemble,",
"create.station.train_not_aligned_1": "UNLOCALIZED: not all carriages aligned",
"create.train_assembly.too_many_bogeys": "UNLOCALIZED: Too many Bogeys attached: %1$s",
"create.train_assembly.frontmost_bogey_at_station": "UNLOCALIZED: Frontmost Bogey must be at Station Marker",

View file

@ -374,7 +374,7 @@ public class Navigation {
if (this.destination == null && !simulate)
distanceStartedAt = distance;
if (this.destination == destination)
return 0;
@ -701,10 +701,13 @@ public class Navigation {
}
public void read(CompoundTag tag, TrackGraph graph) {
destination =
tag.contains("Destination") ? graph.getPoint(EdgePointType.STATION, tag.getUUID("Destination")) : null;
destination = graph != null && tag.contains("Destination")
? graph.getPoint(EdgePointType.STATION, tag.getUUID("Destination"))
: null;
if (destination == null)
return;
distanceToDestination = tag.getDouble("DistanceToDestination");
distanceStartedAt = tag.getDouble("DistanceStartedAt");
destinationBehindTrain = tag.getBoolean("BehindTrain");

View file

@ -4,6 +4,7 @@ import java.util.UUID;
import javax.annotation.Nullable;
import com.jozufozu.flywheel.core.PartialModel;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.Create;
import com.simibubi.create.content.logistics.trains.BezierConnection;
@ -20,16 +21,17 @@ import com.simibubi.create.content.logistics.trains.management.edgePoint.signal.
import com.simibubi.create.content.logistics.trains.track.BezierTrackPointLocation;
import com.simibubi.create.content.logistics.trains.track.TrackTileEntity;
import com.simibubi.create.foundation.render.CachedBufferer;
import com.simibubi.create.foundation.render.SuperByteBuffer;
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType;
import com.simibubi.create.foundation.utility.Couple;
import com.simibubi.create.foundation.utility.Iterate;
import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction.Axis;
import net.minecraft.core.Direction.AxisDirection;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils;
@ -37,6 +39,7 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
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;
import net.minecraftforge.api.distmarker.OnlyIn;
@ -52,6 +55,7 @@ public class TrackTargetingBehaviour<T extends TrackEdgePoint> extends TileEntit
private CompoundTag migrationData;
private EdgePointType<T> edgePointType;
private T edgePoint;
private boolean orthogonal;
public TrackTargetingBehaviour(SmartTileEntity te, EdgePointType<T> edgePointType) {
super(te);
@ -60,12 +64,14 @@ public class TrackTargetingBehaviour<T extends TrackEdgePoint> extends TileEntit
targetTrack = BlockPos.ZERO;
id = UUID.randomUUID();
migrationData = null;
orthogonal = false;
}
@Override
public void write(CompoundTag nbt, boolean clientPacket) {
nbt.putUUID("Id", id);
nbt.put("TargetTrack", NbtUtils.writeBlockPos(targetTrack));
nbt.putBoolean("Ortho", orthogonal);
nbt.putBoolean("TargetDirection", targetDirection == AxisDirection.POSITIVE);
if (migrationData != null && !clientPacket)
nbt.put("Migrate", migrationData);
@ -84,6 +90,7 @@ public class TrackTargetingBehaviour<T extends TrackEdgePoint> extends TileEntit
id = nbt.getUUID("Id");
targetTrack = NbtUtils.readBlockPos(nbt.getCompound("TargetTrack"));
targetDirection = nbt.getBoolean("TargetDirection") ? AxisDirection.POSITIVE : AxisDirection.NEGATIVE;
orthogonal = nbt.getBoolean("Ortho");
if (nbt.contains("Migrate"))
migrationData = nbt.getCompound("Migrate");
if (clientPacket)
@ -150,6 +157,15 @@ public class TrackTargetingBehaviour<T extends TrackEdgePoint> extends TileEntit
CompoundTag data = migrationData;
migrationData = null;
{
orthogonal = targetBezier == null;
Vec3 direction = edge.getDirection(node1, node2, true);
int nonZeroComponents = 0;
for (Axis axis : Iterate.axes)
nonZeroComponents += direction.get(axis) != 0 ? 1 : 0;
orthogonal &= nonZeroComponents <= 1;
}
EdgeData signalData = edge.getEdgeData();
if (signalData.hasPoints()) {
for (EdgePointType<?> otherType : EdgePointType.TYPES.values()) {
@ -165,7 +181,7 @@ public class TrackTargetingBehaviour<T extends TrackEdgePoint> extends TileEntit
return null;
otherPoint.tileAdded(tileEntity, front);
id = otherPoint.getId();
tileEntity.setChanged();
tileEntity.notifyUpdate();
return (T) otherPoint;
}
}
@ -180,6 +196,7 @@ public class TrackTargetingBehaviour<T extends TrackEdgePoint> extends TileEntit
point.setLocation(reverseEdge ? loc.edge : loc.edge.swap(), reverseEdge ? loc.position : length - loc.position);
point.tileAdded(tileEntity, front);
loc.graph.addPoint(edgePointType, point);
tileEntity.sendData();
return point;
}
@ -195,6 +212,14 @@ public class TrackTargetingBehaviour<T extends TrackEdgePoint> extends TileEntit
return TYPE;
}
public boolean isOnCurve() {
return targetBezier != null;
}
public boolean isOrthogonal() {
return orthogonal;
}
public boolean hasValidTrack() {
return getTrackBlockState().getBlock() instanceof ITrackBlock;
}
@ -290,10 +315,11 @@ public class TrackTargetingBehaviour<T extends TrackEdgePoint> extends TileEntit
ms.translate(pos.getX(), pos.getY(), pos.getZ());
ITrackBlock track = (ITrackBlock) block;
SuperByteBuffer sbb = CachedBufferer
.partial(track.prepareTrackOverlay(level, pos, trackState, bezier, direction, ms, type), trackState);
sbb.light(LevelRenderer.getLightColor(level, pos));
sbb.renderInto(ms, buffer.getBuffer(RenderType.cutoutMipped()));
PartialModel partial = track.prepareTrackOverlay(level, pos, trackState, bezier, direction, ms, type);
if (partial != null)
CachedBufferer.partial(partial, trackState)
.light(LevelRenderer.getLightColor(level, pos))
.renderInto(ms, buffer.getBuffer(RenderType.cutoutMipped()));
ms.popPose();
}

View file

@ -68,6 +68,7 @@ public class TrackTargetingBlockItem extends BlockItem {
.getSecond() == AxisDirection.POSITIVE;
stackTag.put("SelectedPos", NbtUtils.writeBlockPos(pos));
stackTag.putBoolean("SelectedDirection", front);
stackTag.remove("Bezier");
player.displayClientMessage(Lang.translate("track_target.set"), true);
stack.setTag(stackTag);
return InteractionResult.SUCCESS;

View file

@ -10,44 +10,64 @@ import com.simibubi.create.content.logistics.trains.management.edgePoint.signal.
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
public class GlobalStation extends SingleTileEdgePoint {
public String name;
public WeakReference<Train> nearestTrain;
public boolean assembling;
public GlobalStation() {
name = "Track Station";
nearestTrain = new WeakReference<Train>(null);
}
@Override
public void tileAdded(BlockEntity tile, boolean front) {
super.tileAdded(tile, front);
BlockState state = tile.getBlockState();
assembling =
state != null && state.hasProperty(StationBlock.ASSEMBLING) && state.getValue(StationBlock.ASSEMBLING);
}
@Override
public void read(CompoundTag nbt, boolean migration) {
super.read(nbt, migration);
name = nbt.getString("Name");
assembling = nbt.getBoolean("Assembling");
nearestTrain = new WeakReference<Train>(null);
}
@Override
public void read(FriendlyByteBuf buffer) {
super.read(buffer);
name = buffer.readUtf();
assembling = buffer.readBoolean();
}
@Override
public void write(CompoundTag nbt) {
super.write(nbt);
nbt.putString("Name", name);
nbt.putBoolean("Assembling", assembling);
}
@Override
public void write(FriendlyByteBuf buffer) {
super.write(buffer);
buffer.writeUtf(name);
buffer.writeBoolean(assembling);
}
public boolean canApproachFrom(TrackNode side) {
return isPrimary(side);
return isPrimary(side) && !assembling;
}
@Override
public boolean canNavigateVia(TrackNode side) {
return super.canNavigateVia(side) && !assembling;
}
public void reserveFor(Train train) {

View file

@ -102,12 +102,13 @@ public class StationEditPacket extends TileEntityConfigurationPacket<StationTile
if (station != null && graphLocation != null) {
station.name = name;
Create.RAILWAYS.sync.pointAdded(graphLocation.graph, station);
Create.RAILWAYS.markTracksDirty();
}
Create.RAILWAYS.markTracksDirty();
}
if (!(blockState.getBlock() instanceof StationBlock))
return;
Boolean isAssemblyMode = blockState.getValue(StationBlock.ASSEMBLING);
if (tryAssemble != null) {
if (!isAssemblyMode)
@ -137,6 +138,25 @@ public class StationEditPacket extends TileEntityConfigurationPacket<StationTile
if (nowAssembling)
te.refreshAssemblyInfo();
GlobalStation station = te.getStation();
GraphLocation graphLocation = te.edgePoint.determineGraphLocation();
if (station != null && graphLocation != null) {
station.assembling = nowAssembling;
Create.RAILWAYS.sync.pointAdded(graphLocation.graph, station);
Create.RAILWAYS.markTracksDirty();
if (nowAssembling)
for (Train train : Create.RAILWAYS.sided(level).trains.values()) {
if (train.navigation.destination != station)
continue;
GlobalStation preferredDestination = train.runtime.startCurrentInstruction();
if (preferredDestination != null)
train.navigation.startNavigation(preferredDestination, Double.MAX_VALUE, false);
else
train.navigation.startNavigation(station, Double.MAX_VALUE, false);
}
}
}
private void scheduleDropRequested(ServerPlayer sender, StationTileEntity te) {

View file

@ -19,7 +19,9 @@ import com.simibubi.create.foundation.networking.AllPackets;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
import net.minecraft.ChatFormatting;
import net.minecraft.client.gui.components.EditBox;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.Mth;
@ -72,14 +74,12 @@ public class StationScreen extends AbstractStationScreen {
};
newTrainButton = new WideIconButton(x + 84, y + 65, AllGuiTextures.I_NEW_TRAIN);
newTrainButton.setToolTip(Lang.translate("station.create_train"));
newTrainButton.withCallback(assemblyCallback);
addRenderableWidget(newTrainButton);
disassembleTrainButton = new WideIconButton(x + 94, y + 65, AllGuiTextures.I_DISASSEMBLE_TRAIN);
disassembleTrainButton.active = false;
disassembleTrainButton.visible = false;
disassembleTrainButton.setToolTip(Lang.translate("station.disassemble_train"));
disassembleTrainButton.withCallback(assemblyCallback);
addRenderableWidget(disassembleTrainButton);
@ -116,7 +116,12 @@ public class StationScreen extends AbstractStationScreen {
.length());
trainNameBox.setHighlightPos(trainNameBox.getCursorPosition());
}
super.tick();
updateAssemblyTooltip(te.edgePoint.isOnCurve() ? "no_assembly_curve"
: !te.edgePoint.isOrthogonal() ? "no_assembly_diagonal"
: trainPresent() && !te.trainCanDisassemble ? "train_not_aligned" : null);
}
private void tickTrainDisplay() {
@ -129,7 +134,7 @@ public class StationScreen extends AbstractStationScreen {
}
leavingAnimation = 0;
newTrainButton.active = true;
newTrainButton.active = te.edgePoint.isOrthogonal();
newTrainButton.visible = true;
Train imminentTrain = getImminent();
@ -181,7 +186,7 @@ public class StationScreen extends AbstractStationScreen {
}
boolean trainAtStation = trainPresent();
disassembleTrainButton.active = trainAtStation && te.trainCanDisassemble;
disassembleTrainButton.active = trainAtStation && te.trainCanDisassemble && te.edgePoint.isOrthogonal();
dropScheduleButton.active = te.trainHasSchedule;
if (te.trainHasSchedule)
@ -199,6 +204,22 @@ public class StationScreen extends AbstractStationScreen {
return guiLeft + background.width / 2 - (Math.min(font.width(s), nameBox.getWidth()) + 10) / 2;
}
private void updateAssemblyTooltip(String key) {
if (key == null) {
disassembleTrainButton.setToolTip(Lang.translate("station.disassemble_train"));
newTrainButton.setToolTip(Lang.translate("station.create_train"));
return;
}
for (IconButton ib : new IconButton[] { disassembleTrainButton, newTrainButton }) {
List<Component> toolTip = ib.getToolTip();
toolTip.clear();
toolTip.add(Lang.translate("station." + key)
.withStyle(ChatFormatting.GRAY));
toolTip.add(Lang.translate("station." + key + "_1")
.withStyle(ChatFormatting.GRAY));
}
}
@Override
protected void renderWindow(PoseStack ms, int mouseX, int mouseY, float partialTicks) {
super.renderWindow(ms, mouseX, mouseY, partialTicks);

View file

@ -138,6 +138,7 @@ public class StationTileEntity extends SmartTileEntity {
tag.putInt("FailedCarriageIndex", failedCarriageIndex);
tag.put("HeldItem", autoSchedule.getStackInSlot(0)
.serializeNBT());
super.write(tag, clientPacket);
if (!clientPacket)
@ -315,7 +316,7 @@ public class StationTileEntity extends SmartTileEntity {
}
BlockState potentialBogeyState = level.getBlockState(bogeyOffset.offset(currentPos));
if (potentialBogeyState.getBlock()instanceof IBogeyBlock bogey && bogeyIndex < bogeyLocations.length) {
if (potentialBogeyState.getBlock() instanceof IBogeyBlock bogey && bogeyIndex < bogeyLocations.length) {
bogeyTypes[bogeyIndex] = bogey;
bogeyLocations[bogeyIndex] = i;
bogeyIndex++;
@ -637,7 +638,7 @@ public class StationTileEntity extends SmartTileEntity {
return true;
BlockState target = edgePoint.getTrackBlockState();
if (!(target.getBlock()instanceof ITrackBlock def))
if (!(target.getBlock() instanceof ITrackBlock def))
return false;
Vec3 axis = null;

View file

@ -460,7 +460,8 @@ public class TrackBlock extends Block implements EntityBlock, IWrenchable, ITrac
msr.translate(offset.subtract(Vec3.atBottomCenterOf(pos)));
msr.translate(0, -4 / 16f, 0);
}
} else
return null;
}
if (normal == null) {

View file

@ -643,6 +643,12 @@
"create.station.disassemble_train": "Disassemble Train",
"create.station.remove_schedule": "Retrieve Schedule",
"create.station.remove_auto_schedule": "Discard Auto-Schedule",
"create.station.no_assembly_diagonal": "Cannot build trains",
"create.station.no_assembly_diagonal_1": "on diagonal tracks",
"create.station.no_assembly_curve": "Cannot build trains",
"create.station.no_assembly_curve_1": "on curved tracks",
"create.station.train_not_aligned": "Cannot disassemble,",
"create.station.train_not_aligned_1": "not all carriages aligned",
"create.train_assembly.too_many_bogeys": "Too many Bogeys attached: %1$s",
"create.train_assembly.frontmost_bogey_at_station": "Frontmost Bogey must be at Station Marker",