Skip to content

Commit

Permalink
Use the CLASS name hashCode
Browse files Browse the repository at this point in the history
This guarantees that there will be no collisions.
  • Loading branch information
esotericenderman committed Nov 1, 2024
1 parent 4657b70 commit ce2336a
Showing 1 changed file with 1 addition and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,12 @@ import org.bukkit.Material
import org.bukkit.inventory.ItemStack

class TexturedItem(plugin: CustomItemPlugin, itemId: String, material: Material) : CustomItem(plugin, itemId, material) {

companion object {
var startingModelData: Int? = null
var texturedItems: Int = 0
}

init {
startingModelData = plugin.name.hashCode()
texturedItems++
}

override fun toItem(item: ItemStack): ItemStack {
super.toItem(item)

item.editMeta {
meta ->
meta.setCustomModelData(startingModelData!! + texturedItems)
meta.setCustomModelData(this::class.qualifiedName.hashCode())
}

return item
Expand Down

0 comments on commit ce2336a

Please sign in to comment.