Skip to content

Commit

Permalink
port to 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoBeliik committed Jun 13, 2024
1 parent ea36cdc commit 16e579d
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 27 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ subprojects {
"version": modversion,
"group": project.group, //Else we target the task's group.
"minecraft_version": minecraft_version,
"forge_version": forge_version,
"forge_version_range": forge_version,
//"forge_version": forge_version,
//"forge_version_range": forge_version,
"minecraft_version_range": minecraft_version,
"fabric_version": fabric_version,
"fabric_loader_version": fabric_loader_version,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static void renderGui() {

public static ResourceLocation getTextureRL() {
String texture = CommonConfig.get().useDarkTheme().get() ? "textures/gui/sm_gui_dark.png" : "textures/gui/sm_gui.png";
return new ResourceLocation(Constants.MOD_ID, texture);
return ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, texture);
}

public static void openMainScreen() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private void setName(String name) {

public SortedMap<ResourceLocation, Double> getMuffledSounds() {
SortedMap<ResourceLocation, Double> temp = new TreeMap<>();
this.muffledSounds.forEach((R, D) -> temp.put(new ResourceLocation(R), D));
this.muffledSounds.forEach((R, D) -> temp.put(ResourceLocation.parse(R), D));
return temp;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class DataManager implements ISoundLists {
private static final Gson gson = new GsonBuilder().setPrettyPrinting().create();

public static void loadData() {
Optional.ofNullable(loadMuffledMap()).ifPresent(mm -> mm.forEach((R, D) -> muffledSounds.put(new ResourceLocation(R), D)));
Optional.ofNullable(loadMuffledMap()).ifPresent(mm -> mm.forEach((R, D) -> muffledSounds.put(ResourceLocation.parse(R), D)));

if (!CommonConfig.get().disableAnchors().get()) {
anchorList.clear();
Expand Down
4 changes: 2 additions & 2 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"modmenu:clientsideOnly": true
},
"depends": {
"fabricloader": ">=0.12",
"fabric": ">=0.45",
"fabricloader": ">=0.15",
"fabric": ">=0.100",
"minecraft": "~${minecraft_version}",
"java": ">=21"
}
Expand Down
8 changes: 4 additions & 4 deletions forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
modLoader = "javafml" #mandatory
loaderVersion = "50.0.19" #mandatory This is typically bumped every Minecraft version by Forge. See https://files.minecraftforge.net/ for a list of versions.
loaderVersion = "51.0.0" #mandatory This is typically bumped every Minecraft version by Forge. See https://files.minecraftforge.net/ for a list of versions.
license = "GNU LESSER GENERAL PUBLIC LICENSE" # Review your options at https://choosealicense.com/.
licenseURL= "https://github.com/LeoBeliik/ExtremeSoundMuffler/blob/master/LICENSE.txt"
issueTrackerURL="https://github.com/LeoBeliik/ExtremeSoundMuffler/issues"
[[mods]] #mandatory
modId = "extremesoundmuffler" #mandatory
version = "3.45.1" #mandatory
version = "3.46" #mandatory
displayName="Extreme Sound Muffler"
displayURL="https://www.curseforge.com/minecraft/mc-mods/extreme-sound-muffler"
logoFile= "esm_logo.png" #optional
Expand All @@ -18,12 +18,12 @@ This mod also works Clientside only.
[[dependencies.extremesoundmuffler]] #optional
modId = "forge" #mandatory
mandatory = true #mandatory
versionRange = "[50.0.19,)" #mandatory
versionRange = "[51.0.0,)" #mandatory
ordering = "NONE" # The order that this dependency should load in relation to your mod, required to be either 'BEFORE' or 'AFTER' if the dependency is not mandatory
side = "BOTH" # Side this dependency is applied on - 'BOTH', 'CLIENT' or 'SERVER'
[[dependencies.extremesoundmuffler]]
modId = "minecraft"
mandatory = true
versionRange = "[1.20.6]"
versionRange = "[1.21]"
ordering = "NONE"
side = "BOTH"
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Project
modversion = 3.45.1
modversion = 3.46
group=com.leobeliik.extremesoundmuffler

# Common
minecraft_version=1.20.6
minecraft_version=1.21
common_runs_enabled=false
common_client_run_name=Common Client
common_server_run_name=Common Server

# Forge
forge_version=50.0.19
forge_version=51.0.0

# NeoForge
neoforge_version=20.6.62-beta
neoforge_version=21.0.0-beta

# Fabric
fabric_version=0.98.0+1.20.6
fabric_version=0.100.1+1.21
fabric_loader_version=0.15.11
fiber_version=0.23.0-+

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 5 additions & 1 deletion neoforge/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id 'idea'
id 'maven-publish'
id 'net.neoforged.gradle.userdev' version '7.0.107'
id 'net.neoforged.gradle.userdev' version '7.0.140'
id 'java-library'
}
base {
Expand Down Expand Up @@ -60,6 +60,10 @@ tasks.withType(ProcessResources).matching(notNeoTask).configureEach {
from project(":common").sourceSets.main.resources
}

tasks.named("test").configure {
enabled = false
}

publishing {
publications {
mavenJava(MavenPublication) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.leobeliik.extremesoundmuffler.interfaces.ISoundLists;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.ModContainer;
import net.neoforged.fml.ModLoadingContext;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.fml.config.ModConfig;
Expand Down Expand Up @@ -30,9 +31,9 @@ class NeoForgeConfig {
private static ModConfigSpec.IntValue creativeInvButtonHorizontal;
private static ModConfigSpec.IntValue creativeInvButtonVertical;

static void init() {
static void init(ModContainer container) {
buildConfig();
ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, NeoForgeConfig.CLIENT_CONFIG);
container.registerConfig(ModConfig.Type.CLIENT, NeoForgeConfig.CLIENT_CONFIG);
CommonConfig.set(new CommonConfig.ConfigAccess(
forbiddenSounds,
lawfulAllList,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.ModContainer;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.fml.common.Mod;
import net.neoforged.neoforge.client.event.ClientPlayerNetworkEvent;
Expand All @@ -22,12 +23,12 @@
@Mod(Constants.MOD_ID)
public class SoundMufflerNeoForge {

public SoundMufflerNeoForge(IEventBus modEventBus) {
public SoundMufflerNeoForge(IEventBus modEventBus, ModContainer container) {
NeoForge.EVENT_BUS.register(this);
//prevent server complain when this mod is clientside only
/*ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class,
() -> new IExtensionPoint.DisplayTest(() -> "", (a, b) -> true));*/
NeoForgeConfig.init();
NeoForgeConfig.init(container);
}

@EventBusSubscriber(modid = Constants.MOD_ID, bus = EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
Expand Down
8 changes: 4 additions & 4 deletions neoforge/src/main/resources/META-INF/neoforge.mods.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
modLoader = "javafml" #mandatory
loaderVersion = "20.6.62" #mandatory
loaderVersion = "21.0.0" #mandatory
license = "GNU LESSER GENERAL PUBLIC LICENSE" # Review your options at https://choosealicense.com/.
licenseURL = "https://github.com/LeoBeliik/ExtremeSoundMuffler/blob/master/LICENSE.txt"
issueTrackerURL = "https://github.com/LeoBeliik/ExtremeSoundMuffler/issues"
[[mods]] #mandatory
modId = "extremesoundmuffler" #mandatory
version = "3.45.1" #mandatory
version = "3.46" #mandatory
displayName = "Extreme Sound Muffler"
logoFile = "esm_logo.png" #optional
authors = "LeoBeliik"
Expand All @@ -19,12 +19,12 @@ config = "extremesoundmuffler.mixins.json"
[[dependencies.extremesoundmuffler]] #optional
modId = "neoforge" #mandatory
type = "required" #mandatory
versionRange = "[20.6.60,)" #mandatory
versionRange = "[21.0.0-beta,)" #mandatory
ordering = "NONE" # The order that this dependency should load in relation to your mod, required to be either 'BEFORE' or 'AFTER' if the dependency is not mandatory
side = "BOTH" # Side this dependency is applied on - 'BOTH', 'CLIENT' or 'SERVER'
[[dependencies.extremesoundmuffler]]
modId = "minecraft"
type = "required"
versionRange = "[1.20.6]"
versionRange = "[1.21]"
ordering = "NONE"
side = "BOTH"
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ plugins {
rootProject.name = 'ExtremeSoundMuffler'
include("common")
include("fabric")
include("forge")
//include("forge")
include("neoforge")

0 comments on commit 16e579d

Please sign in to comment.