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 Dec 14, 2024
1 parent fc8d93a commit c6d3fc5
Show file tree
Hide file tree
Showing 270 changed files with 9,723 additions and 2,381 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ out/
output/
bin/
libs/
doc/

.classpath
.project
.idea/
classes/
.metadata
.vscode
.settings
*.launch
*.launch
.vscode/settings.json
3 changes: 1 addition & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"commentTranslate.hover.enabled": false,
"java.compile.nullAnalysis.mode": "disabled",
"java.configuration.updateBuildConfiguration": "automatic"
"java.compile.nullAnalysis.mode": "disabled"
}
58 changes: 34 additions & 24 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ architectury {

allprojects {
group = rootProject.maven_group
version = "$rootProject.minecraft_version-$rootProject.mod_version"
version = "$rootProject.minecraft_version${rootProject.release_channel != "release" ? "-$rootProject.release_channel" : ""}-$rootProject.mod_version"
}

subprojects {
Expand All @@ -23,33 +23,25 @@ subprojects {
}

repositories {
maven { url = "file://${System.getProperty('user.home')}/.m2/github/modsrepo/maven" } // Local
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://maven.terraformersmc.com/releases/" } // Mod Menu
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.tterrag.com/" // Create Forge, Registrate Forge, Flywheel
content {
includeGroup("com.jozufozu.flywheel")
includeGroup("com.tterrag.registrate")
includeGroup("com.simibubi.create")
}
}

}

dependencies {
Expand All @@ -60,6 +52,36 @@ subprojects {
}
}

processResources {
def expandProps = [
"version": version,
"minecraft_version": rootProject.minecraft_version,
"issues": rootProject.issues,
"source": rootProject.source,
"license": rootProject.license,
"modid": rootProject.archives_name,
"display_name": rootProject.display_name,
"homepage": rootProject.homepage,
"authors": rootProject.authors,
"description": rootProject.description,
"icon": rootProject.icon,
"discord": rootProject.discord,
"next_unsupported_minecraft_version": rootProject.next_unsupported_minecraft_version,
"dragonlib_version": "$rootProject.minecraft_version-$rootProject.dragonlib_version",
"forge_version_int": rootProject.forge_version_int,
"fabric_loader_version": rootProject.fabric_loader_version,
"java_version": rootProject.java_version,
"maven_group": rootProject.maven_group,
"create_forge_version": rootProject.create_forge_version,
"main_class_name": rootProject.main_class_name,
]
filesMatching(['pack.mcmeta', 'fabric.mod.json', 'META-INF/mods.toml', 'createrailwaysnavigator.mixins.json']) {
expand expandProps
}
inputs.properties(expandProps)
exclude ".cache" // Remove cache from generated data
}

java {
withSourcesJar()
withJavadocJar()
Expand All @@ -68,18 +90,6 @@ subprojects {
targetCompatibility = JavaVersion.VERSION_17
}

javadoc {
options {
title = "DragNSounds API ${rootProject.release_channel}-${rootProject.mod_version}"
tags("apiNote:a:API Note:")
tags("implNote:a:Impl Note:")
tags("implSpec:a:Impl Spec:")
tags("related:a:Related:")
tags("example:a:Examples:")
tags("side:a:Valid on side:")
}
}

tasks.withType(JavaCompile).configureEach {
it.options.release = 17
}
Expand Down
7 changes: 4 additions & 3 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ loom {
dependencies {
modImplementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version"

modImplementation("dev.architectury:architectury:${rootProject.architectury_api_version}")
modImplementation("com.electronwill.night-config:toml:3.6.0")
modImplementation("net.minecraftforge:forgeconfigapiport-fabric:${rootProject.forge_config_api_port_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}")

modImplementation("com.simibubi.create:create-fabric-${rootProject.minecraft_version}:${rootProject.create_fabric_version}")
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public static void registerConfig() {
throw new AssertionError();
}


@ExpectPlatform
public static GlobalStation getStationFromBlockEntity(BlockEntity be) {
throw new AssertionError();
Expand Down
4 changes: 4 additions & 0 deletions common/src/main/java/de/mrjulsen/crn/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ public class Constants {
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 Component TEXT_HELP = TextUtils.translate("gui." + CreateRailwaysNavigator.MOD_ID + ".common.help");
public static final Component TEXT_COPY = TextUtils.translate("gui." + CreateRailwaysNavigator.MOD_ID + ".common.copy");
public static final Component TEXT_PASTE = TextUtils.translate("gui." + CreateRailwaysNavigator.MOD_ID + ".common.paste");
public static final Component TEXT_RESET = TextUtils.translate("gui." + CreateRailwaysNavigator.MOD_ID + ".common.reset_defaults");
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 };

Expand All @@ -30,6 +33,7 @@ public class Constants {
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_TRAIN_SEPARATION = GITHUB_WIKI + "Train-Separation";
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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.simibubi.create.foundation.item.TooltipHelper.Palette;

import de.mrjulsen.crn.block.AdvancedDisplayBlock;
import de.mrjulsen.crn.client.input.ModKeys;
import de.mrjulsen.crn.event.CRNClientEventsRegistryEvent;
import de.mrjulsen.crn.event.CRNEventsManager;
import de.mrjulsen.crn.event.ModClientEvents;
Expand Down Expand Up @@ -72,10 +71,6 @@ public static void load() {}

public static void init() {

CRNPlatformSpecific.registerConfig();
if (Platform.getEnv() == EnvType.CLIENT) {
ModKeys.init();
}
ModBlocks.init();
ModItems.init();
ModBlockEntities.init();
Expand All @@ -93,6 +88,8 @@ public static void init() {
ServerErrorPacket.class
));

CRNPlatformSpecific.registerConfig();

ModCommonEvents.init();
if (Platform.getEnv() == EnvType.CLIENT) {
ModClientEvents.init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@

import de.mrjulsen.crn.block.blockentity.AdvancedDisplayBlockEntity;
import de.mrjulsen.crn.block.blockentity.AdvancedDisplayBlockEntity.EUpdateReason;
import de.mrjulsen.crn.block.display.properties.BasicDisplaySettings;
import de.mrjulsen.crn.client.ClientWrapper;
import de.mrjulsen.crn.registry.ModBlockEntities;
import de.mrjulsen.mcdragonlib.data.Pair;
import de.mrjulsen.mcdragonlib.data.Tripple;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.color.block.BlockColor;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
Expand Down Expand Up @@ -52,6 +56,8 @@

public abstract class AbstractAdvancedDisplayBlock extends Block implements IWrenchable, IBE<AdvancedDisplayBlockEntity> {

public static final int DEFAULT_DISPLAY_COLOR = 0xFF404040;

public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING;

public static final BooleanProperty UP = BooleanProperty.create("up");
Expand All @@ -66,6 +72,19 @@ public AbstractAdvancedDisplayBlock(Properties properties) {
.setValue(FACING, Direction.NORTH)
);
}

@Environment(EnvType.CLIENT)
public static BlockColor getDisplayColor() {
return (state, world, pos, layer) -> {
if (world.getBlockEntity(pos) instanceof AdvancedDisplayBlockEntity be) {
return be.getSettingsAs(BasicDisplaySettings.class).map(x -> {
int color = x.getBackColor();
return color == 0 ? null : color;
}).orElse(DEFAULT_DISPLAY_COLOR);
}
return DEFAULT_DISPLAY_COLOR;
};
}

@Override
public BlockState rotate(BlockState pState, Rotation pRotation) {
Expand Down Expand Up @@ -299,17 +318,24 @@ public void onRemove(BlockState pState, Level pLevel, BlockPos pPos, BlockState

@Override
public InteractionResult use(BlockState pState, Level pLevel, BlockPos pPos, Player pPlayer, InteractionHand pHand, BlockHitResult pHit) {

ItemStack heldItem = pPlayer.getItemInHand(pHand);
AdvancedDisplayBlockEntity blockEntity = ((AdvancedDisplayBlockEntity)pLevel.getBlockEntity(pPos)).getController();

if (heldItem.getItem() instanceof DyeItem dyeItem) {
DyeColor dye = dyeItem.getDyeColor();
if (dye != null) {
pLevel.playSound(null, pPos, SoundEvents.DYE_USE, SoundSource.BLOCKS, 1.0F, 1.0F);
int dyeColor = dye == DyeColor.ORANGE ? 0xFFFF9900 : dye.getTextColor();

blockEntity.applyToAll(be -> {
be.setColor(dye == DyeColor.ORANGE ? 0xFF9900 : dye.getMaterialColor().col);
be.notifyUpdate();
be.getSettingsAs(BasicDisplaySettings.class).ifPresent(x -> {
if (pPlayer.isShiftKeyDown()) {
x.setBackColor(dyeColor);
} else {
x.setFontColor(dyeColor);
}
be.notifyUpdate();
});
});

if (pLevel.isClientSide) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public InteractionResult use(BlockState pState, Level pLevel, BlockPos pPos, Pla
}

if (pLevel.isClientSide) {
pPlayer.displayClientMessage(TextUtils.translate("gui.createrailwaysnavigator.time", TimeUtils.parseTime((int)(pLevel.getDayTime() % DragonLib.TICKS_PER_DAY + DragonLib.DAYTIME_SHIFT), ModClientConfig.TIME_FORMAT.get())), true);
pPlayer.displayClientMessage(TextUtils.translate("gui.createrailwaysnavigator.time", TimeUtils.parseTime((int)(pLevel.getDayTime() % DragonLib.ticksPerDay() + DragonLib.daytimeShift()), ModClientConfig.TIME_FORMAT.get())), true);
}
return InteractionResult.SUCCESS;
}
Expand Down
Loading

0 comments on commit c6d3fc5

Please sign in to comment.