support mc 1.21.6 (#69)

This commit is contained in:
alexcrea 2025-06-21 14:26:28 +02:00 committed by GitHub
commit f24d2e227e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 120 additions and 5 deletions

View file

@ -1,7 +1,7 @@
# Custom Anvil # Custom Anvil
**Custom Anvil** is a plugin that allows server administrators to customize every aspect of the anvil's mechanics. **Custom Anvil** is a plugin that allows server administrators to customize every aspect of the anvil's mechanics.
It is expected to work on 1.18 to 1.21.5 minecraft servers running spigot or paper. It is expected to work on 1.18 to 1.21.6 minecraft servers running spigot or paper.
(the plugin support of 1.16.5 to 1.17.1 is experimental and may encounter issues) (the plugin support of 1.16.5 to 1.17.1 is experimental and may encounter issues)
**Custom Anvil** was previously named **Unsafe Enchants+**. **Custom Anvil** was previously named **Unsafe Enchants+**.

View file

@ -12,11 +12,11 @@ plugins {
signing signing
id("cn.lalaki.central").version("1.2.8") id("cn.lalaki.central").version("1.2.8")
// Paper // Paper
id("io.papermc.paperweight.userdev") version "2.0.0-beta.16" apply false id("io.papermc.paperweight.userdev") version "2.0.0-beta.17" apply false
} }
group = "xyz.alexcrea" group = "xyz.alexcrea"
version = "1.11.4" version = "1.12.0"
val effectiveVersion = "$version" + val effectiveVersion = "$version" +
(if (System.getenv("SMALL_COMMIT_HASH") != null) "-dev-${System.getenv("SMALL_COMMIT_HASH")!!}" else "") (if (System.getenv("SMALL_COMMIT_HASH") != null) "-dev-${System.getenv("SMALL_COMMIT_HASH")!!}" else "")
@ -75,6 +75,7 @@ dependencies {
implementation(project(":nms:v1_21R2", configuration = "reobf")) implementation(project(":nms:v1_21R2", configuration = "reobf"))
implementation(project(":nms:v1_21R3", configuration = "reobf")) implementation(project(":nms:v1_21R3", configuration = "reobf"))
implementation(project(":nms:v1_21R4", configuration = "reobf")) implementation(project(":nms:v1_21R4", configuration = "reobf"))
implementation(project(":nms:v1_21R5", configuration = "reobf"))
// include kotlin for the offline jar // include kotlin for the offline jar
implementation(kotlin("stdlib")) implementation(kotlin("stdlib"))

View file

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

0
gradlew vendored Normal file → Executable file
View file

View file

@ -11,7 +11,7 @@ dependencies {
implementation(project(":nms:nms-common")) implementation(project(":nms:nms-common"))
// Used for nms // Used for nms
paperweight.paperDevBundle("1.21.5-no-moonrise-SNAPSHOT") paperweight.paperDevBundle("1.21.5-R0.1-SNAPSHOT")
} }
repositories { repositories {

1
nms/v1_21R5/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.lastDeploymentsId

View file

@ -0,0 +1,42 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
group = rootProject.group
version = rootProject.version
plugins {
id("io.papermc.paperweight.userdev")
}
dependencies {
implementation(project(":nms:nms-common"))
// Used for nms
paperweight.paperDevBundle("1.21.6-R0.1-SNAPSHOT")
}
repositories {
maven("https://repo.papermc.io/repository/maven-public/")
}
// minecraft 1.21 java version is 21.
// Configure used version of kotlin and java
java {
disableAutoTargetJvm()
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
}
// Set target version
tasks.withType<JavaCompile>().configureEach {
sourceCompatibility = "21"
targetCompatibility = "21"
options.encoding = "UTF-8"
}
kotlin {
compilerOptions {
apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
jvmTarget.set(JvmTarget.JVM_21)
}
}

View file

@ -0,0 +1,34 @@
package xyz.alexcrea.cuanvil.dependency.gui.version
import org.bukkit.craftbukkit.inventory.CraftInventoryView
import org.bukkit.inventory.InventoryView
import xyz.alexcrea.cuanvil.dependency.gui.ExternGuiTester
class v1_21R5_ExternGuiTester: ExternGuiTester {
override val wesjdAnvilGuiName = "Wrapper1_21_R5"
var tested = false;
var possible = false;
override fun getContainerClass(view: InventoryView): Class<Any>? {
// In case we are in a test environment
if(!tested) testClassExist()
if(!possible) return null
if(view !is CraftInventoryView<*, *>) return null
val container = view.handle
return container.javaClass
}
fun testClassExist(){
tested = true;
try {
Class.forName("org.bukkit.craftbukkit.inventory.CraftInventoryView")
possible = true
} catch (e: ClassNotFoundException){
possible = false
}
}
}

View file

@ -0,0 +1,33 @@
package xyz.alexcrea.cuanvil.dependency.packet.versions
import net.minecraft.network.protocol.game.ClientboundPlayerAbilitiesPacket
import net.minecraft.world.entity.player.Abilities
import org.bukkit.craftbukkit.entity.CraftPlayer
import org.bukkit.entity.Player
import xyz.alexcrea.cuanvil.dependency.packet.PacketManager
import xyz.alexcrea.cuanvil.dependency.packet.PacketManagerBase
class V1_21R5_PacketManager : PacketManagerBase(), PacketManager {
override val canSetInstantBuild: Boolean
get() = true
override fun setInstantBuild(player: Player, instantBuild: Boolean) {
val nmsPlayer = (player as CraftPlayer).handle
val playerAbilities = nmsPlayer.abilities
val sendedAbilities: Abilities
if (playerAbilities.instabuild == instantBuild) {
sendedAbilities = playerAbilities
} else {
sendedAbilities = Abilities()
sendedAbilities.invulnerable = playerAbilities.invulnerable
sendedAbilities.flying = playerAbilities.flying
sendedAbilities.mayfly = playerAbilities.mayfly
sendedAbilities.instabuild = instantBuild
sendedAbilities.mayBuild = playerAbilities.mayBuild
sendedAbilities.flyingSpeed = playerAbilities.flyingSpeed
sendedAbilities.walkingSpeed = playerAbilities.walkingSpeed
}
val packet = ClientboundPlayerAbilitiesPacket(sendedAbilities)
nmsPlayer.connection.send(packet)
}
}

View file

@ -31,6 +31,8 @@ include("nms:v1_21R3")
findProject(":nms:v1_21R3")?.name = "v1_21R3" findProject(":nms:v1_21R3")?.name = "v1_21R3"
include("nms:v1_21R4") include("nms:v1_21R4")
findProject(":nms:v1_21R4")?.name = "v1_21R4" findProject(":nms:v1_21R4")?.name = "v1_21R4"
include("nms:v1_21R5")
findProject(":nms:v1_21R6")?.name = "v1_21R5"
include(":impl:LegacyEcoEnchant") include(":impl:LegacyEcoEnchant")
findProject(":impl:LegacyEcoEnchant")?.name = "LegacyEcoEnchant" findProject(":impl:LegacyEcoEnchant")?.name = "LegacyEcoEnchant"

View file

@ -44,6 +44,7 @@ object GuiTesterSelector {
2, 3 -> v1_21R2_ExternGuiTester() 2, 3 -> v1_21R2_ExternGuiTester()
4 -> v1_21R3_ExternGuiTester() 4 -> v1_21R3_ExternGuiTester()
5 -> v1_21R4_ExternGuiTester() 5 -> v1_21R4_ExternGuiTester()
6 -> v1_21R5_ExternGuiTester()
else -> null else -> null
} }

View file

@ -58,6 +58,7 @@ object PacketManagerSelector {
2, 3 -> V1_21R2_PacketManager() 2, 3 -> V1_21R2_PacketManager()
4 -> V1_21R3_PacketManager() 4 -> V1_21R3_PacketManager()
5 -> V1_21R4_PacketManager() 5 -> V1_21R4_PacketManager()
6 -> V1_21R4_PacketManager()
else -> null else -> null
} }