Skip to content

Commit

Permalink
feat: initial 1.20.2 commit; ingredients pending rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
bconlon1 committed Jan 30, 2024
1 parent 62a489b commit 4324bd2
Show file tree
Hide file tree
Showing 32 changed files with 742 additions and 756 deletions.
134 changes: 56 additions & 78 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
plugins {
id 'eclipse'
id 'maven-publish'
id 'net.neoforged.gradle' version '[6.0.13, 6.2)'
id 'org.spongepowered.mixin' version '[0.7,0.8)'
id 'org.parchmentmc.librarian.forgegradle' version '[1,2)'
id 'org.moddingx.modgradle.mapping' version '[4,5)'
id 'org.moddingx.modgradle.sourcejar' version '[4,5)' apply false
id 'net.neoforged.gradle.userdev' version '7.0.+'
id 'io.github.0ffz.github-packages' version '[1,2)'
id 'io.github.p03w.machete' version '2.0.1'
id 'com.matthewprenger.cursegradle' version '[1.4,1.5)'
id 'com.modrinth.minotaur' version '[2,3)'
}

version = "${mc_version}-${mod_version}-neoforge"
Expand All @@ -19,83 +16,55 @@ base {

java.toolchain.languageVersion = JavaLanguageVersion.of(17)

apply plugin: 'org.moddingx.modgradle.sourcejar'
runs {
configureEach {
workingDirectory project.file('run')
systemProperty "${mod_id}.iside", 'true'
systemProperty 'forge.logging.console.level', 'info'

minecraft {
mappings channel: 'sugarcane', version: project.mappings

copyIdeResources = true

accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')

runs {
configureEach {
workingDirectory project.file('run')

property "${mod_id}.iside", 'true'

property 'forge.logging.console.level', 'info'

mods {
"${mod_id}" {
source sourceSets.main
}
}
}

client {
property 'forge.enabledGameTestNamespaces', mod_id
}

server {
property 'forge.enabledGameTestNamespaces', mod_id
modSource project.sourceSets.main
}

args '--nogui'
}
client {
systemProperty 'forge.enabledGameTestNamespaces', mod_id
}

gameTestServer {
property 'forge.enabledGameTestNamespaces', mod_id
}
server {
systemProperty 'forge.enabledGameTestNamespaces', mod_id
programArgument '--nogui'
}

data {
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/'), '--existing', file('src/generated/resources/')
gameTestServer {
systemProperty 'neoforge.enabledGameTestNamespaces', mod_id
}

environment 'target', 'fmluserdevdata'
}
data {
programArguments.addAll '--mod', mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath(), '--existing', file('src/generated/resources/').getAbsolutePath()
}
}

sourceSets.main.resources {
srcDir 'src/generated/resources'
}

processResources {
exclude '.cache/'
}

machete {
jij.enabled = false
json.enabled = true
png.enabled = false
sourceFileStriping.enabled = false
lvtStriping.enabled = false
subsystems {
parchment {
minecraftVersion = project.mc_version
mappingsVersion = project.mappings
}
}

tasks.jar.finalizedBy('optimizeOutputsOfJar')

dependencies {
minecraft "net.neoforged:forge:${project.mc_version}-${project.neoforge_version}"
implementation "net.neoforged:neoforge:${project.neoforge_version}"

annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
// compileOnly "mezz.jei:jei-${project.mc_version}-common:${project.jei_version}"
// compileOnly "mezz.jei:jei-${project.mc_version}-forge:${project.jei_version}"

compileOnly "mezz.jei:jei-${project.mc_version}-common:${project.jei_version}"
compileOnly "mezz.jei:jei-${project.mc_version}-forge:${project.jei_version}"
compileOnly "me.shedaniel:RoughlyEnoughItems-api-forge:$rei_version"
compileOnly "me.shedaniel:RoughlyEnoughItems-default-plugin-forge:$rei_version"

compileOnly fg.deobf("me.shedaniel:RoughlyEnoughItems-api-forge:$rei_version")
compileOnly fg.deobf("me.shedaniel:RoughlyEnoughItems-default-plugin-forge:$rei_version")

compileOnly fg.deobf("me.shedaniel.cloth:cloth-config-forge:$cloth_config_version")
compileOnly fg.deobf("dev.architectury:architectury-forge:$architectury_version")
compileOnly "me.shedaniel.cloth:cloth-config-forge:$cloth_config_version"
compileOnly "dev.architectury:architectury-forge:$architectury_version"
}

repositories {
Expand All @@ -104,6 +73,20 @@ repositories {
maven { url = "https://maven.architectury.dev/" }
}

//processResources {
// exclude '.cache/'
//}
//
//machete {
// jij.enabled = false
// json.enabled = true
// png.enabled = false
// sourceFileStriping.enabled = false
// lvtStriping.enabled = false
//}
//
//tasks.jar.finalizedBy('optimizeOutputsOfJar')

tasks.named('jar', Jar).configure {
manifest {
attributes([
Expand All @@ -116,24 +99,24 @@ tasks.named('jar', Jar).configure {
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}

finalizedBy 'reobfJar'
}

tasks.named(sourceSets.main.compileJavaTaskName) {
outputs.file("${it.temporaryDir}/${it.name}-refmap.json").withPropertyName("mixin refmap")
}

compileJava {
options.incremental = false
}

tasks.register('sourceJar', Jar) {
dependsOn 'classes'
from sourceSets.main.allSource
archiveClassifier = 'sources'
}

publishing {
publications {
mavenJava(MavenPublication) {
artifactId project.archivesBaseName
artifact jar
artifact sourceJar
artifact project.jar
artifact project.sourceJar
}
}
repositories {
Expand All @@ -147,8 +130,3 @@ publishing {
}
}
}

mixin {
config "${project.mod_id}.mixins.json"
add sourceSets.main, "${project.mod_id}.refmap.json"
}
14 changes: 7 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ org.gradle.daemon=false
mod_id=nitrogen_internals
mod_name=Nitrogen
mod_version=1.0.2
mc_version=1.20.1
neoforge_version=47.1.70
mappings=2023.08.20-1.20.1
mc_version=1.20.2
neoforge_version=20.2.88
mappings=2023.12.10

# Dependencies
jei_version=15.2.0.27
rei_version=12.0.684
cloth_config_version=11.1.118
architectury_version=9.1.12
#jei_version=15.2.0.27
rei_version=13.0.685
cloth_config_version=12.0.119
architectury_version=10.0.17
15 changes: 0 additions & 15 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,8 @@
pluginManagement {
resolutionStrategy {
eachPlugin {
var plugin = requested.id.toString()

// ModGradle
if (plugin.startsWith('org.moddingx.modgradle.')) {
useModule "org.moddingx:ModGradle:${requested.version}"
}
}
}
repositories {
gradlePluginPortal()
maven { url = 'https://maven.neoforged.net/releases/' }
maven { url = 'https://repo.spongepowered.org/maven' }
maven { url = 'https://maven.parchmentmc.org' }
maven { url = 'https://maven.moddingx.org' }
}
}

plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
}
23 changes: 11 additions & 12 deletions src/main/java/com/aetherteam/nitrogen/Nitrogen.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.metadata.pack.PackMetadataSection;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.data.event.GatherDataEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.event.server.ServerStartingEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
import net.neoforged.neoforge.data.event.GatherDataEvent;
import net.neoforged.neoforge.event.entity.player.PlayerEvent;
import net.neoforged.neoforge.event.server.ServerStartingEvent;
import net.neoforged.fml.common.Mod;
import org.slf4j.Logger;

import java.time.LocalDateTime;
Expand All @@ -39,10 +39,9 @@ public class Nitrogen {
public static final String MODID = "nitrogen_internals";
public static final Logger LOGGER = LogUtils.getLogger();

public Nitrogen() {
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
modEventBus.addListener(this::commonSetup);
modEventBus.addListener(this::dataSetup);
public Nitrogen(IEventBus bus, Dist dist) {
bus.addListener(this::commonSetup);
bus.addListener(this::dataSetup);
}

public void commonSetup(FMLCommonSetupEvent event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static UserSavedData create() {
* @return The {@link UserSavedData} corresponding to the data file.
*/
public static UserSavedData compute(DimensionDataStorage dataStorage) {
return dataStorage.computeIfAbsent(UserSavedData::load, UserSavedData::create, FILE_NAME);
return dataStorage.computeIfAbsent(new SavedData.Factory<>(UserSavedData::create, UserSavedData::load, null), FILE_NAME);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ICapabilitySerializable;
import net.minecraftforge.common.util.INBTSerializable;
import net.minecraftforge.common.util.LazyOptional;
import net.neoforged.neoforge.common.capabilities.Capability;
import net.neoforged.neoforge.common.capabilities.ICapabilitySerializable;
import net.neoforged.neoforge.common.util.INBTSerializable;
import net.neoforged.neoforge.common.util.LazyOptional;

/**
* Record used for creating basic capability providers.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.Level;
import net.minecraftforge.common.util.INBTSerializable;
import net.minecraftforge.network.simple.SimpleChannel;
import net.neoforged.neoforge.common.util.INBTSerializable;
import net.neoforged.neoforge.network.simple.SimpleChannel;
import org.apache.commons.lang3.tuple.Triple;
import oshi.util.tuples.Quintet;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import com.aetherteam.nitrogen.client.renderer.blockentity.NitrogenBlockEntityWithoutLevelRenderer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
import net.minecraftforge.common.util.Lazy;
import net.neoforged.neoforge.client.extensions.common.IClientItemExtensions;
import net.neoforged.neoforge.common.util.Lazy;

public class NitrogenRenderers {
public static final Lazy<BlockEntityWithoutLevelRenderer> blockEntityWithoutLevelRenderer = () ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import net.minecraft.world.level.storage.loot.functions.CopyNameFunction;
import net.minecraft.world.level.storage.loot.predicates.MatchTool;
import net.minecraft.world.level.storage.loot.providers.number.ConstantValue;
import net.minecraftforge.common.Tags;
import net.neoforged.neoforge.common.Tags;

import java.util.Set;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package com.aetherteam.nitrogen.data.providers;

import net.minecraft.core.Direction;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.data.PackOutput;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.block.state.properties.SlabType;
import net.minecraft.world.level.block.state.properties.WallSide;
import net.minecraftforge.client.model.generators.*;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.registries.ForgeRegistries;
import net.neoforged.neoforge.client.model.generators.*;
import net.neoforged.neoforge.common.data.ExistingFileHelper;

import java.util.Map;

Expand All @@ -20,7 +20,7 @@ public NitrogenBlockStateProvider(PackOutput output, String id, ExistingFileHelp
}

public String name(Block block) {
ResourceLocation location = ForgeRegistries.BLOCKS.getKey(block);
ResourceLocation location = BuiltInRegistries.BLOCK.getKey(block);
if (location != null) {
return location.getPath();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.aetherteam.nitrogen.Nitrogen;
import net.minecraft.core.Direction;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.data.PackOutput;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
Expand All @@ -10,10 +11,9 @@
import net.minecraft.world.item.armortrim.TrimMaterial;
import net.minecraft.world.item.armortrim.TrimMaterials;
import net.minecraft.world.level.block.Block;
import net.minecraftforge.client.model.generators.ItemModelBuilder;
import net.minecraftforge.client.model.generators.ItemModelProvider;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.registries.ForgeRegistries;
import net.neoforged.neoforge.client.model.generators.ItemModelBuilder;
import net.neoforged.neoforge.client.model.generators.ItemModelProvider;
import net.neoforged.neoforge.common.data.ExistingFileHelper;

import java.util.List;

Expand All @@ -25,7 +25,7 @@ public NitrogenItemModelProvider(PackOutput output, String id, ExistingFileHelpe
}

public String blockName(Block block) {
ResourceLocation location = ForgeRegistries.BLOCKS.getKey(block);
ResourceLocation location = BuiltInRegistries.BLOCK.getKey(block);
if (location != null) {
return location.getPath();
} else {
Expand All @@ -34,7 +34,7 @@ public String blockName(Block block) {
}

public String itemName(Item item) {
ResourceLocation location = ForgeRegistries.ITEMS.getKey(item);
ResourceLocation location = BuiltInRegistries.ITEM.getKey(item);
if (location != null) {
return location.getPath();
} else {
Expand Down
Loading

0 comments on commit 4324bd2

Please sign in to comment.