mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
parent
71dd823d3e
commit
70767aefd2
6 changed files with 86 additions and 1 deletions
|
|
@ -15,7 +15,7 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "xyz.alexcrea"
|
group = "xyz.alexcrea"
|
||||||
version = "1.6.10"
|
version = "1.6.11"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
// EcoEnchants
|
// EcoEnchants
|
||||||
|
|
@ -60,6 +60,7 @@ dependencies {
|
||||||
implementation(project(":nms:v1_20R4", configuration = "reobf"))
|
implementation(project(":nms:v1_20R4", configuration = "reobf"))
|
||||||
implementation(project(":nms:v1_21R1", configuration = "reobf"))
|
implementation(project(":nms:v1_21R1", configuration = "reobf"))
|
||||||
implementation(project(":nms:v1_21R2", configuration = "reobf"))
|
implementation(project(":nms:v1_21R2", configuration = "reobf"))
|
||||||
|
implementation(project(":nms:v1_21R3"))//, configuration = "reobf")) // TODO add again when paperweigh 1.21.4 update
|
||||||
|
|
||||||
// include kotlin for the offline jar
|
// include kotlin for the offline jar
|
||||||
implementation(kotlin("stdlib"))
|
implementation(kotlin("stdlib"))
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import org.bukkit.entity.Player
|
||||||
import xyz.alexcrea.cuanvil.dependency.packet.PacketManager
|
import xyz.alexcrea.cuanvil.dependency.packet.PacketManager
|
||||||
import xyz.alexcrea.cuanvil.dependency.packet.PacketManagerBase
|
import xyz.alexcrea.cuanvil.dependency.packet.PacketManagerBase
|
||||||
|
|
||||||
|
// Todo: replace it by the mojang mapped version when paper dev bundle release
|
||||||
class V1_21R2_PacketManager : PacketManagerBase(), PacketManager {
|
class V1_21R2_PacketManager : PacketManagerBase(), PacketManager {
|
||||||
override val canSetInstantBuild: Boolean
|
override val canSetInstantBuild: Boolean
|
||||||
get() = true
|
get() = true
|
||||||
|
|
|
||||||
47
nms/v1_21R3/build.gradle.kts
Normal file
47
nms/v1_21R3/build.gradle.kts
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||||
|
|
||||||
|
group = rootProject.group
|
||||||
|
version = rootProject.version
|
||||||
|
|
||||||
|
//TODO uncomment when paperDevBundle 1.21.4 release
|
||||||
|
/*plugins {
|
||||||
|
id("io.papermc.paperweight.userdev")
|
||||||
|
}*/
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation(project(":nms:nms-common"))
|
||||||
|
|
||||||
|
// Used for nms
|
||||||
|
compileOnly("org.spigotmc:spigot-api:1.20.4-R0.1-SNAPSHOT") //TODO remove when paperDevBundle 1.21.4 release
|
||||||
|
compileOnly("org.spigotmc:spigot:1.21.4-R0.1-SNAPSHOT") //TODO remove when paperDevBundle 1.21.4 release
|
||||||
|
//paperweight.paperDevBundle("1.21.4-R0.1-SNAPSHOT") //TODO uncomment when paperDevBundle 1.21.4 release
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven("https://repo.papermc.io/repository/maven-public/")
|
||||||
|
|
||||||
|
mavenLocal() //TODO remove when paperDevBundle 1.21.4 release
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
package xyz.alexcrea.cuanvil.dependency.packet.versions
|
||||||
|
|
||||||
|
import net.minecraft.network.protocol.game.PacketPlayOutAbilities
|
||||||
|
import net.minecraft.world.entity.player.PlayerAbilities
|
||||||
|
import org.bukkit.craftbukkit.v1_21_R3.entity.CraftPlayer
|
||||||
|
import org.bukkit.entity.Player
|
||||||
|
import xyz.alexcrea.cuanvil.dependency.packet.PacketManager
|
||||||
|
import xyz.alexcrea.cuanvil.dependency.packet.PacketManagerBase
|
||||||
|
|
||||||
|
class V1_21R3_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.gj()
|
||||||
|
val sendedAbilities: PlayerAbilities
|
||||||
|
if (playerAbilities.d == instantBuild) {
|
||||||
|
sendedAbilities = playerAbilities
|
||||||
|
} else {
|
||||||
|
sendedAbilities = PlayerAbilities()
|
||||||
|
sendedAbilities.a = playerAbilities.a
|
||||||
|
sendedAbilities.b = playerAbilities.b
|
||||||
|
sendedAbilities.c = playerAbilities.c
|
||||||
|
sendedAbilities.d = instantBuild
|
||||||
|
sendedAbilities.e = playerAbilities.e
|
||||||
|
sendedAbilities.f = playerAbilities.f
|
||||||
|
sendedAbilities.g = playerAbilities.g
|
||||||
|
}
|
||||||
|
val packet = PacketPlayOutAbilities(sendedAbilities)
|
||||||
|
nmsPlayer.f.sendPacket(packet)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -36,3 +36,5 @@ include("nms:v1_21R1")
|
||||||
findProject(":nms:v1_21R1")?.name = "v1_21R1"
|
findProject(":nms:v1_21R1")?.name = "v1_21R1"
|
||||||
include("nms:v1_21R2")
|
include("nms:v1_21R2")
|
||||||
findProject(":nms:v1_21R2")?.name = "v1_21R2"
|
findProject(":nms:v1_21R2")?.name = "v1_21R2"
|
||||||
|
include("nms:v1_21R3")
|
||||||
|
findProject(":nms:v1_21R3")?.name = "v1_21R3"
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ object PacketManagerSelector {
|
||||||
21 -> when (versionParts[2]) {
|
21 -> when (versionParts[2]) {
|
||||||
0, 1 -> V1_21R1_PacketManager()
|
0, 1 -> V1_21R1_PacketManager()
|
||||||
2, 3 -> V1_21R2_PacketManager()
|
2, 3 -> V1_21R2_PacketManager()
|
||||||
|
4 -> V1_21R3_PacketManager()
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue