Skip to content

Commit

Permalink
1.19.2 Port
Browse files Browse the repository at this point in the history
  • Loading branch information
MisterJulsen committed Oct 12, 2024
1 parent 6083a89 commit 78ce181
Show file tree
Hide file tree
Showing 325 changed files with 21,915 additions and 13,366 deletions.
34 changes: 22 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,38 @@
# Create Railways Navigator (Minecraft Create Mod Addon)
![Logo](https://github.com/MisterJulsen/Create-Train-Navigator/blob/1.19.2/icon_256px.png)
# 🚅 Create Railways Navigator (Minecraft Create Mod Addon)
![Logo](https://github.com/user-attachments/assets/2ee05cf6-c816-4dd7-8c24-6bb05062758e)

Get a list possible train connections in your world from one station to another using the Create Railways Navigator.

[![Discord](https://i.imgur.com/YnDoeHs.png)](https://discord.gg/AeSbNgvc7f)
[![Modrinth](https://i.imgur.com/uLIB4gb.png)](https://modrinth.com/mod/create-railways-navigator)
[![CurseForge](https://i.imgur.com/XZYlGVF.png)](https://www.curseforge.com/minecraft/mc-mods/create-railways-navigator)

## Dependencies
## 📚 Dependencies
This mod requires the Minecraft [Create Mod v0.5.1e](https://www.curseforge.com/minecraft/mc-mods/create) or newer for [Minecraft Forge](https://files.minecraftforge.net) or later. This mod also uses [DragonLib](https://www.curseforge.com/minecraft/mc-mods/dragonlib), which is already embedded into the built jar, so you don't have to install it manually.

## Features
## Features
This mod adds a new item, the Create Railways Navigator, which is inspired by the [DB Navigator](https://de.wikipedia.org/wiki/DB_Navigator) (an app in Germany where, among other things, you can get possible train connections). Like this app, the navigator in this mod is intended to suggest possible train connections for trains from the Create Mod in your Minecraft world. Various customization options allow you to specify which track stations should be treated as a single station and how your navigation results should be filtered and sorted so that you always receive the best possible route suggestions.

## Supported Languages
- English (100%)
- German (100%)
- Dutch (100%) (by TheSatanicFlame)
- Polish (100%) (by Slasherss)

## **Please note!**
## 🗣️ Supported Languages
- English
- German
- Dutch (by TheSatanicFlame)
- Polish (by Slasherss)
- Chinese (simplified) (by Mingshuai Zhu, iaddda)
- Saxon (DE) (by PULZ418)
- Bavarian (DE)
- Spanish (by albertosaurio65)
- Russian (by VGamerGroup)
- French (by GeoffreyGx)
- Portuguese (by AlfredoProgramer)
- Korean (by queso-gato1355)
- Swedish (by Geoffrey)


## ⚠️ **Please note!**
To protect your world from damage, you should always create a backup of your world before installing an update of this mod. Alpha versions in particular may contain critical bugs!

## **Dependencies**
## 🐉 **Dependencies**
This mod uses **DragonLib** as a library mod that contains useful code shared accross all my mods. DragonLib is embedded in all builds of Create Railways Navigator since version `0.2.0-beta-1.18.2`, so you don't need to install DragonLib manually. If you are developer and are interested in this library you can find more information about it on [GitHub](https://github.com/MisterJulsen/MC-DragonLib "DragonLib on GitHub").

[![DragonLib](https://i.imgur.com/4d8BF5J.png)](https://github.com/MisterJulsen/MC-DragonLib "DragonLib on GitHub")
2 changes: 2 additions & 0 deletions common/src/main/java/de/mrjulsen/crn/CRNPlatformSpecific.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ public static void registerConfig() {
throw new AssertionError();
}


@ExpectPlatform
public static GlobalStation getStationFromBlockEntity(BlockEntity be) {
throw new AssertionError();
}

}
23 changes: 20 additions & 3 deletions common/src/main/java/de/mrjulsen/crn/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,25 @@ public class Constants {
public static final Component TEXT_FALSE = TextUtils.translate("gui." + CreateRailwaysNavigator.MOD_ID + ".common.false");
public static final Component TEXT_SERVER_ERROR = TextUtils.translate("gui." + CreateRailwaysNavigator.MOD_ID + ".common.server_error");
public static final Component TEXT_SEARCH = TextUtils.translate("gui." + CreateRailwaysNavigator.MOD_ID + ".common.search");
public static final UUID ZERO_UUID = UUID.fromString("00000000-0000-0000-0000-000000000000");
public static final Component TEXT_HELP = TextUtils.translate("gui." + CreateRailwaysNavigator.MOD_ID + ".common.help");
public static final UUID ZERO_UUID = new UUID(0, 0);
public static final int[] DEFAULT_TRAIN_TYPE_COLORS = new int[] { 0xFF393939, 0xFFf0f3f5, 0xFFafb4bb, 0xFF878c96, 0xFF2a7230, 0xFF814997, 0xFF1455c0, 0xFFa9455d, 0xFF55b9e6, 0xFFffd800 };

public static final int COLOR_ON_TIME = 0x1AEA5F;
public static final int COLOR_DELAYED = 0xFF4242;
public static final int COLOR_ON_TIME = 0xFF1AEA5F;
public static final int COLOR_DELAYED = 0xFFFF4242;
public static final int COLOR_TRAIN_BACKGROUND = 0xFF393939;

public static final String GITHUB_WIKI = "https://github.com/MisterJulsen/Create-Train-Navigator/wiki/";
public static final String HELP_PAGE_ADVANCED_DISPLAYS = GITHUB_WIKI + "Advanced-Displays";
public static final String HELP_PAGE_DYNAMIC_DELAYS = GITHUB_WIKI + "Dynamic-Delays";
public static final String HELP_PAGE_GLOBAL_SETTINGS = GITHUB_WIKI + "Global-Settings";
public static final String HELP_PAGE_NAVIGATION_WARNING = GITHUB_WIKI + "Navigation-Warning";
public static final String HELP_PAGE_SCHEDULE_SECTIONS = GITHUB_WIKI + "Train-Schedule-Sections";
public static final String HELP_PAGE_SCHEDULED_TIMES_AND_REAL_TIME = GITHUB_WIKI + "Scheduled-Time-and-Real-Time";
public static final String HELP_PAGE_STATION_BLACKLIST = GITHUB_WIKI + "Station-Blacklist";
public static final String HELP_PAGE_STATION_TAGS = GITHUB_WIKI + "Station-Tags";
public static final String HELP_PAGE_TRAIN_BLACKLIST = GITHUB_WIKI + "Train-Blacklist";
public static final String HELP_PAGE_TRAIN_GROUPS = GITHUB_WIKI + "Train-Groups";
public static final String HELP_PAGE_TRAIN_INITIALIZATION = GITHUB_WIKI + "Train-Imnitialization";
public static final String HELP_PAGE_TRAIN_LINES = GITHUB_WIKI + "Train-Lines";
}
80 changes: 35 additions & 45 deletions common/src/main/java/de/mrjulsen/crn/CreateRailwaysNavigator.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,23 @@
import com.simibubi.create.foundation.item.TooltipHelper.Palette;

import de.mrjulsen.crn.block.AdvancedDisplayBlock;
import de.mrjulsen.crn.event.ClientEvents;
import de.mrjulsen.crn.event.ModEvents;
import de.mrjulsen.crn.event.CRNClientEventsRegistryEvent;
import de.mrjulsen.crn.event.CRNEventsManager;
import de.mrjulsen.crn.event.ModClientEvents;
import de.mrjulsen.crn.event.ModCommonEvents;
import de.mrjulsen.crn.network.packets.cts.AdvancedDisplayUpdatePacket;
import de.mrjulsen.crn.network.packets.cts.GlobalSettingsRequestPacket;
import de.mrjulsen.crn.network.packets.cts.GlobalSettingsUpdatePacket;
import de.mrjulsen.crn.network.packets.cts.NavigationRequestPacket;
import de.mrjulsen.crn.network.packets.cts.NearestStationRequestPacket;
import de.mrjulsen.crn.network.packets.cts.NextConnectionsRequestPacket;
import de.mrjulsen.crn.network.packets.cts.RealtimeRequestPacket;
import de.mrjulsen.crn.network.packets.cts.TrackStationsRequestPacket;
import de.mrjulsen.crn.network.packets.cts.TrainDataRequestPacket;
import de.mrjulsen.crn.network.packets.stc.GlobalSettingsResponsePacket;
import de.mrjulsen.crn.network.packets.stc.NavigationResponsePacket;
import de.mrjulsen.crn.network.packets.stc.NearestStationResponsePacket;
import de.mrjulsen.crn.network.packets.stc.NextConnectionsResponsePacket;
import de.mrjulsen.crn.network.packets.stc.RealtimeResponsePacket;
import de.mrjulsen.crn.network.packets.stc.ServerErrorPacket;
import de.mrjulsen.crn.network.packets.stc.TimeCorrectionPacket;
import de.mrjulsen.crn.network.packets.stc.TrackStationResponsePacket;
import de.mrjulsen.crn.network.packets.stc.TrainDataResponsePacket;
import de.mrjulsen.crn.registry.ModAccessorTypes;
import de.mrjulsen.crn.registry.ModBlockEntities;
import de.mrjulsen.crn.registry.ModBlocks;
import de.mrjulsen.crn.registry.ModDisplayTypes;
import de.mrjulsen.crn.registry.ModExtras;
import de.mrjulsen.crn.registry.ModItems;
import de.mrjulsen.crn.registry.ModSchedule;
import de.mrjulsen.crn.registry.ModTrainStatusInfos;
import de.mrjulsen.mcdragonlib.net.NetworkManagerBase;
import dev.architectury.platform.Platform;
import dev.architectury.utils.Env;
import net.fabricmc.api.EnvType;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
Expand All @@ -47,7 +37,11 @@
public final class CreateRailwaysNavigator {

public static final String MOD_ID = "createrailwaysnavigator";
public static final String SHORT_MOD_ID = "crn";
public static final Logger LOGGER = LogUtils.getLogger();

public static final String DISCORD = "https://discord.gg/hH7YxTrPpk";
public static final String GITHUB = "https://github.com/MisterJulsen/Create-Train-Navigator";

public static final CreateRegistrate REGISTRATE = CreateRegistrate.create(MOD_ID);

Expand All @@ -69,52 +63,48 @@ public static KineticStats create(Item item) {
return null;
}



private static NetworkManagerBase crnNet;



public static void load() {}

public static void init() {

ModBlocks.register();
ModItems.register();
ModBlockEntities.register();
ModExtras.register();
ModBlocks.init();
ModItems.init();
ModBlockEntities.init();
ModExtras.init();
ModSchedule.init();
ModAccessorTypes.init();
ModTrainStatusInfos.init();
ModDisplayTypes.init();

crnNet = new NetworkManagerBase(MOD_ID, "crn_network", List.of(
// cts
GlobalSettingsRequestPacket.class,
GlobalSettingsUpdatePacket.class,
NavigationRequestPacket.class,
NearestStationRequestPacket.class,
NextConnectionsRequestPacket.class,
RealtimeRequestPacket.class,
TrackStationsRequestPacket.class,
TrainDataRequestPacket.class,
AdvancedDisplayUpdatePacket.class,

// stc
GlobalSettingsResponsePacket.class,
NavigationResponsePacket.class,
NearestStationResponsePacket.class,
NextConnectionsResponsePacket.class,
RealtimeResponsePacket.class,
ServerErrorPacket.class,
TrackStationResponsePacket.class,
TrainDataResponsePacket.class,
TimeCorrectionPacket.class
ServerErrorPacket.class
));

CRNPlatformSpecific.registerConfig();

ModEvents.init();
if (Platform.getEnvironment() == Env.CLIENT) {
ClientEvents.init();
ModCommonEvents.init();
if (Platform.getEnv() == EnvType.CLIENT) {
ModClientEvents.init();
}

CRNEventsManager.getEvent(CRNClientEventsRegistryEvent.class).register(MOD_ID, () -> {
});

}

public static NetworkManagerBase net() {
return crnNet;
}

public static boolean isDebug() {
return Platform.isDevelopmentEnvironment();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import com.simibubi.create.foundation.block.IBE;
import com.simibubi.create.foundation.utility.Iterate;

import de.mrjulsen.crn.block.be.AdvancedDisplayBlockEntity;
import de.mrjulsen.crn.block.blockentity.AdvancedDisplayBlockEntity;
import de.mrjulsen.crn.block.blockentity.AdvancedDisplayBlockEntity.EUpdateReason;
import de.mrjulsen.crn.client.ClientWrapper;
import de.mrjulsen.crn.registry.ModBlockEntities;
import de.mrjulsen.mcdragonlib.client.ber.IBlockEntityRendererInstance.EUpdateReason;
import de.mrjulsen.mcdragonlib.data.Pair;
import de.mrjulsen.mcdragonlib.data.Tripple;
import net.minecraft.core.BlockPos;
Expand Down Expand Up @@ -46,6 +46,7 @@
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.material.MaterialColor;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.ticks.LevelTickAccess;

Expand All @@ -57,7 +58,7 @@ public abstract class AbstractAdvancedDisplayBlock extends Block implements IWre
public static final BooleanProperty DOWN = BooleanProperty.create("down");

public AbstractAdvancedDisplayBlock(Properties properties) {
super(properties);
super(properties.color(MaterialColor.METAL));

this.registerDefaultState(this.stateDefinition.any()
.setValue(UP, false)
Expand Down Expand Up @@ -157,7 +158,7 @@ public void onPlace(BlockState pState, Level pLevel, BlockPos pPos, BlockState p
updateNeighbours(pState, pLevel, pPos);

if (pLevel.isClientSide) {
withBlockEntityDo(pLevel, pPos, be -> be.getController().getRenderer().update(pLevel, pPos, pState, be, EUpdateReason.BLOCK_CHANGED));
withBlockEntityDo(pLevel, pPos, be -> be.getController().getRenderer().update(pLevel, pPos, pState, be, EUpdateReason.LAYOUT_CHANGED));
}
}

Expand Down Expand Up @@ -312,7 +313,7 @@ public InteractionResult use(BlockState pState, Level pLevel, BlockPos pPos, Pla
});

if (pLevel.isClientSide) {
blockEntity.getRenderer().update(pLevel, pPos, pState, blockEntity, EUpdateReason.BLOCK_CHANGED);
blockEntity.getRenderer().update(pLevel, pPos, pState, blockEntity, EUpdateReason.LAYOUT_CHANGED);
}

return InteractionResult.SUCCESS;
Expand All @@ -327,7 +328,7 @@ public InteractionResult use(BlockState pState, Level pLevel, BlockPos pPos, Pla
});

if (pLevel.isClientSide) {
blockEntity.getRenderer().update(pLevel, pPos, pState, blockEntity, EUpdateReason.BLOCK_CHANGED);
blockEntity.getRenderer().update(pLevel, pPos, pState, blockEntity, EUpdateReason.LAYOUT_CHANGED);
}

return InteractionResult.SUCCESS;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.mrjulsen.crn.block;

import de.mrjulsen.crn.data.ESide;
import de.mrjulsen.crn.block.properties.ESide;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public Tripple<Float, Float, Float> getRenderRotation(Level level, BlockState bl
return Tripple.of(0.0F, 0.0F, 0.0F);
}


@Override
public boolean isSingleLined() {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.util.Map;
import java.util.Objects;

import de.mrjulsen.crn.data.EBlockAlignment;
import de.mrjulsen.crn.block.properties.EBlockAlignment;
import de.mrjulsen.mcdragonlib.data.Pair;
import de.mrjulsen.mcdragonlib.data.Tripple;
import net.minecraft.core.BlockPos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.util.Map;
import java.util.Objects;

import de.mrjulsen.crn.data.EBlockAlignment;
import de.mrjulsen.crn.block.properties.EBlockAlignment;
import de.mrjulsen.mcdragonlib.data.Pair;
import de.mrjulsen.mcdragonlib.data.Tripple;
import net.minecraft.core.BlockPos;
Expand Down Expand Up @@ -82,7 +82,7 @@ public class AdvancedDisplayHalfPanelBlock extends AbstractAdvancedSidedDisplayB

public AdvancedDisplayHalfPanelBlock(Properties properties) {
super(properties);
registerDefaultState(defaultBlockState()
registerDefaultState(defaultBlockState()
.setValue(Y_ALIGN, EBlockAlignment.CENTER)
.setValue(Z_ALIGN, EBlockAlignment.CENTER)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.util.Map;
import java.util.Objects;

import de.mrjulsen.crn.data.EBlockAlignment;
import de.mrjulsen.crn.block.properties.EBlockAlignment;
import de.mrjulsen.mcdragonlib.data.Pair;
import de.mrjulsen.mcdragonlib.data.Tripple;
import net.minecraft.core.BlockPos;
Expand Down
Loading

0 comments on commit 78ce181

Please sign in to comment.