mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 08:14:00 +02:00
update for 1.21.6
This commit is contained in:
parent
3df4f4bab7
commit
a0c243f2dd
9 changed files with 116 additions and 1 deletions
|
|
@ -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"))
|
||||||
|
|
|
||||||
|
|
@ -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
1
nms/v1_21R5/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
.lastDeploymentsId
|
||||||
42
nms/v1_21R5/build.gradle.kts
Normal file
42
nms/v1_21R5/build.gradle.kts
Normal 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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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"
|
||||||
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue