first commit
This commit is contained in:
136
neoforge/build.gradle
Normal file
136
neoforge/build.gradle
Normal file
@@ -0,0 +1,136 @@
|
||||
plugins {
|
||||
id 'net.neoforged.gradle.userdev' version '7.0.+'
|
||||
id 'com.matthewprenger.cursegradle' version "${cursegradle_version}"
|
||||
id 'com.github.johnrengelman.shadow' version "${shadow_version}"
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
var mod_version = mcef_version
|
||||
|
||||
archivesBaseName = project.archives_base_name
|
||||
version = mod_version
|
||||
group = mod_packagename
|
||||
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(java_version as int)
|
||||
|
||||
runs {
|
||||
client {
|
||||
workingDirectory project.file('run')
|
||||
}
|
||||
server {
|
||||
workingDirectory project.file('run/server')
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Add the following to ~/.gradle/gradle.properties
|
||||
systemProp.org.gradle.s3.endpoint=https://<the s3 endpoint>
|
||||
MCEF_S3_PUBLISH_URL_SNAPSHOT=s3://<bucket>/repositories/snapshots
|
||||
MCEF_S3_PUBLISH_URL_RELEASE=s3://<bucket>/repositories/releases
|
||||
MCEF_S3_PUBLISH_ACCESS_KEY=<access key>
|
||||
MCEF_S3_PUBLISH_SECRET_KEY=<secret key>
|
||||
*/
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
url ((mcef_version.toString().endsWith("SNAPSHOT")) ? findProperty('MCEF_S3_PUBLISH_URL_SNAPSHOT') : findProperty('MCEF_S3_PUBLISH_URL_RELEASE'))
|
||||
credentials(AwsCredentials) {
|
||||
accessKey = findProperty('MCEF_S3_PUBLISH_ACCESS_KEY')
|
||||
secretKey = findProperty('MCEF_S3_PUBLISH_SECRET_KEY')
|
||||
}
|
||||
}
|
||||
}
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
from components.java
|
||||
groupId = 'com.cinemamod'
|
||||
artifactId = 'mcef-neoforge'
|
||||
version = mcef_version
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets.main.resources { srcDir 'src/generated/resources' }
|
||||
|
||||
configurations {
|
||||
shadowMc.extendsFrom minecraftLibrary
|
||||
}
|
||||
|
||||
tasks.register('prepareWorkspace') {
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "net.neoforged:neoforge:${neoforge_version}"
|
||||
|
||||
implementation(project(':common')) {
|
||||
transitive false
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register('generateJava', Copy) {
|
||||
from project(':common').file('src/template/java')
|
||||
into "${buildDir}/generated/java"
|
||||
expand 'compatibility_version': mod_compatibility_version
|
||||
}
|
||||
sourceSets.main.java {
|
||||
srcDir "${buildDir}/generated/java"
|
||||
}
|
||||
compileJava.dependsOn generateJava
|
||||
|
||||
processResources {
|
||||
filesMatching('**/*.toml') {
|
||||
expand 'mod_id': mod_id,
|
||||
'mod_version': mod_version,
|
||||
'mod_name': mod_name,
|
||||
'neoforge_version': neoforge_version,
|
||||
'loader_version': loader_version,
|
||||
'neoforge_dependency': 'neoforge_dependency',
|
||||
'minecraft_version': minecraft_version
|
||||
}
|
||||
from("${project(':common').projectDir}/src/main/resources")
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
source(project(':common').sourceSets.main.allSource)
|
||||
source(project(':common').sourceSets.jcef.allSource)
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
|
||||
jar {
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
manifest {
|
||||
attributes(['Specification-Title' : mod_name,
|
||||
'Specification-Vendor' : mod_vendor,
|
||||
'Specification-Version' : "1",
|
||||
'Implementation-Title' : mod_name,
|
||||
'Implementation-Version' : mod_version,
|
||||
'Implementation-Vendor' : mod_vendor,
|
||||
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
|
||||
'java-cef-commit' : project.parent.getCheckedOutGitCommitHash(project.parent)
|
||||
])
|
||||
}
|
||||
from configurations.shadow.collect { it.isDirectory() ? it : zipTree(it) }
|
||||
}
|
||||
|
||||
curseforge {
|
||||
apiKey = file("${rootDir}/curseforge_api_key.txt").exists() ? file("${rootDir}/curseforge_api_key.txt").text.trim() : ''
|
||||
project {
|
||||
id = curse_id
|
||||
releaseType = release_type
|
||||
addGameVersion minecraft_version
|
||||
addGameVersion 'NeoForge'
|
||||
addGameVersion "Java ${java_version}"
|
||||
mainArtifact(jar) {
|
||||
displayName = "[NEOFORGE][${minecraft_version}] ${mod_name} ${mod_version}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
configurations = [project.configurations.shadowMc]
|
||||
archiveClassifier = ''
|
||||
}
|
||||
16
neoforge/gradle.properties
Normal file
16
neoforge/gradle.properties
Normal file
@@ -0,0 +1,16 @@
|
||||
org.gradle.jvmargs=-Xmx4G
|
||||
org.gradle.daemon=false
|
||||
|
||||
neoforge_version=21.0.145
|
||||
loader_version=[1,)
|
||||
neoforge_dependency=[21.0.0-beta,)
|
||||
|
||||
mod_packagename=com.cinemamod
|
||||
archives_base_name=mcef-neoforge
|
||||
|
||||
curse_id=636236
|
||||
release_type=release
|
||||
recommended=true
|
||||
|
||||
neogradle.subsystems.parchment.minecraftVersion=1.21
|
||||
neogradle.subsystems.parchment.mappingsVersion=2024.07.28
|
||||
13
neoforge/runs/junit/junit_jvm_args.txt
Normal file
13
neoforge/runs/junit/junit_jvm_args.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
-p
|
||||
D:\program\gradle-cache\caches\modules-2\files-2.1\cpw.mods\bootstraplauncher\2.0.2\1a2d076cbc33b0520cbacd591224427b2a20047d\bootstraplauncher-2.0.2.jar;D:\program\gradle-cache\caches\modules-2\files-2.1\cpw.mods\securejarhandler\3.0.8\c0ef95cecd8699a0449053ac7d9c160748d902cd\securejarhandler-3.0.8.jar;D:\program\gradle-cache\caches\modules-2\files-2.1\org.ow2.asm\asm-commons\9.5\19ab5b5800a3910d30d3a3e64fdb00fd0cb42de0\asm-commons-9.5.jar;D:\program\gradle-cache\caches\modules-2\files-2.1\org.ow2.asm\asm-util\9.5\64b5a1fc8c1b15ed2efd6a063e976bc8d3dc5ffe\asm-util-9.5.jar;D:\program\gradle-cache\caches\modules-2\files-2.1\org.ow2.asm\asm-analysis\9.5\490bacc77de7cbc0be1a30bb3471072d705be4a4\asm-analysis-9.5.jar;D:\program\gradle-cache\caches\modules-2\files-2.1\org.ow2.asm\asm-tree\9.5\fd33c8b6373abaa675be407082fdfda35021254a\asm-tree-9.5.jar;D:\program\gradle-cache\caches\modules-2\files-2.1\org.ow2.asm\asm\9.5\dc6ea1875f4d64fbc85e1691c95b96a3d8569c90\asm-9.5.jar;D:\program\gradle-cache\caches\modules-2\files-2.1\net.neoforged\JarJarFileSystems\0.4.1\78f59f89defcd032ed788b151ca6a0d40ace796a\JarJarFileSystems-0.4.1.jar
|
||||
--add-modules
|
||||
ALL-MODULE-PATH
|
||||
--add-opens
|
||||
java.base/java.util.jar=cpw.mods.securejarhandler
|
||||
--add-opens
|
||||
java.base/java.lang.invoke=cpw.mods.securejarhandler
|
||||
--add-exports
|
||||
java.base/sun.security.util=cpw.mods.securejarhandler
|
||||
--add-exports
|
||||
jdk.naming.dns/com.sun.jndi.dns=java.naming
|
||||
-XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump
|
||||
18
neoforge/runs/junit/junit_test_args.txt
Normal file
18
neoforge/runs/junit/junit_test_args.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
--launchTarget
|
||||
forgejunituserdev
|
||||
--version
|
||||
21.0.145
|
||||
--assetIndex
|
||||
asset-index
|
||||
--assetsDir
|
||||
D:\program\gradle-cache\caches\minecraft\assets
|
||||
--gameDir
|
||||
.
|
||||
--fml.neoForgeVersion
|
||||
21.0.145
|
||||
--fml.fmlVersion
|
||||
4.0.21
|
||||
--fml.mcVersion
|
||||
1.21
|
||||
--fml.neoFormVersion
|
||||
20240613.152323
|
||||
43
neoforge/src/main/java/com/cinemamod/mcef/MCEFInitEvent.java
Normal file
43
neoforge/src/main/java/com/cinemamod/mcef/MCEFInitEvent.java
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* MCEF (Minecraft Chromium Embedded Framework)
|
||||
* Copyright (C) 2023 CinemaMod Group
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* little unsure of if I should uncomment this or not
|
||||
* basically; forge's way of doing this sorta "listening for a thing" is events
|
||||
* this allows that to be used for MCEF initalization
|
||||
*
|
||||
* there is a fabric-equivalent-expectation for this, but it's sorta just what's already in the MCEF class if I'm remembering correctly
|
||||
*/
|
||||
|
||||
//package com.cinemamod.mcef;
|
||||
//
|
||||
//import net.minecraftforge.common.MinecraftForge;
|
||||
//import net.minecraftforge.eventbus.api.Event;
|
||||
//
|
||||
//public class MCEFInitEvent extends Event {
|
||||
// static {
|
||||
// MCEF.scheduleForInit(() -> {
|
||||
// MinecraftForge.EVENT_BUS.post(new MCEFInitEvent());
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// public MCEFInitEvent() {
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* MCEF (Minecraft Chromium Embedded Framework)
|
||||
* Copyright (C) 2023 CinemaMod Group
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*/
|
||||
|
||||
package com.cinemamod.mcef;
|
||||
|
||||
import com.cinemamod.mcef.example.MCEFExampleMod;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.neoforged.fml.event.lifecycle.FMLDedicatedServerSetupEvent;
|
||||
import net.neoforged.fml.loading.FMLEnvironment;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@Mod(NeoForgeMCEFMod.MODID)
|
||||
public class NeoForgeMCEFMod {
|
||||
public static final String MODID = "mcef";
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
|
||||
public NeoForgeMCEFMod(IEventBus modEventBus) {
|
||||
modEventBus.addListener(this::clientSetup);
|
||||
modEventBus.addListener(this::serverSetup);
|
||||
}
|
||||
|
||||
private void clientSetup(final FMLClientSetupEvent event) {
|
||||
if (!FMLEnvironment.production) {
|
||||
new MCEFExampleMod();
|
||||
}
|
||||
}
|
||||
|
||||
private void serverSetup(final FMLDedicatedServerSetupEvent event) {
|
||||
// MCEF server-side does nothing
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* MCEF (Minecraft Chromium Embedded Framework)
|
||||
* Copyright (C) 2023 CinemaMod Group
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*/
|
||||
|
||||
package com.cinemamod.mcef.example;
|
||||
|
||||
import com.mojang.blaze3d.platform.InputConstants;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.neoforged.neoforge.client.event.ClientTickEvent;
|
||||
import net.neoforged.neoforge.common.NeoForge;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
public class MCEFExampleMod {
|
||||
private static final Minecraft minecraft = Minecraft.getInstance();
|
||||
|
||||
public static final KeyMapping KEY_MAPPING = new KeyMapping(
|
||||
"Open Browser", InputConstants.Type.KEYSYM,
|
||||
GLFW.GLFW_KEY_F10, "key.categories.misc"
|
||||
);
|
||||
|
||||
public MCEFExampleMod() {
|
||||
NeoForge.EVENT_BUS.addListener(this::onTick);
|
||||
}
|
||||
|
||||
public void onTick(ClientTickEvent.Post event) {
|
||||
// Check if our key was pressed and make sure the ExampleScreen isn't already open
|
||||
if (KEY_MAPPING.isDown() && !(minecraft.screen instanceof ExampleScreen)) {
|
||||
// Display the ExampleScreen web browser
|
||||
minecraft.setScreen(new ExampleScreen(
|
||||
Component.literal("Example Screen")
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
29
neoforge/src/main/resources/META-INF/neoforge.mods.toml
Normal file
29
neoforge/src/main/resources/META-INF/neoforge.mods.toml
Normal file
@@ -0,0 +1,29 @@
|
||||
modLoader="javafml"
|
||||
loaderVersion="${loader_version}"
|
||||
license="LGPL"
|
||||
issueTrackerURL="https://github.com/CinemaMod/mcef/issues"
|
||||
displayURL="https://github.com/CinemaMod/mcef"
|
||||
logoFile="icon.png"
|
||||
# credits=""
|
||||
authors="ds58"
|
||||
[[mixins]]
|
||||
config="mcef.mixins.json"
|
||||
[[mods]]
|
||||
modId="${mod_id}"
|
||||
version="${mod_version}"
|
||||
displayName="${mod_name}"
|
||||
updateJSONURL=""
|
||||
displayTest="NONE"
|
||||
description='''A Minecraft mod and library for adding the Chromium web browser into the game (Minecraft Chromium Embedded Framework).'''
|
||||
[[dependencies.${mod_id}]]
|
||||
modId="neoforge"
|
||||
mandatory=true
|
||||
versionRange="${neoforge_dependency}"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
[[dependencies.${mod_id}]]
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
versionRange="[1.21,)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
6
neoforge/src/main/resources/pack.mcmeta
Normal file
6
neoforge/src/main/resources/pack.mcmeta
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"pack": {
|
||||
"description": "mcef resources",
|
||||
"pack_format": 13
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user