Skip to content

Commit

Permalink
Added crab pots and thermal vents
Browse files Browse the repository at this point in the history
Edited yeti crab behavior
  • Loading branch information
MysticKoko committed Nov 25, 2023
1 parent c781bb0 commit 5f37e23
Show file tree
Hide file tree
Showing 39 changed files with 946 additions and 10 deletions.
13 changes: 6 additions & 7 deletions src/client/kotlin/dev/hybridlabs/aquatic/HybridAquaticClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,17 @@ import dev.hybridlabs.aquatic.client.network.HybridAquaticClientNetworking
import dev.hybridlabs.aquatic.client.render.block.entity.*
import dev.hybridlabs.aquatic.client.render.entity.HybridAquaticEntityRenderers
import dev.hybridlabs.aquatic.client.render.hud.FishingNetHUDRenderer
import dev.hybridlabs.aquatic.client.render.item.AnemoneBlockItemRenderer
import dev.hybridlabs.aquatic.client.render.item.BuoyBlockItemRenderer
import dev.hybridlabs.aquatic.client.render.item.MessageInABottleBlockItemRenderer
import dev.hybridlabs.aquatic.client.render.item.*
import dev.hybridlabs.aquatic.item.HybridAquaticItems
import net.fabricmc.api.ClientModInitializer
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap
import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback
import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry
import net.fabricmc.fabric.api.client.rendering.v1.DimensionRenderingRegistry.WeatherRenderer
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback
import net.minecraft.client.MinecraftClient
import net.minecraft.client.render.RenderLayer
import net.minecraft.client.render.WorldRenderer
import net.minecraft.client.render.block.entity.BlockEntityRendererFactories
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory
import net.minecraft.world.World

object HybridAquaticClient : ClientModInitializer {
override fun onInitializeClient() {
Expand All @@ -36,7 +31,7 @@ object HybridAquaticClient : ClientModInitializer {
registerEntityRenderers()
registerWeatherRenderers()
registerTooltips()
registerHudAddons();
registerHudAddons()
}

private fun registerWeatherRenderers() {
Expand All @@ -63,6 +58,8 @@ object HybridAquaticClient : ClientModInitializer {
BlockEntityRendererFactories.register(HybridAquaticBlockEntityTypes.MESSAGE_IN_A_BOTTLE, ::MessageInABottleBlockEntityRenderer)
BlockEntityRendererFactories.register(HybridAquaticBlockEntityTypes.FISHING_PLAQUE, ::FishingPlaqueBlockEntityRenderer)
BlockEntityRendererFactories.register(HybridAquaticBlockEntityTypes.BUOY, ::BuoyBlockEntityRenderer)
BlockEntityRendererFactories.register(HybridAquaticBlockEntityTypes.HYDROTHERMAL_VENT, ::HydrothermalVentBlockEntityRenderer)
BlockEntityRendererFactories.register(HybridAquaticBlockEntityTypes.CRAB_POT, ::CrabPotBlockEntityRenderer)
}

private fun registerEntityRenderers() {
Expand All @@ -72,7 +69,9 @@ object HybridAquaticClient : ClientModInitializer {
private fun registerBuiltinItemRenderers(registry: BuiltinItemRendererRegistry = BuiltinItemRendererRegistry.INSTANCE) {
registry.register(HybridAquaticItems.ANEMONE, AnemoneBlockItemRenderer())
registry.register(HybridAquaticItems.BUOY, BuoyBlockItemRenderer())
registry.register(HybridAquaticItems.CRAB_POT, CrabPotBlockItemRenderer())
registry.register(HybridAquaticItems.MESSAGE_IN_A_BOTTLE, MessageInABottleBlockItemRenderer())
registry.register(HybridAquaticItems.HYDROTHERMAL_VENT, HydrothermalVentBlockItemRenderer())
}

fun createBlockEntityRendererFactoryContext(): BlockEntityRendererFactory.Context {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package dev.hybridlabs.aquatic.client.model.block.entity

import dev.hybridlabs.aquatic.HybridAquatic
import dev.hybridlabs.aquatic.block.entity.BuoyBlockEntity
import dev.hybridlabs.aquatic.block.entity.CrabPotBlockEntity
import net.minecraft.util.Identifier
import software.bernie.geckolib.model.GeoModel

class CrabPotBlockEntityModel: GeoModel<CrabPotBlockEntity>() {
override fun getAnimationResource(entity: CrabPotBlockEntity): Identifier {
return ANIMATION_LOCATION
}

override fun getModelResource(animatable: CrabPotBlockEntity): Identifier {
return MODEL_LOCATION
}

override fun getTextureResource(entity: CrabPotBlockEntity): Identifier {
return TEXTURE_LOCATION
}

companion object {
val ANIMATION_LOCATION = Identifier(HybridAquatic.MOD_ID, "animations/crab_pot.animation.json")
val MODEL_LOCATION = Identifier(HybridAquatic.MOD_ID, "geo/entity/block/crab_pot.geo.json")
val TEXTURE_LOCATION = Identifier(HybridAquatic.MOD_ID, "textures/block/crab_pot.png")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package dev.hybridlabs.aquatic.client.model.block.entity

import dev.hybridlabs.aquatic.HybridAquatic
import dev.hybridlabs.aquatic.block.entity.BuoyBlockEntity
import dev.hybridlabs.aquatic.block.entity.CrabPotBlockEntity
import dev.hybridlabs.aquatic.block.entity.HydrothermalVentBlockEntity
import net.minecraft.util.Identifier
import software.bernie.geckolib.model.GeoModel

class HydrothermalVentBlockEntityModel: GeoModel<HydrothermalVentBlockEntity>() {
override fun getAnimationResource(entity: HydrothermalVentBlockEntity): Identifier {
return ANIMATION_LOCATION
}

override fun getModelResource(animatable: HydrothermalVentBlockEntity): Identifier {
return MODEL_LOCATION
}

override fun getTextureResource(entity: HydrothermalVentBlockEntity): Identifier {
return TEXTURE_LOCATION
}

companion object {
val ANIMATION_LOCATION = Identifier(HybridAquatic.MOD_ID, "animations/hydrothermal_vent.animation.json")
val MODEL_LOCATION = Identifier(HybridAquatic.MOD_ID, "geo/entity/block/hydrothermal_vent.geo.json")
val TEXTURE_LOCATION = Identifier(HybridAquatic.MOD_ID, "textures/block/hydrothermal_vent.png")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package dev.hybridlabs.aquatic.client.render.block.entity

import dev.hybridlabs.aquatic.block.entity.CrabPotBlockEntity
import dev.hybridlabs.aquatic.client.model.block.entity.CrabPotBlockEntityModel
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory.Context
import software.bernie.geckolib.renderer.GeoBlockRenderer

class CrabPotBlockEntityRenderer(context: Context) : GeoBlockRenderer<CrabPotBlockEntity>(CrabPotBlockEntityModel())
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package dev.hybridlabs.aquatic.client.render.block.entity

import dev.hybridlabs.aquatic.block.entity.HydrothermalVentBlockEntity
import dev.hybridlabs.aquatic.client.model.block.entity.HydrothermalVentBlockEntityModel
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory.Context
import software.bernie.geckolib.renderer.GeoBlockRenderer

class HydrothermalVentBlockEntityRenderer(context: Context) : GeoBlockRenderer<HydrothermalVentBlockEntity>(HydrothermalVentBlockEntityModel())
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package dev.hybridlabs.aquatic.client.render.item

import dev.hybridlabs.aquatic.HybridAquaticClient
import dev.hybridlabs.aquatic.block.HybridAquaticBlocks
import dev.hybridlabs.aquatic.block.entity.BuoyBlockEntity
import dev.hybridlabs.aquatic.block.entity.CrabPotBlockEntity
import dev.hybridlabs.aquatic.client.render.block.entity.BuoyBlockEntityRenderer
import dev.hybridlabs.aquatic.client.render.block.entity.CrabPotBlockEntityRenderer
import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry.DynamicItemRenderer
import net.minecraft.client.render.VertexConsumerProvider
import net.minecraft.client.render.model.json.ModelTransformationMode
import net.minecraft.client.util.math.MatrixStack
import net.minecraft.item.ItemStack
import net.minecraft.util.math.BlockPos

class CrabPotBlockItemRenderer: DynamicItemRenderer {
private val crabPotBlockEntity = CrabPotBlockEntity(BlockPos.ORIGIN, HybridAquaticBlocks.CRAB_POT.defaultState)
private val renderer = CrabPotBlockEntityRenderer(HybridAquaticClient.createBlockEntityRendererFactoryContext())

override fun render(
stack: ItemStack,
mode: ModelTransformationMode,
matrices: MatrixStack,
vertexConsumers: VertexConsumerProvider,
light: Int,
overlay: Int
) {
renderer.render(crabPotBlockEntity, 1.0f, matrices, vertexConsumers, light, overlay)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package dev.hybridlabs.aquatic.client.render.item

import dev.hybridlabs.aquatic.HybridAquaticClient
import dev.hybridlabs.aquatic.block.HybridAquaticBlocks
import dev.hybridlabs.aquatic.block.entity.BuoyBlockEntity
import dev.hybridlabs.aquatic.block.entity.CrabPotBlockEntity
import dev.hybridlabs.aquatic.block.entity.HydrothermalVentBlockEntity
import dev.hybridlabs.aquatic.client.render.block.entity.BuoyBlockEntityRenderer
import dev.hybridlabs.aquatic.client.render.block.entity.HydrothermalVentBlockEntityRenderer
import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry.DynamicItemRenderer
import net.minecraft.client.render.VertexConsumerProvider
import net.minecraft.client.render.model.json.ModelTransformationMode
import net.minecraft.client.util.math.MatrixStack
import net.minecraft.item.ItemStack
import net.minecraft.util.math.BlockPos

class HydrothermalVentBlockItemRenderer: DynamicItemRenderer {
private val hydrothermalVentBlockEntity = HydrothermalVentBlockEntity(BlockPos.ORIGIN, HybridAquaticBlocks.HYDROTHERMAL_VENT.defaultState)
private val renderer = HydrothermalVentBlockEntityRenderer(HybridAquaticClient.createBlockEntityRendererFactoryContext())

override fun render(
stack: ItemStack,
mode: ModelTransformationMode,
matrices: MatrixStack,
vertexConsumers: VertexConsumerProvider,
light: Int,
overlay: Int
) {
renderer.render(hydrothermalVentBlockEntity, 1.0f, matrices, vertexConsumers, light, overlay)
}
}
4 changes: 4 additions & 0 deletions src/generated/resources/assets/hybrid-aquatic/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
"block.hybrid-aquatic.basking_shark_plushie": "Basking Shark Plushie",
"block.hybrid-aquatic.bull_shark_plushie": "Bull Shark Plushie",
"block.hybrid-aquatic.buoy": "Buoy",
"block.hybrid-aquatic.crab_pot": "Crab Pot",
"block.hybrid-aquatic.crate": "Crate",
"block.hybrid-aquatic.crate.description": "Break with an axe to open",
"block.hybrid-aquatic.frilled_shark_plushie": "Frilled Shark Plushie",
"block.hybrid-aquatic.great_white_shark_plushie": "Great White Shark Plushie",
"block.hybrid-aquatic.hammerhead_shark_plushie": "Hammerhead Shark Plushie",
"block.hybrid-aquatic.hydrothermal_vent": "Hydrothermal Vent",
"block.hybrid-aquatic.message_in_a_bottle": "Message in a Bottle",
"block.hybrid-aquatic.message_in_a_bottle.jar": "Message in a Jar",
"block.hybrid-aquatic.message_in_a_bottle.longneck": "Message in a Longneck Bottle",
Expand Down Expand Up @@ -51,6 +53,7 @@
"entity.hybrid-aquatic.hammerhead_shark": "Hammerhead Shark",
"entity.hybrid-aquatic.hermit_crab": "Hermit Crab",
"entity.hybrid-aquatic.horseshoe_crab": "Horseshoe Crab",
"entity.hybrid-aquatic.karkinos": "Karkinos",
"entity.hybrid-aquatic.lightfoot_crab": "Lightfoot Crab",
"entity.hybrid-aquatic.lionfish": "Lionfish",
"entity.hybrid-aquatic.lions_mane_jellyfish": "Lion's Mane Jellyfish",
Expand Down Expand Up @@ -168,6 +171,7 @@
"item.hybrid-aquatic.hermit_crab_spawn_egg": "Hermit Crab Spawn Egg",
"item.hybrid-aquatic.hook.description": "Needs to be put in the offhand",
"item.hybrid-aquatic.horseshoe_crab_spawn_egg": "Horseshoe Crab Spawn Egg",
"item.hybrid-aquatic.karkinos_spawn_egg": "Karkinos Spawn Egg",
"item.hybrid-aquatic.lightfoot_crab_spawn_egg": "Lightfoot Crab Spawn Egg",
"item.hybrid-aquatic.lionfish": "Lionfish",
"item.hybrid-aquatic.lionfish_spawn_egg": "Lionfish Spawn Egg",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "hybrid-aquatic:crab_pot"
}
],
"rolls": 1.0
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "hybrid-aquatic:hydrothermal_vent"
}
],
"rolls": 1.0
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"minecraft:water"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"replace": false,
"values": [
"minecraft:deep_ocean",
"minecraft:deep_frozen_ocean",
"minecraft:deep_cold_ocean",
"minecraft:deep_lukewarm_ocean"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"type": "minecraft:random_patch",
"config": {
"feature": {
"feature": {
"type": "minecraft:simple_block",
"config": {
"to_place": {
"type": "minecraft:simple_state_provider",
"state": {
"Name": "hybrid-aquatic:hydrothermal_vent",
"Properties": {
"waterlogged": "true"
}
}
}
}
},
"placement": [
{
"type": "minecraft:block_predicate_filter",
"predicate": {
"type": "minecraft:matching_block_tag",
"tag": "hybrid-aquatic:hydrothermal_vent_generate_in"
}
}
]
},
"tries": 6,
"xz_spread": 2,
"y_spread": 2
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"feature": "hybrid-aquatic:hydrothermal_vents",
"placement": [
{
"type": "minecraft:in_square"
},
{
"type": "minecraft:heightmap",
"heightmap": "OCEAN_FLOOR_WG"
},
{
"type": "minecraft:count",
"count": 1
},
{
"type": "minecraft:biome"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,4 @@ class AnemoneBlock(settings: Settings) : PlantBlock(settings), BlockEntityProvid
private val SHAPE = createCuboidShape(1.0, 0.0, 1.0, 15.0, 16.0, 15.0)
private val COLLISION_SHAPE = createCuboidShape(1.0, 0.0, 1.0, 15.0, 8.0, 15.0)
}
}
}
Loading

0 comments on commit 5f37e23

Please sign in to comment.