Skip to content

Commit

Permalink
Update to 1.20.4
Browse files Browse the repository at this point in the history
- Use Neoforge due to issues with running forge
  • Loading branch information
Dragon-Seeker committed Dec 28, 2023
1 parent 24013f6 commit fc2164d
Show file tree
Hide file tree
Showing 19 changed files with 281 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ private static Optional<CondensedItemEntry.Builder> deserializeEntry(Identifier
builder.setTitleFromTag();
}
} else {
Text text = Text.Serializer.fromJson(element);
Text text = Text.Serialization.fromJsonTree(element);

builder.setTitle(text);
}
Expand All @@ -257,7 +257,7 @@ private static Optional<CondensedItemEntry.Builder> deserializeEntry(Identifier
JsonElement element = jsonObject.get("description");

try {
Text text = Text.Serializer.fromJson(element);
Text text = Text.Serialization.fromJsonTree(element);

builder.setDescription(text);
} catch (JsonParseException e){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"required": true,
"package": "io.wispforest.condensed_creative.mixins",
"compatibilityLevel": "JAVA_17",
"minVersion": "0.8",
"mixins": [
"ItemGroupAccessor",
"ItemStackSetAccessor"
Expand Down
10 changes: 0 additions & 10 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,6 @@ dependencies {

modCompileOnly("com.terraformersmc:modmenu:${rootProject.modmenu}")
modLocalRuntime("com.terraformersmc:modmenu:${rootProject.modmenu}")

// modLocalRuntime("maven.modrinth:ferrite-core:${rootProject.ferrite_core}-fabric")
// modLocalRuntime("maven.modrinth:starlight:${rootProject.starlight}")
//
// //modLocalRuntime("maven.modrinth:lithium:${rootProject.lithium}")
//
// modLocalRuntime("maven.modrinth:sodium:${rootProject.sodium}")
//
// implementation 'org.joml:joml:1.10.2'
// modLocalRuntime 'org.joml:joml:1.10.2'
}

processResources {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.wispforest.condensed_creative.forge;
package io.wispforest.condensed_creative.neoforge;


import io.wispforest.condensed_creative.CondensedCreative;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.wispforest.condensed_creative.forge;
package io.wispforest.condensed_creative.neoforge;

import io.wispforest.condensed_creative.CondensedCreative;
import net.minecraftforge.fml.common.Mod;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.wispforest.condensed_creative.forge;
package io.wispforest.condensed_creative.neoforge;

import com.mojang.logging.LogUtils;
import io.wispforest.condensed_creative.registry.CondensedCreativeInitializer;
Expand Down
2 changes: 1 addition & 1 deletion forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
modLoader = "javafml"
loaderVersion = "[46,)"
loaderVersion = "[49,)"
issueTrackerURL = "https://github.com/wisp-forest/condensed-creative/issues"
license = "MIT license"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"required": true,
"package": "io.wispforest.condensed_creative.forge.mixins",
"package": "io.wispforest.condensed_creative.neoforge.mixins",
"compatibilityLevel": "JAVA_17",
"client": [
],
Expand Down
29 changes: 14 additions & 15 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,32 @@
org.gradle.jvmargs=-Xmx4G

# Mod Properties
mod_version = 3.2.0+1.20.2
mod_version = 3.2.0+1.20.4
maven_group = io.wispforest
archives_base_name = condensed_creative

# Minecraft Properties
minecraft_version=1.20.2
minecraft_version=1.20.4

#quilt,fabric,forge
enabled_platforms=fabric,forge
enabled_platforms=fabric,neoforge

architectury_version=8.1.79
yarn_mappings = 1.20.2+build.4
yarn_mappings = 1.20.4+build.3

# Loader Versions
fabric_loader_version=0.14.24
fabric_api_version=0.90.7+1.20.2
fabric_loader_version=0.15.3
fabric_api_version=0.92.0+1.20.4

forge_version=1.20.2-48.0.40
# NeoForge Dependencies
neoforge_version=20.4.46-beta

# Mod Local's
ferrite_core = 6.0.0
# Forge Dependencies
forge_version=1.20.4-49.0.12

#Fabric Only
lithium = mc1.20.2-0.11.2
sodium = mc1.20.2-0.5.3
modmenu = 8.0.0
owo_version = 0.11.3+1.20.2
# Mod Local's
modmenu = 9.0.0
owo_version = 0.12.0-pre.6+1.20.3

# Dependencies
cloth_config = 11.1.106
cloth_config = 13.0.121
108 changes: 108 additions & 0 deletions neoforge/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.1.2"
}

architectury {
platformSetupLoomIde()
neoForge()
}

repositories {
maven { url "https://maven.neoforged.net/releases/" }
}

loom {
accessWidenerPath = project(":common").loom.accessWidenerPath

neoForge {
// convertAccessWideners = true
// extraAccessWideners.add loom.accessWidenerPath.get().asFile.name
//
// mixinConfig "condensedCreativeCommon.mixins.json"
// mixinConfig "condensedCreativeForge.mixins.json"
}
}

configurations {
common
shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this.
compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common
developmentNeoForge.extendsFrom common
}

dependencies {
neoForge "net.neoforged:neoforge:${rootProject.neoforge_version}"
// Remove the next line if you don't want to depend on the API
//modApi "dev.architectury:architectury-forge:${rootProject.architectury_version}"

common(project(path: ":common", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionNeoForge")) { transitive = false }

modApi("me.shedaniel.cloth:cloth-config-neoforge:${rootProject.cloth_config}")

modImplementation("me.shedaniel.cloth:cloth-config-neoforge:${rootProject.cloth_config}")
}

processResources {
inputs.property "version", project.version

filesMatching("META-INF/mods.toml") {
expand "version": project.version
}
}

shadowJar {
exclude "fabric.mod.json"
exclude "architectury.common.json"

configurations = [project.configurations.shadowCommon]
archiveClassifier.set "neoforge-dev-shadow"
}

remapJar {
input.set shadowJar.archiveFile
dependsOn shadowJar
archiveClassifier.set "neoforge"

atAccessWideners.add(loom.accessWidenerPath.get().asFile.name)//atAccessWideners.add('my_mod.accesswidener')
}

jar {
archiveClassifier.set "neoforge-dev"
}

sourcesJar {
def commonSources = project(":common").sourcesJar
dependsOn commonSources
from commonSources.archiveFile.map { zipTree(it) }
archiveClassifier.set "neoforge-sources"
}

components.java {
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
skip()
}
}

def ENV = System.getenv()

publishing {
publications {
mavenForge(MavenPublication) {
artifactId = rootProject.archives_base_name + "-" + project.name
from components.java
}
}

repositories {
maven {
url ENV.MAVEN_URL

credentials {
username ENV.MAVEN_USER
password ENV.MAVEN_PASSWORD
}
}
}
}
1 change: 1 addition & 0 deletions neoforge/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
loom.platform=neoforge
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package io.wispforest.condensed_creative.neoforge;


import io.wispforest.condensed_creative.CondensedCreative;
import io.wispforest.condensed_creative.compat.CondensedCreativeConfig;
import io.wispforest.condensed_creative.data.CondensedEntriesLoader;
import me.shedaniel.autoconfig.AutoConfig;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.ModLoadingContext;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
import net.neoforged.fml.loading.FMLEnvironment;
import net.neoforged.neoforge.client.ConfigScreenHandler;
import net.neoforged.neoforge.client.event.RegisterClientReloadListenersEvent;

@Mod.EventBusSubscriber(modid = CondensedCreative.MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public class CondensedCreativeClientForge {

@OnlyIn(Dist.CLIENT)
@SubscribeEvent
public static void setupClient(final FMLClientSetupEvent event){
event.enqueueWork(() -> {
CondensedCreative.onInitializeClient(!FMLEnvironment.production);

ModLoadingContext.get().registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class,
() -> new ConfigScreenHandler.ConfigScreenFactory(
(client, parent) -> AutoConfig.getConfigScreen(CondensedCreativeConfig.class, parent).get()));
});
}

@OnlyIn(Dist.CLIENT)
@SubscribeEvent
public static void registerReloadListener(RegisterClientReloadListenersEvent event){
event.registerReloadListener(new CondensedEntriesLoader());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package io.wispforest.condensed_creative.neoforge;

import io.wispforest.condensed_creative.CondensedCreative;
import net.neoforged.fml.common.Mod;

@Mod(CondensedCreative.MODID)
public class CondensedCreativeForge {

public CondensedCreativeForge() {}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package io.wispforest.condensed_creative.neoforge;

import com.mojang.logging.LogUtils;
import io.wispforest.condensed_creative.registry.CondensedCreativeInitializer;
import net.neoforged.fml.ModList;
import net.neoforged.neoforgespi.language.ModFileScanData;
import org.objectweb.asm.Type;
import org.slf4j.Logger;

import java.util.ArrayList;
import java.util.List;

public class LoaderSpecificUtilsImpl {

public static final Logger LOGGER = LogUtils.getLogger();

public static List<CondensedCreativeInitializer> getEntryPoints(){
final List<CondensedCreativeInitializer> condensedCreativeInitializers = new ArrayList<>();

for(ModFileScanData data : ModList.get().getAllScanData()) {
for (ModFileScanData.AnnotationData annotationData : data.getAnnotations()) {
if(!annotationData.annotationType().equals(Type.getType(CondensedCreativeInitializer.InitializeCondensedEntries.class))){
continue;
}

try {
Class<?> clazz = Class.forName(annotationData.memberName());

if(CondensedCreativeInitializer.class.isAssignableFrom(clazz)){
try {
condensedCreativeInitializers.add((CondensedCreativeInitializer) clazz.getDeclaredConstructor().newInstance());
} catch (Throwable e){
LOGGER.error("Failed to load CondensedEntryInit: " + annotationData.memberName(), e);
}
}
} catch (Throwable e) {
LOGGER.error("No class from such annotation: " + annotationData.memberName(), e);
}

break;
}
}

return condensedCreativeInitializers;
}
}
32 changes: 32 additions & 0 deletions neoforge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
modLoader = "javafml"
loaderVersion = "[1,)"
issueTrackerURL = "https://github.com/wisp-forest/condensed-creative/issues"
license = "MIT license"

[[mods]]
modId = "condensed_creative"
version = "${version}"
displayName = "Condensed Creative"
authors = "Blodhgarm"
description = '''
A Mod that allows for Modders to Condense there many blocks into Bedrock like Item Entry's!
'''
logoFile = "icon.png"
[[mixins]]
config = 'condensedCreativeCommon.mixins.json'
[[mixins]]
config = 'condensedCreativeForge.mixins.json'

[[dependencies.condensed_creative]]
modId = "neoforge"
required = true
versionRange = "[20,)"
ordering = "NONE"
side = "BOTH"

[[dependencies.condensed_creative]]
modId = "minecraft"
required = true
versionRange = "[1.20,)"
ordering = "NONE"
side = "BOTH"
13 changes: 13 additions & 0 deletions neoforge/src/main/resources/condensedCreativeForge.mixins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"required": true,
"package": "io.wispforest.condensed_creative.neoforge.mixins",
"compatibilityLevel": "JAVA_17",
"minVersion": "0.8",
"client": [
],
"mixins": [
],
"injectors": {
"defaultRequire": 1
}
}
Binary file added neoforge/src/main/resources/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions neoforge/src/main/resources/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"pack": {
"description": "Condensed Creative",
"pack_format": 9
}
}
Loading

0 comments on commit fc2164d

Please sign in to comment.