Skip to content

Commit

Permalink
port to 1.18.2
Browse files Browse the repository at this point in the history
  • Loading branch information
der-fruhling committed Jun 10, 2024
1 parent 6206efc commit 8774ad4
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 74 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ architectury {
}

group = maven_group
version = "${mod_version}+mc1.19.2"
version = "${mod_version}+mc1.18.2"

subprojects {
apply plugin: "dev.architectury.loom"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation;

import java.io.IOException;
Expand Down Expand Up @@ -75,115 +76,115 @@ private static ModConfig loadConfig() {
public static Screen createConfigScreen(Screen parent) {
var builder = ConfigBuilder.create()
.setParentScreen(parent)
.setTitle(Component.translatable("title.create_train_perspective.config"))
.setTitle(new TranslatableComponent("title.create_train_perspective.config"))
.setSavingRunnable(INSTANCE::save);

var general = builder.getOrCreateCategory(Component.translatable(
var general = builder.getOrCreateCategory(new TranslatableComponent(
"category.create_train_perspective.general"
));

var entryBuilder = builder.entryBuilder();

general.addEntry(entryBuilder
.startBooleanToggle(
Component.translatable("option.create_train_perspective.enabled"),
new TranslatableComponent("option.create_train_perspective.enabled"),
INSTANCE.enabled)
.setTooltip(Component.translatable("option.create_train_perspective.enabled.tooltip"))
.setTooltip(new TranslatableComponent("option.create_train_perspective.enabled.tooltip"))
.setSaveConsumer(value -> INSTANCE.enabled = value)
.setDefaultValue(true)
.build());

var leaning = entryBuilder.startSubCategory(Component.translatable(
var leaning = entryBuilder.startSubCategory(new TranslatableComponent(
"category.create_train_perspective.leaning"
));

leaning.add(entryBuilder
.startBooleanToggle(
Component.translatable("option.create_train_perspective.leaning.enabled"),
new TranslatableComponent("option.create_train_perspective.leaning.enabled"),
INSTANCE.leanEnabled)
.setTooltip(Component.translatable("option.create_train_perspective.leaning.enabled.tooltip"))
.setTooltip(new TranslatableComponent("option.create_train_perspective.leaning.enabled.tooltip"))
.setSaveConsumer(value -> INSTANCE.leanEnabled = value)
.setDefaultValue(true)
.build());

leaning.add(entryBuilder
.startBooleanToggle(
Component.translatable("option.create_train_perspective.leaning.roll_enabled"),
new TranslatableComponent("option.create_train_perspective.leaning.roll_enabled"),
INSTANCE.rollEnabled)
.setTooltip(Component.translatable("option.create_train_perspective.leaning.roll_enabled.tooltip"))
.setTooltip(new TranslatableComponent("option.create_train_perspective.leaning.roll_enabled.tooltip"))
.setSaveConsumer(value -> INSTANCE.rollEnabled = value)
.setDefaultValue(true)
.build());

general.addEntry(leaning.build());

var multiplayer = entryBuilder.startSubCategory(Component.translatable(
var multiplayer = entryBuilder.startSubCategory(new TranslatableComponent(
"category.create_train_perspective.multiplayer"
));

multiplayer.add(entryBuilder
.startBooleanToggle(
Component.translatable("option.create_train_perspective.multiplayer.apply_to_others"),
new TranslatableComponent("option.create_train_perspective.multiplayer.apply_to_others"),
INSTANCE.applyToOthers)
.setTooltip(Component.translatable("option.create_train_perspective.multiplayer.apply_to_others.tooltip"))
.setTooltip(new TranslatableComponent("option.create_train_perspective.multiplayer.apply_to_others.tooltip"))
.setSaveConsumer(value -> INSTANCE.applyToOthers = value)
.setDefaultValue(true)
.build());

general.addEntry(multiplayer.build());

var advanced = entryBuilder.startSubCategory(Component.translatable(
var advanced = entryBuilder.startSubCategory(new TranslatableComponent(
"category.create_train_perspective.advanced"
));

advanced.add(entryBuilder
.startFloatField(
Component.translatable("option.create_train_perspective.advanced.lean_magnitude"),
new TranslatableComponent("option.create_train_perspective.advanced.lean_magnitude"),
INSTANCE.leanMagnitude)
.setTooltip(Component.translatable("option.create_train_perspective.advanced.lean_magnitude.tooltip"))
.setTooltip(new TranslatableComponent("option.create_train_perspective.advanced.lean_magnitude.tooltip"))
.setSaveConsumer(value -> INSTANCE.leanMagnitude = value)
.setDefaultValue(1.0f)
.build());

advanced.add(entryBuilder
.startFloatField(
Component.translatable("option.create_train_perspective.advanced.roll_magnitude"),
new TranslatableComponent("option.create_train_perspective.advanced.roll_magnitude"),
INSTANCE.rollMagnitude)
.setTooltip(Component.translatable("option.create_train_perspective.advanced.roll_magnitude.tooltip"))
.setTooltip(new TranslatableComponent("option.create_train_perspective.advanced.roll_magnitude.tooltip"))
.setSaveConsumer(value -> INSTANCE.rollMagnitude = value)
.setDefaultValue(1.0f)
.build());

advanced.add(entryBuilder
.startBooleanToggle(
Component.translatable("option.create_train_perspective.advanced.apply_to_entities"),
new TranslatableComponent("option.create_train_perspective.advanced.apply_to_entities"),
INSTANCE.applyToNonPlayerEntities)
.setTooltip(Component.translatable("option.create_train_perspective.advanced.apply_to_entities.tooltip"))
.setTooltip(new TranslatableComponent("option.create_train_perspective.advanced.apply_to_entities.tooltip"))
.setSaveConsumer(value -> INSTANCE.applyToNonPlayerEntities = value)
.setDefaultValue(true)
.build());

advanced.add(entryBuilder
.startStrList(
Component.translatable("option.create_train_perspective.advanced.blocked_entities"),
new TranslatableComponent("option.create_train_perspective.advanced.blocked_entities"),
INSTANCE.blockedEntities.stream().map(ResourceLocation::toString).toList())
.setTooltip(Component.translatable("option.create_train_perspective.advanced.blocked_entities.tooltip"))
.setTooltip(new TranslatableComponent("option.create_train_perspective.advanced.blocked_entities.tooltip"))
.setSaveConsumer(value -> INSTANCE.blockedEntities = value.stream().map(ResourceLocation::new).toList())
.setDefaultValue(new ArrayList<>())
.build());

var debug = entryBuilder.startSubCategory(Component.translatable("category.create_train_perspective.debug"));
var debug = entryBuilder.startSubCategory(new TranslatableComponent("category.create_train_perspective.debug"));

debug.add(entryBuilder
.startTextDescription(Component.translatable("category.create_train_perspective.debug.description").withStyle(ChatFormatting.BOLD))
.startTextDescription(new TranslatableComponent("category.create_train_perspective.debug.description").withStyle(ChatFormatting.BOLD))
.build());

debug.add(entryBuilder
.startBooleanToggle(
Component.translatable("option.create_train_perspective.debug.standing_transforms"),
new TranslatableComponent("option.create_train_perspective.debug.standing_transforms"),
INSTANCE.dbgShowStandingTransforms)
.setSaveConsumer(value -> INSTANCE.dbgShowStandingTransforms = value)
.setTooltip(Component.translatable("option.create_train_perspective.debug.standing_transforms.tooltip"))
.setTooltip(new TranslatableComponent("option.create_train_perspective.debug.standing_transforms.tooltip"))
.setDefaultValue(false)
.build());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.minecraft.client.Camera;
import net.minecraft.client.player.AbstractClientPlayer;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.BlockGetter;
Expand Down Expand Up @@ -101,7 +102,7 @@ public void modifyPosition(Camera instance,
var newV = MixinUtil.applyStandingCameraTranslation(clientPlayer, x, y, z, persp, f);

if (ModConfig.INSTANCE.dbgShowStandingTransforms) {
clientPlayer.displayClientMessage(Component.literal("%f, %f, %f".formatted(x - newV.x, y - newV.y, z - newV.z)), true);
clientPlayer.displayClientMessage(new TextComponent("%f, %f, %f".formatted(x - newV.x, y - newV.y, z - newV.z)), true);
}

setPosition(newV.x, newV.y, newV.z);
Expand Down
2 changes: 1 addition & 1 deletion fabric/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
loom.platform=fabric
create_version=0.5.1-f-build.1416+mc1.19.2
create_version=0.5.1-f-build.1333+mc1.18.2
flywheel_version=0.6.10-2
41 changes: 23 additions & 18 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,29 @@
"depends": {
"architectury": "*",
"create": [
"0.5.0.f-776+1.19.2",
"0.5.0.g-791+1.19.2",
"0.5.0.g-796+1.19.2",
"0.5.0.i-925+1.19.2",
"0.5.0.i-946+1.19.2",
"0.5.0.i-961+1.19.2",
"0.5.0.i-989+1.19.2",
"0.5.0.i-991+1.19.2",
"0.5.0.i-1003+1.19.2",
"0.5.0.i-1017+1.19.2",
"0.5.1-b-build.1075+mc1.19.2",
"0.5.1-b-build.1079+mc1.19.2",
"0.5.1-b-build.1089+mc1.19.2",
"0.5.1-c-build.1160+mc1.19.2",
"0.5.1-f-build.1334+mc1.19.2",
"0.5.1-f-build.1416+mc1.19.2"
"0.5.0.c-708+1.18.2",
"0.5.0.d-728+1.18.2",
"0.5.0.d-730+1.18.2",
"0.5.0.d-731+1.18.2",
"0.5.0.e-733+1.18.2",
"0.5.0.g-788+1.18.2",
"0.5.0.g-792+1.18.2",
"0.5.0.i-921+1.18.2",
"0.5.0.i-944+1.18.2",
"0.5.0.i-960+1.18.2",
"0.5.0.i-963+1.18.2",
"0.5.0.i-979+1.18.2",
"0.5.0.i-988+1.18.2",
"0.5.0.i-1002+1.18.2",
"0.5.0.i-1016+1.18.2",
"0.5.1-b-build.1070+mc1.18.2",
"0.5.1-b-build.1078+mc1.18.2",
"0.5.1-b-build.1088+mc1.18.2",
"0.5.1-c-build.1159+mc1.18.2",
"0.5.1-f-build.1333+mc1.18.2",
"0.5.1-f-build.1415+mc1.18.2"
],
"minecraft": "1.19.2",
"cloth-config": ">=8"
"minecraft": "1.18.2",
"cloth-config": ">=6"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

import dev.architectury.platform.forge.EventBuses;
import net.derfruhling.minecraft.create.trainperspective.CreateTrainPerspectiveMod;
import net.derfruhling.minecraft.create.trainperspective.ModConfig;
import net.minecraftforge.client.ConfigScreenHandler;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
Expand All @@ -16,8 +13,8 @@ public class ModForgeEntrypoint {

public ModForgeEntrypoint() {
MinecraftForge.EVENT_BUS.addListener(this::onClientSetupEvent);
ModLoadingContext.get().registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class, () ->
new ConfigScreenHandler.ConfigScreenFactory((minecraft, screen) -> ModConfig.createConfigScreen(screen)));
/*ModLoadingContext.get().registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class, () ->
new ConfigScreenHandler.ConfigScreenFactory((minecraft, screen) -> ModConfig.createConfigScreen(screen)));*/
}

private void onClientSetupEvent(FMLClientSetupEvent event) {
Expand Down
16 changes: 5 additions & 11 deletions forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader = "javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion="[43,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
loaderVersion="[40,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
license = "MIT"
Expand Down Expand Up @@ -50,7 +50,7 @@ Moves your camera (and body!) with the Create Mod train you're riding to increas
# Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory
# The version range of the dependency
versionRange="[43,)" #mandatory
versionRange="[40,)" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the dependency is not mandatory
# BEFORE - This mod is loaded BEFORE the dependency
# AFTER - This mod is loaded AFTER the dependency
Expand All @@ -61,7 +61,7 @@ Moves your camera (and body!) with the Create Mod train you're riding to increas
modId="minecraft"
mandatory=true
# This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange="[1.19,1.20)"
versionRange="[1.18,1.19)"
ordering="NONE"
side="BOTH"
[[dependencies."${mod_id}"]]
Expand All @@ -73,18 +73,12 @@ Moves your camera (and body!) with the Create Mod train you're riding to increas
[[dependencies."${mod_id}"]]
modId="architectury"
mandatory=true
versionRange="[6,)"
versionRange="[4,)"
ordering="NONE"
side="BOTH"
[[dependencies."${mod_id}"]]
modId="cloth_config"
mandatory=true
versionRange="[8.0.0,)"
versionRange="[6.2,)"
ordering="NONE"
side="BOTH"
[[dependencies."${mod_id}"]]
modId = "cloth_config"
mandatory = true
versionRange = "[8.0.0,)"
ordering = "NONE"
side = "BOTH"
24 changes: 12 additions & 12 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
org.gradle.jvmargs=-Xmx3G
# minecraft & architectury versions
minecraft_version=1.19.2
architectury_version=6.6.92
minecraft_version=1.18.2
architectury_version=4.12.94
enabled_platforms=fabric,forge
# forge
forge_version=1.19.2-43.3.0
forge_version=1.18.2-40.2.21
# fabric
fabric_loader_version=0.15.7
fabric_api_version=0.77.0+1.19.2
fabric_api_version=0.77.0+1.18.2
# public info
mod_id=create_train_perspective
mod_version=0.5.0
maven_group=net.derfruhling.minecraft
archives_base_name=create-train-perspective
# mod dependency versions
create_minecraft_version = 1.19.2
flywheel_minecraft_version = 1.19.2
create_version = 0.5.1.f-46
flywheel_version = 0.6.10-20
registrate_version = MC1.19-1.1.5
cloth_config_version=8.3.115
mod_menu_version=4.1.2
create_minecraft_version = 1.18.2
flywheel_minecraft_version = 1.18.2
create_version = 0.5.1.f-332
flywheel_version = 0.6.10-105
registrate_version = MC1.18.2-1.1.3
cloth_config_version=6.5.102
mod_menu_version=3.2.5
# modrinth project info
modrinth_project_id=create-train-perspective
modrinth_version_type=beta
modrinth_game_versions=1.19.2
modrinth_game_versions=1.18.2

0 comments on commit 8774ad4

Please sign in to comment.