Some changes. Slowly approaching forge....

Forge-1.14.4
Szum123321 2020-04-10 22:07:34 +02:00
parent 6c2715f652
commit 73bee53ee7
9 changed files with 169 additions and 170 deletions

View File

@ -1,151 +1,151 @@
buildscript { buildscript {
repositories { repositories {
maven { url = 'https://files.minecraftforge.net/maven' } maven { url = 'https://files.minecraftforge.net/maven' }
jcenter() jcenter()
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
} }
} }
apply plugin: 'net.minecraftforge.gradle' apply plugin: 'net.minecraftforge.gradle'
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'eclipse' apply plugin: 'eclipse'
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
version = '1.0' version = '1.1.1-1.14.4'
group = 'net.szum123321.TextileBackup' // http://maven.apache.org/guides/mini/guide-naming-conventions.html group = 'szum123321.textile_backup' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'textile_backup' archivesBaseName = 'textile_backup[FORGE]'
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
minecraft { minecraft {
// The mappings can be changed at any time, and must be in the following format. // The mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD Snapshot are built nightly. // snapshot_YYYYMMDD Snapshot are built nightly.
// stable_# Stables are built at the discretion of the MCP team. // stable_# Stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work. // Use non-default mappings at your own risk. they may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace. // Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: 'snapshot', version: '20190719-1.14.3' mappings channel: 'snapshot', version: '20190719-1.14.3'
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
// Default run configurations. // Default run configurations.
// These can be tweaked, removed, or duplicated as needed. // These can be tweaked, removed, or duplicated as needed.
runs { runs {
client { client {
workingDirectory project.file('run') workingDirectory project.file('run')
// Recommended logging data for a userdev environment // Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// Recommended logging level for the console // Recommended logging level for the console
property 'forge.logging.console.level', 'debug' property 'forge.logging.console.level', 'debug'
mods { mods {
examplemod { examplemod {
source sourceSets.main source sourceSets.main
} }
} }
} }
server { server {
workingDirectory project.file('run') workingDirectory project.file('run')
// Recommended logging data for a userdev environment // Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// Recommended logging level for the console // Recommended logging level for the console
property 'forge.logging.console.level', 'debug' property 'forge.logging.console.level', 'debug'
mods { mods {
examplemod { examplemod {
source sourceSets.main source sourceSets.main
} }
} }
} }
data { data {
workingDirectory project.file('run') workingDirectory project.file('run')
// Recommended logging data for a userdev environment // Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// Recommended logging level for the console // Recommended logging level for the console
property 'forge.logging.console.level', 'debug' property 'forge.logging.console.level', 'debug'
args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/') args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/')
mods { mods {
examplemod { examplemod {
source sourceSets.main source sourceSets.main
} }
} }
} }
} }
} }
dependencies { dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied. // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it. // The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft 'net.minecraftforge:forge:1.14.4-28.2.0' minecraft 'net.minecraftforge:forge:1.14.4-28.2.0'
compile "blue.endless:jankson:1.2.0" compile "blue.endless:jankson:1.2.0"
// You may put jars on which you depend on in ./libs or you may define them like so.. // You may put jars on which you depend on in ./libs or you may define them like so..
// compile "some.group:artifact:version:classifier" // compile "some.group:artifact:version:classifier"
// compile "some.group:artifact:version" // compile "some.group:artifact:version"
// Real examples // Real examples
// compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env // compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
// compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env // compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
// The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime. // The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
// provided 'com.mod-buildcraft:buildcraft:6.0.8:dev' // provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// These dependencies get remapped to your current MCP mappings // These dependencies get remapped to your current MCP mappings
// deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev' // deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// For more info... // For more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html // http://www.gradle.org/docs/current/userguide/dependency_management.html
} }
// Example for how to get properties into the manifest for reading by the runtime.. // Example for how to get properties into the manifest for reading by the runtime..
jar { jar {
manifest { manifest {
attributes([ attributes([
"Specification-Title": "examplemod", "Specification-Title": "Textile Backup",
"Specification-Vendor": "examplemodsareus", "Specification-Vendor": "Szum123321",
"Specification-Version": "1", // We are version 1 of ourselves "Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": project.name, "Implementation-Title": project.name,
"Implementation-Version": "${version}", "Implementation-Version": "${version}",
"Implementation-Vendor" :"examplemodsareus", "Implementation-Vendor" :"Szum123321",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
]) ])
} }
} }
// Example configuration to allow publishing using the maven-publish task // Example configuration to allow publishing using the maven-publish task
// we define a custom artifact that is sourced from the reobfJar output task // we define a custom artifact that is sourced from the reobfJar output task
// and then declare that to be published // and then declare that to be published
// Note you'll need to add a repository here // Note you'll need to add a repository here
def reobfFile = file("$buildDir/reobfJar/output.jar") def reobfFile = file("$buildDir/reobfJar/output.jar")
def reobfArtifact = artifacts.add('default', reobfFile) { def reobfArtifact = artifacts.add('default', reobfFile) {
type 'jar' type 'jar'
builtBy 'reobfJar' builtBy 'reobfJar'
} }
publishing { publishing {
publications { publications {
mavenJava(MavenPublication) { mavenJava(MavenPublication) {
artifact reobfArtifact artifact reobfArtifact
} }
} }
repositories { repositories {
maven { maven {
url "file:///${project.projectDir}/mcmodsrepo" url "file:///${project.projectDir}/mcmodsrepo"
} }
} }
} }

View File

@ -65,19 +65,18 @@ public class ConfigHandler {
public static ConfigData loadConfig(){ public static ConfigData loadConfig(){
File configFile = getConfigFile(); File configFile = getConfigFile();
if(!configFile.exists()) { if(!configFile.exists())
TextileBackup.logger.info("Creating new config file");
saveConfig(new ConfigData()); saveConfig(new ConfigData());
}
try { try {
Jankson jankson = Jankson.builder().build(); Jankson jankson = Jankson.builder().build();
return jankson.fromJson(jankson.load(configFile), ConfigData.class); return jankson.fromJson(jankson.load(configFile), ConfigData.class);
} catch (IOException | SyntaxError e) { } catch (IOException e) {
TextileBackup.logger.error(e.getMessage());
} catch(SyntaxError e) {
TextileBackup.logger.error(e.getMessage()); TextileBackup.logger.error(e.getMessage());
} }
TextileBackup.logger.info("Loading default config!");
return new ConfigData(); return new ConfigData();
} }

View File

@ -46,12 +46,10 @@ public class TextileBackup {
} }
public void setup(FMLCommonSetupEvent event){ public void setup(FMLCommonSetupEvent event){
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
MinecraftForge.EVENT_BUS.register(ServerBackupScheduler.class); MinecraftForge.EVENT_BUS.register(ServerBackupScheduler.class);
config = ConfigHandler.loadConfig(); config = ConfigHandler.loadConfig();
logger.info("Now");
} }
@SubscribeEvent @SubscribeEvent

View File

@ -32,13 +32,10 @@ public class ServerBackupScheduler {
@SubscribeEvent @SubscribeEvent
public static void onServerTick(TickEvent.ServerTickEvent event) { public static void onServerTick(TickEvent.ServerTickEvent event) {
if(event.phase == TickEvent.Phase.START) { if(event.phase == TickEvent.Phase.START) {
TextileBackup.logger.info("Diiff: " + (System.currentTimeMillis() - lastBackupTime));
if(System.currentTimeMillis() - lastBackupTime >= TextileBackup.config.backupInterval * 1000) { if(System.currentTimeMillis() - lastBackupTime >= TextileBackup.config.backupInterval * 1000) {
if(server.getPlayerList().getCurrentPlayerCount() > 0 || TextileBackup.config.doBackupsOnEmptyServer) if(server.getPlayerList().getCurrentPlayerCount() > 0 || TextileBackup.config.doBackupsOnEmptyServer)
BackupHelper.create(server, null, true, null); BackupHelper.create(server, null, true, null);
TextileBackup.logger.info("Time: " + lastBackupTime);
lastBackupTime = System.currentTimeMillis(); lastBackupTime = System.currentTimeMillis();
} }
} }
@ -48,9 +45,6 @@ public class ServerBackupScheduler {
public static void onServerStarted(FMLServerStartingEvent event) { public static void onServerStarted(FMLServerStartingEvent event) {
server = event.getServer(); server = event.getServer();
lastBackupTime = System.currentTimeMillis(); lastBackupTime = System.currentTimeMillis();
TextileBackup.logger.info("Server Starting at: " + lastBackupTime);
TextileBackup.logger.info("Interval is: " + TextileBackup.config.backupInterval);
} }
@SubscribeEvent @SubscribeEvent

View File

@ -1,17 +1,15 @@
modLoader="javafml" #mandatory modLoader="javafml" #mandatory
loaderVersion="[28,)" #mandatory (28 is current forge version) loaderVersion="[28,)" #mandatory (28 is current forge version)
issueTrackerURL="http://my.issue.tracker/" #optional issueTrackerURL="https://github.com/Szum123321/textile_backup/issues" #optional
[[mods]] #mandatory [[mods]] #mandatory
# The modid of the mod
modId="textile_backup" #mandatory modId="textile_backup" #mandatory
version="${file.jarVersion}" #mandatory version="[Forge]1.1.1-1.14.4" #mandatory
displayName="Textile Backup" #mandatory displayName="Textile Backup" #mandatory
# A URL to query for updates for this mod. See the JSON update specification <here>
updateJSONURL="http://myurl.me/" #optional updateJSONURL="http://myurl.me/" #optional
displayURL="http://example.com/" #optional displayURL="https://www.curseforge.com/minecraft/mc-mods/textile-backup" #optional
logoFile="examplemod.png" #optional logoFile="textile_backup.png" #optional
credits="Thanks for this example mod goes to Java" #optional credits="Made on request of one of curseforge users" #optional
authors="Szum123321" #optional authors="Szum123321" #optional
description=''' description='''

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

10
update.json Normal file
View File

@ -0,0 +1,10 @@
{
"homepage": "https://www.curseforge.com/minecraft/mc-mods/textile-backup",
"promos": {
"1.14.4-latest": "1.1.1-1.14.4",
"1.14.4-recommended": "1.1.1-1.14.4"
},
"1.14.4": {
"1.1.1": "Initial release for forge"
}
}