From 5d1b9c6c7e7162dc932784b9bd307bad9ff18421 Mon Sep 17 00:00:00 2001 From: Waterpicker Date: Fri, 6 Dec 2024 01:47:58 -0600 Subject: [PATCH] Fixed additional potential spam. --- .../core/generationscore/common/util/PokemonFunctions.kt | 5 +++-- .../core/generationscore/common/world/item/DnaSplicer.kt | 5 +---- .../generationscore/common/world/item/PokemonStoringItem.kt | 3 ++- .../core/generationscore/common/world/item/TimeCapsule.kt | 5 +---- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/common/src/main/java/generations/gg/generations/core/generationscore/common/util/PokemonFunctions.kt b/common/src/main/java/generations/gg/generations/core/generationscore/common/util/PokemonFunctions.kt index b34f4df70..1cb3e8c6f 100644 --- a/common/src/main/java/generations/gg/generations/core/generationscore/common/util/PokemonFunctions.kt +++ b/common/src/main/java/generations/gg/generations/core/generationscore/common/util/PokemonFunctions.kt @@ -136,6 +136,8 @@ fun ItemStack.getPokemon(): Pokemon? { } + + fun Pokemon.removeIfBelongs(player: Player): Boolean { return belongsTo(player) && storeCoordinates.get()?.remove() == true } @@ -149,5 +151,4 @@ fun ItemStack.setLore(lore: List?): ItemStack { compoundtag.remove(ItemStack.TAG_LORE) } return this -} - +} \ No newline at end of file diff --git a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/DnaSplicer.kt b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/DnaSplicer.kt index 815e59771..e9923a3c9 100644 --- a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/DnaSplicer.kt +++ b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/DnaSplicer.kt @@ -28,6 +28,7 @@ class DnaSplicer(properties: Properties): PokemonStoringItem(properties) { var list = mutableListOf() list.add(pokemon) stack.setLore(list) + stack.setHoverName(super.getName(stack).copy() + getPokemonText(stack)) player.level().playSound(null, entity, SoundEvents.ENDERMAN_TELEPORT, SoundSource.MASTER, 1.0f, 1.0f) @@ -92,10 +93,6 @@ class DnaSplicer(properties: Properties): PokemonStoringItem(properties) { return false } - override fun getName(stack: ItemStack): Component { - return super.getName(stack).copy().withStyle(ChatFormatting.GRAY) + getPokemonText(stack) - } - override fun getPokemonText(stack: ItemStack): Component { var color = ChatFormatting.WHITE diff --git a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/PokemonStoringItem.kt b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/PokemonStoringItem.kt index 4011319d0..afb47b824 100644 --- a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/PokemonStoringItem.kt +++ b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/PokemonStoringItem.kt @@ -44,6 +44,7 @@ abstract class PokemonStoringItem(properties: Properties) : Item(properties), Po item.shrink(1) item.removePokemon() item.setLore(mutableListOf()) + item.setHoverName(null) player.level().playSound(null, player, SoundEvents.ENDERMAN_TELEPORT, SoundSource.MASTER, 1.0f, 1.0f) return InteractionResultHolder.sidedSuccess(item, false) } @@ -51,4 +52,4 @@ abstract class PokemonStoringItem(properties: Properties) : Item(properties), Po return super.use(level, player, usedHand) } -} +} \ No newline at end of file diff --git a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/TimeCapsule.kt b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/TimeCapsule.kt index bf6d36b0a..22d116de1 100644 --- a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/TimeCapsule.kt +++ b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/TimeCapsule.kt @@ -29,6 +29,7 @@ class TimeCapsule(properties: Properties) : PokemonStoringItem(properties) { var list = mutableListOf() list.add(pokemon) stack.setLore(list) + stack.setHoverName(super.getName(stack).copy() + getPokemonText(stack)) player.level().playSound( null, @@ -46,10 +47,6 @@ class TimeCapsule(properties: Properties) : PokemonStoringItem(properties) { } } - override fun getName(stack: ItemStack): Component { - return super.getName(stack).copy() + getPokemonText(stack) - } - override val isConsumed: Boolean get() = false