From ec274203604a24a8cd2b07906c34b6fb4be1c9ba Mon Sep 17 00:00:00 2001 From: MysticKoko <132279944+MysticKoko@users.noreply.github.com> Date: Fri, 27 Dec 2024 18:31:30 +0200 Subject: [PATCH] Jungle Lily Pad edits and a new sea message --- .../assets/hybrid-aquatic/lang/en_us.json | 4 +- .../hybrid-aquatic/sea_message/yashaa.json | 6 ++ .../configured_feature/jungle_lily_pad.json | 5 +- .../aquatic/block/JungleLilyPadBlock.kt | 92 ++++++++++++++---- .../server/seamessage/SeaMessageProvider.kt | 3 +- .../models/block/jungle_lily_pad.json | 2 +- .../textures/item/john_dory.png | Bin 0 -> 622 bytes 7 files changed, 91 insertions(+), 21 deletions(-) create mode 100644 src/generated/resources/data/hybrid-aquatic/hybrid-aquatic/sea_message/yashaa.json create mode 100644 src/main/resources/assets/hybrid-aquatic/textures/item/john_dory.png diff --git a/src/generated/resources/assets/hybrid-aquatic/lang/en_us.json b/src/generated/resources/assets/hybrid-aquatic/lang/en_us.json index c4291e47..98006365 100644 --- a/src/generated/resources/assets/hybrid-aquatic/lang/en_us.json +++ b/src/generated/resources/assets/hybrid-aquatic/lang/en_us.json @@ -224,7 +224,7 @@ "hybrid-aquatic.sea_message.bad_luck": "According to the Luck and Probability department it’s statistically bad luck to wish people good luck during a crisis.", "hybrid-aquatic.sea_message.bad_luck.title": "Important Notice: FBC", "hybrid-aquatic.sea_message.bold_muddy": "AW MAN I DROWNED!", - "hybrid-aquatic.sea_message.boo": "\nBoo", + "hybrid-aquatic.sea_message.boo": "Boo", "hybrid-aquatic.sea_message.catpenjoe": "If you wanna get a catgirl, you first have to become a catboy.", "hybrid-aquatic.sea_message.control_oop": "Objects of Power shape reality around us. Handle with care.", "hybrid-aquatic.sea_message.control_oop.title": "Object of Power: Sea Message", @@ -251,6 +251,8 @@ "hybrid-aquatic.sea_message.willowshine": "Beware the fish girl", "hybrid-aquatic.sea_message.womp_womp": "womp womp", "hybrid-aquatic.sea_message.womp_womp.title": "Catchphrase", + "hybrid-aquatic.sea_message.yashaa": "Why are you crying on a nice day like today? I mean, it's even snowing...", + "hybrid-aquatic.sea_message.yashaa.title": "Cepriestess", "item.hybrid-aquatic.african_butterfly_spawn_egg": "African Butterfly Fish Spawn Egg", "item.hybrid-aquatic.anglerfish": "Anglerfish", "item.hybrid-aquatic.anglerfish_spawn_egg": "Anglerfish Spawn Egg", diff --git a/src/generated/resources/data/hybrid-aquatic/hybrid-aquatic/sea_message/yashaa.json b/src/generated/resources/data/hybrid-aquatic/hybrid-aquatic/sea_message/yashaa.json new file mode 100644 index 00000000..5cb653c0 --- /dev/null +++ b/src/generated/resources/data/hybrid-aquatic/hybrid-aquatic/sea_message/yashaa.json @@ -0,0 +1,6 @@ +{ + "author": "Yashaa", + "has_title": true, + "infinite": false, + "translation_key": "hybrid-aquatic.sea_message.yashaa" +} \ No newline at end of file diff --git a/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/jungle_lily_pad.json b/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/jungle_lily_pad.json index 7244e470..8e6fd121 100644 --- a/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/jungle_lily_pad.json +++ b/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/jungle_lily_pad.json @@ -8,7 +8,10 @@ "to_place": { "type": "minecraft:simple_state_provider", "state": { - "Name": "hybrid-aquatic:jungle_lily_pad" + "Name": "hybrid-aquatic:jungle_lily_pad", + "Properties": { + "waterlogged": "true" + } } } } diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/block/JungleLilyPadBlock.kt b/src/main/kotlin/dev/hybridlabs/aquatic/block/JungleLilyPadBlock.kt index bf3f7dbd..31922bcb 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/block/JungleLilyPadBlock.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/block/JungleLilyPadBlock.kt @@ -1,42 +1,100 @@ package dev.hybridlabs.aquatic.block -import net.minecraft.block.BlockState -import net.minecraft.block.IceBlock -import net.minecraft.block.PlantBlock -import net.minecraft.block.ShapeContext +import net.minecraft.block.* import net.minecraft.entity.Entity import net.minecraft.entity.vehicle.BoatEntity +import net.minecraft.fluid.FluidState import net.minecraft.fluid.Fluids +import net.minecraft.item.ItemPlacementContext import net.minecraft.server.world.ServerWorld +import net.minecraft.state.StateManager +import net.minecraft.state.property.Properties import net.minecraft.util.math.BlockPos +import net.minecraft.util.math.Direction +import net.minecraft.util.math.Vec3d import net.minecraft.util.shape.VoxelShape import net.minecraft.world.BlockView import net.minecraft.world.World +import net.minecraft.world.WorldAccess +import net.minecraft.world.WorldView -open class JungleLilyPadBlock(settings: Settings?) : PlantBlock(settings) { - override fun onEntityCollision(state: BlockState, world: World, pos: BlockPos, entity: Entity) { - super.onEntityCollision(state, world, pos, entity) - if (world is ServerWorld && entity is BoatEntity) { - world.breakBlock(BlockPos(pos), true, entity) +@Suppress("OVERRIDE_DEPRECATION", "DEPRECATION") +class JungleLilyPadBlock(settings: Settings?) : PlantBlock(settings) { + init { + defaultState = defaultState.with(Properties.WATERLOGGED, true) + } + + override fun canPlaceAt(state: BlockState, world: WorldView, pos: BlockPos): Boolean { + val fluidStateAbove = world.getFluidState(pos.up()) + if (fluidStateAbove.fluid != Fluids.EMPTY) { + return false + } + + val stateBelow = world.getBlockState(pos.down()) + if (stateBelow.block == this) { + return false } + + val fluidState = world.getFluidState(pos) + return fluidState.fluid == Fluids.WATER || sideCoversSmallSquare(world, pos.down(), Direction.UP) } - override fun getOutlineShape( + override fun getPlacementState(context: ItemPlacementContext): BlockState? { + val world = context.world + val pos = context.blockPos + val fluidState = world.getFluidState(pos) + return if (fluidState.fluid == Fluids.WATER) { + super.getPlacementState(context)?.with(Properties.WATERLOGGED, true) + } else { + null + } + } + + override fun getStateForNeighborUpdate( state: BlockState, - world: BlockView, + direction: Direction, + neighborState: BlockState, + world: WorldAccess, pos: BlockPos, - context: ShapeContext + neighborPos: BlockPos + ): BlockState { + if (state.get(Properties.WATERLOGGED)) { + world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)) + } + + if (!canPlaceAt(state, world, pos)) { + return Blocks.AIR.defaultState + } + + return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos) + } + + override fun getOutlineShape( + state: BlockState?, + world: BlockView?, + pos: BlockPos?, + context: ShapeContext? ): VoxelShape { return SHAPE } - override fun canPlantOnTop(floor: BlockState, world: BlockView, pos: BlockPos): Boolean { - val fluidState = world.getFluidState(pos) - val fluidState2 = world.getFluidState(pos.up()) - return (fluidState.fluid === Fluids.WATER || floor.block is IceBlock) && fluidState2.fluid === Fluids.EMPTY + override fun getFluidState(state: BlockState): FluidState { + return if (state.get(Properties.WATERLOGGED)) Fluids.WATER.getStill(false) else super.getFluidState(state) + } + + override fun appendProperties(builder: StateManager.Builder) { + builder.add(Properties.WATERLOGGED) + } + + override fun onEntityCollision(state: BlockState, world: World, pos: BlockPos, entity: Entity) { + super.onEntityCollision(state, world, pos, entity) + if (world is ServerWorld && entity is BoatEntity) { + entity.slowMovement(state, Vec3d(0.66, 0.66, 0.66)) + world.breakBlock(BlockPos(pos), false, entity) + } } companion object { - protected val SHAPE: VoxelShape = createCuboidShape(1.0, 0.0, 1.0, 15.0, 1.5, 15.0) + private val SHAPE: VoxelShape = createCuboidShape(1.0, 15.0, 1.0, 15.0, 16.0, 15.0) } } \ No newline at end of file diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/data/server/seamessage/SeaMessageProvider.kt b/src/main/kotlin/dev/hybridlabs/aquatic/data/server/seamessage/SeaMessageProvider.kt index bfcae659..52aef422 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/data/server/seamessage/SeaMessageProvider.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/data/server/seamessage/SeaMessageProvider.kt @@ -44,7 +44,8 @@ class SeaMessageProvider(output: FabricDataOutput, registriesFuture: Completable GeneratedSeaMessageData("crocodile", "It's always the crocodile you don't see you have to worry about.", "Jeremy Wade", englishTitle = "The Unseen Crocodile"), GeneratedSeaMessageData("bad_luck", "According to the Luck and Probability department it’s statistically bad luck to wish people good luck during a crisis.", "Agent Estevez", englishTitle = "Important Notice: FBC"), GeneratedSeaMessageData("cryptic_gun_message", "< You/We wield the Gun/You >", "The Board", englishTitle = "Hotline"), - GeneratedSeaMessageData("boo", "\nBoo"), + GeneratedSeaMessageData("boo", "Boo"), + GeneratedSeaMessageData("yashaa", "Why are you crying on a nice day like today? I mean, it's even snowing...", "Yashaa", englishTitle = "Cepriestess"), GeneratedSeaMessageData("control_oop", "Objects of Power shape reality around us. Handle with care.", author = "FBC", englishTitle = "Object of Power: Sea Message"), GeneratedSeaMessageData("dylan", """ You are a worm through time. diff --git a/src/main/resources/assets/hybrid-aquatic/models/block/jungle_lily_pad.json b/src/main/resources/assets/hybrid-aquatic/models/block/jungle_lily_pad.json index 26c96273..fcd39c2d 100644 --- a/src/main/resources/assets/hybrid-aquatic/models/block/jungle_lily_pad.json +++ b/src/main/resources/assets/hybrid-aquatic/models/block/jungle_lily_pad.json @@ -2,7 +2,7 @@ "credit": "Made with Blockbench", "texture_size": [32, 32], "textures": { - "1": "hybrid-aquatic:block/jungle_lilypad" + "1": "hybrid-aquatic:block/jungle_lily_pad" }, "elements": [ { diff --git a/src/main/resources/assets/hybrid-aquatic/textures/item/john_dory.png b/src/main/resources/assets/hybrid-aquatic/textures/item/john_dory.png new file mode 100644 index 0000000000000000000000000000000000000000..597ca3c2d88412b31c5e69d3dcded1494664782c GIT binary patch literal 622 zcmV-!0+IcRP)Px%4oO5oR5(wKlg&$1VHC!nJ7el7(_B9$8Vha4NkIuiq5{JfYL+c*5ty&FH zfHLm~On*v9j*P&YSI;`_+Uk6GO4{M|n(*u`AmyrpduLn{7h@GLF$JI3g^?FaxKI;J zo2URc8^g%XEe5hqO7Z;%eOgIRXOYM+H1puLBAF(t?wnfy04V+8qe1wKeMoF>g8&8< zM1T3kM9wcG5Kz~2M-pfngT@iS=x(o)f literal 0 HcmV?d00001