diff --git a/src/main/kotlin/com/mineinabyss/blocky/api/BlockyFurnitures.kt b/src/main/kotlin/com/mineinabyss/blocky/api/BlockyFurnitures.kt index 7cc15a8f..9083dc32 100644 --- a/src/main/kotlin/com/mineinabyss/blocky/api/BlockyFurnitures.kt +++ b/src/main/kotlin/com/mineinabyss/blocky/api/BlockyFurnitures.kt @@ -99,15 +99,6 @@ object BlockyFurnitures { return true } - /** - * Updates the hitbox & light packets of a furniture entity. - */ - fun updateFurniturePackets(furniture: ItemDisplay) { - FurniturePacketHelpers.sendInteractionEntityPacket(furniture) - FurniturePacketHelpers.sendCollisionHitboxPacket(furniture) - FurniturePacketHelpers.sendLightPacket(furniture) - } - /** * Updates the hitbox & light packets of a furniture entity for a given player. */ diff --git a/src/main/kotlin/com/mineinabyss/blocky/helpers/FurniturePacketHelpers.kt b/src/main/kotlin/com/mineinabyss/blocky/helpers/FurniturePacketHelpers.kt index 5872bccd..4cdb9421 100644 --- a/src/main/kotlin/com/mineinabyss/blocky/helpers/FurniturePacketHelpers.kt +++ b/src/main/kotlin/com/mineinabyss/blocky/helpers/FurniturePacketHelpers.kt @@ -56,10 +56,11 @@ object FurniturePacketHelpers { const val INTERACTION_HEIGHT_ID = 9 const val ITEM_DISPLAY_ITEMSTACK_ID = 23 - val collisionHitboxPosMap = mutableMapOf>() - val interactionHitboxIdMap = mutableSetOf() - val interactionHitboxPacketMap = mutableMapOf>() - val hitboxOutlineIdMap = mutableMapOf() + private val collisionHitboxPosMap = mutableMapOf>() + private val interactionHitboxIdMap = mutableSetOf() + private val interactionHitboxPacketMap = mutableMapOf>() + private val hitboxOutlineIdMap = mutableMapOf() + private val outlinePlayerMap = mutableMapOf() fun getBaseFurnitureFromInteractionEntity(id: Int) = interactionHitboxIdMap.firstOrNull { id in it.entityIds }?.furniture @@ -95,22 +96,6 @@ object FurniturePacketHelpers { } } - /** - * Sends a packet to show the interaction hitbox of the given furniture to all players in the world. - * @param furniture The furniture to show the interaction hitbox of. - */ - fun sendInteractionEntityPacket(furniture: ItemDisplay) { - // Don't send interactionEntity packet if modelengine furniture with hitbox - if (furniture.isModelEngineFurniture) { - val modelId = furniture.toGeary().get()?.modelId ?: return - val blueprint = ModelEngineAPI.getBlueprint(modelId) ?: return - if (blueprint.mainHitbox != null || blueprint.subHitboxes.isNotEmpty()) return - } - furniture.world.players.forEach { - sendInteractionEntityPacket(furniture, it) - } - } - /** * Sends a packet to show the interaction hitbox of the given furniture to the given player. * @param furniture The furniture to show the interaction hitbox of. @@ -176,14 +161,6 @@ object FurniturePacketHelpers { PacketContainer.fromPacket(ClientboundRemoveEntitiesPacket(*entityIds.toIntArray())).sendTo(player) } - fun sendHitboxOutlinePacket(furniture: ItemDisplay) { - furniture.world.players.forEach { - sendHitboxOutlinePacket(furniture, it) - } - } - - val outlinePlayerMap = mutableMapOf() - fun sendHitboxOutlinePacket(furniture: ItemDisplay, player: Player) { if (outlinePlayerMap[player.uniqueId] == furniture.uniqueId) return removeHitboxOutlinePacket(player) @@ -232,15 +209,6 @@ object FurniturePacketHelpers { outlinePlayerMap.remove(player.uniqueId) } - /** - * Sends a packet to show the collision hitbox of the given furniture to all players in the world. - * @param baseEntity The furniture to show the collision hitbox of. - */ - fun sendCollisionHitboxPacket(baseEntity: ItemDisplay) { - baseEntity.world.players.forEach { - sendCollisionHitboxPacket(baseEntity, it) - } - } /** * Sends a packet to show the collision hitbox of the given furniture to the given player. @@ -281,16 +249,6 @@ object FurniturePacketHelpers { player.sendMultiBlockChange(positions) } - /** - * Sends the light packets for this furniture to all players in the world - * @param baseEntity The furniture to send the light packets for - */ - fun sendLightPacket(baseEntity: ItemDisplay) { - baseEntity.world.players.forEach { - sendLightPacket(baseEntity, it) - } - } - /** * Sends the light packets for this furniture to a specific player * @param baseEntity The furniture to send the light packets for