Skip to content

Commit

Permalink
feat: 1.20.6+ support
Browse files Browse the repository at this point in the history
  • Loading branch information
Boy0000 committed May 12, 2024
1 parent fb53558 commit 69062b9
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 19 deletions.
2 changes: 0 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,4 @@ dependencies {

// Other plugins
compileOnly(libs.blocky)
compileOnly(idofrontLibs.minecraft.plugin.protocollib)
compileOnly(libs.protocolburrito)
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
group=com.mineinabyss
version=1.10
idofrontVersion=0.23.0
idofrontVersion=0.24.0-dev.8
6 changes: 2 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
[versions]
gearyPaper = "0.30.0"
blocky = "0.9.13-dev.1"
protocolburrito = "0.10.0-dev.0"
gearyPaper = "0.30.1-dev.10"
blocky = "0.9.13-dev.6"

[libraries]
geary-papermc = { module = "com.mineinabyss:geary-papermc", version.ref = "gearyPaper" }
blocky = { module = "com.mineinabyss:blocky", version.ref = "blocky" }
protocolburrito = { module = "com.mineinabyss:protocolburrito", version.ref = "protocolburrito" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ pluginManagement {
repositories {
gradlePluginPortal()
maven("https://repo.mineinabyss.com/releases")
maven("https://repo.mineinabyss.com/snapshots")
maven("https://repo.papermc.io/repository/maven-public/")
}

Expand All @@ -19,6 +20,7 @@ dependencyResolutionManagement {

repositories {
maven("https://repo.mineinabyss.com/releases")
maven("https://repo.mineinabyss.com/snapshots")
}

versionCatalogs {
Expand Down
1 change: 1 addition & 0 deletions src/main/kotlin/com/mineinabyss/bonfire/BonfireCommands.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.mineinabyss.geary.papermc.datastore.encode
import com.mineinabyss.geary.papermc.datastore.remove
import com.mineinabyss.geary.papermc.tracking.entities.toGeary
import com.mineinabyss.geary.papermc.tracking.entities.toGearyOrNull
import com.mineinabyss.geary.serialization.setPersisting
import com.mineinabyss.idofront.commands.arguments.intArg
import com.mineinabyss.idofront.commands.arguments.offlinePlayerArg
import com.mineinabyss.idofront.commands.arguments.playerArg
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.mineinabyss.bonfire.extensions

import com.comphenix.protocol.events.PacketContainer
import com.github.shynixn.mccoroutine.bukkit.launch
import com.github.shynixn.mccoroutine.bukkit.minecraftDispatcher
import com.github.shynixn.mccoroutine.bukkit.ticks
Expand All @@ -13,13 +12,13 @@ import com.mineinabyss.geary.papermc.tracking.entities.toGeary
import com.mineinabyss.geary.papermc.tracking.entities.toGearyOrNull
import com.mineinabyss.geary.papermc.tracking.items.gearyItems
import com.mineinabyss.idofront.entities.toPlayer
import com.mineinabyss.protocolburrito.dsl.sendTo
import kotlinx.coroutines.delay
import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket
import net.minecraft.network.syncher.EntityDataSerializers
import net.minecraft.network.syncher.SynchedEntityData
import org.bukkit.Bukkit
import org.bukkit.craftbukkit.v1_20_R3.inventory.CraftItemStack
import org.bukkit.craftbukkit.entity.CraftPlayer
import org.bukkit.craftbukkit.inventory.CraftItemStack
import org.bukkit.entity.Display
import org.bukkit.entity.Entity
import org.bukkit.entity.ItemDisplay
Expand Down Expand Up @@ -74,7 +73,7 @@ fun ItemDisplay.updateBonfireState() {
com.mineinabyss.bonfire.bonfire.plugin.launch(com.mineinabyss.bonfire.bonfire.plugin.minecraftDispatcher) {
delay(1.ticks)
bonfire.bonfirePlayers.mapNotNull { it.toPlayer() }.filter { it.world == world && it.location.distanceSquared(location) < (Bukkit.getServer().simulationDistance * 16.0).pow(2) }.forEach {
PacketContainer.fromPacket(metadataPacket).sendTo(it)
(it as CraftPlayer).handle.connection.send(metadataPacket)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import com.mineinabyss.bonfire.extensions.isBonfire
import com.mineinabyss.bonfire.extensions.removeOldBonfire
import com.mineinabyss.bonfire.extensions.updateBonfireState
import com.mineinabyss.geary.helpers.with
import com.mineinabyss.geary.papermc.bridge.conditions.Cooldown
import com.mineinabyss.geary.papermc.datastore.decode
import com.mineinabyss.geary.papermc.datastore.encode
import com.mineinabyss.geary.papermc.datastore.encodeComponentsTo
import com.mineinabyss.geary.papermc.datastore.remove
import com.mineinabyss.geary.papermc.tracking.entities.toGeary
import com.mineinabyss.geary.papermc.tracking.entities.toGearyOrNull
import com.mineinabyss.geary.serialization.setPersisting
import com.mineinabyss.idofront.entities.toOfflinePlayer
import com.mineinabyss.idofront.messaging.error
import com.mineinabyss.idofront.messaging.success
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.mineinabyss.bonfire.listeners

import com.comphenix.protocol.events.PacketContainer
import com.github.shynixn.mccoroutine.bukkit.asyncDispatcher
import com.github.shynixn.mccoroutine.bukkit.launch
import com.mineinabyss.blocky.helpers.FurnitureUUID
Expand All @@ -11,8 +10,8 @@ import com.mineinabyss.bonfire.components.BonfireDebug
import com.mineinabyss.bonfire.extensions.isBonfire
import com.mineinabyss.geary.papermc.tracking.entities.toGeary
import com.mineinabyss.idofront.entities.toOfflinePlayer
import com.mineinabyss.idofront.nms.aliases.toNMS
import com.mineinabyss.idofront.textcomponents.miniMsg
import com.mineinabyss.protocolburrito.dsl.sendTo
import io.papermc.paper.adventure.PaperAdventure
import it.unimi.dsi.fastutil.ints.IntList
import kotlinx.coroutines.delay
Expand All @@ -30,6 +29,7 @@ import net.minecraft.world.entity.Entity
import net.minecraft.world.entity.EntityType
import net.minecraft.world.phys.Vec3
import org.bukkit.Color
import org.bukkit.craftbukkit.entity.CraftPlayer
import org.bukkit.entity.ItemDisplay
import org.bukkit.entity.Player
import org.bukkit.event.EventHandler
Expand Down Expand Up @@ -60,7 +60,7 @@ class DebugListener : Listener {
EntityType.TEXT_DISPLAY, 0, Vec3.ZERO, 0.0
)

PacketContainer.fromPacket(textDisplayPacket).sendTo(this)
(this as CraftPlayer).handle.connection.send(textDisplayPacket)
bonfire.plugin.launch {
do {
this@sendDebugTextDisplay.sendDebugText(baseEntity, entityId)
Expand Down Expand Up @@ -88,7 +88,7 @@ class DebugListener : Listener {
bitmask = bitmask or (0 and 0x0F shl 3) // Set alignment to CENTER (0)

withContext(bonfire.plugin.asyncDispatcher) {
PacketContainer.fromPacket(
(this@sendDebugText as CraftPlayer).handle.connection.send(
ClientboundSetEntityDataPacket(
entityId, listOf(
SynchedEntityData.DataValue(15, EntityDataSerializers.BYTE, 1), // Billboard
Expand All @@ -101,12 +101,12 @@ class DebugListener : Listener {
SynchedEntityData.DataValue(27, EntityDataSerializers.BYTE, bitmask.toByte())
)
)
).sendTo(this@sendDebugText)
)
}
}

private fun removeDebugTextDisplay(player: Player) =
debugIdMap[player.uniqueId]?.values?.let {
PacketContainer.fromPacket(ClientboundRemoveEntitiesPacket(IntList.of(*it.toIntArray()))).sendTo(player)
(player as CraftPlayer).handle.connection.send(ClientboundRemoveEntitiesPacket(IntList.of(*it.toIntArray())))
}
}

0 comments on commit 69062b9

Please sign in to comment.