Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
93bcf6ce44 | ||
|
|
afcbcfa527 | ||
|
|
2ed1f2bb2f | ||
|
|
9cb596e746 |
@@ -3,12 +3,19 @@ package com.willfp.eco.internal.spigot.proxy.common.packet.display
|
||||
import com.willfp.eco.core.EcoPlugin
|
||||
import com.willfp.eco.core.packet.PacketEvent
|
||||
import com.willfp.eco.core.packet.PacketListener
|
||||
import com.willfp.eco.internal.spigot.proxy.common.toResourceLocation
|
||||
import com.willfp.eco.util.namespacedKeyOf
|
||||
import net.minecraft.network.protocol.game.ClientboundPlaceGhostRecipePacket
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
|
||||
class PacketAutoRecipe(
|
||||
private val plugin: EcoPlugin
|
||||
) : PacketListener {
|
||||
private val fKey = ClientboundPlaceGhostRecipePacket::class.java
|
||||
.declaredFields
|
||||
.first { it.type == ResourceLocation::class.java }
|
||||
.apply { isAccessible = true }
|
||||
|
||||
override fun onSend(event: PacketEvent) {
|
||||
val packet = event.packet.handle as? ClientboundPlaceGhostRecipePacket ?: return
|
||||
|
||||
@@ -24,9 +31,7 @@ class PacketAutoRecipe(
|
||||
return
|
||||
}
|
||||
|
||||
val fKey = packet.javaClass.getDeclaredField("b")
|
||||
fKey.isAccessible = true
|
||||
val key = fKey[packet] as ResourceLocation
|
||||
fKey[packet] = ResourceLocation(key.namespace, key.path + "_displayed")
|
||||
fKey[packet] = namespacedKeyOf(key.namespace, key.path + "_displayed").toResourceLocation()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import net.minecraft.util.Unit
|
||||
import net.minecraft.world.item.component.CustomData
|
||||
import net.minecraft.world.item.component.CustomModelData
|
||||
import net.minecraft.world.item.component.ItemLore
|
||||
import net.minecraft.world.item.enchantment.ItemEnchantments
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.craftbukkit.CraftRegistry
|
||||
import org.bukkit.craftbukkit.CraftServer
|
||||
@@ -53,7 +54,7 @@ class NewEcoFastItemStack(
|
||||
private val pdc = (handle.get(DataComponents.CUSTOM_DATA)?.copyTag() ?: CompoundTag()).makePdc()
|
||||
|
||||
override fun getEnchants(checkStored: Boolean): Map<Enchantment, Int> {
|
||||
val enchantments = handle.get(DataComponents.ENCHANTMENTS) ?: return emptyMap()
|
||||
val enchantments = handle.get(DataComponents.ENCHANTMENTS) ?: ItemEnchantments.EMPTY
|
||||
|
||||
val map = mutableMapOf<Enchantment, Int>()
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
version = 6.73.5
|
||||
version = 6.73.7
|
||||
kotlin.incremental.useClasspathSnapshot=false
|
||||
Reference in New Issue
Block a user