Skip to content

Commit

Permalink
Merge branch 'refs/heads/1.19/dev' into 1.20/dev
Browse files Browse the repository at this point in the history
# Conflicts:
#	common/src/main/java/com/railwayteam/railways/registry/CRPalettes.java
#	common/src/main/java/com/railwayteam/railways/util/ColorUtils.java
  • Loading branch information
IThundxr committed Jun 10, 2024
2 parents f4b6e9d + 6377cfe commit 79d95af
Show file tree
Hide file tree
Showing 22 changed files with 173 additions and 180 deletions.
28 changes: 15 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
name: Build

on:
workflow_dispatch:
push:
paths-ignore:
- .docs/**
pull_request:
paths-ignore:
- .docs/**
on: [workflow_dispatch, push, pull_request]

jobs:
build:
Expand All @@ -16,12 +9,21 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup JDK 17
uses: actions/setup-java@v4
- name: Setup Java
run: echo "JAVA_HOME=$JAVA_HOME_17_X64" >> "$GITHUB_ENV"

- name: Loom Cache
uses: actions/cache@v4
with:
path: "**/.gradle/loom-cache"
key: "${{ runner.os }}-gradle-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }}"
restore-keys: "${{ runner.os }}-gradle-"

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
java-version: '17'
distribution: temurin
cache: gradle
gradle-home-cache-cleanup: true
cache-read-only: ${{ !endsWith(github.ref, '/dev') }}

- name: Validate Gradle Wrapper Integrity
uses: gradle/wrapper-validation-action@v2
Expand Down
35 changes: 20 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,35 @@ on:
- forge

jobs:
release:
build:
runs-on: ubuntu-latest
env:
RELEASE_BUILD: true
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }}

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup JDK 17
uses: actions/setup-java@v4
- name: Setup Java
run: echo "JAVA_HOME=$JAVA_HOME_17_X64" >> "$GITHUB_ENV"

- name: Loom Cache
uses: actions/cache@v4
with:
java-version: '17'
distribution: temurin
cache: gradle
path: "**/.gradle/loom-cache"
key: "${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}"
restore-keys: "${{ runner.os }}-gradle-"

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-home-cache-cleanup: true
cache-read-only: true

- name: Validate Gradle Wrapper Integrity
uses: gradle/wrapper-validation-action@v2

- name: Set Platform environment variable
run: echo "PLATFORM=${{ inputs.platform }}" >> $GITHUB_ENV

- name: Build & Publish
env:
RELEASE_BUILD: true
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }}
run: ./gradlew railwaysPublish
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ a preview, or if you are just fixing a typo in the README, etc.


## License
Steam 'n' Rails is licensed under the MIT license. See [LICENSE](LICENSE) for more information.
Steam 'n' Rails is licensed under the LGPL license. See [LICENSE](LICENSE) for more information.

Certain sections of the code are from the Create mod, which is licensed under the MIT license. See [Create's license](https://github.com/Creators-of-Create/Create/blob/mc1.18/dev/LICENSE) for more information.

Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ subprojects {
}

tasks.named<RemapJarTask>("remapJar") {
from("${rootProject.projectDir}/LICENSE")
val shadowJar = project.tasks.named<ShadowJar>("shadowJar").get()
inputFile.set(shadowJar.archiveFile)
injectAccessWidener = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import net.minecraft.core.Direction;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.Property;
import org.jetbrains.annotations.Nullable;

public class BoilerCTBehaviour extends ConnectedTextureBehaviour {
Expand Down Expand Up @@ -55,7 +56,7 @@ private boolean connectsTo(BlockAndTintGetter reader, BlockPos pos, BlockState s
if (other.getBlock() != state.getBlock())
return false;

return other.getValue(BoilerBlock.HORIZONTAL_AXIS) == state.getValue(BoilerBlock.HORIZONTAL_AXIS);
return isSameState(other, state, BoilerBlock.HORIZONTAL_AXIS, BoilerBlock.RAISED);
}

@Override
Expand All @@ -70,4 +71,13 @@ public CTContext buildContext(BlockAndTintGetter reader, BlockPos pos, BlockStat

return context;
}

private boolean isSameState(BlockState state, BlockState otherState, Property<?>... properties) {
for (Property<?> property : properties) {
if (state.getValue(property) != otherState.getValue(property))
return false;
}

return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.railwayteam.railways.content.custom_tracks.phantom.PhantomSpriteManager;
import com.railwayteam.railways.content.cycle_menu.TagCycleHandlerClient;
import com.railwayteam.railways.content.qol.TrackEdgePointHighlighter;
import com.railwayteam.railways.registry.CRKeys;
import com.railwayteam.railways.registry.CRPackets;
import com.railwayteam.railways.util.packet.ConfigureDevCapeC2SPacket;
import net.minecraft.client.Minecraft;
Expand All @@ -39,6 +40,7 @@ public class ClientEvents {

@MultiLoaderEvent
public static void onClientTickStart(Minecraft mc) {
CRKeys.fixBinds();
PhantomSpriteManager.tick(mc);

Level level = mc.level;
Expand Down
10 changes: 10 additions & 0 deletions common/src/main/java/com/railwayteam/railways/registry/CRKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import com.mojang.blaze3d.platform.InputConstants;
import com.railwayteam.railways.Railways;
import com.simibubi.create.AllKeys;
import dev.architectury.injectables.annotations.ExpectPlatform;
import net.minecraft.client.KeyMapping;
import net.minecraft.client.Minecraft;
Expand Down Expand Up @@ -57,6 +58,15 @@ public static void register() {
}
}

public static void fixBinds() {
long window = Minecraft.getInstance().getWindow().getWindow();
for (CRKeys key : values()) {
if (key.keybind == null || key.keybind.isUnbound())
continue;
key.keybind.setDown(InputConstants.isKeyDown(window, key.getBoundCode()));
}
}

public KeyMapping getKeybind() {
return keybind;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,31 +53,12 @@
public class CRPalettes {
private static final CreateRegistrate REGISTRATE = Railways.registrate();

private static final List<DyeColor> ORDERED_DYE_COLORS = List.of(
DyeColor.WHITE,
DyeColor.LIGHT_GRAY,
DyeColor.GRAY,
DyeColor.BLACK,
DyeColor.BROWN,
DyeColor.RED,
DyeColor.ORANGE,
DyeColor.YELLOW,
DyeColor.LIME,
DyeColor.GREEN,
DyeColor.CYAN,
DyeColor.LIGHT_BLUE,
DyeColor.BLUE,
DyeColor.PURPLE,
DyeColor.MAGENTA,
DyeColor.PINK
);

public static void register() { // registration order is important for a clean inventory layout
ModSetup.usePalettesTab();
for (Styles style : Styles.values())
style.register(null);

for (DyeColor dyeColor : ORDERED_DYE_COLORS) {
for (DyeColor dyeColor : ColorUtils.ORDERED_DYE_COLORS) {
for (Styles style : Styles.values())
style.register(dyeColor);
}
Expand All @@ -89,7 +70,7 @@ public static void register() { // registration order is important for a clean i

static {
CYCLE_GROUPS.put(null, CRTags.optionalTag(BuiltInRegistries.ITEM, Railways.asResource("palettes/cycle_groups/base")));
for (DyeColor dyeColor : ORDERED_DYE_COLORS) {
for (DyeColor dyeColor : ColorUtils.ORDERED_DYE_COLORS) {
CYCLE_GROUPS.put(dyeColor, CRTags.optionalTag(BuiltInRegistries.ITEM, Railways.asResource("palettes/cycle_groups/" + dyeColor.name().toLowerCase(Locale.ROOT))));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package com.railwayteam.railways.registry;

import com.railwayteam.railways.Railways;
import com.railwayteam.railways.util.ColorUtils;
import com.simibubi.create.foundation.block.connected.AllCTTypes;
import com.simibubi.create.foundation.block.connected.CTSpriteShiftEntry;
import com.simibubi.create.foundation.block.connected.CTSpriteShifter;
Expand Down Expand Up @@ -62,7 +63,7 @@ private static void initLocometal(@Nullable DyeColor color) {

static {
initLocometal(null);
for (DyeColor color : DyeColor.values()) {
for (DyeColor color : ColorUtils.ORDERED_DYE_COLORS) {
initLocometal(color);
}
}
Expand Down
21 changes: 21 additions & 0 deletions common/src/main/java/com/railwayteam/railways/util/ColorUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,28 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

public class ColorUtils {
public static final List<DyeColor> ORDERED_DYE_COLORS = List.of(
DyeColor.WHITE,
DyeColor.LIGHT_GRAY,
DyeColor.GRAY,
DyeColor.BLACK,
DyeColor.BROWN,
DyeColor.RED,
DyeColor.ORANGE,
DyeColor.YELLOW,
DyeColor.LIME,
DyeColor.GREEN,
DyeColor.CYAN,
DyeColor.LIGHT_BLUE,
DyeColor.BLUE,
DyeColor.PURPLE,
DyeColor.MAGENTA,
DyeColor.PINK
);

public static MapColor mapColorFromDye(@Nullable DyeColor dyeColor, @NotNull MapColor defaultColor) {
if (dyeColor == null)
return defaultColor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@
}
},
{
"from": [7.5, 5.496, 0.5],
"to": [8.5, 10.504, 1.5],
"from": [7.5, 5.49, 0.5],
"to": [8.5, 10.51, 1.5],
"rotation": {"angle": 0, "axis": "y", "origin": [11, 8, 5]},
"faces": {
"up": {"uv": [4, 1, 5, 2], "texture": "#2"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@
}
},
{
"from": [7.5, 5.496, 0.5],
"to": [8.5, 10.504, 1.5],
"from": [7.5, 5.49, 0.5],
"to": [8.5, 10.51, 1.5],
"rotation": {"angle": 0, "axis": "y", "origin": [11, 8, 5]},
"faces": {
"up": {"uv": [4, 1, 5, 2], "texture": "#2"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,17 +182,17 @@
}
},
{
"from": [7.5, 8.496, 0.5],
"to": [8.5, 10.504, 1.5],
"from": [7.5, 8.49, 0.5],
"to": [8.5, 10.51, 1.5],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 8.5, 3]},
"faces": {
"up": {"uv": [4, 1, 5, 2], "texture": "#2"},
"down": {"uv": [4, 3, 5, 4], "texture": "#2"}
}
},
{
"from": [7.5, 5.496, 0.5],
"to": [8.5, 7.504, 1.5],
"from": [7.5, 5.49, 0.5],
"to": [8.5, 7.51, 1.5],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 8.5, 3]},
"faces": {
"up": {"uv": [4, 1, 5, 2], "texture": "#2"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@
}
},
{
"from": [10.5, 4.996, 1.5],
"to": [11.5, 11.004, 2.5],
"from": [10.5, 4.995, 1.5],
"to": [11.5, 11.005, 2.5],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 8.5, 0]},
"faces": {
"up": {"uv": [10.5, 0, 11, 0.5], "texture": "#1"},
Expand Down Expand Up @@ -182,17 +182,17 @@
}
},
{
"from": [7.5, 8.496, 0.5],
"to": [8.5, 10.504, 1.5],
"from": [7.5, 8.49, 0.5],
"to": [8.5, 10.51, 1.5],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 8.5, 3]},
"faces": {
"up": {"uv": [4, 1, 5, 2], "texture": "#2"},
"down": {"uv": [4, 3, 5, 4], "texture": "#2"}
}
},
{
"from": [7.5, 5.496, 0.5],
"to": [8.5, 7.504, 1.5],
"from": [7.5, 5.49, 0.5],
"to": [8.5, 7.51, 1.5],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 8.5, 3]},
"faces": {
"up": {"uv": [4, 1, 5, 2], "texture": "#2"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@
}
},
{
"from": [7.5, 5.496, 0.5],
"to": [8.5, 10.504, 1.5],
"from": [7.5, 5.49, 0.5],
"to": [8.5, 10.51, 1.5],
"rotation": {"angle": 0, "axis": "y", "origin": [11, 8, 5]},
"faces": {
"up": {"uv": [4, 1, 5, 2], "texture": "#2"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@
}
},
{
"from": [7.5, 5.496, 0.5],
"to": [8.5, 10.504, 1.5],
"from": [7.5, 5.49, 0.5],
"to": [8.5, 10.51, 1.5],
"rotation": {"angle": 0, "axis": "y", "origin": [11, 8, 5]},
"faces": {
"up": {"uv": [4, 1, 5, 2], "texture": "#2"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,17 +182,17 @@
}
},
{
"from": [7.5, 8.496, 0.5],
"to": [8.5, 10.504, 1.5],
"from": [7.5, 8.49, 0.5],
"to": [8.5, 10.51, 1.5],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 8.5, 3]},
"faces": {
"up": {"uv": [4, 1, 5, 2], "texture": "#2"},
"down": {"uv": [4, 3, 5, 4], "texture": "#2"}
}
},
{
"from": [7.5, 5.496, 0.5],
"to": [8.5, 7.504, 1.5],
"from": [7.5, 5.49, 0.5],
"to": [8.5, 7.51, 1.5],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 8.5, 3]},
"faces": {
"up": {"uv": [4, 1, 5, 2], "texture": "#2"},
Expand Down
Loading

0 comments on commit 79d95af

Please sign in to comment.