Skip to content

Commit

Permalink
some errors fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan-Khar committed Feb 7, 2024
1 parent ed8e4d8 commit f526caf
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 20 deletions.
5 changes: 5 additions & 0 deletions src/main/kotlin/dev/hybridlabs/aquatic/block/AnemoneBlock.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.hybridlabs.aquatic.block

import com.mojang.serialization.MapCodec
import dev.hybridlabs.aquatic.block.entity.AnemoneBlockEntity
import dev.hybridlabs.aquatic.block.entity.HybridAquaticBlockEntityTypes
import dev.hybridlabs.aquatic.entity.fish.ClownfishEntity
Expand Down Expand Up @@ -52,6 +53,10 @@ class AnemoneBlock(settings: Settings) : PlantBlock(settings), BlockEntityProvid
return !floor.getCollisionShape(world, pos).getFace(Direction.UP).isEmpty || floor.isSideSolidFullSquare(world, pos, Direction.UP)
}

override fun getCodec(): MapCodec<out PlantBlock> {
TODO("Not yet implemented")
}

override fun getStateForNeighborUpdate(
state: BlockState,
direction: Direction,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class MessageInABottleBlock(settings: Settings) : BlockWithEntity(settings), Wat
defaultState = defaultState.with(WATERLOGGED, false)
}

override fun getPickStack(world: BlockView, pos: BlockPos, state: BlockState): ItemStack {
override fun getPickStack(world: WorldView, pos: BlockPos, state: BlockState): ItemStack {
val blockEntity = world.getBlockEntity(pos)
if (blockEntity !is MessageInABottleBlockEntity) {
return super.getPickStack(world, pos, state)
Expand Down
3 changes: 2 additions & 1 deletion src/main/kotlin/dev/hybridlabs/aquatic/block/SeaMessage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import net.minecraft.nbt.NbtList
import net.minecraft.nbt.NbtString
import net.minecraft.text.MutableText
import net.minecraft.text.Text
import net.minecraft.text.Text.Serialization

/**
* Represents a message inside a Message in a Bottle.
Expand All @@ -34,7 +35,7 @@ data class SeaMessage(
val stack = ItemStack(Items.WRITTEN_BOOK)

stack.setSubNbt(WrittenBookItem.PAGES_KEY, NbtList().apply {
add(NbtString.of(Text.Serializer.toJson(text)))
add(NbtString.of(Serialization.toJsonString(text)))
})

stack.setSubNbt(WrittenBookItem.TITLE_KEY, NbtString.of("Sea Message"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider
import net.minecraft.advancement.criterion.InventoryChangedCriterion
import net.minecraft.block.Blocks
import net.minecraft.data.server.recipe.RecipeExporter
import net.minecraft.data.server.recipe.RecipeJsonProvider
import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder
import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder
import net.minecraft.item.Item
import net.minecraft.item.Items
import net.minecraft.recipe.CampfireCookingRecipe
import net.minecraft.recipe.RecipeSerializer
import net.minecraft.recipe.SmeltingRecipe
import net.minecraft.recipe.SmokingRecipe
import net.minecraft.recipe.book.RecipeCategory
import net.minecraft.registry.tag.ItemTags
import java.util.function.Consumer

class RecipeProvider(output: FabricDataOutput) : FabricRecipeProvider(output) {

Expand Down Expand Up @@ -166,16 +167,8 @@ class RecipeProvider(output: FabricDataOutput) : FabricRecipeProvider(output) {
output: Item,
experience: Float
) {
offerFoodCookingRecipe(exporter, "smelting", RecipeSerializer.SMELTING, 200, input, output, experience)
offerFoodCookingRecipe(exporter, "smoking", RecipeSerializer.SMOKING, 100, input, output, experience)
offerFoodCookingRecipe(
exporter,
"campfire_cooking",
RecipeSerializer.CAMPFIRE_COOKING,
600,
input,
output,
experience
)
offerFoodCookingRecipe(exporter, "smelting", RecipeSerializer.SMELTING, ::SmeltingRecipe, 200, input, output, experience)
offerFoodCookingRecipe(exporter, "smoking", RecipeSerializer.SMOKING, ::SmokingRecipe,100, input, output, experience)
offerFoodCookingRecipe(exporter, "campfire_cooking", RecipeSerializer.CAMPFIRE_COOKING, ::CampfireCookingRecipe, 600, input, output, experience)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,12 @@ open class HybridAquaticCritterEntity(type: EntityType<out HybridAquaticCritterE
override fun getAnimatableInstanceCache(): AnimatableInstanceCache {
return factory
}

override fun canBreatheInWater(): Boolean {
return true
}
/*
TODO: put critters in EntityTypeTags.CAN_BREATHE_UNDER_WATER tag
override fun canBreatheInWater(): Boolean {
return true
}
*/

var variant: Int
get() = dataTracker.get(VARIANT).coerceAtLeast(0).coerceAtMost(variantCount-1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class MessageInABottleItemEntry(
* The codec for this class.
*/
val CODEC: Codec<MessageInABottleItemEntry> = RecordCodecBuilder.create { instance ->
val default = method_53290(instance)
val default = addLeafFields(instance)
instance.group(
default.t1(),
default.t2(),
Expand Down

0 comments on commit f526caf

Please sign in to comment.