mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2025-01-05 18:58:59 +01:00
Fix gradle builds
This commit is contained in:
parent
cc47d6cdb4
commit
5abc9b8fc1
@ -11,23 +11,23 @@ ext {
|
||||
remapServerCode = true
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
dependencies {
|
||||
implementation project(':shared')
|
||||
compileOnly libs.io.netty.netty.buffer
|
||||
compileOnly libs.it.unimi.dsi.fastutil
|
||||
compileOnly libs.com.mojang.datafixerupper
|
||||
dependencies {
|
||||
implementation project(':shared')
|
||||
compileOnly libs.io.netty.netty.buffer
|
||||
compileOnly libs.it.unimi.dsi.fastutil
|
||||
compileOnly libs.com.mojang.datafixerupper
|
||||
|
||||
afterEvaluate {
|
||||
if (remapServerCode) {
|
||||
implementation "org.spigotmc:spigot:${craftbukkitVersion}:remapped-mojang"
|
||||
implementation "org.spigotmc:spigot:${craftbukkitVersion}:remapped-obf"
|
||||
|
||||
implementation "org.spigotmc:minecraft-server:${craftbukkitVersion}:maps-mojang@txt"
|
||||
implementation "org.spigotmc:minecraft-server:${craftbukkitVersion}:maps-spigot@csrg"
|
||||
} else {
|
||||
implementation "org.spigotmc:spigot:${craftbukkitVersion}"
|
||||
}
|
||||
}
|
||||
|
||||
configurations.all {
|
||||
resolutionStrategy.force "org.spigotmc:spigot:${craftbukkitVersion}:remapped-mojang"
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
|
@ -14,11 +14,23 @@ buildscript {
|
||||
|
||||
// Spigot server code remapping: https://www.spigotmc.org/threads/spigot-bungeecord-1-17-1-17-1.510208/
|
||||
// These dependencies and mappings are installed into the local Maven repository when BuildTools builds the Spigot dependencies.
|
||||
def m2Repo = new File(repositories.mavenLocal().url.path)
|
||||
def remappedMojang = new File(m2Repo, 'org/spigotmc/spigot/{craftbukkitVersion}/spigot-{craftbukkitVersion}-remapped-mojang.jar').path
|
||||
def remappedObf = new File(m2Repo, 'org/spigotmc/spigot/{craftbukkitVersion}/spigot-{craftbukkitVersion}-remapped-obf.jar').path
|
||||
def mojangMappings = new File(m2Repo, 'org/spigotmc/minecraft-server/{craftbukkitVersion}/minecraft-server-{craftbukkitVersion}-maps-mojang.txt').path
|
||||
def spigotMappings = new File(m2Repo, 'org/spigotmc/minecraft-server/{craftbukkitVersion}/minecraft-server-{craftbukkitVersion}-maps-spigot.csrg').path
|
||||
def gradleCache = new File(System.getProperty("user.home"), '.gradle/caches/modules-2/files-2.1')
|
||||
def findInGradleCache = { group, module, version, fileName ->
|
||||
def baseDir = new File(gradleCache, "${group}/${module}/${version}")
|
||||
|
||||
if (!baseDir.exists()) {
|
||||
throw new Exception("Failed to resolve ${baseDir} when trying to load ${fileName}. Cache missing");
|
||||
}
|
||||
|
||||
def result = baseDir.listFiles()?.findAll { it.isDirectory() }?.collectMany({ it.listFiles().flatten() })?.find { it.name == fileName }?.path
|
||||
|
||||
if (result == null) {
|
||||
throw new Exception("Failed to resolve ${baseDir}/<cache key>/${fileName}");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
def specialSource = buildscript.configurations.specialSource.resolvedConfiguration.getFirstLevelModuleDependencies().find {
|
||||
it.moduleGroup == 'net.md-5' && it.moduleName == 'SpecialSource'
|
||||
@ -26,6 +38,9 @@ def specialSource = buildscript.configurations.specialSource.resolvedConfigurati
|
||||
|
||||
// Converts from Mojang's mappings to Minecraft's obfuscated mappings.
|
||||
ext.remapMojangToObfuscated = { inputFile, outputFile, craftbukkitVersion ->
|
||||
def remappedMojang = findInGradleCache("org.spigotmc", "spigot", craftbukkitVersion, "spigot-${craftbukkitVersion}-remapped-mojang.jar")
|
||||
def mojangMappings = findInGradleCache("org.spigotmc", "minecraft-server", craftbukkitVersion, "minecraft-server-${craftbukkitVersion}-maps-mojang.txt")
|
||||
|
||||
println '> remapMojangToObfuscated'
|
||||
println ' Input: ' + inputFile.path
|
||||
println ' Output: ' + outputFile.path
|
||||
@ -38,13 +53,16 @@ ext.remapMojangToObfuscated = { inputFile, outputFile, craftbukkitVersion ->
|
||||
'--live',
|
||||
'-i', inputFile.path,
|
||||
'-o', outputFile.path,
|
||||
'-m', mojangMappings.replace('{craftbukkitVersion}', craftbukkitVersion),
|
||||
'-m', mojangMappings,
|
||||
'--reverse'
|
||||
}
|
||||
}
|
||||
|
||||
// Converts from Minecraft's obfuscated mappings to Spigot's mappings.
|
||||
ext.remapObfuscatedToSpigot = { inputFile, outputFile, craftbukkitVersion ->
|
||||
def spigotMappings = findInGradleCache("org.spigotmc", "minecraft-server", craftbukkitVersion, "minecraft-server-${craftbukkitVersion}-maps-spigot.csrg")
|
||||
def remappedObf = findInGradleCache("org.spigotmc", "spigot", craftbukkitVersion, "spigot-${craftbukkitVersion}-remapped-obf.jar")
|
||||
|
||||
println '> remapObfuscatedToSpigot'
|
||||
println ' Input: ' + inputFile.path
|
||||
println ' Output: ' + outputFile.path
|
||||
@ -57,7 +75,7 @@ ext.remapObfuscatedToSpigot = { inputFile, outputFile, craftbukkitVersion ->
|
||||
'--live',
|
||||
'-i', inputFile.path,
|
||||
'-o', outputFile.path,
|
||||
'-m', spigotMappings.replace('{craftbukkitVersion}', craftbukkitVersion)
|
||||
'-m', spigotMappings
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,9 +208,9 @@ public enum DisguiseType {
|
||||
|
||||
PAINTING,
|
||||
|
||||
@NmsAddedIn(NmsVersion.v1_21_R2) PALE_OAK_BOAT,
|
||||
@NmsAddedIn(NmsVersion.UNSUPPORTED) PALE_OAK_BOAT,
|
||||
|
||||
@NmsAddedIn(NmsVersion.v1_21_R2) PALE_OAK_CHEST_BOAT,
|
||||
@NmsAddedIn(NmsVersion.UNSUPPORTED) PALE_OAK_CHEST_BOAT,
|
||||
|
||||
@NmsAddedIn(NmsVersion.v1_14) PANDA,
|
||||
|
||||
|
@ -2145,6 +2145,27 @@ public class ReflectionManager {
|
||||
|
||||
if (nmsEntityName == null) {
|
||||
switch (disguiseType) {
|
||||
case BOAT:
|
||||
case ACACIA_BOAT:
|
||||
case BIRCH_BOAT:
|
||||
case CHERRY_BOAT:
|
||||
case DARK_OAK_BOAT:
|
||||
case JUNGLE_BOAT:
|
||||
case MANGROVE_BOAT:
|
||||
case OAK_BOAT:
|
||||
case PALE_OAK_BOAT:
|
||||
case SPRUCE_BOAT:
|
||||
case BAMBOO_RAFT:
|
||||
case BAMBOO_CHEST_RAFT:
|
||||
case ACACIA_CHEST_BOAT:
|
||||
case BIRCH_CHEST_BOAT:
|
||||
case CHERRY_CHEST_BOAT:
|
||||
case DARK_OAK_CHEST_BOAT:
|
||||
case JUNGLE_CHEST_BOAT:
|
||||
case MANGROVE_CHEST_BOAT:
|
||||
case OAK_CHEST_BOAT:
|
||||
case PALE_OAK_CHEST_BOAT:
|
||||
case SPRUCE_CHEST_BOAT:
|
||||
case ALLAY:
|
||||
case AXOLOTL:
|
||||
case BLOCK_DISPLAY:
|
||||
|
Loading…
Reference in New Issue
Block a user