Skip to content

Commit

Permalink
Feature complete; updated to 1.19.4
Browse files Browse the repository at this point in the history
- updated to 1.19.4 for custom damage types
- added configuration options for timeToMaxBoost,
  standardRailTimeToNoBoost, and unpoweredRailTimeToNoBoost
- living entities that trains collide with get knocked back and take
  damage proportional to train speed
- fixed storage cart inventory opening while trying to link carts
- fixed trains unlinking when moving too fast
- fixed carts maxing at 40 m/s
- readme rough draft
- updated copyright year
  • Loading branch information
antD97 committed Dec 7, 2023
1 parent 181a9cb commit 793001f
Show file tree
Hide file tree
Showing 34 changed files with 396 additions and 107 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright © 2021 antD97
Copyright © 2021-2023 antD97

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the “Software”), to deal in
Expand Down
127 changes: 124 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,130 @@
# Rail Transport Plus

A [Minecraft](https://www.minecraft.net) mod that adds linkable minecarts and faster than
default minecart top speed.
[Modrinth]() |
[Planet Minecraft]() |
[CurseForge]() |
[Video Demo]() |
[Downloads](https://github.com/antD97/RailTransportPlus/releases)

A [Minecraft](https://www.minecraft.net) mod that adds linkable minecarts and faster than vanilla minecart speed while
trying to stay true to the vanilla experience.

# Cart Linking

Two carts can be linked by holding a chain and crouch right-clicking a minecart with a chain, and then crouch
right-clicking another minecart. The second minecart that was right-clicked will then ignore all vanilla minecart
movement mechanics and follow the first right-clicked minecart.

A train of linked carts can be made by shift right-clicking the rear most minecart and then shift right-clicking
another minecart. There is a max train length of four minecarts, unless furnace minecarts are added to the front of
the train. The max length of the train per furnace minecart is as follows:
- 0 or 1 furnace minecart: 4 minecart limit
- 2 furnace minecarts: 8 minecart limit
- 3 furnace minecarts: 12 minecart limit
- 4 furnace minecarts: 16 minecart limit

Note: If one or more minecarts in a train end up in unloaded chunks, the entire train stops moving.

# Furnace Minecart Boosting

Fueled furnace minecarts rolling on powered rails will continue to increase speed until they reach 60 m/s. Boosted
furnace minecarts can be combined with cart linking to move players and items across long distances quickly. If a
minecart train uses multiple furnace minecarts, all furnace minecarts in the train must be fueled for the boosting
to activate.

Furnace minecarts also have the added ability to be refueled without player interaction. If the cart immediately
following the furnace carts of train is a chest cart, the furnace carts will automatically take coal from the chest
cart to refuel themselves.


Takes 7.5s for a non boosted furnace cart to reach max boost while on a powered rail
Takes 5s for a max boost furnace cart to return to zero total boost




# Design, Objectives, and Balance

Improve functionality to underutilized furnace minecarts

Provide basic mechanics that can be used by players to create creative complex systems. Some problems are left
for the player to solve (e.g. carts going too fast need to slow down for corners)

Default max boosted furnace cart speed of 60 m/s was chosen to be competitive to other transportation options on
effort for travel speed.

- rail transport plus boosted furnace cart
- 60 m/s (42.43 m/s if travelling diagonally by moving across each horizontal axis)
- pros
- lots of storage/seating
- afk-able
- faster than elytra
- cons
- rail infrastructure cost
- optional station infrastructure cost
- elytra
- 33.5 m/s
- pros
- same speed regardless of direction
- can go anywhere
- cons
- slowest for long distances
- normal ice boat road
- 40 m/s (28.28 m/s if travelling diagonally by moving across each horizontal axis)
- pros
- less expensive than boosted furnace cart rail
- faster than elytra
- cons
- little storage/seating
- not afk-able
- some infrastructure cost
- blue ice boat road
- 72.73 m/s (51.43 m/s if travelling diagonally by moving across each horizontal axis)
- pros
- fast
- cons
- little storage/seating
- high infrastructure cost
- not afk-able
- Dolphin's Grace status effect with Depth Strider III and Soul Speed III on a layer of Soul Soil underwater
- 75 m/s (53.03 m/s if travelling diagonally by moving across each horizontal axis)
- pros
- very fast
- cons
- requires appropriate enchanted gear
- no storage/seating
- high infrastructure cost
- not afk-able
- Dolphin's Grace status effect with Depth Strider III, Soul Speed III on a layer of Soul Soil, and Speed II status effect underwater
- 144 m/s (101.82 m/s if travelling diagonally by moving across each horizontal axis)
- pros
- fastest
- cons
- requires appropriate enchanted gear
- no storage/seating
- high infrastructure cost
- not afk-able

I don't want to make a new best form of transportation that makes the other methods of transportation pointless, but
rather make the player consider what form of transportation is best for their specific use case.

source for transportation speeds: https://minecraft.wiki/w/Transportation

# Configuration

Each world can be configured using the `world/config/rail-transport-plus.properties` file.

**Changing the config file located at `.minecraft/config/rail-transport-plus.properties` does not affect preexisting
worlds. This file is only used as the initial config file when creating a new world.**

- `maxBoostedSpeed` (default: 60)
- how fast fueled furnace minecarts will travel when on powered rails in meters/second
- `maxCartsPerFurnaceCart` (default: 3)
- how many non furnace carts are allowed on a train per furnace minecart
- `maxFurnaceCartsPerTrain` (default: 4)
- the max number of furnace minecarts per train

## Copyright and License

Copyright © 2021 antD97
Copyright © 2021-2023 antD97
Licensed under the [MIT License](LICENSE)
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.19.3
yarn_mappings=1.19.3+build.5
loader_version=0.14.13
minecraft_version=1.19.4
yarn_mappings=1.19.4+build.2
loader_version=0.15.0

# Mod Properties
mod_version = 1.0.0
maven_group = com.antd
archives_base_name = rail-transport-plus

# Dependencies
fabric_version=0.73.0+1.19.3
fabric_version=0.87.2+1.19.4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2021 antD97
* Copyright © 2021-2023 antD97
* Licensed under the MIT License https://antD.mit-license.org/
*/
package com.antd.railtransportplus;
Expand Down
39 changes: 35 additions & 4 deletions src/main/java/com/antd/railtransportplus/Config.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2021 antD97
* Copyright © 2021-2023 antD97
* Licensed under the MIT License https://antD.mit-license.org/
*/
package com.antd.railtransportplus;
Expand All @@ -9,22 +9,47 @@
/** Rail Transport Plus configuration settings. */
public class Config {

/** Default configuration settings. */
public final static Config DEFAULT = new Config(50, 3, 4);

/** Boosted furnace cart max speed. */
public final double maxBoostedSpeed;
/** Time it takes for a fueled furnace minecart on a powered rail to reach maximum boost (in seconds). */
public final double timeToMaxBoost;
/**
* Time it takes for a max boost furnace minecart to reach zero boost while on a standard minecart rail (in
* seconds).
*/
public final double standardRailTimeToNoBoost;
/**
* Time it takes for a max boost furnace minecart to reach zero boost while on an unpowered minecart rail (in
* seconds).
*/
public final double unpoweredRailTimeToNoBoost;

/** Max number of carts a single furnace cart can pull. */
public final int maxCartsPerFurnaceCart;
/** Max number of furnace carts in a train. */
public final int maxFurnaceCartsPerTrain;

public Config() {
this.maxBoostedSpeed = 65;
this.timeToMaxBoost = 10;
this.standardRailTimeToNoBoost = 7.5;
this.unpoweredRailTimeToNoBoost = 3.33;
this.maxCartsPerFurnaceCart = 3;
this.maxFurnaceCartsPerTrain = 4;
}

private Config(
double maxBoostedSpeed,
double timeToMaxBoost,
double standardRailTimeToNoBoost,
double unpoweredRailTimeToNoBoost,
int maxCartsPerFurnaceCart,
int maxFurnaceCartsPerTrain
) {
this.maxBoostedSpeed = maxBoostedSpeed;
this.timeToMaxBoost = timeToMaxBoost;
this.standardRailTimeToNoBoost = standardRailTimeToNoBoost;
this.unpoweredRailTimeToNoBoost = unpoweredRailTimeToNoBoost;
this.maxCartsPerFurnaceCart = maxCartsPerFurnaceCart;
this.maxFurnaceCartsPerTrain = maxFurnaceCartsPerTrain;
}
Expand All @@ -34,6 +59,9 @@ public Properties createProperties() {
final var properties = new Properties();

properties.setProperty("maxBoostedSpeed", maxBoostedSpeed + "");
properties.setProperty("timeToMaxBoost", timeToMaxBoost + "");
properties.setProperty("standardRailTimeToNoBoost", standardRailTimeToNoBoost + "");
properties.setProperty("unpoweredRailTimeToNoBoost", unpoweredRailTimeToNoBoost + "");
properties.setProperty("maxCartsPerFurnaceCart", maxCartsPerFurnaceCart + "");
properties.setProperty("maxFurnaceCartsPerTrain", maxFurnaceCartsPerTrain + "");

Expand All @@ -45,6 +73,9 @@ public static Config loadConfig(Properties properties) {
try {
return new Config(
Double.parseDouble(properties.getProperty("maxBoostedSpeed")),
Double.parseDouble(properties.getProperty("timeToMaxBoost")),
Double.parseDouble(properties.getProperty("standardRailTimeToNoBoost")),
Double.parseDouble(properties.getProperty("unpoweredRailTimeToNoBoost")),
Integer.parseInt(properties.getProperty("maxCartsPerFurnaceCart")),
Integer.parseInt(properties.getProperty("maxFurnaceCartsPerTrain"))
);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/antd/railtransportplus/LinkResult.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2021 antD97
* Copyright © 2021-2023 antD97
* Licensed under the MIT License https://antD.mit-license.org/
*/
package com.antd.railtransportplus;
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/com/antd/railtransportplus/RailTransportPlus.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2021 antD97
* Copyright © 2021-2023 antD97
* Licensed under the MIT License https://antD.mit-license.org/
*/
package com.antd.railtransportplus;
Expand All @@ -13,6 +13,9 @@
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerWorldEvents;
import net.fabricmc.fabric.api.event.player.UseEntityCallback;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.minecraft.entity.damage.DamageType;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -38,6 +41,9 @@ public class RailTransportPlus implements ModInitializer {
public static Config globalConfig = null;
public static Config worldConfig = null;

public static final RegistryKey<DamageType> TRAIN_DAMAGE = RegistryKey.of(RegistryKeys.DAMAGE_TYPE,
new Identifier("railtransportplus", "train_damage"));

@Override
public void onInitialize() {

Expand All @@ -53,7 +59,7 @@ public void onInitialize() {

// default global config
if (globalConfig == null) {
globalConfig = Config.DEFAULT;
globalConfig = new Config();

try (var fw = new FileWriter(globalConfigFile)) {
globalConfig.createProperties().store(fw, "Default global config generated on:");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2021 antD97
* Copyright © 2021-2023 antD97
* Licensed under the MIT License https://antD.mit-license.org/
*/
package com.antd.railtransportplus;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2021 antD97
* Copyright © 2021-2023 antD97
* Licensed under the MIT License https://antD.mit-license.org/
*/
package com.antd.railtransportplus.interfaceinject;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2021 antD97
* Copyright © 2021-2023 antD97
* Licensed under the MIT License https://antD.mit-license.org/
*/
package com.antd.railtransportplus.interfaceinject;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2021 antD97
* Copyright © 2021-2023 antD97
* Licensed under the MIT License https://antD.mit-license.org/
*/
package com.antd.railtransportplus.interfaceinject;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright © 2021-2023 antD97
* Licensed under the MIT License https://antD.mit-license.org/
*/
package com.antd.railtransportplus.interfaceinject;

public interface IRtpStorageMinecartEntity {

void skipNextOpen();

boolean getSkipNextOpen();

void resetSkipNextOpen();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright © 2021-2023 antD97
* Licensed under the MIT License https://antD.mit-license.org/
*/
package com.antd.railtransportplus.interfaceinject;

public interface IRtpVehicleInventory {

void skipNextOpen();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2021 antD97
* Copyright © 2021-2023 antD97
* Licensed under the MIT License https://antD.mit-license.org/
*/
package com.antd.railtransportplus.listener.client;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2021 antD97
* Copyright © 2021-2023 antD97
* Licensed under the MIT License https://antD.mit-license.org/
*/
package com.antd.railtransportplus.listener.client;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2021 antD97
* Copyright © 2021-2023 antD97
* Licensed under the MIT License https://antD.mit-license.org/
*/
package com.antd.railtransportplus.listener.server;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2021 antD97
* Copyright © 2021-2023 antD97
* Licensed under the MIT License https://antD.mit-license.org/
*/
package com.antd.railtransportplus.listener.server;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2021 antD97
* Copyright © 2021-2023 antD97
* Licensed under the MIT License https://antD.mit-license.org/
*/
package com.antd.railtransportplus.listener.server;
Expand Down
Loading

0 comments on commit 793001f

Please sign in to comment.