Skip to content

Commit

Permalink
Begin IMPL of fishing net custom tool tips
Browse files Browse the repository at this point in the history
Added:
 - Fishing net tooltip data class
 - Callback to handle the tooltip
  • Loading branch information
dragoncommands committed Oct 4, 2023
1 parent 0086241 commit 4b2b760
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package dev.hybridlabs.aquatic

import dev.hybridlabs.aquatic.block.HybridAquaticBlocks
import dev.hybridlabs.aquatic.block.entity.HybridAquaticBlockEntityTypes
import dev.hybridlabs.aquatic.client.item.FishingNetTooltip
import dev.hybridlabs.aquatic.client.item.MessageInABottleTooltip
import dev.hybridlabs.aquatic.client.model.HybridAquaticEntityModelLayers
import dev.hybridlabs.aquatic.client.network.HybridAquaticClientNetworking
Expand Down Expand Up @@ -35,6 +36,7 @@ object HybridAquaticClient : ClientModInitializer {

private fun registerTooltips() {
ItemTooltipCallback.EVENT.register(MessageInABottleTooltip())
ItemTooltipCallback.EVENT.register(FishingNetTooltip())
}

private fun registerBlockRenderLayers(registry: BlockRenderLayerMap = BlockRenderLayerMap.INSTANCE) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package dev.hybridlabs.aquatic.client.item

import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback
import net.minecraft.client.item.TooltipContext
import net.minecraft.item.ItemStack
import net.minecraft.text.Text

class FishingNetTooltip : ItemTooltipCallback {
override fun getTooltip(stack: ItemStack?, context: TooltipContext?, lines: MutableList<Text>?) {
TODO("Not yet implemented")
}
}
6 changes: 6 additions & 0 deletions src/main/kotlin/dev/hybridlabs/aquatic/item/FishingNetItem.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import dev.hybridlabs.aquatic.tag.HybridAquaticEntityTags
import net.fabricmc.fabric.impl.event.interaction.InteractionEventsRouter
import net.minecraft.block.Block
import net.minecraft.client.item.TooltipContext
import net.minecraft.client.item.TooltipData
import net.minecraft.entity.Entity
import net.minecraft.entity.EntityType
import net.minecraft.entity.LivingEntity
Expand All @@ -17,6 +18,7 @@ import net.minecraft.text.Text
import net.minecraft.util.ActionResult
import net.minecraft.util.Hand
import net.minecraft.world.World
import java.util.*
import kotlin.jvm.optionals.getOrDefault
import kotlin.jvm.optionals.getOrNull

Expand Down Expand Up @@ -76,6 +78,10 @@ class FishingNetItem(settings: Settings?) : Item(settings) {
super.appendTooltip(stack, world, tooltip, context)
}

override fun getTooltipData(stack: ItemStack?): Optional<TooltipData> {
return super.getTooltipData(stack)
}

companion object {
const val ENTITY_KEY : String = "storedEntity"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package dev.hybridlabs.aquatic.item

import net.minecraft.client.item.TooltipData

class FishingNetTooltipData : TooltipData {

}

0 comments on commit 4b2b760

Please sign in to comment.