Skip to content

Commit

Permalink
Jungle Lily Pad edits and a new sea message
Browse files Browse the repository at this point in the history
  • Loading branch information
MysticKoko committed Dec 27, 2024
1 parent 70c4a0c commit ec27420
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"author": "Yashaa",
"has_title": true,
"infinite": false,
"translation_key": "hybrid-aquatic.sea_message.yashaa"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
}
Expand Down
92 changes: 75 additions & 17 deletions src/main/kotlin/dev/hybridlabs/aquatic/block/JungleLilyPadBlock.kt
Original file line number Diff line number Diff line change
@@ -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<Block, BlockState>) {
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)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ec27420

Please sign in to comment.