diff --git a/FabricMod/src/main/resources/fabric.mod.json b/FabricMod/src/main/resources/fabric.mod.json index a7b5230f3..16f1d505a 100644 --- a/FabricMod/src/main/resources/fabric.mod.json +++ b/FabricMod/src/main/resources/fabric.mod.json @@ -95,7 +95,7 @@ "fabric-api": ">=$fabric_api", "fabric-language-kotlin": ">=$fabric_language_kotlin", "architectury": ">=$architectury", - "minecraft": "=$minecraft", + "minecraft": ">=$minecraft", "java": ">=$java" }, "custom": { diff --git a/NeoForgeMod/src/main/resources/META-INF/neoforge.mods.toml b/NeoForgeMod/src/main/resources/META-INF/neoforge.mods.toml index 9ade40c6e..1feb1c44a 100644 --- a/NeoForgeMod/src/main/resources/META-INF/neoforge.mods.toml +++ b/NeoForgeMod/src/main/resources/META-INF/neoforge.mods.toml @@ -29,7 +29,7 @@ side = "BOTH" [[dependencies.avm_staff]] modId = "minecraft" type = "required" -versionRange = "[$minecraft]" +versionRange = "[$minecraft,)" ordering = "NONE" side = "BOTH" diff --git a/StaffMod/src/main/kotlin/opekope2/avm_staff/api/StaffMod.kt b/StaffMod/src/main/kotlin/opekope2/avm_staff/api/StaffMod.kt index 166fa3ff9..b589a8171 100644 --- a/StaffMod/src/main/kotlin/opekope2/avm_staff/api/StaffMod.kt +++ b/StaffMod/src/main/kotlin/opekope2/avm_staff/api/StaffMod.kt @@ -25,10 +25,10 @@ import dev.architectury.registry.CreativeTabRegistry import dev.architectury.registry.registries.DeferredRegister import dev.architectury.registry.registries.RegistrySupplier import net.minecraft.block.AbstractBlock -import net.minecraft.block.enums.Instrument +import net.minecraft.block.enums.NoteBlockInstrument import net.minecraft.block.piston.PistonBehavior import net.minecraft.client.particle.ParticleManager -import net.minecraft.component.DataComponentType +import net.minecraft.component.ComponentType import net.minecraft.entity.EntityType import net.minecraft.entity.SpawnGroup import net.minecraft.entity.damage.DamageType @@ -78,7 +78,7 @@ private val SOUND_EVENTS = DeferredRegister.create(MOD_ID, RegistryKeys.SOUND_EV */ val crownOfKingOrangeBlock: RegistrySupplier = BLOCKS.register("crown_of_king_orange") { CrownBlock( - AbstractBlock.Settings.create().instrument(Instrument.BELL).strength(1.0f) + AbstractBlock.Settings.create().instrument(NoteBlockInstrument.BELL).strength(1.0f) .pistonBehavior(PistonBehavior.DESTROY).sounds(BlockSoundGroup.COPPER_GRATE).nonOpaque() ) } @@ -181,7 +181,7 @@ val impactTntEntityType: RegistrySupplier> = ENTITY_ .eyeHeight(EntityType.TNT.dimensions.eyeHeight) .maxTrackingRange(EntityType.TNT.maxTrackDistance) .trackingTickInterval(EntityType.TNT.trackTickInterval) - .build(Identifier(MOD_ID, "impact_tnt").toString()) + .build(Identifier.of(MOD_ID, "impact_tnt").toString()) } /** @@ -196,7 +196,7 @@ val cakeEntityType: RegistrySupplier> = .dimensions(cakeSize.toFloat(), cakeSize.toFloat()) .maxTrackingRange(EntityType.FALLING_BLOCK.maxTrackDistance) .trackingTickInterval(EntityType.FALLING_BLOCK.trackTickInterval) - .build(Identifier(MOD_ID, "cake").toString()) + .build(Identifier.of(MOD_ID, "cake").toString()) } /** @@ -218,9 +218,9 @@ val soulFlamethrowerParticleType: RegistrySupplier = /** * Data component registered as `avm_staff:staff_item`. Stores the item inserted into the staff. */ -val staffItemComponentType: RegistrySupplier> = +val staffItemComponentType: RegistrySupplier> = DATA_COMPONENT_TYPES.register("staff_item") { - DataComponentType.builder() + ComponentType.builder() .codec(StaffItemComponent.CODEC) .packetCodec(StaffItemComponent.PACKET_CODEC) .build() @@ -229,9 +229,9 @@ val staffItemComponentType: RegistrySupplier> = +val rocketModeComponentType: RegistrySupplier> = DATA_COMPONENT_TYPES.register("rocket_mode") { - DataComponentType.builder() + ComponentType.builder() .packetCodec(PacketCodec.unit(MinecraftUnit.INSTANCE)) .build() } @@ -239,9 +239,9 @@ val rocketModeComponentType: RegistrySupplier> /** * Data component registered as `avm_staff:furnace_data`. If this is present, the furnace is lit. */ -val staffFurnaceDataComponentType: RegistrySupplier> = +val staffFurnaceDataComponentType: RegistrySupplier> = DATA_COMPONENT_TYPES.register("furnace_data") { - DataComponentType.builder() + ComponentType.builder() .packetCodec(StaffFurnaceDataComponent.PACKET_CODEC) .build() } @@ -250,9 +250,9 @@ val staffFurnaceDataComponentType: RegistrySupplier> = +val staffRendererOverrideComponentType: RegistrySupplier> = DATA_COMPONENT_TYPES.register("staff_renderer_override") { - DataComponentType.builder() + ComponentType.builder() .codec(StaffRendererOverrideComponent.CODEC) .packetCodec(StaffRendererOverrideComponent.PACKET_CODEC) .build() @@ -261,9 +261,9 @@ val staffRendererOverrideComponentType: RegistrySupplier> = +val staffRendererPartComponentType: RegistrySupplier> = DATA_COMPONENT_TYPES.register("staff_renderer_part") { - DataComponentType.builder() + ComponentType.builder() .packetCodec(StaffRendererPartComponent.PACKET_CODEC) .build() } @@ -272,27 +272,27 @@ val staffRendererPartComponentType: RegistrySupplier = SOUND_EVENTS.register("entity.cake.splash") { - SoundEvent.of(Identifier(MOD_ID, "entity.cake.splash")) + SoundEvent.of(Identifier.of(MOD_ID, "entity.cake.splash")) } /** * Sound event registered as `avm_staff:entity.cake.throw`. */ val cakeThrowSoundEvent: RegistrySupplier = SOUND_EVENTS.register("entity.cake.throw") { - SoundEvent.of(Identifier(MOD_ID, "entity.cake.throw")) + SoundEvent.of(Identifier.of(MOD_ID, "entity.cake.throw")) } /** * `avm_staff:pranked` damage type. */ val cakeDamageType: RegistryKey = - RegistryKey.of(RegistryKeys.DAMAGE_TYPE, Identifier(MOD_ID, "pranked")) + RegistryKey.of(RegistryKeys.DAMAGE_TYPE, Identifier.of(MOD_ID, "pranked")) /** * `avm_staff:pranked_by_player` damage type. */ val playerCakeDamageType: RegistryKey = - RegistryKey.of(RegistryKeys.DAMAGE_TYPE, Identifier(MOD_ID, "pranked_by_player")) + RegistryKey.of(RegistryKeys.DAMAGE_TYPE, Identifier.of(MOD_ID, "pranked_by_player")) /** * Throwable cakes game rule. When set to true, cakes can be thrown by right clicking, and dispensers will shoot cakes diff --git a/StaffMod/src/main/kotlin/opekope2/avm_staff/api/component/StaffItemComponent.kt b/StaffMod/src/main/kotlin/opekope2/avm_staff/api/component/StaffItemComponent.kt index 5e53fe9d7..10f185db0 100644 --- a/StaffMod/src/main/kotlin/opekope2/avm_staff/api/component/StaffItemComponent.kt +++ b/StaffMod/src/main/kotlin/opekope2/avm_staff/api/component/StaffItemComponent.kt @@ -20,13 +20,13 @@ package opekope2.avm_staff.api.component import com.mojang.serialization.Codec import com.mojang.serialization.codecs.RecordCodecBuilder -import net.minecraft.component.DataComponentType +import net.minecraft.component.ComponentType import net.minecraft.item.ItemStack import net.minecraft.network.RegistryByteBuf import net.minecraft.network.codec.PacketCodec /** - * [ItemStack] wrapper to make them compatible with [DataComponentType]s. + * [ItemStack] wrapper to make them compatible with [ComponentType]s. * * @param item The item stored in this component. Must be [copied][ItemStack.copy] before modifying it */ diff --git a/StaffMod/src/main/kotlin/opekope2/avm_staff/api/entity/CakeEntity.kt b/StaffMod/src/main/kotlin/opekope2/avm_staff/api/entity/CakeEntity.kt index 20ecdc5a3..affcd2f0d 100644 --- a/StaffMod/src/main/kotlin/opekope2/avm_staff/api/entity/CakeEntity.kt +++ b/StaffMod/src/main/kotlin/opekope2/avm_staff/api/entity/CakeEntity.kt @@ -35,6 +35,7 @@ import net.minecraft.entity.data.TrackedDataHandlerRegistry import net.minecraft.nbt.NbtCompound import net.minecraft.network.packet.s2c.play.EntitySpawnS2CPacket import net.minecraft.predicate.entity.EntityPredicates +import net.minecraft.server.network.EntityTrackerEntry import net.minecraft.sound.SoundCategory import net.minecraft.util.math.BlockPos import net.minecraft.util.math.Vec3d @@ -192,7 +193,8 @@ class CakeEntity(entityType: EntityType, world: World) : Entity(enti override fun entityDataRequiresOperator() = true - override fun createSpawnPacket() = EntitySpawnS2CPacket(this) + override fun createSpawnPacket(entityTrackerEntry: EntityTrackerEntry) = + EntitySpawnS2CPacket(this, entityTrackerEntry) override fun onSpawnPacket(packet: EntitySpawnS2CPacket) { super.onSpawnPacket(packet) diff --git a/StaffMod/src/main/kotlin/opekope2/avm_staff/api/item/StaffItem.kt b/StaffMod/src/main/kotlin/opekope2/avm_staff/api/item/StaffItem.kt index b80029ea9..a8474cdf8 100644 --- a/StaffMod/src/main/kotlin/opekope2/avm_staff/api/item/StaffItem.kt +++ b/StaffMod/src/main/kotlin/opekope2/avm_staff/api/item/StaffItem.kt @@ -53,8 +53,8 @@ abstract class StaffItem(settings: Settings) : Item(settings) { stack[DataComponentTypes.ATTRIBUTE_MODIFIERS] = stack.itemInStaff.staffHandlerOrDefault.attributeModifiers } - override fun getMaxUseTime(stack: ItemStack): Int { - return stack.itemInStaff.staffHandlerOrDefault.maxUseTime + override fun getMaxUseTime(stack: ItemStack, user: LivingEntity): Int { + return stack.itemInStaff.staffHandlerOrDefault.maxUseTime // TODO extend API } override fun use(world: World, user: PlayerEntity, hand: Hand): TypedActionResult { diff --git a/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/Initializer.kt b/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/Initializer.kt index cb90f1a00..013b6ebe3 100644 --- a/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/Initializer.kt +++ b/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/Initializer.kt @@ -78,8 +78,8 @@ fun initializeNetworking() { } private val MODIFIABLE_LOOT_TABLES = setOf( - Identifier("chests/bastion_treasure"), - Identifier("chests/trial_chambers/reward_unique") + Identifier.ofVanilla("chests/bastion_treasure"), + Identifier.ofVanilla("chests/trial_chambers/reward_unique") ) fun subscribeToEvents() { @@ -142,13 +142,13 @@ private fun modifyLootTables( context: LootEvent.LootTableModificationContext, builtin: Boolean ) { - // FIXME builtin check after updating to 1.21 because Fabric detects experiments as data pack + if (!builtin) return if (lootTable.value !in MODIFIABLE_LOOT_TABLES) return context.addPool( LootPool.builder().with( LootTableEntry.builder( - RegistryKey.of(RegistryKeys.LOOT_TABLE, Identifier(MOD_ID, "add_loot_pool/${lootTable.value.path}")) + RegistryKey.of(RegistryKeys.LOOT_TABLE, Identifier.of(MOD_ID, "add_loot_pool/${lootTable.value.path}")) ) ) ) @@ -191,7 +191,7 @@ fun registerClientContent() { @Environment(EnvType.CLIENT) fun registerSmithingTableTextures() { StaffInfusionSmithingRecipeTextures.register( - Identifier(MOD_ID, "item/smithing_table/empty_slot_royal_staff"), + Identifier.of(MOD_ID, "item/smithing_table/empty_slot_royal_staff"), ISmithingTemplateItemAccessor.emptySlotRedstoneDustTexture() ) } diff --git a/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/model/ModelPredicates.kt b/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/model/ModelPredicates.kt index 943c6bb74..dbcf9b30f 100644 --- a/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/model/ModelPredicates.kt +++ b/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/model/ModelPredicates.kt @@ -32,7 +32,7 @@ import kotlin.jvm.optionals.getOrNull // ModelPredicateProviderRegistry.register is private in common project @Environment(EnvType.CLIENT) fun registerModelPredicateProviders(register: (Identifier, ClampedModelPredicateProvider) -> Unit) { - register(Identifier(MOD_ID, "using_item")) { stack, _, entity, _ -> + register(Identifier.of(MOD_ID, "using_item")) { stack, _, entity, _ -> val isActiveOverride = stack[staffRendererOverrideComponentType.get()]?.isActive?.getOrNull() when { isActiveOverride == true -> 1f @@ -41,10 +41,10 @@ fun registerModelPredicateProviders(register: (Identifier, ClampedModelPredicate else -> 0f } } - register(Identifier(MOD_ID, "head"), matchStaffRendererPart(StaffRendererPartComponent.HEAD)) - register(Identifier(MOD_ID, "item"), matchStaffRendererPart(StaffRendererPartComponent.ITEM)) - register(Identifier(MOD_ID, "rod_top"), matchStaffRendererPart(StaffRendererPartComponent.ROD_TOP)) - register(Identifier(MOD_ID, "rod_bottom"), matchStaffRendererPart(StaffRendererPartComponent.ROD_BOTTOM)) + register(Identifier.of(MOD_ID, "head"), matchStaffRendererPart(StaffRendererPartComponent.HEAD)) + register(Identifier.of(MOD_ID, "item"), matchStaffRendererPart(StaffRendererPartComponent.ITEM)) + register(Identifier.of(MOD_ID, "rod_top"), matchStaffRendererPart(StaffRendererPartComponent.ROD_TOP)) + register(Identifier.of(MOD_ID, "rod_bottom"), matchStaffRendererPart(StaffRendererPartComponent.ROD_BOTTOM)) } private fun matchStaffRendererPart(part: StaffRendererPartComponent) = ClampedModelPredicateProvider { stack, _, _, _ -> diff --git a/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/networking/c2s/play/AttackC2SPacket.kt b/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/networking/c2s/play/AttackC2SPacket.kt index 38f8fa692..d1f1404b1 100644 --- a/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/networking/c2s/play/AttackC2SPacket.kt +++ b/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/networking/c2s/play/AttackC2SPacket.kt @@ -38,7 +38,7 @@ internal class AttackC2SPacket(val hand: Hand) : IC2SPacket { companion object : PacketRegistrarAndReceiver( NetworkManager.c2s(), - Identifier(MOD_ID, "attack"), + Identifier.of(MOD_ID, "attack"), ::AttackC2SPacket ) { override fun receive(packet: AttackC2SPacket, context: NetworkManager.PacketContext) { diff --git a/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/networking/c2s/play/InsertItemIntoStaffC2SPacket.kt b/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/networking/c2s/play/InsertItemIntoStaffC2SPacket.kt index e0644f6e2..1445b6ad4 100644 --- a/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/networking/c2s/play/InsertItemIntoStaffC2SPacket.kt +++ b/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/networking/c2s/play/InsertItemIntoStaffC2SPacket.kt @@ -38,7 +38,7 @@ internal class InsertItemIntoStaffC2SPacket() : IC2SPacket { companion object : PacketRegistrarAndReceiver( NetworkManager.c2s(), - Identifier(MOD_ID, "add_item"), + Identifier.of(MOD_ID, "add_item"), ::InsertItemIntoStaffC2SPacket ) { override fun receive(packet: InsertItemIntoStaffC2SPacket, context: NetworkManager.PacketContext) { diff --git a/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/networking/c2s/play/RemoveItemFromStaffC2SPacket.kt b/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/networking/c2s/play/RemoveItemFromStaffC2SPacket.kt index caed1e105..546a10423 100644 --- a/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/networking/c2s/play/RemoveItemFromStaffC2SPacket.kt +++ b/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/networking/c2s/play/RemoveItemFromStaffC2SPacket.kt @@ -39,7 +39,7 @@ internal class RemoveItemFromStaffC2SPacket() : IC2SPacket { companion object : PacketRegistrarAndReceiver( NetworkManager.c2s(), - Identifier(MOD_ID, "remove_item"), + Identifier.of(MOD_ID, "remove_item"), ::RemoveItemFromStaffC2SPacket ) { override fun receive(packet: RemoveItemFromStaffC2SPacket, context: NetworkManager.PacketContext) { diff --git a/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/staff/handler/AnvilHandler.kt b/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/staff/handler/AnvilHandler.kt index 76030a771..b64775a20 100644 --- a/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/staff/handler/AnvilHandler.kt +++ b/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/staff/handler/AnvilHandler.kt @@ -30,6 +30,7 @@ import net.minecraft.item.Item import net.minecraft.item.ItemStack import net.minecraft.predicate.entity.EntityPredicates import net.minecraft.util.Hand +import net.minecraft.util.Identifier import net.minecraft.util.math.BlockPos import net.minecraft.util.math.Box import net.minecraft.util.math.Direction @@ -37,10 +38,7 @@ import net.minecraft.world.World import net.minecraft.world.WorldEvents import opekope2.avm_staff.api.staff.StaffHandler import opekope2.avm_staff.mixin.IAnvilBlockAccessor -import opekope2.avm_staff.util.attackDamage -import opekope2.avm_staff.util.equipTime -import opekope2.avm_staff.util.itemStackInStaff -import opekope2.avm_staff.util.mutableItemStackInStaff +import opekope2.avm_staff.util.* import kotlin.math.ceil import kotlin.math.floor @@ -136,7 +134,7 @@ internal class AnvilHandler(private val damagedItem: Item?) : StaffHandler() { .build() private fun anvilModifier() = EntityAttributeModifier( - "Anvil modifier", -1.0, EntityAttributeModifier.Operation.ADD_MULTIPLIED_TOTAL + Identifier.of(MOD_ID, "anvil_modifier"), -1.0, EntityAttributeModifier.Operation.ADD_MULTIPLIED_TOTAL ) } } diff --git a/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/staff/handler/CampfireHandler.kt b/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/staff/handler/CampfireHandler.kt index 6b009a03b..2f6e6da71 100644 --- a/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/staff/handler/CampfireHandler.kt +++ b/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/staff/handler/CampfireHandler.kt @@ -158,7 +158,7 @@ internal class CampfireHandler( data class Properties( val nonFlammableBlockFireChance: Double, val flammableBlockFireChance: Double, - val attackFireSeconds: Int, + val attackFireSeconds: Float, val flameFireTicks: Int, val rocketThrust: Double ) diff --git a/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/staff/handler/FurnaceHandler.kt b/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/staff/handler/FurnaceHandler.kt index 3a8bf8744..064b3c7ef 100644 --- a/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/staff/handler/FurnaceHandler.kt +++ b/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/staff/handler/FurnaceHandler.kt @@ -34,11 +34,11 @@ import net.minecraft.entity.ItemEntity import net.minecraft.entity.LivingEntity import net.minecraft.entity.attribute.EntityAttributes import net.minecraft.entity.player.PlayerEntity -import net.minecraft.inventory.SingleStackInventory import net.minecraft.item.ItemStack import net.minecraft.particle.ParticleTypes import net.minecraft.recipe.AbstractCookingRecipe import net.minecraft.recipe.RecipeType +import net.minecraft.recipe.input.SingleStackRecipeInput import net.minecraft.server.world.ServerWorld import net.minecraft.sound.SoundCategory import net.minecraft.sound.SoundEvent @@ -95,8 +95,8 @@ internal class FurnaceHandler( val stackToSmelt = itemToSmelt?.stack ?: return if (furnaceData.serverBurnTicks < stackToSmelt.count) return - val inventory = ItemEntityInventory(itemToSmelt) - val recipe = world.recipeManager.getFirstMatch(recipeType, inventory, world).getOrNull()?.value ?: return + val recipeInput = SingleStackRecipeInput(itemToSmelt.stack) + val recipe = world.recipeManager.getFirstMatch(recipeType, recipeInput, world).getOrNull()?.value ?: return val resultItem = recipe.getResult(world.registryManager).copyWithCount(stackToSmelt.count) val (vx, vy, vz) = itemToSmelt.velocity @@ -165,18 +165,6 @@ internal class FurnaceHandler( } } - private class ItemEntityInventory(private val itemEntity: ItemEntity) : SingleStackInventory { - override fun getStack(): ItemStack = itemEntity.stack - - override fun setStack(stack: ItemStack?) {} - - override fun markDirty() {} - - override fun canPlayerUse(player: PlayerEntity?) = false - - override fun decreaseStack(count: Int): ItemStack = ItemStack.EMPTY - } - private companion object { private val ITEM_DIMENSIONS = EntityType.ITEM.dimensions private val SMELTING_VOLUME = Box(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5).contract( diff --git a/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/staff/handler/MagmaBlockHandler.kt b/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/staff/handler/MagmaBlockHandler.kt index 593654bae..f77201958 100644 --- a/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/staff/handler/MagmaBlockHandler.kt +++ b/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/staff/handler/MagmaBlockHandler.kt @@ -70,7 +70,7 @@ internal class MagmaBlockHandler : StaffHandler() { target: Entity, hand: Hand ): EventResult { - target.setOnFireFor(8) + target.setOnFireFor(8f) return EventResult.pass() } @@ -80,9 +80,8 @@ internal class MagmaBlockHandler : StaffHandler() { if (shooter is PlayerEntity && shooter.isAttackCoolingDown) return val spawnPos = EntityType.SMALL_FIREBALL.getSpawnPosition(world, shooter.approximateStaffTipPosition) - val (x, y, z) = shooter.rotationVector - world.spawnEntity(SmallFireballEntity(world, shooter, x, y, z).apply { + world.spawnEntity(SmallFireballEntity(world, shooter, shooter.rotationVector).apply { setPosition(spawnPos) }) world.syncWorldEvent(WorldEvents.BLAZE_SHOOTS, shooter.blockPos, 0) diff --git a/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/staff/handler/VanillaStaffHandlers.kt b/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/staff/handler/VanillaStaffHandlers.kt index b5a2c8819..ecf2ab331 100644 --- a/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/staff/handler/VanillaStaffHandlers.kt +++ b/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/staff/handler/VanillaStaffHandlers.kt @@ -52,13 +52,13 @@ fun registerVanillaStaffHandlers() { CAMPFIRE.registerHandler( CampfireHandler( flamethrowerParticleType, - CampfireHandler.Properties(1 / 20.0, 5 / 20.0, 4, 1, 0.1) + CampfireHandler.Properties(1 / 20.0, 5 / 20.0, 4f, 1, 0.1) ) ) SOUL_CAMPFIRE.registerHandler( CampfireHandler( soulFlamethrowerParticleType, - CampfireHandler.Properties(2 / 20.0, 10 / 20.0, 6, 2, 0.12) + CampfireHandler.Properties(2 / 20.0, 10 / 20.0, 6f, 2, 0.12) ) ) diff --git a/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/staff/handler/WitherSkeletonSkullHandler.kt b/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/staff/handler/WitherSkeletonSkullHandler.kt index 604a04338..f37b40b53 100644 --- a/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/staff/handler/WitherSkeletonSkullHandler.kt +++ b/StaffMod/src/main/kotlin/opekope2/avm_staff/internal/staff/handler/WitherSkeletonSkullHandler.kt @@ -77,9 +77,8 @@ internal class WitherSkeletonSkullHandler : StaffHandler() { if (user is PlayerEntity && user.isAttackCoolingDown) return val spawnPos = EntityType.WITHER_SKULL.getSpawnPosition(world, user.approximateStaffTipPosition) ?: return - val (x, y, z) = user.rotationVector - world.spawnEntity(WitherSkullEntity(world, user, x, y, z).apply { + world.spawnEntity(WitherSkullEntity(world, user, user.rotationVector).apply { isCharged = charged setPosition(spawnPos) }) diff --git a/StaffMod/src/main/kotlin/opekope2/avm_staff/util/AttributeUtil.kt b/StaffMod/src/main/kotlin/opekope2/avm_staff/util/AttributeUtil.kt index 33b7d8774..49f54b838 100644 --- a/StaffMod/src/main/kotlin/opekope2/avm_staff/util/AttributeUtil.kt +++ b/StaffMod/src/main/kotlin/opekope2/avm_staff/util/AttributeUtil.kt @@ -22,6 +22,7 @@ package opekope2.avm_staff.util import net.minecraft.entity.attribute.EntityAttributeModifier import net.minecraft.item.Item +import net.minecraft.util.Identifier private const val PLAYER_BASE_ATTACK_DAMAGE = 1.0 private const val PLAYER_BASE_ATTACK_SPEED = 4.0 @@ -33,8 +34,7 @@ private const val PLAYER_BASE_ATTACK_SPEED = 4.0 * @param totalAttackDamage The desired amount of damage in half hearts */ fun attackDamage(totalAttackDamage: Double): EntityAttributeModifier = EntityAttributeModifier( - Item.ATTACK_DAMAGE_MODIFIER_ID, - "Staff modifier", + Item.BASE_ATTACK_DAMAGE_MODIFIER_ID, totalAttackDamage - PLAYER_BASE_ATTACK_DAMAGE, EntityAttributeModifier.Operation.ADD_VALUE ) @@ -46,8 +46,7 @@ fun attackDamage(totalAttackDamage: Double): EntityAttributeModifier = EntityAtt * @param totalAttackSpeed The desired attack speed in attack/second */ fun attackSpeed(totalAttackSpeed: Double): EntityAttributeModifier = EntityAttributeModifier( - Item.ATTACK_SPEED_MODIFIER_ID, - "Staff modifier", + Item.BASE_ATTACK_SPEED_MODIFIER_ID, totalAttackSpeed - PLAYER_BASE_ATTACK_SPEED, EntityAttributeModifier.Operation.ADD_VALUE ) @@ -66,7 +65,7 @@ fun equipTime(totalEquipTime: Double): EntityAttributeModifier = attackSpeed(1.0 * @param additionalRange The number of blocks to add to the interaction range */ fun interactionRange(additionalRange: Double) = EntityAttributeModifier( - "Staff modifier", + Identifier.of(MOD_ID, "staff_modifier"), additionalRange, EntityAttributeModifier.Operation.ADD_VALUE ) diff --git a/StaffMod/src/main/resources/data/avm_staff/loot_tables/add_loot_pool/chests/bastion_treasure.json b/StaffMod/src/main/resources/data/avm_staff/loot_table/add_loot_pool/chests/bastion_treasure.json similarity index 100% rename from StaffMod/src/main/resources/data/avm_staff/loot_tables/add_loot_pool/chests/bastion_treasure.json rename to StaffMod/src/main/resources/data/avm_staff/loot_table/add_loot_pool/chests/bastion_treasure.json diff --git a/StaffMod/src/main/resources/data/avm_staff/loot_tables/add_loot_pool/chests/trial_chambers/reward_unique.json b/StaffMod/src/main/resources/data/avm_staff/loot_table/add_loot_pool/chests/trial_chambers/reward_unique.json similarity index 100% rename from StaffMod/src/main/resources/data/avm_staff/loot_tables/add_loot_pool/chests/trial_chambers/reward_unique.json rename to StaffMod/src/main/resources/data/avm_staff/loot_table/add_loot_pool/chests/trial_chambers/reward_unique.json diff --git a/StaffMod/src/main/resources/data/avm_staff/loot_tables/blocks/crown_of_king_orange.json b/StaffMod/src/main/resources/data/avm_staff/loot_table/blocks/crown_of_king_orange.json similarity index 100% rename from StaffMod/src/main/resources/data/avm_staff/loot_tables/blocks/crown_of_king_orange.json rename to StaffMod/src/main/resources/data/avm_staff/loot_table/blocks/crown_of_king_orange.json diff --git a/StaffMod/src/main/resources/data/avm_staff/loot_tables/blocks/wall_crown_of_king_orange.json b/StaffMod/src/main/resources/data/avm_staff/loot_table/blocks/wall_crown_of_king_orange.json similarity index 100% rename from StaffMod/src/main/resources/data/avm_staff/loot_tables/blocks/wall_crown_of_king_orange.json rename to StaffMod/src/main/resources/data/avm_staff/loot_table/blocks/wall_crown_of_king_orange.json diff --git a/StaffMod/src/main/resources/data/avm_staff/recipes/faint_royal_staff.json b/StaffMod/src/main/resources/data/avm_staff/recipe/faint_royal_staff.json similarity index 100% rename from StaffMod/src/main/resources/data/avm_staff/recipes/faint_royal_staff.json rename to StaffMod/src/main/resources/data/avm_staff/recipe/faint_royal_staff.json diff --git a/StaffMod/src/main/resources/data/avm_staff/recipes/faint_royal_staff_head.json b/StaffMod/src/main/resources/data/avm_staff/recipe/faint_royal_staff_head.json similarity index 100% rename from StaffMod/src/main/resources/data/avm_staff/recipes/faint_royal_staff_head.json rename to StaffMod/src/main/resources/data/avm_staff/recipe/faint_royal_staff_head.json diff --git a/StaffMod/src/main/resources/data/avm_staff/recipes/faint_staff_rod.json b/StaffMod/src/main/resources/data/avm_staff/recipe/faint_staff_rod.json similarity index 100% rename from StaffMod/src/main/resources/data/avm_staff/recipes/faint_staff_rod.json rename to StaffMod/src/main/resources/data/avm_staff/recipe/faint_staff_rod.json diff --git a/StaffMod/src/main/resources/data/avm_staff/recipes/royal_staff_ingredient.json b/StaffMod/src/main/resources/data/avm_staff/recipe/royal_staff_ingredient.json similarity index 100% rename from StaffMod/src/main/resources/data/avm_staff/recipes/royal_staff_ingredient.json rename to StaffMod/src/main/resources/data/avm_staff/recipe/royal_staff_ingredient.json diff --git a/StaffMod/src/main/resources/data/avm_staff/recipes/royal_staff_smithing.json b/StaffMod/src/main/resources/data/avm_staff/recipe/royal_staff_smithing.json similarity index 100% rename from StaffMod/src/main/resources/data/avm_staff/recipes/royal_staff_smithing.json rename to StaffMod/src/main/resources/data/avm_staff/recipe/royal_staff_smithing.json diff --git a/StaffMod/src/main/resources/data/avm_staff/recipes/staff_infusion_smithing_template.json b/StaffMod/src/main/resources/data/avm_staff/recipe/staff_infusion_smithing_template.json similarity index 100% rename from StaffMod/src/main/resources/data/avm_staff/recipes/staff_infusion_smithing_template.json rename to StaffMod/src/main/resources/data/avm_staff/recipe/staff_infusion_smithing_template.json diff --git a/StaffMod/src/main/resources/data/minecraft/advancements/recipes/avm_staff/faint_royal_staff.json b/StaffMod/src/main/resources/data/minecraft/advancement/recipes/avm_staff/faint_royal_staff.json similarity index 100% rename from StaffMod/src/main/resources/data/minecraft/advancements/recipes/avm_staff/faint_royal_staff.json rename to StaffMod/src/main/resources/data/minecraft/advancement/recipes/avm_staff/faint_royal_staff.json diff --git a/StaffMod/src/main/resources/data/minecraft/advancements/recipes/avm_staff/faint_royal_staff_head.json b/StaffMod/src/main/resources/data/minecraft/advancement/recipes/avm_staff/faint_royal_staff_head.json similarity index 100% rename from StaffMod/src/main/resources/data/minecraft/advancements/recipes/avm_staff/faint_royal_staff_head.json rename to StaffMod/src/main/resources/data/minecraft/advancement/recipes/avm_staff/faint_royal_staff_head.json diff --git a/StaffMod/src/main/resources/data/minecraft/advancements/recipes/avm_staff/faint_staff_rod.json b/StaffMod/src/main/resources/data/minecraft/advancement/recipes/avm_staff/faint_staff_rod.json similarity index 100% rename from StaffMod/src/main/resources/data/minecraft/advancements/recipes/avm_staff/faint_staff_rod.json rename to StaffMod/src/main/resources/data/minecraft/advancement/recipes/avm_staff/faint_staff_rod.json diff --git a/StaffMod/src/main/resources/data/minecraft/advancements/recipes/avm_staff/royal_staff_ingredient.json b/StaffMod/src/main/resources/data/minecraft/advancement/recipes/avm_staff/royal_staff_ingredient.json similarity index 100% rename from StaffMod/src/main/resources/data/minecraft/advancements/recipes/avm_staff/royal_staff_ingredient.json rename to StaffMod/src/main/resources/data/minecraft/advancement/recipes/avm_staff/royal_staff_ingredient.json diff --git a/StaffMod/src/main/resources/data/minecraft/advancements/recipes/avm_staff/royal_staff_smithing.json b/StaffMod/src/main/resources/data/minecraft/advancement/recipes/avm_staff/royal_staff_smithing.json similarity index 100% rename from StaffMod/src/main/resources/data/minecraft/advancements/recipes/avm_staff/royal_staff_smithing.json rename to StaffMod/src/main/resources/data/minecraft/advancement/recipes/avm_staff/royal_staff_smithing.json diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts deleted file mode 100644 index 876c922b2..000000000 --- a/buildSrc/build.gradle.kts +++ /dev/null @@ -1,7 +0,0 @@ -plugins { - `kotlin-dsl` -} - -repositories { - mavenCentral() -} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index aa725f69d..9340d3cea 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,26 +1,26 @@ [versions] java = "21" # Don't forget to update *.mixins.json -kotlin = "1.9.23" -staff-mod = "0.17.0" +kotlin = "2.0.0" +staff-mod = "0.17.1" architectury-plugin = "3.4-SNAPSHOT" -architectury-loom = "1.6-SNAPSHOT" -yarn = "1.20.6+build.2" +architectury-loom = "1.7-SNAPSHOT" +yarn = "1.21+build.9" shadow = "8.1.1" -minecraft = "1.20.6" -architectury-api = "12.1.2" +minecraft = "1.21" +architectury-api = "13.0.6" fabric-loader = "0.15.11" #forge = "1.20.4-49.0.27" -neoforge = "20.6.72-beta" -fabric-api = "0.99.0+1.20.6" -fabric-language-kotlin = "1.10.19+kotlin.1.9.23" -kotlinforforge = "5.1.0" -mixin-extras = "0.3.6" +neoforge = "21.0.164" +fabric-api = "0.102.0+1.21" +fabric-language-kotlin = "1.11.0+kotlin.2.0.0" +kotlinforforge = "5.4.0" +mixin-extras = "0.4.0" dokka = "1.9.20" [libraries] minecraft = { group = "com.mojang", name = "minecraft", version.ref = "minecraft" } yarn = { group = "net.fabricmc", name = "yarn", version.ref = "yarn" } -yarn-patch-neoforge = { group = "dev.architectury", name = "yarn-mappings-patch-neoforge", version.require = "1.20.5+build.3" } # FIXME +yarn-patch-neoforge = { group = "dev.architectury", name = "yarn-mappings-patch-neoforge", version.require = "1.21+build.4" } # FIXME kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin" } architectury = { group = "dev.architectury", name = "architectury", version.ref = "architectury-api" } architectury-fabric = { group = "dev.architectury", name = "architectury-fabric", version.ref = "architectury-api" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e6441136f..2c3521197 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b82aa23a4..09523c0e5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 1aa94a426..f5feea6d6 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -84,7 +86,8 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum diff --git a/gradlew.bat b/gradlew.bat index 25da30dbd..9d21a2183 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ##########################################################################