Skip to content

Commit

Permalink
fix 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
cccgh5 committed Oct 4, 2024
1 parent 24aa3f1 commit dbe7921
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions modules/bukkit-nms/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ dependencies {
api(libs.exposed.core)
api(libs.netty)
api(libs.koin.core)
paperweight.paperDevBundle("1.20.6-R0.1-SNAPSHOT")
paperweight.paperDevBundle("1.21-R0.1-SNAPSHOT")

testImplementationModule("bukkit", "test")
testImplementation(libs.mockBukkit)
testImplementation(libs.junit.parameterizedTest)
testImplementation(libs.kotlinx.coroutines.test)
}

paperweight.reobfArtifactConfiguration = io.papermc.paperweight.userdev.ReobfArtifactConfiguration.MOJANG_PRODUCTION
//paperweight.reobfArtifactConfiguration = io.papermc.paperweight.userdev.ReobfArtifactConfiguration.MOJANG_PRODUCTION
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ import net.minecraft.network.protocol.game.ClientboundAddEntityPacket
import net.minecraft.network.protocol.game.ClientboundRemoveEntitiesPacket
import net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket
import net.minecraft.network.protocol.game.ClientboundTeleportEntityPacket
import net.minecraft.server.level.ServerEntity
import net.minecraft.server.level.ServerLevel
import net.minecraft.server.network.ServerPlayerConnection
import net.minecraft.world.entity.Entity
import org.bukkit.Location
import org.bukkit.inventory.EquipmentSlot
import org.bukkit.inventory.ItemStack
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject


abstract class AbstractVirtualEntity(
private var location: Location,
private var name: String,
Expand Down Expand Up @@ -138,7 +142,12 @@ abstract class AbstractVirtualEntity(
if (state mask VirtualEntityState.CREAT) {
if (!vaild) entityInitialize()
if (switchState) state = state switch VirtualEntityState.CREAT
packets.add(ClientboundAddEntityPacket(getEntity()))

val npcServerEntity = ServerEntity(
getEntity().level() as ServerLevel, getEntity(), 0, false,
{ packet: Packet<*>? -> }, setOf<ServerPlayerConnection>()
)
packets.add(ClientboundAddEntityPacket(getEntity(), npcServerEntity))
}

if (state mask VirtualEntityState.UPDATE_ITEM) {
Expand Down

0 comments on commit dbe7921

Please sign in to comment.