Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .idea/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
120 changes: 58 additions & 62 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
plugins {
id('idea')
id("maven-publish")
id('maven-publish')
// todo replace with mc-publish, as these plugins do not support Gradle configuration cache
id('com.modrinth.minotaur') version '2.+'
id('com.matthewprenger.cursegradle') version '1.4.0'
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.9"
id 'net.neoforged.moddev.legacyforge' version '2.0.80'
id('net.neoforged.moddev') version '2.0.80'
}

group = "thedarkcolour.forestry"
tasks.named('wrapper', Wrapper).configure {
distributionType = Wrapper.DistributionType.BIN
}

group = 'forestry'
version = forestryVersion
archivesBaseName = "forestry-$minecraftVersion"
base.archivesName = "forestry-$minecraftVersion"

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

legacyForge {
version = "1.20.1-$forgeVersion"
neoForge {
version = "$neoForgeVersion"

accessTransformers = files('src/main/resources/META-INF/accesstransformer.cfg')
// Set to false because Forge has broken access transformers
//validateAccessTransformers = true
validateAccessTransformers = true

// Add Parchment parameter mappings
parchment {
Expand Down Expand Up @@ -60,21 +63,22 @@ repositories {
maven {
name = 'jei'
url = 'https://maven.blamejared.com/'
content { includeGroup "mezz.jei" }
content { includeGroup 'mezz.jei' }
}
maven {
name = "Patchouli"
url = "https://maven.blamejared.com/"
name = 'Patchouli'
url = 'https://maven.blamejared.com/'
content { includeGroup 'vazkii.patchouli' }
}
maven {
name = 'Architectury API'
url = "https://maven.architectury.dev"
content { includeGroup "dev.architectury" }
url = 'https://maven.architectury.dev'
content { includeGroup 'dev.architectury' }
}
maven {
name = 'KubeJS and Rhino'
url = 'https://maven.latvian.dev/releases'
content { includeGroup 'dev.latvian.mods' }
content { includeGroupAndSubgroups 'dev.latvian' }
}
maven {
name = 'Mekanism'
Expand All @@ -87,83 +91,76 @@ repositories {
content { includeGroup 'top.theillusivec4.curios' }
}
maven {
url "https://cursemaven.com"
content {
includeGroup "curse.maven"
}
url = 'https://cursemaven.com'
content { includeGroup 'curse.maven' }
}
maven {
name = 'ModKit'
url 'https://jitpack.io'
content { includeGroup 'com.github.thedarkcolour' }
name = 'ModKit and KubeJS transitive dep'
url = 'https://jitpack.io'
content {
includeGroup 'com.github.thedarkcolour'
includeGroup 'com.github.rtyley'
}
}
}

dependencies {
// JEI OPTIONAL
modCompileOnly "mezz.jei:jei-$minecraftVersion-common-api:$jeiVersion"
modCompileOnly "mezz.jei:jei-$minecraftVersion-forge-api:$jeiVersion"
modRuntimeOnly "mezz.jei:jei-$minecraftVersion-forge:$jeiVersion"
compileOnly "mezz.jei:jei-$minecraftVersion-neoforge-api:$jeiVersion"
runtimeOnly "mezz.jei:jei-$minecraftVersion-neoforge:$jeiVersion"
// KubeJS OPTIONAL
modImplementation "dev.architectury:architectury-forge:${architectury_version}"
modImplementation "dev.latvian.mods:rhino-forge:${rhino_version}"
modImplementation "dev.latvian.mods:kubejs-forge:${kubejs_version}"
implementation "dev.architectury:architectury-neoforge:${architectury_version}"
implementation "dev.latvian.mods:rhino:${rhino_version}"
implementation "dev.latvian.mods:kubejs-neoforge:${kubejs_version}"
// Curios Optional
modImplementation "top.theillusivec4.curios:curios-forge:${curiosVersion}+${minecraftVersion}"
implementation "top.theillusivec4.curios:curios-neoforge:${curiosVersion}+${minecraftVersion}"
// PATCHOULI REQUIRED
modCompileOnly "vazkii.patchouli:Patchouli:$patchouliVersion-FORGE:api"
modRuntimeOnly "vazkii.patchouli:Patchouli:$patchouliVersion-FORGE"
compileOnly "vazkii.patchouli:Patchouli:$patchouliVersion-NEOFORGE:api"
runtimeOnly "vazkii.patchouli:Patchouli:$patchouliVersion-NEOFORGE"
// ModKit DEV ONLY
modImplementation 'com.github.thedarkcolour:ModKit:cc8f1c11ec'

// DEV ONLY
compileOnly "org.jetbrains:annotations:23.0.0"
implementation 'com.github.thedarkcolour:ModKit:0cfafa780c'
}

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

var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) {
var generateModMetadata = tasks.register('generateModMetadata', ProcessResources) {
var replaceProperties = [
"version" : project.version,
"forgeVersionRange" : forgeVersionRange,
"jeiVersionRange" : jeiVersionRange,
"patchouliVersionRange": patchouliVersionRange,
"fmlVersionRange" : fmlVersionRange,
'version' : project.version,
'forgeVersionRange' : forgeVersionRange,
'jeiVersionRange' : jeiVersionRange,
'patchouliVersionRange': patchouliVersionRange,
'fmlVersionRange' : fmlVersionRange,
]
inputs.properties replaceProperties
expand replaceProperties

from "src/main/templates"
into "build/generated/sources/modMetadata"
from 'src/main/templates'
into 'build/generated/sources/modMetadata'
}
sourceSets.main.resources.srcDir generateModMetadata

idea.project.settings {
taskTriggers {
afterSync generateModMetadata
}
}
neoForge.ideSyncTask generateModMetadata

jar {
from sourceSets.main.output.classesDirs
from sourceSets.main.output.resourcesDir

manifest {
attributes([
"Specification-Title" : "Forestry",
"Specification-Vendor" : "SirSengir",
"Specification-Version" : "${project.version}",
"Implementation-Title" : "${project.name}",
"Implementation-Version" : "${project.version}",
"Implementation-Vendor" : "SirSengir",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
"Specification-Title" : "Forestry",
"Specification-Vendor" : "SirSengir",
"Specification-Version" : "${project.version}",
"Implementation-Title" : "${project.name}",
"Implementation-Version" : "${project.version}",
"Implementation-Vendor" : "SirSengir",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}

tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
options.compilerArgs << "-Xmaxerrs" << "400"
options.compilerArgs << "-Xmaxerrs" << "2000"
}

idea {
Expand Down Expand Up @@ -214,7 +211,7 @@ publishing {
publications {
mavenJava(MavenPublication) {
groupId = project.group
artifactId = project.archivesBaseName
artifactId = project.base.archivesName
version = project.version

// ForgeGradle will generate wild dependency definitions, see https://github.com/MinecraftForge/ForgeGradle/issues/584
Expand Down Expand Up @@ -242,8 +239,8 @@ publishing {

maven {
credentials {
username System.getenv("MODMAVEN_USER")
password System.getenv("MODMAVEN_PASSWORD")
username = System.getenv("MODMAVEN_USER")
password = System.getenv("MODMAVEN_PASSWORD")
}

name = "Modmaven"
Expand Down Expand Up @@ -288,7 +285,7 @@ modrinth {
loaders = ["forge"]
changelog = getChangelog(project.version)

uploadFile = reobfJar
uploadFile = jar
additionalFiles.add(sourcesJar)
additionalFiles.add(apiJar)
additionalFiles.add(javadocJar)
Expand Down Expand Up @@ -324,4 +321,3 @@ static def getChangelog(Object version) {
// Fallback in case this fails
return "Forestry Update ${version}"
}

3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## Forestry 3.0.0
- Moistener, Fermenter, Rainmaker, Biogas Engine, and Peat Engine fuels are now data-driven

## Forestry 2.6.1
- Fixed Research Notes voiding items when used in the offhand (#222)
- Fix tags for Survivalist tools (#221)
Expand Down
32 changes: 17 additions & 15 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
org.gradle.daemon=false
org.gradle.jvmargs=-Xmx3G
org.gradle.jvmargs=-Xmx1G
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configuration-cache=true

curseforgeId=1056828
modrinthId=2oORTOi2
Expand All @@ -9,21 +11,21 @@ modrinthId=2oORTOi2
forestryVersion=2.6.1

# Minecraft
minecraftVersion=1.20.1
mappingsVersion=2023.06.26
minecraftVersion=1.21.1
mappingsVersion=2024.11.17
# Forge
forgeVersion=47.4.0
forgeVersionRange=[47.3.5,)
fmlVersionRange=[43,)
neoForgeVersion=21.1.172
forgeVersionRange=[21.1,)
fmlVersionRange=[4,)
# JEI
jeiVersion=15.20.0.106
jeiVersionRange=[15,)
jeiVersion=19.19.6.236
jeiVersionRange=[19,)
# Patchouli
patchouliVersion=1.20.1-84
patchouliVersionRange=[1.20.1-84,)
patchouliVersion=1.21-88
patchouliVersionRange=[1.21-88,)
# KubeJS
kubejs_version=2001.6.5-build.16
rhino_version=2001.2.3-build.10
architectury_version=9.2.14
kubejs_version=2101.7.1-build.181
rhino_version=2101.2.7-build.74
architectury_version=13.0.8
# Curios
curiosVersion=5.14.1
curiosVersion=9.5.1
22 changes: 11 additions & 11 deletions src/main/java/forestry/Forestry.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
import forestry.apiimpl.plugin.PluginManager;
import forestry.core.EventHandlerCore;
import forestry.core.config.ForestryConfig;
import forestry.core.network.NetworkHandler;
import forestry.modules.ForestryModuleManager;
import net.minecraftforge.common.ForgeMod;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.neoforged.fml.ModContainer;
import net.neoforged.fml.ModList;
import net.neoforged.fml.common.Mod;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.common.NeoForgeMod;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand All @@ -25,17 +24,18 @@ public class Forestry {
public static final boolean DEBUG = ModList.get().isLoaded("modkit");
public static final Logger LOGGER = LogManager.getLogger(ForestryConstants.MOD_ID);

public Forestry() {
public Forestry(ModContainer container) {
// IForestryModule - registration of game objects
ForestryModuleManager moduleManager = (ForestryModuleManager) IForestryApi.INSTANCE.getModuleManager();
moduleManager.init();
NetworkHandler.register();
MinecraftForge.EVENT_BUS.register(EventHandlerCore.class);
NeoForge.EVENT_BUS.register(EventHandlerCore.class);

// IForestryPlugin - registration of Forestry data
PluginManager.loadPlugins();
PluginManager.registerErrors();

ForestryConfig.register(ModLoadingContext.get());
ForestryConfig.register(container);

ForgeMod.enableMilkFluid();
NeoForgeMod.enableMilkFluid();
}
}
39 changes: 17 additions & 22 deletions src/main/java/forestry/api/ForestryCapabilities.java
Original file line number Diff line number Diff line change
@@ -1,33 +1,28 @@
package forestry.api;

import forestry.api.apiculture.IArmorApiarist;
import forestry.api.core.IArmorNaturalist;
import forestry.api.apiculture.IBeeProtection;
import forestry.api.core.ISpectacleVision;
import forestry.api.genetics.capability.IIndividualHandlerItem;
import forestry.api.genetics.filter.IFilterLogic;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityManager;
import net.minecraftforge.common.capabilities.CapabilityToken;
import net.neoforged.neoforge.capabilities.ItemCapability;

import static forestry.api.ForestryConstants.forestry;

/**
* All capabilities added by base Forestry.
* <p>
* If your mod does not require a dependency on Forestry, it is recommended to use your own CapabilityTokens instead
* of the ones below, as recommended by {@link net.minecraftforge.common.capabilities.ForgeCapabilities}.
*/
public class ForestryCapabilities {
// Apiculture
public static Capability<IArmorApiarist> ARMOR_APIARIST = CapabilityManager.get(new CapabilityToken<>() {
});

// Arboriculture
public static Capability<IArmorNaturalist> ARMOR_NATURALIST = CapabilityManager.get(new CapabilityToken<>() {
});
/**
* Items with this capability can protect the wearer from harmful bee effects.
*/
public static ItemCapability<IBeeProtection, Void> BEE_PROTECTION = ItemCapability.createVoid(forestry("bee_protection"), IBeeProtection.class);

// Genetics
public static Capability<IIndividualHandlerItem> INDIVIDUAL_HANDLER_ITEM = CapabilityManager.get(new CapabilityToken<>() {
});
/**
* Grants the wearer the ability to see wild bee hives and pollinated leaves more easily.
*/
public static ItemCapability<ISpectacleVision, Void> SPECTACLE_VISION = ItemCapability.createVoid(forestry("spectacle_vision"), ISpectacleVision.class);

// Genetic Filter
public static Capability<IFilterLogic> FILTER_LOGIC = CapabilityManager.get(new CapabilityToken<>() {
});
/**
* Items with this capability support Forestry's genetic data.
*/
public static ItemCapability<IIndividualHandlerItem, Void> INDIVIDUAL_HANDLER_ITEM = ItemCapability.createVoid(forestry("individual"), IIndividualHandlerItem.class);
}
2 changes: 1 addition & 1 deletion src/main/java/forestry/api/ForestryConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ public class ForestryConstants {
* @return A new resource location under the Forestry namespace. In most cases, mods should use their own namespace instead.
*/
public static ResourceLocation forestry(String path) {
return new ResourceLocation(MOD_ID, path);
return ResourceLocation.fromNamespaceAndPath(MOD_ID, path);
}
}
Loading