Setup support for custom mappings
This commit is contained in:
parent
ea9e47b29d
commit
a8a695afc1
7 changed files with 137 additions and 7 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -19,3 +19,7 @@
|
|||
*.iws
|
||||
|
||||
*.launch
|
||||
mappings/.gradle/
|
||||
mappings/mcp/
|
||||
mappings/build/
|
||||
mappings/*.csv
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
54
mappings/build.gradle
Normal file
54
mappings/build.gradle
Normal file
|
@ -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
|
||||
}
|
||||
}
|
2
mappings/custom/methods.csv
Normal file
2
mappings/custom/methods.csv
Normal file
|
@ -0,0 +1,2 @@
|
|||
searge,name,side,desc
|
||||
func_225566_b_,configured,2,
|
|
67
mappings/patch_csvs.py
Normal file
67
mappings/patch_csvs.py
Normal file
|
@ -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))
|
3
settings.gradle
Normal file
3
settings.gradle
Normal file
|
@ -0,0 +1,3 @@
|
|||
include 'mappings'
|
||||
|
||||
gradle.startParameter.taskNames = [":mappings:build", ":mappings:install"] + gradle.startParameter.taskNames
|
Loading…
Reference in a new issue