diff --git a/.gitignore b/.gitignore index 9ae545fea..7899d1c64 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,7 @@ *.iws *.launch +mappings/.gradle/ +mappings/mcp/ +mappings/build/ +mappings/*.csv diff --git a/build.gradle b/build.gradle index 9024fbede..05e6f1809 100644 --- a/build.gradle +++ b/build.gradle @@ -19,6 +19,8 @@ apply plugin: 'eclipse' apply plugin: 'idea' apply plugin: 'maven' +repositories { mavenLocal() } + group = "com.github.glitchfiend.biomesoplenty" archivesBaseName = "BiomesOPlenty" @@ -115,8 +117,6 @@ curseforge { } } - - artifacts { if (changelog_file.exists()) { archives changelog_file diff --git a/gradle.properties b/gradle.properties index fe594fe32..1c1c4ef54 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,9 +5,9 @@ org.gradle.daemon=false mod_version=9.0.0 -minecraft_version=1.14.4 -minecraft_version_toml=14 -forge_version=28.1.0 -forge_version_toml=28 +minecraft_version=1.15.1 +minecraft_version_toml=15 +forge_version=30.0.15 +forge_version_toml=30 forge_group=net.minecraftforge -mappings_version=20191221-1.14.3 +mappings_version=2-1.15.1 diff --git a/mappings/build.gradle b/mappings/build.gradle new file mode 100644 index 000000000..0de6529d3 --- /dev/null +++ b/mappings/build.gradle @@ -0,0 +1,54 @@ +apply plugin: 'java' +apply plugin: 'maven' + +ext.channel = 'snapshot' +ext.dlVersion = '2' +ext.mcVersion = '1.15.1' + +group = 'de.oceanlabs.mcp' +version = dlVersion + '-' + mcVersion +archivesBaseName = 'mcp_' + ext.channel + +def downloadCSV(name) { + mkdir 'mcp' + def out = new File('mcp/' + name) + new URL('http://export.mcpbot.bspk.rs/' + name).withInputStream{ i -> out.withOutputStream{ it << i }} +} + +task downloadCSVs { + downloadCSV('fields.csv') + downloadCSV('methods.csv') + downloadCSV('params.csv') +} + +task patchCSVs { + println 'Patching csvs..' + + // Apparently making this an Exec task doesn't work properly? Do this instead. + exec { + ignoreExitValue true + workingDir '.' + + if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) { + commandLine 'cmd', '/c', 'python', 'patch_csvs.py' + } else { + commandLine 'python', 'patch_csvs.py' + } + } +} + +patchCSVs.dependsOn(downloadCSVs) + +jar { + extension = 'zip' + from '.' + include '*.csv' +} + +install { + repositories.mavenInstaller { + pom.groupId = project.group; + pom.version = project.version + pom.artifactId = 'mcp_' + project.channel + } +} \ No newline at end of file diff --git a/mappings/custom/methods.csv b/mappings/custom/methods.csv new file mode 100644 index 000000000..505206524 --- /dev/null +++ b/mappings/custom/methods.csv @@ -0,0 +1,2 @@ +searge,name,side,desc +func_225566_b_,configured,2, diff --git a/mappings/patch_csvs.py b/mappings/patch_csvs.py new file mode 100644 index 000000000..aedb46eef --- /dev/null +++ b/mappings/patch_csvs.py @@ -0,0 +1,67 @@ +import csv +import os +import shutil +import sys + +entries = { + 'fields.csv': [], + 'methods.csv': [], + 'params.csv': [] +} + +for key in entries.keys(): + mcp_file = 'mcp/{}'.format(key) + patch_file = 'custom/{}'.format(key) + + if not os.path.isfile(patch_file): + print('Copying {}...'.format(key)) + shutil.copyfile(mcp_file, key) + continue + + print('Patching {}...'.format(key)) + + header_row = [] + + # Read custom csv + with open(patch_file, 'r') as f: + reader = csv.reader(f) + for row in reader: + name = row[0] + + if name.startswith('searge') or name.startswith('param'): + header_row = row + continue + + entries[key].append(row) + + # Read MCP csv and merge it + with open(mcp_file, 'r') as f: + reader = csv.reader(f) + for row in reader: + name = row[0] + existing = False + + if name.startswith('searge') or name.startswith('param'): + continue + + for existing_entry in entries[key]: + if name == existing_entry[0]: + existing = True + break + + if not existing: + entries[key].append(row) + + entries[key].sort(key=lambda x: x[0]) + + # Insert header at the start of the list + entries[key].insert(0, header_row) + + # Write final output file + with open(key, 'w') as f: + writer = csv.writer(f, lineterminator='\n') + + for row in entries[key]: + writer.writerow(row) + + print('Created {}'.format(key)) \ No newline at end of file diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 000000000..8af7f8ee0 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,3 @@ +include 'mappings' + +gradle.startParameter.taskNames = [":mappings:build", ":mappings:install"] + gradle.startParameter.taskNames \ No newline at end of file