Skip to content

Commit

Permalink
Secret stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
MysticKoko committed Nov 27, 2024
1 parent 7f0383d commit eec8aa4
Show file tree
Hide file tree
Showing 7 changed files with 135 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/main/kotlin/dev/hybridlabs/aquatic/HybridAquatic.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import dev.hybridlabs.aquatic.effect.HybridAquaticStatusEffects
import dev.hybridlabs.aquatic.enchantment.HybridAquaticEnchantments
import dev.hybridlabs.aquatic.entity.HybridAquaticEntityTypes
import dev.hybridlabs.aquatic.entity.SpawnRestrictionRegistry
import dev.hybridlabs.aquatic.fluid.HybridAquaticFluids
import dev.hybridlabs.aquatic.item.HybridAquaticItemGroups
import dev.hybridlabs.aquatic.item.HybridAquaticItems
import dev.hybridlabs.aquatic.loot.LootTableModifications
Expand Down Expand Up @@ -41,6 +42,7 @@ object HybridAquatic : ModInitializer {
logger.info("Initializing $MOD_ID")

HybridAquaticBlocks
HybridAquaticFluids
HybridAquaticBlockEntityTypes

StrippableBlockRegistry.register(HybridAquaticBlocks.DRIFTWOOD_LOG, HybridAquaticBlocks.STRIPPED_DRIFTWOOD_LOG)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package dev.hybridlabs.aquatic.block
import com.google.common.collect.ImmutableSet
import dev.hybridlabs.aquatic.HybridAquatic
import dev.hybridlabs.aquatic.block.wood.HybridAquaticWoodTypes
import dev.hybridlabs.aquatic.fluid.HybridAquaticFluids
import net.fabricmc.fabric.api.`object`.builder.v1.block.FabricBlockSettings
import net.minecraft.block.*
import net.minecraft.block.entity.BlockEntity
Expand Down Expand Up @@ -35,6 +36,9 @@ object HybridAquaticBlocks {
.pistonBehavior(PistonBehavior.DESTROY)
))

val BRINE = register("brine", FluidBlock(HybridAquaticFluids.BRINE, AbstractBlock.Settings.create().mapColor(MapColor.WATER_BLUE).replaceable().noCollision().strength(100.0f).pistonBehavior(PistonBehavior.DESTROY).dropsNothing().liquid().sounds(BlockSoundGroup.INTENTIONALLY_EMPTY)))


val BASKING_SHARK_PLUSHIE = register("basking_shark_plushie", createPlushieBlock(PlushieBlock.Variant.BASKING_SHARK, Blocks.GRAY_WOOL))
val BULL_SHARK_PLUSHIE = register("bull_shark_plushie", createPlushieBlock(PlushieBlock.Variant.BULL_SHARK, Blocks.LIGHT_GRAY_WOOL))
val FRILLED_SHARK_PLUSHIE = register("frilled_shark_plushie", createPlushieBlock(PlushieBlock.Variant.FRILLED_SHARK, Blocks.GRAY_WOOL))
Expand Down Expand Up @@ -203,6 +207,7 @@ object HybridAquaticBlocks {
.instrument(Instrument.CUSTOM_HEAD)
)
}

private fun register(id: String, block: Block): Block {
return Registry.register(Registries.BLOCK, Identifier(HybridAquatic.MOD_ID, id), block)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class ModelProvider(output: FabricDataOutput) : FabricModelProvider(output) {
HybridAquaticItems.GLOW_SLIME,
HybridAquaticItems.SHARK_TOOTH,
HybridAquaticItems.SPONGE_CHUNK,
HybridAquaticItems.BRINE_BUCKET,
HybridAquaticItems.PEARL,
HybridAquaticItems.BLACK_PEARL,
HybridAquaticItems.SULFUR,
Expand Down
104 changes: 104 additions & 0 deletions src/main/kotlin/dev/hybridlabs/aquatic/fluid/BrineFluid.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
package dev.hybridlabs.aquatic.fluid

import dev.hybridlabs.aquatic.block.HybridAquaticBlocks
import dev.hybridlabs.aquatic.item.HybridAquaticItems
import net.minecraft.block.Block
import net.minecraft.block.BlockState
import net.minecraft.block.FluidBlock
import net.minecraft.fluid.FlowableFluid
import net.minecraft.fluid.Fluid
import net.minecraft.fluid.FluidState
import net.minecraft.item.Item
import net.minecraft.state.StateManager
import net.minecraft.util.math.BlockPos
import net.minecraft.util.math.Direction
import net.minecraft.world.BlockView
import net.minecraft.world.World
import net.minecraft.world.WorldAccess
import net.minecraft.world.WorldView

open class BrineFluid : FlowableFluid() {
override fun isInfinite(world: World?): Boolean {
return false
}

override fun beforeBreakingBlock(world: WorldAccess, pos: BlockPos?, state: BlockState) {
val blockEntity = if (state.hasBlockEntity()) world.getBlockEntity(pos) else null
Block.dropStacks(state, world, pos, blockEntity)
}

override fun getFlowSpeed(world: WorldView?): Int {
return 3
}

override fun getLevelDecreasePerBlock(world: WorldView?): Int {
return 2
}

override fun getLevel(state: FluidState?): Int {
return 8
}

override fun getTickRate(world: WorldView?): Int {
return 5
}

override fun getBlastResistance(): Float {
return 100F
}

override fun canBeReplacedWith(
state: FluidState?,
world: BlockView?,
pos: BlockPos?,
fluid: Fluid?,
direction: Direction?
): Boolean {
return false
}

override fun getStill(): Fluid {
return HybridAquaticFluids.BRINE
}

override fun getFlowing(): Fluid {
return HybridAquaticFluids.FLOWING_BRINE
}

override fun getBucketItem(): Item {
return HybridAquaticItems.BRINE_BUCKET
}

public override fun toBlockState(state: FluidState?): BlockState {
return HybridAquaticBlocks.BRINE.defaultState.with(FluidBlock.LEVEL, getBlockStateLevel(state)) as BlockState
}

override fun isStill(state: FluidState?): Boolean {
return false
}

internal class Flowing : BrineFluid() {
override fun appendProperties(builder: StateManager.Builder<Fluid?, FluidState?>) {
super.appendProperties(builder)
builder.add(LEVEL)
}

override fun getLevel(state: FluidState): Int {
return state.get(LEVEL)
}

override fun isStill(state: FluidState?): Boolean {
return false
}
}

internal class Still : BrineFluid() {
override fun getLevel(state: FluidState?): Int {
return 8
}

override fun isStill(state: FluidState?): Boolean {
return true
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package dev.hybridlabs.aquatic.fluid

import dev.hybridlabs.aquatic.HybridAquatic
import net.minecraft.fluid.FlowableFluid
import net.minecraft.fluid.Fluid
import net.minecraft.registry.Registries
import net.minecraft.registry.Registry
import net.minecraft.util.Identifier

object HybridAquaticFluids {

val BRINE = register("brine", BrineFluid()) as FlowableFluid

val FLOWING_BRINE = register("flowing_brine", BrineFluid()) as FlowableFluid

private fun register(id: String, fluid: Fluid): Fluid {
return Registry.register(Registries.FLUID, Identifier(HybridAquatic.MOD_ID, id), fluid)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ object HybridAquaticItemGroups {
entries.add(HybridAquaticItems.CREEPERMAGNET_HOOK)
entries.add(HybridAquaticItems.OMINOUS_HOOK)

// fishing net
// tools
entries.add(HybridAquaticItems.BRINE_BUCKET)
entries.add(HybridAquaticItems.SEASHELL_SPEAR)
entries.add(HybridAquaticItems.SEASHELL_PICKAXE)
entries.add(HybridAquaticItems.SEASHELL_AXE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package dev.hybridlabs.aquatic.item
import dev.hybridlabs.aquatic.HybridAquatic
import dev.hybridlabs.aquatic.block.HybridAquaticBlocks
import dev.hybridlabs.aquatic.entity.HybridAquaticEntityTypes
import dev.hybridlabs.aquatic.fluid.BrineFluid
import net.fabricmc.fabric.api.item.v1.FabricItemSettings
import net.minecraft.block.Block
import net.minecraft.entity.EntityType
Expand Down Expand Up @@ -46,6 +47,7 @@ object HybridAquaticItems {
val PEARL = register("pearl", Item(FabricItemSettings()))
val BLACK_PEARL = register("black_pearl", Item(FabricItemSettings()))
val CUTTLEBONE = register("cuttlebone", Item(FabricItemSettings()))
val BRINE_BUCKET = register("brine_bucket", BucketItem(BrineFluid(), FabricItemSettings()))

val SEASHELL_SPEAR = register("seashell_spear", SwordItem(HybridAquaticToolMaterials.SEASHELL,
3,
Expand Down

0 comments on commit eec8aa4

Please sign in to comment.