Skip to content

Commit

Permalink
chore: update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
andantet committed Oct 28, 2024
1 parent 91dba8a commit e7b4ccb
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 23 deletions.
20 changes: 10 additions & 10 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21.1
yarn_build=3
loader_version=0.16.5
minecraft_version=1.21.3
yarn_build=2
loader_version=0.16.7

# Mod Properties
mod_version=1.10
mod_version=1.11
maven_group=net.mcbrawls
mod_id=blueprint

# Dependencies
fabric_version=0.105.0+1.21.1
fabric_version=0.107.0+1.21.3

kotlin_version=1.9.24
fabric_kotlin_version=1.10.20+kotlin.1.9.24
kotlin_version=2.0.21
fabric_kotlin_version=1.12.3+kotlin.2.0.21

codex_version=1.5.0
sgui_version=1.6.1+1.21.1
fantasy_version=0.6.4+1.21
polymer_version=0.9.16+1.21.1
sgui_version=1.7.2+1.21.2
fantasy_version=0.6.5+1.21.2
polymer_version=0.10.1+1.21.3
13 changes: 10 additions & 3 deletions src/main/kotlin/net/mcbrawls/blueprint/block/BlueprintBlocks.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,19 @@ import net.minecraft.block.AbstractBlock
import net.minecraft.block.Block
import net.minecraft.registry.Registries
import net.minecraft.registry.Registry
import net.minecraft.registry.RegistryKey
import net.minecraft.registry.RegistryKeys
import net.minecraft.util.Identifier

object BlueprintBlocks {
val POINT_REGION = register("point_region", PointRegionBlock(AbstractBlock.Settings.create().dropsNothing()))
val POINT_REGION = register("point_region", AbstractBlock.Settings.create().dropsNothing(), ::PointRegionBlock)

private fun register(id: String, block: Block): Block {
return Registry.register(Registries.BLOCK, Identifier.of(BlueprintMod.MOD_ID, id), block)
private fun register(id: String, settings: AbstractBlock.Settings, factory: (AbstractBlock.Settings) -> Block): Block {
return register(RegistryKey.of(RegistryKeys.BLOCK, Identifier.of(BlueprintMod.MOD_ID, id)), settings, factory)
}

private fun register(key: RegistryKey<Block>, settings: AbstractBlock.Settings, factory: (AbstractBlock.Settings) -> Block): Block {
val block = factory.invoke(settings.registryKey(key))
return Registry.register(Registries.BLOCK, key, block)
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.mcbrawls.blueprint.block.entity

import eu.pb4.polymer.core.api.block.PolymerBlockUtils
import net.fabricmc.fabric.api.`object`.builder.v1.block.entity.FabricBlockEntityTypeBuilder
import net.mcbrawls.blueprint.BlueprintMod
import net.mcbrawls.blueprint.block.BlueprintBlocks
import net.minecraft.block.entity.BlockEntity
Expand All @@ -12,9 +13,9 @@ import net.minecraft.util.Identifier
import net.minecraft.util.Util

object BlueprintBlockEntityTypes {
val REGION_ID = register("region_id", BlockEntityType.Builder.create(::RegionIdBlockEntity, BlueprintBlocks.POINT_REGION))
val REGION_ID = register("region_id", FabricBlockEntityTypeBuilder.create(::RegionIdBlockEntity, BlueprintBlocks.POINT_REGION))

private fun <T : BlockEntity> register(id: String, builder: BlockEntityType.Builder<T>): BlockEntityType<T> {
private fun <T : BlockEntity> register(id: String, builder: FabricBlockEntityTypeBuilder<T>): BlockEntityType<T> {
val identifier = Identifier.of(BlueprintMod.MOD_ID, id)
val datafixType = Util.getChoiceType(TypeReferences.BLOCK_ENTITY, identifier.toString());
val type = builder.build(datafixType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ object BlueprintEditorHandler {
val posDiff = maxPos.subtract(minPos)
val pos = BlockPos((minPos.x + posDiff.x / 2), (minPos.y + posDiff.y / 2), (minPos.z + posDiff.z / 2))
val vec = Vec3d.ofBottomCenter(pos)
player.teleport(world, vec.x, vec.y, vec.z, 0.0f, 0.0f)
player.teleport(world, vec.x, vec.y, vec.z, setOf(), 0.0f, 0.0f, true)

player.changeGameMode(GameMode.SPECTATOR)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import net.minecraft.block.Blocks
import net.minecraft.util.math.BlockPos
import net.minecraft.util.math.Vec3d
import net.minecraft.world.World
import xyz.nucleoid.packettweaker.PacketContext

class PointRegionBlock(settings: Settings) : RegionBlock(settings), PolymerBlock {
override fun saveRegion(
Expand All @@ -22,7 +23,7 @@ class PointRegionBlock(settings: Settings) : RegionBlock(settings), PolymerBlock
return PointRegion(Vec3d.of(relativePos))
}

override fun getPolymerBlockState(state: BlockState): BlockState {
override fun getPolymerBlockState(state: BlockState, context: PacketContext): BlockState {
return Blocks.YELLOW_WOOL.defaultState
}

Expand Down
13 changes: 10 additions & 3 deletions src/main/kotlin/net/mcbrawls/blueprint/item/BlueprintItems.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,19 @@ import net.minecraft.item.Item
import net.minecraft.item.Items
import net.minecraft.registry.Registries
import net.minecraft.registry.Registry
import net.minecraft.registry.RegistryKey
import net.minecraft.registry.RegistryKeys
import net.minecraft.util.Identifier

object BlueprintItems {
val POINT_REGION = register("point_region", PolymerBlockItem(BlueprintBlocks.POINT_REGION, Item.Settings(), Items.YELLOW_WOOL))
val POINT_REGION = register("point_region") { settings -> PolymerBlockItem(BlueprintBlocks.POINT_REGION, settings, Items.YELLOW_WOOL) }

private fun register(id: String, block: Item): Item {
return Registry.register(Registries.ITEM, Identifier.of(BlueprintMod.MOD_ID, id), block)
private fun register(id: String, settings: Item.Settings = Item.Settings(), factory: (Item.Settings) -> Item): Item {
return register(RegistryKey.of(RegistryKeys.ITEM, Identifier.of(BlueprintMod.MOD_ID, id)), settings, factory)
}

private fun register(key: RegistryKey<Item>, settings: Item.Settings, factory: (Item.Settings) -> Item): Item {
val block = factory.invoke(settings.registryKey(key))
return Registry.register(Registries.ITEM, key, block)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import net.minecraft.resource.ResourceManager
import net.minecraft.server.MinecraftServer
import net.minecraft.util.Identifier
import net.minecraft.util.WorldSavePath
import net.minecraft.util.profiler.Profiler
import net.minecraft.world.level.storage.LevelStorage
import org.slf4j.Logger
import org.slf4j.LoggerFactory
Expand Down Expand Up @@ -103,7 +102,6 @@ object BlueprintManager : SimpleResourceReloadListener<Map<Identifier, Blueprint
@OptIn(ExperimentalPathApi::class)
override fun load(
manager: ResourceManager,
profiler: Profiler,
executor: Executor
): CompletableFuture<Map<Identifier, Blueprint>> {
return CompletableFuture.supplyAsync {
Expand Down Expand Up @@ -202,7 +200,6 @@ object BlueprintManager : SimpleResourceReloadListener<Map<Identifier, Blueprint
override fun apply(
data: Map<Identifier, Blueprint>,
manager: ResourceManager,
profiler: Profiler,
executor: Executor
): CompletableFuture<Void> {
return CompletableFuture.runAsync {
Expand Down

0 comments on commit e7b4ccb

Please sign in to comment.