Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.18.2 dev #48

Merged
merged 15 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ run/
out/
*.iml
.gradle/
.vscode/
output/
bin/
libs/
Expand All @@ -14,6 +15,5 @@ libs/
.idea/
classes/
.metadata
.vscode
.settings
*.launch
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"java.compile.nullAnalysis.mode": "disabled",
"commentTranslate.hover.enabled": false,
"java.compile.nullAnalysis.mode": "disabled",
"java.configuration.updateBuildConfiguration": "automatic"
}
27 changes: 16 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Create Railways Navigator (Minecraft Create Mod Addon)
# 🚅 Create Railways Navigator (Minecraft Create Mod Addon)
![Logo](https://github.com/MisterJulsen/Create-Train-Navigator/blob/1.18.2/icon_256px.png)

Get a list possible train connections in your world from one station to another using the Create Railways Navigator.
Expand All @@ -7,22 +7,27 @@ Get a list possible train connections in your world from one station to another
[![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)

## ⚠️ **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")
102 changes: 57 additions & 45 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,70 +1,82 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.3-SNAPSHOT" apply false
id 'dev.architectury.loom' version '1.6-SNAPSHOT' apply false
id 'architectury-plugin' version '3.4-SNAPSHOT'
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
}

architectury {
minecraft = rootProject.minecraft_version
minecraft = project.minecraft_version
}

subprojects {
apply plugin: "dev.architectury.loom"

loom {
silentMojangMappingsLicense()
}

dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
mappings loom.layered() {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${rootProject.minecraft_version}:${rootProject.parchmentmc_version}@zip")
}
}
allprojects {
group = rootProject.maven_group
version = "$rootProject.minecraft_version-$rootProject.mod_version"
}

allprojects {
apply plugin: "java"
apply plugin: "architectury-plugin"
apply plugin: "maven-publish"
subprojects {
apply plugin: 'dev.architectury.loom'
apply plugin: 'architectury-plugin'
apply plugin: 'maven-publish'

base {
archivesName = rootProject.archives_base_name
archivesName = "$rootProject.archives_name-$project.name"
}

version = "${rootProject.mod_version}-${project.name}"
group = rootProject.maven_group

repositories {
maven { // Flywheel
url = "https://maven.tterrag.com/"
content {
includeGroup("com.jozufozu.flywheel")
}
}
maven { // DragonLib
name = "MrJulsen's Mod Resources"
url = "https://raw.githubusercontent.com/MisterJulsen/modsrepo/main/maven"
}
maven { // Forge Config Api (required for fabric version of DragonLib)
name = "Fuzs Mod Resources"
url = "https://raw.githubusercontent.com/Fuzss/modresources/main/maven/"
}
maven {
url "https://cursemaven.com"
maven { url = "https://raw.githubusercontent.com/MisterJulsen/modsrepo/main/maven" } // DragonLib
maven { url = "https://raw.githubusercontent.com/Fuzss/modresources/main/maven/" } // Forge Config API
maven { url = "https://maven.parchmentmc.org" } // ParchmentMC
maven { url = "https://maven.terraformersmc.com/" } // ModMenu
maven { url = "https://maven.tterrag.com/" } // Flywheel
maven { url = "https://maven.shedaniel.me/" } // Cloth Config, REI
maven { url = "https://maven.blamejared.com/" } // JEI
maven { url = "https://maven.quiltmc.org/repository/release" } // Quilt Mappings
maven { url = "https://api.modrinth.com/maven" } // LazyDFU
maven { url = "https://mvn.devos.one/snapshots/" } // Create, Porting Lib, Forge Tags, Milk Lib, Registrate
maven { url = "https://maven.jamieswhiteshirt.com/libs-release" } // Reach Entity Attributes
maven { url = "https://jitpack.io/" } // Mixin Extras, Fabric ASM
maven { url = "https://maven.tterrag.com/" } // Flywheel
maven { url = "https://cursemaven.com"
content {
includeGroup "curse.maven"
}
}
maven { url "https://maven.parchmentmc.org/"}
}

tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.release = 17
dependencies {
minecraft "net.minecraft:minecraft:$rootProject.minecraft_version"
mappings loom.layered() {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${rootProject.minecraft_version}:${rootProject.parchment_version}@zip")
}
}

java {
withSourcesJar()
withJavadocJar()

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

tasks.withType(JavaCompile).configureEach {
it.options.release = 17
}

// Configure Maven publishing.
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = rootProject.archives_name + "-" + project.name
from components.java
}
}

repositories {
maven {
name "GitHub"
url "file://${System.getProperty('user.home')}/.m2/github/modsrepo/maven"
}
}
}
}
40 changes: 9 additions & 31 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,40 +1,18 @@
architectury {
common(rootProject.enabled_platforms.split(","))
common rootProject.enabled_platforms.split(',')
}

loom {
accessWidenerPath = file("src/main/resources/createrailwaysnavigator.accesswidener")
}

repositories {
maven { url = "https://maven.shedaniel.me/" } // Cloth Config, REI
maven { url = "https://maven.blamejared.com/" } // JEI
maven { url = "https://maven.parchmentmc.org" } // Parchment mappings
maven { url = "https://maven.quiltmc.org/repository/release" } // Quilt Mappings
maven { url = "https://api.modrinth.com/maven" } // LazyDFU
maven { url = "https://maven.terraformersmc.com/releases/" } // Mod Menu
maven { url = "https://mvn.devos.one/snapshots/" } // Create, Porting Lib, Forge Tags, Milk Lib, Registrate
maven { url = "https://raw.githubusercontent.com/Fuzss/modresources/main/maven/" } // Forge Config API Port
maven { url = "https://maven.jamieswhiteshirt.com/libs-release" } // Reach Entity Attributes
maven { url = "https://jitpack.io/" } // Mixin Extras, Fabric ASM
maven { url = "https://maven.tterrag.com/" } // Flywheel
}

dependencies {
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modApi(include("de.mrjulsen.mcdragonlib:dragonlib-fabric:${rootProject.minecraft_version}-${rootProject.dragonlib_version}"))

modCompileOnly("com.simibubi.create:create-fabric-${rootProject.minecraft_version}:${rootProject.create_fabric_version}")
}

publishing {
publications {
mavenCommon(MavenPublication) {
artifactId = rootProject.archives_base_name
from components.java
}
}
modImplementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version"

modCompileOnly("dev.architectury:architectury:${rootProject.architectury_api_version}")
modCompileOnly("com.electronwill.night-config:toml:3.6.0")
modCompileOnly("net.minecraftforge:forgeconfigapiport-fabric:${rootProject.forge_config_api_port_version}")
modImplementation("de.mrjulsen.mcdragonlib:dragonlib-fabric:${rootProject.minecraft_version}-${rootProject.dragonlib_version}")

repositories {
}
}
modImplementation("com.simibubi.create:create-fabric-${rootProject.minecraft_version}:${rootProject.create_fabric_version}")
}
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 @@ -35,4 +35,6 @@ public static MinecraftServer getServer() {
public static void registerConfig() {
throw new AssertionError();
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package de.mrjulsen.crn;

import java.util.function.Supplier;

import com.simibubi.create.foundation.block.connected.ConnectedTextureBehaviour;
import dev.architectury.injectables.annotations.ExpectPlatform;
import net.minecraft.world.level.block.Block;

public class CRNPlatformSpecificClient {

@ExpectPlatform
public static void registerCTBehviour(Block entry, Supplier<ConnectedTextureBehaviour> behaviorSupplier) {
throw new AssertionError();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,9 @@ public void read(CompoundTag pTag, boolean clientPacket) {

xSize = pTag.getByte(NBT_XSIZE);
ySize = pTag.getByte(NBT_YSIZE);
color = pTag.getInt(NBT_COLOR);
if (pTag.contains(NBT_COLOR)) {
color = pTag.getInt(NBT_COLOR);
}
glowing = pTag.getBoolean(NBT_GLOWING);
isController = pTag.getBoolean(NBT_CONTROLLER);
infoType = EDisplayInfo.getTypeById(pTag.getInt(NBT_INFO_TYPE));
Expand Down
16 changes: 9 additions & 7 deletions common/src/main/java/de/mrjulsen/crn/client/ClientWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
import de.mrjulsen.crn.data.GlobalSettingsManager;
import de.mrjulsen.crn.network.packets.stc.ServerErrorPacket;
import de.mrjulsen.mcdragonlib.client.gui.DLScreen;
import de.mrjulsen.mcdragonlib.util.TextUtils;
import dev.architectury.networking.NetworkManager.PacketContext;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.components.toasts.SystemToast;
import net.minecraft.client.gui.components.toasts.SystemToast.SystemToastIds;
import net.minecraft.client.resources.language.ClientLanguage;
import net.minecraft.client.resources.language.LanguageInfo;
import net.minecraft.locale.Language;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.level.Level;

public class ClientWrapper {
Expand All @@ -45,7 +45,7 @@ public static void showRouteOverlaySettingsGui(RouteDetailsOverlayScreen overlay
}

public static void handleErrorMessagePacket(ServerErrorPacket packet, Supplier<PacketContext> ctx) {
Minecraft.getInstance().getToasts().addToast(new SystemToast(SystemToastIds.PERIODIC_NOTIFICATION, Constants.TEXT_SERVER_ERROR, new TextComponent(packet.message)));
Minecraft.getInstance().getToasts().addToast(new SystemToast(SystemToastIds.PERIODIC_NOTIFICATION, Constants.TEXT_SERVER_ERROR, TextUtils.text(packet.message)));
}

public static void showAdvancedDisplaySettingsScreen(AdvancedDisplayBlockEntity blockEntity) {
Expand All @@ -58,12 +58,14 @@ public static void updateLanguage(ELanguage lang, boolean force) {
}

LanguageInfo info = lang == ELanguage.DEFAULT ? null : Minecraft.getInstance().getLanguageManager().getLanguage(lang.getCode());
if (info == null) {
info = Minecraft.getInstance().getLanguageManager().getSelected();
}
currentLanguage = lang;
currentClientLanguage = ClientLanguage.loadFrom(Minecraft.getInstance().getResourceManager(), List.of(info));
CreateRailwaysNavigator.LOGGER.info("Updated custom language to: " + (info == null ? null : info.getName()));
if (lang == ELanguage.DEFAULT || info == null) {
currentClientLanguage = Language.getInstance();
CreateRailwaysNavigator.LOGGER.info("Updated custom language to: (Default)");
} else {
currentClientLanguage = ClientLanguage.loadFrom(Minecraft.getInstance().getResourceManager(), List.of(info));
CreateRailwaysNavigator.LOGGER.info("Updated custom language to: " + (info == null ? null : info.getName()));
}
}

public static Language getCurrentClientLanguage() {
Expand Down
Loading