From 8b262d07c09146d253dbb8f5098e8bc4e3d5b945 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Sun, 30 May 2021 19:08:11 +0800 Subject: [PATCH] Refactor and 1.17-pre1 (#96) * Fix #94 Signed-off-by: shedaniel * Add Chunk data save and load events, closes #89 (#92) * Created Chunk save and load event. Closes #89 * Fixed missing licence * Update common/src/main/java/me/shedaniel/architectury/event/events/ChunkEvent.java * Update common/src/main/java/me/shedaniel/architectury/event/events/ChunkEvent.java * Update common/src/main/java/me/shedaniel/architectury/event/events/ChunkEvent.java * Supply ServerLevel in ChunkEvent.LOAD, style cleanup Signed-off-by: shedaniel * Add "Data" suffix to Chunk IO Events and mark level as nullable for load * Update common/src/main/java/me/shedaniel/architectury/event/events/ChunkEvent.java * Bump to 1.16 Co-authored-by: shedaniel Co-authored-by: Max * Update pr.yml * Add NetworkManager hook for Entity spawn packets (#88) * New utility hook for creating a entity spawn packet. before every mod had to implement this in itself. * Apply suggestions from code review Co-authored-by: shedaniel * Update common/src/main/java/me/shedaniel/architectury/networking/NetworkManager.java * Update common/src/main/java/me/shedaniel/architectury/networking/NetworkManager.java * Properly implement SpawnEntityPacket & Format style Signed-off-by: shedaniel * Format Signed-off-by: shedaniel * createEntitySpawnPacket -> createAddEntityPacket for mojmap consistency Signed-off-by: shedaniel * Bump version to 1.17 Co-authored-by: Max Co-authored-by: shedaniel * Add Javadocs for all events (#91) * javadoc for ClientChatEvent * javadoc for ClientPlayerEvent * javadoc for ClientRawInputEvent * Added javadoc for ClientScreenInputEvent * Bit refactoring and removed javadoc @see to the caller methods * Add javadoc for BlockEvent * Add javadoc for ChatEvent * Add javadoc for CommandPerformEvent and CommandRegistrationEvent * Add javadoc for EntityEvent * Add javadoc for ExplosionEvent * Add javadoc for GuiEvent * Add javadoc for InteractionEvent * Add javadoc for LightningEvent, RecipeUpdateEvent & TextureStitchEvent * Add javadoc for LifecycleEvent & ClientLifecycleEvent * Add javadoc for TooltipEvent * Add javadoc for TickEvent and partly PlayerEvent * More javadoc for PlayerEvent * Finally all event have javadoc * Update common/src/main/java/me/shedaniel/architectury/event/events/CommandPerformEvent.java Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com> * Update common/src/main/java/me/shedaniel/architectury/event/events/CommandPerformEvent.java Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com> * Update common/src/main/java/me/shedaniel/architectury/event/events/CommandPerformEvent.java Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com> * Update common/src/main/java/me/shedaniel/architectury/event/events/ChatEvent.java Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com> * Update common/src/main/java/me/shedaniel/architectury/event/events/CommandRegistrationEvent.java Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com> * Update common/src/main/java/me/shedaniel/architectury/event/events/EntityEvent.java Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com> * Update common/src/main/java/me/shedaniel/architectury/event/events/EntityEvent.java Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com> * Update common/src/main/java/me/shedaniel/architectury/event/events/EntityEvent.java Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com> * Update common/src/main/java/me/shedaniel/architectury/event/events/EntityEvent.java Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com> * Update common/src/main/java/me/shedaniel/architectury/event/events/client/ClientScreenInputEvent.java Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com> * Update common/src/main/java/me/shedaniel/architectury/event/events/client/ClientScreenInputEvent.java Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com> * Update common/src/main/java/me/shedaniel/architectury/event/events/BlockEvent.java Co-authored-by: Max * Update common/src/main/java/me/shedaniel/architectury/event/events/BlockEvent.java Co-authored-by: Max * Update common/src/main/java/me/shedaniel/architectury/event/events/BlockEvent.java Co-authored-by: Max * Update common/src/main/java/me/shedaniel/architectury/event/events/BlockEvent.java Co-authored-by: Max * Update common/src/main/java/me/shedaniel/architectury/event/events/LifecycleEvent.java Co-authored-by: Max * Update common/src/main/java/me/shedaniel/architectury/event/events/LifecycleEvent.java Co-authored-by: Max * Update common/src/main/java/me/shedaniel/architectury/event/events/LifecycleEvent.java Co-authored-by: Max * Update common/src/main/java/me/shedaniel/architectury/event/events/PlayerEvent.java Co-authored-by: Max * Apply suggestions from code review Co-authored-by: Max Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com> Co-authored-by: Max * Apply suggestions from code review Co-authored-by: Max Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Max Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Max Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com> * Apply suggestions from code review * Apply suggestions from code review Co-authored-by: shedaniel * Applied some more reviews * Applied some more reviews * Applied suggestions * Reformat and apply some minor suggestions * Apply suggestions from review (first batch) * Remove double return javadoc * Apply suggestions from code review Co-authored-by: shedaniel * Add "scaled" to mouse coordinates * Final touches Signed-off-by: shedaniel * Remove invalid tips Signed-off-by: shedaniel Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com> Co-authored-by: Max Co-authored-by: shedaniel * Refactor Signed-off-by: shedaniel * Update common/src/main/java/dev/architectury/event/events/common/InteractionEvent.java Co-authored-by: Max * Apply suggestions from code review Co-authored-by: Max * attack -> hurt Signed-off-by: shedaniel * Update @param for InteractionEvent#FARMLAND_TRAMPLE Signed-off-by: shedaniel * world -> level Signed-off-by: shedaniel * Relocate hooks Signed-off-by: shedaniel * Organize imports Signed-off-by: shedaniel * Registry -> Registrar Please voice out your opinion!! Signed-off-by: shedaniel * Some more renames itemOptional -> optionalItem RegistryBuilder -> RegistrarBuilder RegistryOption -> RegistrarOption Not forcing RegistryEntry on new registries, vanilla types don't have them Signed-off-by: shedaniel * Java 16-ification Signed-off-by: shedaniel * Optimise imports after the var change Signed-off-by: shedaniel * Un-minimize architectury-common.mixins.json Signed-off-by: shedaniel Co-authored-by: canitzp <12819060+canitzp@users.noreply.github.com> Co-authored-by: Max Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com> --- .github/workflows/dev_pr.yml | 2 +- build.gradle | 4 +- .../architectury/annotations}/ForgeEvent.java | 2 +- .../annotations}/ForgeEventCancellable.java | 2 +- .../core/AbstractRecipeSerializer.java | 2 +- .../architectury/core/RegistryEntry.java | 2 +- .../event/CompoundEventResult.java | 47 ++- .../architectury/event/Event.java | 2 +- .../architectury/event/EventActor.java | 2 +- .../architectury/event/EventFactory.java | 121 +----- .../architectury/event/EventHandler.java | 11 +- .../architectury/event/EventResult.java | 55 ++- .../event/events/client/ClientChatEvent.java | 72 ++++ .../event/events/client/ClientGuiEvent.java | 160 ++++++++ .../events/client/ClientLifecycleEvent.java | 20 +- .../events/client/ClientPlayerEvent.java | 31 +- .../events/client/ClientRawInputEvent.java | 88 +++++ .../client/ClientRecipeUpdateEvent.java} | 19 +- .../events/client/ClientScreenInputEvent.java | 201 ++++++++++ .../client/ClientTextureStitchEvent.java} | 27 +- .../event/events/client/ClientTickEvent.java | 13 +- .../events/client/ClientTooltipEvent.java | 160 ++++++++ .../event/events/common/BlockEvent.java | 89 +++++ .../event/events/common}/ChatEvent.java | 29 +- .../event/events/common/ChunkEvent.java | 64 ++++ .../events/common}/CommandPerformEvent.java | 38 +- .../common}/CommandRegistrationEvent.java | 15 +- .../event/events/common/EntityEvent.java | 133 +++++++ .../event/events/common/ExplosionEvent.java | 65 ++++ .../event/events/common/InteractionEvent.java | 161 ++++++++ .../event/events/common/LifecycleEvent.java | 115 ++++++ .../event/events/common}/LightningEvent.java | 22 +- .../event/events/common/PlayerEvent.java | 265 +++++++++++++ .../event/events/common/TickEvent.java | 90 +++++ .../extensions/BlockEntityExtension.java | 4 +- .../extensions/ItemExtension.java | 2 +- .../architectury/fluid/FluidStack.java | 10 +- .../architectury/hooks/DyeColorHooks.java | 4 +- .../hooks/LevelResourceHooks.java | 2 +- .../hooks/PackRepositoryHooks.java | 4 +- .../hooks/block}/BlockEntityHooks.java | 4 +- .../hooks/client}/screen/ScreenAccess.java | 2 +- .../hooks/client}/screen/ScreenHooks.java | 4 +- .../hooks/fluid}/FluidStackHooks.java | 6 +- .../hooks/item}/ItemStackHooks.java | 11 +- .../hooks/level}/ExplosionHooks.java | 4 +- .../hooks/level}/biome/BiomeHooks.java | 2 +- .../hooks/level}/biome/BiomeProperties.java | 2 +- .../hooks/level}/biome/ClimateProperties.java | 2 +- .../hooks/level}/biome/EffectsProperties.java | 2 +- .../level}/biome/GenerationProperties.java | 2 +- .../hooks/level}/biome/SpawnProperties.java | 2 +- .../hooks/level/entity}/EntityHooks.java | 4 +- .../hooks/level/entity}/ItemEntityHooks.java | 6 +- .../hooks/level/entity}/PlayerHooks.java | 4 +- .../architectury/hooks/tags}/TagHooks.java | 24 +- .../architectury/impl/ScreenAccessImpl.java | 6 +- .../impl/TooltipEventColorContextImpl.java | 6 +- .../impl/TooltipEventPositionContextImpl.java | 6 +- .../architectury/impl/package-info.java} | 10 +- .../architectury/mixin/FluidTagsAccessor.java | 2 +- .../mixin/MixinFallingBlockEntity.java | 9 +- .../mixin/MixinLightningBolt.java | 6 +- .../networking/NetworkChannel.java | 44 +-- .../networking/NetworkManager.java | 25 +- .../architectury/platform/Mod.java | 2 +- .../architectury/platform/Platform.java | 36 +- .../registry/CreativeTabRegistry.java} | 8 +- .../registry/ReloadListenerRegistry.java} | 10 +- .../registry/block}/BlockProperties.java | 4 +- .../block}/BlockPropertiesExtension.java | 2 +- .../registry/block}/ToolType.java | 4 +- .../keymappings/KeyMappingRegistry.java} | 10 +- .../BlockEntityRendererRegistry.java} | 14 +- .../rendering/ColorHandlerRegistry.java} | 16 +- .../client/rendering/RenderTypeRegistry.java} | 8 +- .../registry/fuel/FuelRegistry.java | 4 +- .../registry/level}/GameRuleFactory.java | 4 +- .../registry/level}/GameRuleRegistry.java | 4 +- .../CriteriaTriggersRegistry.java | 4 +- .../level/biome}/BiomeModifications.java | 6 +- .../entity/EntityAttributeRegistry.java} | 8 +- .../level/entity/EntityRendererRegistry.java} | 14 +- .../level/entity}/trade/SimpleTrade.java | 21 +- .../level/entity}/trade/TradeRegistry.java | 4 +- .../registry/menu/ExtendedMenuProvider.java | 2 +- .../registry/menu}/MenuRegistry.java | 5 +- .../registries}/DeferredRegister.java | 24 +- .../registry/registries/Registrar.java} | 19 +- .../registries/RegistrarBuilder.java} | 20 +- .../registry/registries}/Registries.java | 25 +- .../registries}/RegistrySupplier.java | 2 +- .../registries/options/RegistrarOption.java} | 4 +- .../options/StandardRegistrarOption.java} | 4 +- .../architectury/utils/Env.java | 2 +- .../architectury/utils/EnvExecutor.java | 4 +- .../architectury/utils/GameInstance.java | 4 +- .../architectury/utils/NbtType.java | 2 +- .../utils/PlatformExpectedError.java | 2 +- .../utils/value}/BooleanValue.java | 2 +- .../utils/value}/DoubleValue.java | 2 +- .../utils/value}/FloatSupplier.java | 2 +- .../architectury/utils/value}/FloatValue.java | 2 +- .../architectury/utils/value}/IntValue.java | 2 +- .../architectury/utils/value}/LongValue.java | 2 +- .../architectury/utils/value}/Value.java | 2 +- .../shedaniel/architectury/Architectury.java | 32 -- .../architectury/PlatformMethods.java | 55 --- .../architectury/event/events/BlockEvent.java | 63 ---- .../event/events/EntityEvent.java | 80 ---- .../architectury/event/events/GuiEvent.java | 94 ----- .../event/events/InteractionEvent.java | 79 ---- .../event/events/LifecycleEvent.java | 75 ---- .../event/events/PlayerEvent.java | 120 ------ .../architectury/event/events/TickEvent.java | 49 --- .../event/events/TooltipEvent.java | 100 ----- .../event/events/client/ClientChatEvent.java | 53 --- .../events/client/ClientRawInputEvent.java | 59 --- .../events/client/ClientScreenInputEvent.java | 74 ---- .../resources/architectury-common.mixins.json | 4 +- .../compat/fabric/ModMenuCompatibility.java | 11 +- .../event/fabric/EventFactoryImpl.java | 15 +- .../event/fabric/EventHandlerImpl.java | 35 +- .../block}/fabric/BlockEntityHooksImpl.java | 5 +- .../screen/fabric/ScreenHooksImpl.java | 2 +- .../hooks/fabric/DyeColorHooksImpl.java | 4 +- .../hooks/fabric/PackRepositoryHooksImpl.java | 2 +- .../PersistentEntitySectionManagerHooks.java | 2 +- .../fluid}/fabric/FluidStackHooksImpl.java | 49 ++- .../level/entity}/fabric/EntityHooksImpl.java | 6 +- .../entity}/fabric/ItemEntityHooksImpl.java | 4 +- .../level/entity}/fabric/PlayerHooksImpl.java | 2 +- .../level}/fabric/ExplosionHooksImpl.java | 2 +- .../hooks/tags}/fabric/TagHooksImpl.java | 4 +- .../impl/fabric/ChatComponentImpl.java | 4 +- .../impl/fabric/ScreenInputDelegate.java | 13 +- .../init/fabric/ArchitecturyClient.java | 7 +- .../mixin/fabric/ExplosionPreInvoker.java | 7 +- .../mixin/fabric/LivingDeathInvoker.java | 7 +- .../mixin/fabric/MixinBaseSpawner.java | 7 +- .../fabric/MixinBlockEntityExtension.java | 6 +- .../mixin/fabric/MixinBlockItem.java | 10 +- .../mixin/fabric/MixinBucketItem.java | 8 +- .../mixin/fabric/MixinCatSpawner.java | 4 +- .../mixin/fabric/MixinChunkMap.java | 51 +++ .../mixin/fabric/MixinChunkSerializer.java | 49 +++ .../mixin/fabric/MixinCommands.java | 14 +- .../mixin/fabric/MixinDedicatedServer.java | 4 +- .../mixin/fabric/MixinEntity.java | 5 +- .../mixin/fabric/MixinExplosion.java | 6 +- .../mixin/fabric/MixinFarmBlock.java | 6 +- .../mixin/fabric/MixinFurnaceResultSlot.java | 4 +- .../mixin/fabric/MixinInventory.java | 12 +- .../mixin/fabric/MixinItemEntity.java | 9 +- .../mixin/fabric/MixinLivingEntity.java | 16 +- .../mixin/fabric/MixinNaturalSpawner.java | 9 +- .../mixin/fabric/MixinPatrolSpawner.java | 7 +- .../MixinPersistentEntitySectionManager.java | 15 +- .../mixin/fabric/MixinPhantomSpawner.java | 4 +- .../mixin/fabric/MixinPlayer.java | 16 +- .../mixin/fabric/MixinPlayerAdvancements.java | 4 +- .../mixin/fabric/MixinPlayerList.java | 4 +- .../mixin/fabric/MixinResultSlot.java | 4 +- .../MixinServerGamePacketListenerImpl.java | 19 +- .../mixin/fabric/MixinServerLevel.java | 14 +- .../mixin/fabric/MixinServerPlayer.java | 4 +- .../fabric/MixinServerPlayerGameMode.java | 13 +- .../mixin/fabric/PlayerAttackInvoker.java | 7 +- .../mixin/fabric/client/MixinClientLevel.java | 11 +- .../client/MixinClientPacketListener.java | 21 +- .../client/MixinDebugScreenOverlay.java | 8 +- .../fabric/client/MixinEffectInstance.java | 2 +- .../fabric/client/MixinGameRenderer.java | 9 +- .../fabric/client/MixinIntegratedServer.java | 4 +- .../fabric/client/MixinKeyboardHandler.java | 39 +- .../mixin/fabric/client/MixinMinecraft.java | 29 +- .../fabric/client/MixinMouseHandler.java | 50 ++- .../client/MixinMultiPlayerGameMode.java | 10 +- .../mixin/fabric/client/MixinScreen.java | 46 +-- .../fabric/client/MixinTextureAtlas.java | 8 +- .../networking/fabric/NetworkManagerImpl.java | 13 +- .../networking/fabric/SpawnEntityPacket.java | 102 +++++ .../platform/fabric/PlatformImpl.java | 8 +- .../fabric/ArchitecturyMixinPlugin.java | 11 +- .../block}/fabric/BlockPropertiesImpl.java | 12 +- .../registry/block}/fabric/ToolTypeImpl.java | 2 +- .../fabric/KeyMappingRegistryImpl.java} | 8 +- .../BlockEntityRendererRegistryImpl.java} | 6 +- .../fabric/ColorHandlerRegistryImpl.java} | 12 +- .../fabric/RenderTypeRegistryImpl.java} | 4 +- .../fabric/CreativeTabRegistryImpl.java} | 4 +- .../fabric/ReloadListenerRegistryImpl.java} | 10 +- .../fuel/fabric/FuelRegistryImpl.java | 6 +- .../fabric/CriteriaTriggersRegistryImpl.java | 2 +- .../biome}/fabric/BiomeModificationsImpl.java | 14 +- .../fabric/EntityAttributeRegistryImpl.java} | 4 +- .../fabric/EntityRendererRegistryImpl.java} | 10 +- .../trade/fabric/TradeRegistryImpl.java | 2 +- .../level}/fabric/GameRuleFactoryImpl.java | 2 +- .../level}/fabric/GameRuleRegistryImpl.java | 2 +- .../menu}/fabric/MenuRegistryImpl.java | 10 +- .../registries}/fabric/RegistriesImpl.java | 65 ++-- .../utils/fabric/GameInstanceImpl.java | 10 +- .../main/resources/architectury.mixins.json | 110 +++--- fabric/src/main/resources/fabric.mod.json | 6 +- .../event/forge/EventHandlerImplClient.java | 2 - .../event/forge/EventHandlerImplCommon.java | 25 +- .../mixin/forge/MixinChunkSerializer.java | 65 ++++ .../mixin/forge/MixinClientLevel.java | 57 +++ .../mixin/forge/MixinWorldEvent.java | 32 +- .../networking/forge/NetworkManagerImpl.java | 6 + .../forge/BiomeModificationsImpl.java | 1 - .../main/resources/architectury.mixins.json | 3 + gradle.properties | 8 +- .../architectury/test/TestMod.java | 41 ++- .../test/debug/ConsoleMessageSink.java | 2 +- .../architectury/test/debug/MessageSink.java | 2 +- .../client/ClientOverlayMessageSink.java | 37 +- .../architectury/test/entity/TestEntity.java | 45 +++ .../architectury/test/events/DebugEvents.java | 347 ++++++++++++++++++ .../test/gamerule/TestGameRules.java | 6 +- .../test/registry/TestRegistries.java | 24 +- .../test/registry/client/TestKeybinds.java | 12 +- .../objects/EquippableTickingItem.java | 6 +- .../test/tab/TestCreativeTabs.java | 10 +- .../architectury/test/tags/TestTags.java | 16 +- .../architectury/test/trade/TestTrades.java | 10 +- .../architectury/test/events/DebugEvents.java | 337 ----------------- .../src/main/resources/fabric.mod.json | 2 +- 229 files changed, 3529 insertions(+), 2354 deletions(-) rename common/src/main/java/{me/shedaniel/architectury => dev/architectury/annotations}/ForgeEvent.java (96%) rename common/src/main/java/{me/shedaniel/architectury => dev/architectury/annotations}/ForgeEventCancellable.java (96%) rename common/src/main/java/{me/shedaniel => dev}/architectury/core/AbstractRecipeSerializer.java (96%) rename common/src/main/java/{me/shedaniel => dev}/architectury/core/RegistryEntry.java (95%) rename common/src/main/java/{me/shedaniel => dev}/architectury/event/CompoundEventResult.java (82%) rename common/src/main/java/{me/shedaniel => dev}/architectury/event/Event.java (96%) rename common/src/main/java/{me/shedaniel => dev}/architectury/event/EventActor.java (95%) rename common/src/main/java/{me/shedaniel => dev}/architectury/event/EventFactory.java (63%) rename common/src/main/java/{me/shedaniel => dev}/architectury/event/EventHandler.java (82%) rename common/src/main/java/{me/shedaniel => dev}/architectury/event/EventResult.java (71%) create mode 100644 common/src/main/java/dev/architectury/event/events/client/ClientChatEvent.java create mode 100644 common/src/main/java/dev/architectury/event/events/client/ClientGuiEvent.java rename common/src/main/java/{me/shedaniel => dev}/architectury/event/events/client/ClientLifecycleEvent.java (71%) rename common/src/main/java/{me/shedaniel => dev}/architectury/event/events/client/ClientPlayerEvent.java (65%) create mode 100644 common/src/main/java/dev/architectury/event/events/client/ClientRawInputEvent.java rename common/src/main/java/{me/shedaniel/architectury/event/events/RecipeUpdateEvent.java => dev/architectury/event/events/client/ClientRecipeUpdateEvent.java} (65%) create mode 100644 common/src/main/java/dev/architectury/event/events/client/ClientScreenInputEvent.java rename common/src/main/java/{me/shedaniel/architectury/event/events/TextureStitchEvent.java => dev/architectury/event/events/client/ClientTextureStitchEvent.java} (63%) rename common/src/main/java/{me/shedaniel => dev}/architectury/event/events/client/ClientTickEvent.java (76%) create mode 100644 common/src/main/java/dev/architectury/event/events/client/ClientTooltipEvent.java create mode 100644 common/src/main/java/dev/architectury/event/events/common/BlockEvent.java rename common/src/main/java/{me/shedaniel/architectury/event/events => dev/architectury/event/events/common}/ChatEvent.java (57%) create mode 100644 common/src/main/java/dev/architectury/event/events/common/ChunkEvent.java rename common/src/main/java/{me/shedaniel/architectury/event/events => dev/architectury/event/events/common}/CommandPerformEvent.java (59%) rename common/src/main/java/{me/shedaniel/architectury/event/events => dev/architectury/event/events/common}/CommandRegistrationEvent.java (68%) create mode 100644 common/src/main/java/dev/architectury/event/events/common/EntityEvent.java create mode 100644 common/src/main/java/dev/architectury/event/events/common/ExplosionEvent.java create mode 100644 common/src/main/java/dev/architectury/event/events/common/InteractionEvent.java create mode 100644 common/src/main/java/dev/architectury/event/events/common/LifecycleEvent.java rename common/src/main/java/{me/shedaniel/architectury/event/events => dev/architectury/event/events/common}/LightningEvent.java (63%) create mode 100644 common/src/main/java/dev/architectury/event/events/common/PlayerEvent.java create mode 100644 common/src/main/java/dev/architectury/event/events/common/TickEvent.java rename common/src/main/java/{me/shedaniel => dev}/architectury/extensions/BlockEntityExtension.java (94%) rename common/src/main/java/{me/shedaniel => dev}/architectury/extensions/ItemExtension.java (97%) rename common/src/main/java/{me/shedaniel => dev}/architectury/fluid/FluidStack.java (96%) rename common/src/main/java/{me/shedaniel => dev}/architectury/hooks/DyeColorHooks.java (91%) rename common/src/main/java/{me/shedaniel => dev}/architectury/hooks/LevelResourceHooks.java (96%) rename common/src/main/java/{me/shedaniel => dev}/architectury/hooks/PackRepositoryHooks.java (92%) rename common/src/main/java/{me/shedaniel/architectury/hooks => dev/architectury/hooks/block}/BlockEntityHooks.java (91%) rename common/src/main/java/{me/shedaniel/architectury/hooks => dev/architectury/hooks/client}/screen/ScreenAccess.java (96%) rename common/src/main/java/{me/shedaniel/architectury/hooks => dev/architectury/hooks/client}/screen/ScreenHooks.java (95%) rename common/src/main/java/{me/shedaniel/architectury/hooks => dev/architectury/hooks/fluid}/FluidStackHooks.java (96%) rename common/src/main/java/{me/shedaniel/architectury/hooks => dev/architectury/hooks/item}/ItemStackHooks.java (86%) rename common/src/main/java/{me/shedaniel/architectury/hooks => dev/architectury/hooks/level}/ExplosionHooks.java (94%) rename common/src/main/java/{me/shedaniel/architectury/hooks => dev/architectury/hooks/level}/biome/BiomeHooks.java (99%) rename common/src/main/java/{me/shedaniel/architectury/hooks => dev/architectury/hooks/level}/biome/BiomeProperties.java (97%) rename common/src/main/java/{me/shedaniel/architectury/hooks => dev/architectury/hooks/level}/biome/ClimateProperties.java (96%) rename common/src/main/java/{me/shedaniel/architectury/hooks => dev/architectury/hooks/level}/biome/EffectsProperties.java (98%) rename common/src/main/java/{me/shedaniel/architectury/hooks => dev/architectury/hooks/level}/biome/GenerationProperties.java (98%) rename common/src/main/java/{me/shedaniel/architectury/hooks => dev/architectury/hooks/level}/biome/SpawnProperties.java (97%) rename common/src/main/java/{me/shedaniel/architectury/hooks => dev/architectury/hooks/level/entity}/EntityHooks.java (92%) rename common/src/main/java/{me/shedaniel/architectury/hooks => dev/architectury/hooks/level/entity}/ItemEntityHooks.java (89%) rename common/src/main/java/{me/shedaniel/architectury/hooks => dev/architectury/hooks/level/entity}/PlayerHooks.java (91%) rename common/src/main/java/{me/shedaniel/architectury/hooks => dev/architectury/hooks/tags}/TagHooks.java (61%) rename common/src/main/java/{me/shedaniel => dev}/architectury/impl/ScreenAccessImpl.java (93%) rename common/src/main/java/{me/shedaniel => dev}/architectury/impl/TooltipEventColorContextImpl.java (91%) rename common/src/main/java/{me/shedaniel => dev}/architectury/impl/TooltipEventPositionContextImpl.java (88%) rename common/src/main/java/{me/shedaniel/architectury/event/Actor.java => dev/architectury/impl/package-info.java} (82%) rename common/src/main/java/{me/shedaniel => dev}/architectury/mixin/FluidTagsAccessor.java (96%) rename common/src/main/java/{me/shedaniel => dev}/architectury/mixin/MixinFallingBlockEntity.java (78%) rename common/src/main/java/{me/shedaniel => dev}/architectury/mixin/MixinLightningBolt.java (92%) rename common/src/main/java/{me/shedaniel => dev}/architectury/networking/NetworkChannel.java (71%) rename common/src/main/java/{me/shedaniel => dev}/architectury/networking/NetworkManager.java (80%) rename common/src/main/java/{me/shedaniel => dev}/architectury/platform/Mod.java (97%) rename common/src/main/java/{me/shedaniel => dev}/architectury/platform/Platform.java (75%) rename common/src/main/java/{me/shedaniel/architectury/registry/CreativeTabs.java => dev/architectury/registry/CreativeTabRegistry.java} (87%) rename common/src/main/java/{me/shedaniel/architectury/registry/ReloadListeners.java => dev/architectury/registry/ReloadListenerRegistry.java} (78%) rename common/src/main/java/{me/shedaniel/architectury/registry => dev/architectury/registry/block}/BlockProperties.java (95%) rename common/src/main/java/{me/shedaniel/architectury/registry => dev/architectury/registry/block}/BlockPropertiesExtension.java (95%) rename common/src/main/java/{me/shedaniel/architectury/registry => dev/architectury/registry/block}/ToolType.java (95%) rename common/src/main/java/{me/shedaniel/architectury/registry/KeyBindings.java => dev/architectury/registry/client/keymappings/KeyMappingRegistry.java} (80%) rename common/src/main/java/{me/shedaniel/architectury/registry/BlockEntityRenderers.java => dev/architectury/registry/client/rendering/BlockEntityRendererRegistry.java} (70%) rename common/src/main/java/{me/shedaniel/architectury/registry/ColorHandlers.java => dev/architectury/registry/client/rendering/ColorHandlerRegistry.java} (81%) rename common/src/main/java/{me/shedaniel/architectury/registry/RenderTypes.java => dev/architectury/registry/client/rendering/RenderTypeRegistry.java} (87%) rename common/src/main/java/{me/shedaniel => dev}/architectury/registry/fuel/FuelRegistry.java (93%) rename common/src/main/java/{me/shedaniel/architectury/registry => dev/architectury/registry/level}/GameRuleFactory.java (96%) rename common/src/main/java/{me/shedaniel/architectury/registry => dev/architectury/registry/level}/GameRuleRegistry.java (93%) rename common/src/main/java/{me/shedaniel/architectury/registry => dev/architectury/registry/level/advancement}/CriteriaTriggersRegistry.java (92%) rename common/src/main/java/{me/shedaniel/architectury/registry => dev/architectury/registry/level/biome}/BiomeModifications.java (94%) rename common/src/main/java/{me/shedaniel/architectury/registry/entity/EntityAttributes.java => dev/architectury/registry/level/entity/EntityAttributeRegistry.java} (88%) rename common/src/main/java/{me/shedaniel/architectury/registry/entity/EntityRenderers.java => dev/architectury/registry/level/entity/EntityRendererRegistry.java} (71%) rename common/src/main/java/{me/shedaniel/architectury/registry => dev/architectury/registry/level/entity}/trade/SimpleTrade.java (79%) rename common/src/main/java/{me/shedaniel/architectury/registry => dev/architectury/registry/level/entity}/trade/TradeRegistry.java (95%) rename common/src/main/java/{me/shedaniel => dev}/architectury/registry/menu/ExtendedMenuProvider.java (95%) rename common/src/main/java/{me/shedaniel/architectury/registry => dev/architectury/registry/menu}/MenuRegistry.java (97%) rename common/src/main/java/{me/shedaniel/architectury/registry => dev/architectury/registry/registries}/DeferredRegister.java (84%) rename common/src/main/java/{me/shedaniel/architectury/registry/Registry.java => dev/architectury/registry/registries/Registrar.java} (72%) rename common/src/main/java/{me/shedaniel/architectury/registry/registries/RegistryBuilder.java => dev/architectury/registry/registries/RegistrarBuilder.java} (61%) rename common/src/main/java/{me/shedaniel/architectury/registry => dev/architectury/registry/registries}/Registries.java (76%) rename common/src/main/java/{me/shedaniel/architectury/registry => dev/architectury/registry/registries}/RegistrySupplier.java (98%) rename common/src/main/java/{me/shedaniel/architectury/registry/registries/RegistryOption.java => dev/architectury/registry/registries/options/RegistrarOption.java} (90%) rename common/src/main/java/{me/shedaniel/architectury/registry/registries/StandardRegistryOption.java => dev/architectury/registry/registries/options/StandardRegistrarOption.java} (90%) rename common/src/main/java/{me/shedaniel => dev}/architectury/utils/Env.java (97%) rename common/src/main/java/{me/shedaniel => dev}/architectury/utils/EnvExecutor.java (95%) rename common/src/main/java/{me/shedaniel => dev}/architectury/utils/GameInstance.java (92%) rename common/src/main/java/{me/shedaniel => dev}/architectury/utils/NbtType.java (97%) rename common/src/main/java/{me/shedaniel => dev}/architectury/utils/PlatformExpectedError.java (97%) rename common/src/main/java/{me/shedaniel/architectury/utils => dev/architectury/utils/value}/BooleanValue.java (96%) rename common/src/main/java/{me/shedaniel/architectury/utils => dev/architectury/utils/value}/DoubleValue.java (96%) rename common/src/main/java/{me/shedaniel/architectury/utils => dev/architectury/utils/value}/FloatSupplier.java (95%) rename common/src/main/java/{me/shedaniel/architectury/utils => dev/architectury/utils/value}/FloatValue.java (96%) rename common/src/main/java/{me/shedaniel/architectury/utils => dev/architectury/utils/value}/IntValue.java (96%) rename common/src/main/java/{me/shedaniel/architectury/utils => dev/architectury/utils/value}/LongValue.java (96%) rename common/src/main/java/{me/shedaniel/architectury/utils => dev/architectury/utils/value}/Value.java (95%) delete mode 100644 common/src/main/java/me/shedaniel/architectury/Architectury.java delete mode 100644 common/src/main/java/me/shedaniel/architectury/PlatformMethods.java delete mode 100644 common/src/main/java/me/shedaniel/architectury/event/events/BlockEvent.java delete mode 100644 common/src/main/java/me/shedaniel/architectury/event/events/EntityEvent.java delete mode 100644 common/src/main/java/me/shedaniel/architectury/event/events/GuiEvent.java delete mode 100644 common/src/main/java/me/shedaniel/architectury/event/events/InteractionEvent.java delete mode 100644 common/src/main/java/me/shedaniel/architectury/event/events/LifecycleEvent.java delete mode 100644 common/src/main/java/me/shedaniel/architectury/event/events/PlayerEvent.java delete mode 100644 common/src/main/java/me/shedaniel/architectury/event/events/TickEvent.java delete mode 100644 common/src/main/java/me/shedaniel/architectury/event/events/TooltipEvent.java delete mode 100644 common/src/main/java/me/shedaniel/architectury/event/events/client/ClientChatEvent.java delete mode 100644 common/src/main/java/me/shedaniel/architectury/event/events/client/ClientRawInputEvent.java delete mode 100644 common/src/main/java/me/shedaniel/architectury/event/events/client/ClientScreenInputEvent.java rename fabric/src/main/java/{me/shedaniel => dev}/architectury/compat/fabric/ModMenuCompatibility.java (78%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/event/fabric/EventFactoryImpl.java (76%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/event/fabric/EventHandlerImpl.java (78%) rename fabric/src/main/java/{me/shedaniel/architectury/hooks => dev/architectury/hooks/block}/fabric/BlockEntityHooksImpl.java (93%) rename fabric/src/main/java/{me/shedaniel/architectury/hooks => dev/architectury/hooks/client}/screen/fabric/ScreenHooksImpl.java (97%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/hooks/fabric/DyeColorHooksImpl.java (91%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/hooks/fabric/PackRepositoryHooksImpl.java (96%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/hooks/fabric/PersistentEntitySectionManagerHooks.java (95%) rename fabric/src/main/java/{me/shedaniel/architectury/hooks => dev/architectury/hooks/fluid}/fabric/FluidStackHooksImpl.java (75%) rename fabric/src/main/java/{me/shedaniel/architectury/hooks => dev/architectury/hooks/level/entity}/fabric/EntityHooksImpl.java (93%) rename fabric/src/main/java/{me/shedaniel/architectury/hooks => dev/architectury/hooks/level/entity}/fabric/ItemEntityHooksImpl.java (92%) rename fabric/src/main/java/{me/shedaniel/architectury/hooks => dev/architectury/hooks/level/entity}/fabric/PlayerHooksImpl.java (95%) rename fabric/src/main/java/{me/shedaniel/architectury/hooks => dev/architectury/hooks/level}/fabric/ExplosionHooksImpl.java (97%) rename fabric/src/main/java/{me/shedaniel/architectury/hooks => dev/architectury/hooks/tags}/fabric/TagHooksImpl.java (87%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/impl/fabric/ChatComponentImpl.java (93%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/impl/fabric/ScreenInputDelegate.java (81%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/init/fabric/ArchitecturyClient.java (83%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/ExplosionPreInvoker.java (91%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/LivingDeathInvoker.java (88%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/MixinBaseSpawner.java (91%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/MixinBlockEntityExtension.java (90%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/MixinBlockItem.java (79%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/MixinBucketItem.java (87%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/MixinCatSpawner.java (95%) create mode 100644 fabric/src/main/java/dev/architectury/mixin/fabric/MixinChunkMap.java create mode 100644 fabric/src/main/java/dev/architectury/mixin/fabric/MixinChunkSerializer.java rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/MixinCommands.java (78%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/MixinDedicatedServer.java (93%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/MixinEntity.java (89%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/MixinExplosion.java (93%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/MixinFarmBlock.java (93%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/MixinFurnaceResultSlot.java (93%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/MixinInventory.java (83%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/MixinItemEntity.java (86%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/MixinLivingEntity.java (77%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/MixinNaturalSpawner.java (86%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/MixinPatrolSpawner.java (87%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/MixinPersistentEntitySectionManager.java (78%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/MixinPhantomSpawner.java (96%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/MixinPlayer.java (82%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/MixinPlayerAdvancements.java (94%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/MixinPlayerList.java (94%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/MixinResultSlot.java (94%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/MixinServerGamePacketListenerImpl.java (77%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/MixinServerLevel.java (79%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/MixinServerPlayer.java (96%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/MixinServerPlayerGameMode.java (87%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/PlayerAttackInvoker.java (83%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/client/MixinClientLevel.java (86%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/client/MixinClientPacketListener.java (81%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/client/MixinDebugScreenOverlay.java (84%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/client/MixinEffectInstance.java (97%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/client/MixinGameRenderer.java (84%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/client/MixinIntegratedServer.java (92%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/client/MixinKeyboardHandler.java (72%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/client/MixinMinecraft.java (84%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/client/MixinMouseHandler.java (71%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/client/MixinMultiPlayerGameMode.java (84%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/client/MixinScreen.java (74%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/mixin/fabric/client/MixinTextureAtlas.java (87%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/networking/fabric/NetworkManagerImpl.java (91%) create mode 100644 fabric/src/main/java/dev/architectury/networking/fabric/SpawnEntityPacket.java rename fabric/src/main/java/{me/shedaniel => dev}/architectury/platform/fabric/PlatformImpl.java (95%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/plugin/fabric/ArchitecturyMixinPlugin.java (86%) rename fabric/src/main/java/{me/shedaniel/architectury/registry => dev/architectury/registry/block}/fabric/BlockPropertiesImpl.java (88%) rename fabric/src/main/java/{me/shedaniel/architectury/registry => dev/architectury/registry/block}/fabric/ToolTypeImpl.java (96%) rename fabric/src/main/java/{me/shedaniel/architectury/registry/fabric/KeyBindingsImpl.java => dev/architectury/registry/client/keymappings/fabric/KeyMappingRegistryImpl.java} (82%) rename fabric/src/main/java/{me/shedaniel/architectury/registry/fabric/BlockEntityRenderersImpl.java => dev/architectury/registry/client/rendering/fabric/BlockEntityRendererRegistryImpl.java} (83%) rename fabric/src/main/java/{me/shedaniel/architectury/registry/fabric/ColorHandlersImpl.java => dev/architectury/registry/client/rendering/fabric/ColorHandlerRegistryImpl.java} (87%) rename fabric/src/main/java/{me/shedaniel/architectury/registry/fabric/RenderTypesImpl.java => dev/architectury/registry/client/rendering/fabric/RenderTypeRegistryImpl.java} (93%) rename fabric/src/main/java/{me/shedaniel/architectury/registry/fabric/CreativeTabsImpl.java => dev/architectury/registry/fabric/CreativeTabRegistryImpl.java} (93%) rename fabric/src/main/java/{me/shedaniel/architectury/registry/fabric/ReloadListenersImpl.java => dev/architectury/registry/fabric/ReloadListenerRegistryImpl.java} (86%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/registry/fuel/fabric/FuelRegistryImpl.java (89%) rename fabric/src/main/java/{me/shedaniel/architectury/registry => dev/architectury/registry/level/advancement}/fabric/CriteriaTriggersRegistryImpl.java (94%) rename fabric/src/main/java/{me/shedaniel/architectury/registry => dev/architectury/registry/level/biome}/fabric/BiomeModificationsImpl.java (95%) rename fabric/src/main/java/{me/shedaniel/architectury/registry/entity/fabric/EntityAttributesImpl.java => dev/architectury/registry/level/entity/fabric/EntityAttributeRegistryImpl.java} (93%) rename fabric/src/main/java/{me/shedaniel/architectury/registry/entity/fabric/EntityRenderersImpl.java => dev/architectury/registry/level/entity/fabric/EntityRendererRegistryImpl.java} (75%) rename fabric/src/main/java/{me/shedaniel/architectury/registry => dev/architectury/registry/level/entity}/trade/fabric/TradeRegistryImpl.java (96%) rename fabric/src/main/java/{me/shedaniel/architectury/registry => dev/architectury/registry/level}/fabric/GameRuleFactoryImpl.java (97%) rename fabric/src/main/java/{me/shedaniel/architectury/registry => dev/architectury/registry/level}/fabric/GameRuleRegistryImpl.java (95%) rename fabric/src/main/java/{me/shedaniel/architectury/registry => dev/architectury/registry/menu}/fabric/MenuRegistryImpl.java (89%) rename fabric/src/main/java/{me/shedaniel/architectury/registry => dev/architectury/registry/registries}/fabric/RegistriesImpl.java (69%) rename fabric/src/main/java/{me/shedaniel => dev}/architectury/utils/fabric/GameInstanceImpl.java (87%) create mode 100644 forge/src/main/java/me/shedaniel/architectury/mixin/forge/MixinChunkSerializer.java create mode 100644 forge/src/main/java/me/shedaniel/architectury/mixin/forge/MixinClientLevel.java rename common/src/main/java/me/shedaniel/architectury/event/events/ExplosionEvent.java => forge/src/main/java/me/shedaniel/architectury/mixin/forge/MixinWorldEvent.java (53%) rename testmod-common/src/main/java/{me/shedaniel => dev}/architectury/test/TestMod.java (51%) rename testmod-common/src/main/java/{me/shedaniel => dev}/architectury/test/debug/ConsoleMessageSink.java (96%) rename testmod-common/src/main/java/{me/shedaniel => dev}/architectury/test/debug/MessageSink.java (95%) rename testmod-common/src/main/java/{me/shedaniel => dev}/architectury/test/debug/client/ClientOverlayMessageSink.java (72%) create mode 100644 testmod-common/src/main/java/dev/architectury/test/entity/TestEntity.java create mode 100644 testmod-common/src/main/java/dev/architectury/test/events/DebugEvents.java rename testmod-common/src/main/java/{me/shedaniel => dev}/architectury/test/gamerule/TestGameRules.java (91%) rename testmod-common/src/main/java/{me/shedaniel => dev}/architectury/test/registry/TestRegistries.java (77%) rename testmod-common/src/main/java/{me/shedaniel => dev}/architectury/test/registry/client/TestKeybinds.java (76%) rename testmod-common/src/main/java/{me/shedaniel => dev}/architectury/test/registry/objects/EquippableTickingItem.java (90%) rename testmod-common/src/main/java/{me/shedaniel => dev}/architectury/test/tab/TestCreativeTabs.java (76%) rename testmod-common/src/main/java/{me/shedaniel => dev}/architectury/test/tags/TestTags.java (75%) rename testmod-common/src/main/java/{me/shedaniel => dev}/architectury/test/trade/TestTrades.java (78%) delete mode 100644 testmod-common/src/main/java/me/shedaniel/architectury/test/events/DebugEvents.java diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index ebc6e759..e0cbe32f 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -71,7 +71,7 @@ jobs: java: [ 16 ] # Build on Java 16 (version shipped with MC 1.17) runs-on: ubuntu-20.04 if: | - contains(github.event.pull_request.labels.*.name, 'api') && !contains(github.event.pull_request.title, '[ci skip]') + !contains(github.event.pull_request.title, '[ci skip]') steps: - uses: actions/checkout@v2 diff --git a/build.gradle b/build.gradle index 04066d7f..e7a26020 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { - id "architectury-plugin" version "3.1-SNAPSHOT" - id "dev.architectury.loom" version "0.7.2-SNAPSHOT" apply false + id "architectury-plugin" version "3.2-SNAPSHOT" + id "dev.architectury.loom" version "0.8.0-SNAPSHOT" apply false id "org.cadixdev.licenser" version "0.5.0" id "com.matthewprenger.cursegradle" version "1.4.0" apply false id "maven-publish" diff --git a/common/src/main/java/me/shedaniel/architectury/ForgeEvent.java b/common/src/main/java/dev/architectury/annotations/ForgeEvent.java similarity index 96% rename from common/src/main/java/me/shedaniel/architectury/ForgeEvent.java rename to common/src/main/java/dev/architectury/annotations/ForgeEvent.java index 69946567..43d44702 100644 --- a/common/src/main/java/me/shedaniel/architectury/ForgeEvent.java +++ b/common/src/main/java/dev/architectury/annotations/ForgeEvent.java @@ -17,7 +17,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury; +package dev.architectury.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/common/src/main/java/me/shedaniel/architectury/ForgeEventCancellable.java b/common/src/main/java/dev/architectury/annotations/ForgeEventCancellable.java similarity index 96% rename from common/src/main/java/me/shedaniel/architectury/ForgeEventCancellable.java rename to common/src/main/java/dev/architectury/annotations/ForgeEventCancellable.java index f3a218b9..daba12af 100644 --- a/common/src/main/java/me/shedaniel/architectury/ForgeEventCancellable.java +++ b/common/src/main/java/dev/architectury/annotations/ForgeEventCancellable.java @@ -17,7 +17,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury; +package dev.architectury.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/common/src/main/java/me/shedaniel/architectury/core/AbstractRecipeSerializer.java b/common/src/main/java/dev/architectury/core/AbstractRecipeSerializer.java similarity index 96% rename from common/src/main/java/me/shedaniel/architectury/core/AbstractRecipeSerializer.java rename to common/src/main/java/dev/architectury/core/AbstractRecipeSerializer.java index c758061b..7166a6e7 100644 --- a/common/src/main/java/me/shedaniel/architectury/core/AbstractRecipeSerializer.java +++ b/common/src/main/java/dev/architectury/core/AbstractRecipeSerializer.java @@ -17,7 +17,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.core; +package dev.architectury.core; import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeSerializer; diff --git a/common/src/main/java/me/shedaniel/architectury/core/RegistryEntry.java b/common/src/main/java/dev/architectury/core/RegistryEntry.java similarity index 95% rename from common/src/main/java/me/shedaniel/architectury/core/RegistryEntry.java rename to common/src/main/java/dev/architectury/core/RegistryEntry.java index 1b8523b6..31d93c05 100644 --- a/common/src/main/java/me/shedaniel/architectury/core/RegistryEntry.java +++ b/common/src/main/java/dev/architectury/core/RegistryEntry.java @@ -17,7 +17,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.core; +package dev.architectury.core; /** * An entry in registries, will extend {@code ForgeRegistryEntry} on forge. diff --git a/common/src/main/java/me/shedaniel/architectury/event/CompoundEventResult.java b/common/src/main/java/dev/architectury/event/CompoundEventResult.java similarity index 82% rename from common/src/main/java/me/shedaniel/architectury/event/CompoundEventResult.java rename to common/src/main/java/dev/architectury/event/CompoundEventResult.java index 40f99d3d..d89b9791 100644 --- a/common/src/main/java/me/shedaniel/architectury/event/CompoundEventResult.java +++ b/common/src/main/java/dev/architectury/event/CompoundEventResult.java @@ -17,7 +17,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.event; +package dev.architectury.event; import net.minecraft.world.InteractionResultHolder; @@ -28,7 +28,7 @@ import net.minecraft.world.InteractionResultHolder; * @param the type of the extra result * @see #pass() * @see #interrupt(Boolean, Object) - * @see CompoundEventResult + * @see EventResult */ public class CompoundEventResult { private static final CompoundEventResult PASS = new CompoundEventResult<>(EventResult.pass(), null); @@ -114,6 +114,44 @@ public class CompoundEventResult { return result.value(); } + /** + * Returns whether the result does not contain an outcome, may be {@code false} only + * if the event is deterministic. + * + * @return whether the result does not contain an outcome + */ + public boolean isEmpty() { + return result.isEmpty(); + } + + /** + * Returns whether the result contains an outcome, may be {@code true} only + * if the event is deterministic. + * + * @return whether the result contains an outcome + */ + public boolean isPresent() { + return result.isPresent(); + } + + /** + * Returns whether the result contains a {@code true} outcome + * + * @return whether the result contains a {@code true} outcome + */ + public boolean isTrue() { + return result.isTrue(); + } + + /** + * Returns whether the result contains a {@code false} outcome + * + * @return whether the result contains a {@code false} outcome + */ + public boolean isFalse() { + return result.isFalse(); + } + /** * Returns the {@link EventResult} view of the result, this returns the same values as * {@link #interruptsFurtherEvaluation()} and {@link #value()}. @@ -139,9 +177,6 @@ public class CompoundEventResult { * @return the Minecraft-facing result */ public InteractionResultHolder asMinecraft() { - if (value() != null) { - return value() ? InteractionResultHolder.success(object()) : InteractionResultHolder.fail(object()); - } - return InteractionResultHolder.pass(object()); + return new InteractionResultHolder<>(result.asMinecraft(), object); } } diff --git a/common/src/main/java/me/shedaniel/architectury/event/Event.java b/common/src/main/java/dev/architectury/event/Event.java similarity index 96% rename from common/src/main/java/me/shedaniel/architectury/event/Event.java rename to common/src/main/java/dev/architectury/event/Event.java index f5d46284..62f3c635 100644 --- a/common/src/main/java/me/shedaniel/architectury/event/Event.java +++ b/common/src/main/java/dev/architectury/event/Event.java @@ -17,7 +17,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.event; +package dev.architectury.event; public interface Event { T invoker(); diff --git a/common/src/main/java/me/shedaniel/architectury/event/EventActor.java b/common/src/main/java/dev/architectury/event/EventActor.java similarity index 95% rename from common/src/main/java/me/shedaniel/architectury/event/EventActor.java rename to common/src/main/java/dev/architectury/event/EventActor.java index bb3c7f95..ec575e4d 100644 --- a/common/src/main/java/me/shedaniel/architectury/event/EventActor.java +++ b/common/src/main/java/dev/architectury/event/EventActor.java @@ -17,7 +17,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.event; +package dev.architectury.event; @FunctionalInterface public interface EventActor { diff --git a/common/src/main/java/me/shedaniel/architectury/event/EventFactory.java b/common/src/main/java/dev/architectury/event/EventFactory.java similarity index 63% rename from common/src/main/java/me/shedaniel/architectury/event/EventFactory.java rename to common/src/main/java/dev/architectury/event/EventFactory.java index 0831735d..b2fd0769 100644 --- a/common/src/main/java/me/shedaniel/architectury/event/EventFactory.java +++ b/common/src/main/java/dev/architectury/event/EventFactory.java @@ -17,14 +17,12 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.event; +package dev.architectury.event; import com.google.common.reflect.AbstractInvocationHandler; -import me.shedaniel.architectury.ForgeEvent; -import me.shedaniel.architectury.ForgeEventCancellable; -import me.shedaniel.architectury.annotations.ExpectPlatform; -import net.minecraft.world.InteractionResult; -import net.minecraft.world.InteractionResultHolder; +import dev.architectury.annotations.ForgeEvent; +import dev.architectury.annotations.ForgeEventCancellable; +import dev.architectury.injectables.annotations.ExpectPlatform; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; @@ -55,7 +53,7 @@ public final class EventFactory { return of(listeners -> (T) Proxy.newProxyInstance(EventFactory.class.getClassLoader(), new Class[]{clazz}, new AbstractInvocationHandler() { @Override protected Object handleInvocation(@NotNull Object proxy, @NotNull Method method, Object @NotNull [] args) throws Throwable { - for (T listener : listeners) { + for (var listener : listeners) { method.invoke(listener, args); } return null; @@ -63,28 +61,6 @@ public final class EventFactory { })); } - @SafeVarargs - public static Event createInteractionResult(T... typeGetter) { - if (typeGetter.length != 0) throw new IllegalStateException("array must be empty!"); - return createInteractionResult((Class) typeGetter.getClass().getComponentType()); - } - - @SuppressWarnings("UnstableApiUsage") - public static Event createInteractionResult(Class clazz) { - return of(listeners -> (T) Proxy.newProxyInstance(EventFactory.class.getClassLoader(), new Class[]{clazz}, new AbstractInvocationHandler() { - @Override - protected Object handleInvocation(@NotNull Object proxy, @NotNull Method method, Object @NotNull [] args) throws Throwable { - for (T listener : listeners) { - InteractionResult result = (InteractionResult) Objects.requireNonNull(method.invoke(listener, args)); - if (result != InteractionResult.PASS) { - return result; - } - } - return InteractionResult.PASS; - } - })); - } - @SafeVarargs public static Event createEventResult(T... typeGetter) { if (typeGetter.length != 0) throw new IllegalStateException("array must be empty!"); @@ -96,8 +72,8 @@ public final class EventFactory { return of(listeners -> (T) Proxy.newProxyInstance(EventFactory.class.getClassLoader(), new Class[]{clazz}, new AbstractInvocationHandler() { @Override protected Object handleInvocation(@NotNull Object proxy, @NotNull Method method, Object @NotNull [] args) throws Throwable { - for (T listener : listeners) { - EventResult result = (EventResult) Objects.requireNonNull(method.invoke(listener, args)); + for (var listener : listeners) { + var result = (EventResult) Objects.requireNonNull(method.invoke(listener, args)); if (result.interruptsFurtherEvaluation()) { return result; } @@ -107,28 +83,6 @@ public final class EventFactory { })); } - @SafeVarargs - public static Event createInteractionResultHolder(T... typeGetter) { - if (typeGetter.length != 0) throw new IllegalStateException("array must be empty!"); - return createInteractionResultHolder((Class) typeGetter.getClass().getComponentType()); - } - - @SuppressWarnings("UnstableApiUsage") - public static Event createInteractionResultHolder(Class clazz) { - return of(listeners -> (T) Proxy.newProxyInstance(EventFactory.class.getClassLoader(), new Class[]{clazz}, new AbstractInvocationHandler() { - @Override - protected Object handleInvocation(@NotNull Object proxy, @NotNull Method method, Object @NotNull [] args) throws Throwable { - for (T listener : listeners) { - InteractionResultHolder result = (InteractionResultHolder) Objects.requireNonNull(method.invoke(listener, args)); - if (result.getResult() != InteractionResult.PASS) { - return result; - } - } - return InteractionResultHolder.pass(null); - } - })); - } - @SafeVarargs public static Event createCompoundEventResult(T... typeGetter) { if (typeGetter.length != 0) throw new IllegalStateException("array must be empty!"); @@ -140,8 +94,8 @@ public final class EventFactory { return of(listeners -> (T) Proxy.newProxyInstance(EventFactory.class.getClassLoader(), new Class[]{clazz}, new AbstractInvocationHandler() { @Override protected Object handleInvocation(@NotNull Object proxy, @NotNull Method method, Object @NotNull [] args) throws Throwable { - for (T listener : listeners) { - CompoundEventResult result = (CompoundEventResult) Objects.requireNonNull(method.invoke(listener, args)); + for (var listener : listeners) { + var result = (CompoundEventResult) Objects.requireNonNull(method.invoke(listener, args)); if (result.interruptsFurtherEvaluation()) { return result; } @@ -162,7 +116,7 @@ public final class EventFactory { Event> event = of(listeners -> (Consumer) Proxy.newProxyInstance(EventFactory.class.getClassLoader(), new Class[]{Consumer.class}, new AbstractInvocationHandler() { @Override protected Object handleInvocation(@NotNull Object proxy, @NotNull Method method, Object @NotNull [] args) throws Throwable { - for (Consumer listener : listeners) { + for (var listener : listeners) { method.invoke(listener, args); } return null; @@ -178,45 +132,6 @@ public final class EventFactory { return event; } - @SafeVarargs - public static Event> createActorLoop(T... typeGetter) { - if (typeGetter.length != 0) throw new IllegalStateException("array must be empty!"); - return createActorLoop((Class) typeGetter.getClass().getComponentType()); - } - - @SuppressWarnings("UnstableApiUsage") - public static Event> createActorLoop(Class clazz) { - Event> event = of(listeners -> (Actor) Proxy.newProxyInstance(EventFactory.class.getClassLoader(), new Class[]{Actor.class}, new AbstractInvocationHandler() { - @Override - protected Object handleInvocation(@NotNull Object proxy, @NotNull Method method, Object @NotNull [] args) throws Throwable { - for (Actor listener : listeners) { - InteractionResult result = (InteractionResult) method.invoke(listener, args); - if (result != InteractionResult.PASS) { - return result; - } - } - return InteractionResult.PASS; - } - })); - Class superClass = clazz; - do { - - if (superClass.isAnnotationPresent(ForgeEventCancellable.class)) { - return attachToForgeActorCancellable(event); - } - superClass = superClass.getSuperclass(); - } while (superClass != null); - superClass = clazz; - do { - - if (superClass.isAnnotationPresent(ForgeEvent.class)) { - return attachToForgeActor(event); - } - superClass = superClass.getSuperclass(); - } while (superClass != null); - return event; - } - @SafeVarargs public static Event> createEventActorLoop(T... typeGetter) { if (typeGetter.length != 0) throw new IllegalStateException("array must be empty!"); @@ -228,8 +143,8 @@ public final class EventFactory { Event> event = of(listeners -> (EventActor) Proxy.newProxyInstance(EventFactory.class.getClassLoader(), new Class[]{EventActor.class}, new AbstractInvocationHandler() { @Override protected Object handleInvocation(@NotNull Object proxy, @NotNull Method method, Object @NotNull [] args) throws Throwable { - for (EventActor listener : listeners) { - EventResult result = (EventResult) method.invoke(listener, args); + for (var listener : listeners) { + var result = (EventResult) method.invoke(listener, args); if (result.interruptsFurtherEvaluation()) { return result; } @@ -262,18 +177,6 @@ public final class EventFactory { throw new AssertionError(); } - @ExpectPlatform - @ApiStatus.Internal - public static Event> attachToForgeActor(Event> event) { - throw new AssertionError(); - } - - @ExpectPlatform - @ApiStatus.Internal - public static Event> attachToForgeActorCancellable(Event> event) { - throw new AssertionError(); - } - @ExpectPlatform @ApiStatus.Internal public static Event> attachToForgeEventActor(Event> event) { diff --git a/common/src/main/java/me/shedaniel/architectury/event/EventHandler.java b/common/src/main/java/dev/architectury/event/EventHandler.java similarity index 82% rename from common/src/main/java/me/shedaniel/architectury/event/EventHandler.java rename to common/src/main/java/dev/architectury/event/EventHandler.java index bf7ad139..7eb9d380 100644 --- a/common/src/main/java/me/shedaniel/architectury/event/EventHandler.java +++ b/common/src/main/java/dev/architectury/event/EventHandler.java @@ -17,14 +17,11 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.event; +package dev.architectury.event; -import me.shedaniel.architectury.annotations.ExpectPlatform; -import me.shedaniel.architectury.event.events.BlockEvent; -import me.shedaniel.architectury.event.events.EntityEvent; -import me.shedaniel.architectury.event.events.PlayerEvent; -import me.shedaniel.architectury.platform.Platform; -import me.shedaniel.architectury.utils.Env; +import dev.architectury.injectables.annotations.ExpectPlatform; +import dev.architectury.platform.Platform; +import dev.architectury.utils.Env; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; diff --git a/common/src/main/java/me/shedaniel/architectury/event/EventResult.java b/common/src/main/java/dev/architectury/event/EventResult.java similarity index 71% rename from common/src/main/java/me/shedaniel/architectury/event/EventResult.java rename to common/src/main/java/dev/architectury/event/EventResult.java index c1802020..07947c3a 100644 --- a/common/src/main/java/me/shedaniel/architectury/event/EventResult.java +++ b/common/src/main/java/dev/architectury/event/EventResult.java @@ -17,7 +17,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.event; +package dev.architectury.event; + +import net.minecraft.world.InteractionResult; +import org.apache.commons.lang3.BooleanUtils; /** * A result from an event, determines if the event should continue to other listeners, @@ -112,4 +115,54 @@ public final class EventResult { public Boolean value() { return value; } + + /** + * Returns whether the result does not contain an outcome, may be {@code false} only + * if the event is deterministic. + * + * @return whether the result does not contain an outcome + */ + public boolean isEmpty() { + return value == null; + } + + /** + * Returns whether the result contains an outcome, may be {@code true} only + * if the event is deterministic. + * + * @return whether the result contains an outcome + */ + public boolean isPresent() { + return value != null; + } + + /** + * Returns whether the result contains a {@code true} outcome + * + * @return whether the result contains a {@code true} outcome + */ + public boolean isTrue() { + return BooleanUtils.isTrue(value); + } + + /** + * Returns whether the result contains a {@code false} outcome + * + * @return whether the result contains a {@code false} outcome + */ + public boolean isFalse() { + return BooleanUtils.isFalse(value); + } + + /** + * Returns the Minecraft-facing result, however ignores {@link #interruptsFurtherEvaluation()}. + * + * @return the Minecraft-facing result + */ + public InteractionResult asMinecraft() { + if (isPresent()) { + return value() ? InteractionResult.SUCCESS : InteractionResult.FAIL; + } + return InteractionResult.PASS; + } } diff --git a/common/src/main/java/dev/architectury/event/events/client/ClientChatEvent.java b/common/src/main/java/dev/architectury/event/events/client/ClientChatEvent.java new file mode 100644 index 00000000..f28d89c1 --- /dev/null +++ b/common/src/main/java/dev/architectury/event/events/client/ClientChatEvent.java @@ -0,0 +1,72 @@ +/* + * This file is part of architectury. + * Copyright (C) 2020, 2021 architectury + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package dev.architectury.event.events.client; + +import dev.architectury.event.CompoundEventResult; +import dev.architectury.event.Event; +import dev.architectury.event.EventFactory; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.network.chat.ChatType; +import net.minecraft.network.chat.Component; +import org.jetbrains.annotations.Nullable; + +import java.util.UUID; + +@Environment(EnvType.CLIENT) +public interface ClientChatEvent { + /** + * @see Process#process(String) + */ + Event PROCESS = EventFactory.createCompoundEventResult(); + /** + * @see Received#process(ChatType, Component, UUID) + */ + Event RECEIVED = EventFactory.createCompoundEventResult(); + + @Environment(EnvType.CLIENT) + interface Process { + /** + * Event to modify the chat message a clients sends. + * Equivalent to Forge's {@code ClientChatEvent} event. + * + * @param message The raw chat message the client wants to send. + * @return A {@link CompoundEventResult} determining the outcome of the event, + * if an outcome is set, the sent message is overridden. + */ + CompoundEventResult process(String message); + } + + @Environment(EnvType.CLIENT) + interface Received { + /** + * Event to intercept the receiving of an chat message. + * Invoked as soon as the client receives the chat message packet. + * Equivalent to Forge's {@code ClientChatReceivedEvent} event. + * + * @param type Where was the message emitted from. + * @param message The chat message. + * @param sender The packet sender. Can be {@code null}, but probably is the sending player UUID or {@link net.minecraft.Util#NIL_UUID} + * @return A {@link CompoundEventResult} determining the outcome of the event, + * if an outcome is set, the received message is overridden. + */ + CompoundEventResult process(ChatType type, Component message, @Nullable UUID sender); + } +} diff --git a/common/src/main/java/dev/architectury/event/events/client/ClientGuiEvent.java b/common/src/main/java/dev/architectury/event/events/client/ClientGuiEvent.java new file mode 100644 index 00000000..dc3685c7 --- /dev/null +++ b/common/src/main/java/dev/architectury/event/events/client/ClientGuiEvent.java @@ -0,0 +1,160 @@ +/* + * This file is part of architectury. + * Copyright (C) 2020, 2021 architectury + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package dev.architectury.event.events.client; + +import com.mojang.blaze3d.vertex.PoseStack; +import dev.architectury.event.CompoundEventResult; +import dev.architectury.event.Event; +import dev.architectury.event.EventFactory; +import dev.architectury.event.EventResult; +import dev.architectury.hooks.client.screen.ScreenAccess; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.gui.screens.Screen; + +import java.util.List; + +@Environment(EnvType.CLIENT) +public interface ClientGuiEvent { + /** + * @see RenderHud#renderHud(PoseStack, float) + */ + Event RENDER_HUD = EventFactory.createLoop(); + /** + * @see DebugText#gatherText(List) + */ + Event DEBUG_TEXT_LEFT = EventFactory.createLoop(); + Event DEBUG_TEXT_RIGHT = EventFactory.createLoop(); + /** + * @see ScreenInitPre#init(Screen, ScreenAccess) + */ + Event INIT_PRE = EventFactory.createEventResult(); + /** + * @see ScreenInitPost#init(Screen, ScreenAccess) + */ + Event INIT_POST = EventFactory.createLoop(); + /** + * @see ScreenRenderPre#render(Screen, PoseStack, int, int, float) + */ + Event RENDER_PRE = EventFactory.createEventResult(); + /** + * @see ScreenRenderPost#render(Screen, PoseStack, int, int, float) + */ + Event RENDER_POST = EventFactory.createLoop(); + /** + * @see SetScreen#modifyScreen(Screen) + */ + Event SET_SCREEN = EventFactory.createCompoundEventResult(); + + @Environment(EnvType.CLIENT) + interface RenderHud { + /** + * Invoked after the in-game hud has been rendered. + * Equivalent to Forge's {@code RenderGameOverlayEvent.Post@ElementType#ALL} and Fabric's {@code HudRenderCallback}. + * + * @param matrices The pose stack. + * @param tickDelta The tick delta. + */ + void renderHud(PoseStack matrices, float tickDelta); + } + + @Environment(EnvType.CLIENT) + interface DebugText { + /** + * Invoked when the debug text is being gathered for rendering. + * There are two different versions of this event, one for the left and one for the right side. + * Equivalent to Forge's {@code RenderGameOverlayEvent.Text}, when {@code Minecraft.getInstance().options.renderDebug} is true. + * + * @param strings The current debug text strings. + */ + void gatherText(List strings); + } + + @Environment(EnvType.CLIENT) + interface ScreenInitPre { + /** + * Invoked when a screen is being initialized and after the previous widgets have been cleared. + * Equivalent to Forge's {@code GuiScreenEvent.InitGuiEvent.Pre} event. + * + * @param screen The screen. + * @param access The accessor of the screen. + * @return A {@link EventResult} determining the outcome of the event, + * the execution of the vanilla initialization may be cancelled by the result. + */ + EventResult init(Screen screen, ScreenAccess access); + } + + @Environment(EnvType.CLIENT) + interface ScreenInitPost { + /** + * Invoked after a screen has been initialized and all the vanilla initialization logic has happened. + * Equivalent to Forge's {@code GuiScreenEvent.InitGuiEvent.Post} event. + * + * @param screen The screen. + * @param access The accessor of the screen. + */ + void init(Screen screen, ScreenAccess access); + } + + @Environment(EnvType.CLIENT) + interface ScreenRenderPre { + /** + * Invoked before any screen is rendered. + * Equivalent to Forge's {@code GuiScreenEvent.DrawScreenEvent.Pre} event. + * + * @param screen The screen. + * @param matrices The pose stack. + * @param mouseX The scaled x-coordinate of the mouse cursor. + * @param mouseY The scaled y-coordinate of the mouse cursor. + * @param delta The current tick delta. + * @return A {@link EventResult} determining the outcome of the event, + * the vanilla render may be cancelled by the result. + */ + EventResult render(Screen screen, PoseStack matrices, int mouseX, int mouseY, float delta); + } + + @Environment(EnvType.CLIENT) + interface ScreenRenderPost { + /** + * Invoked after a screen has finished rendering using the vanilla logic. + * Equivalent to Forge's {@code GuiScreenEvent.DrawScreenEvent.Post} event. + * + * @param screen The screen. + * @param matrices The pose stack. + * @param mouseX The scaled x-coordinate of the mouse cursor. + * @param mouseY The scaled y-coordinate of the mouse cursor. + * @param delta The current tick delta. + */ + void render(Screen screen, PoseStack matrices, int mouseX, int mouseY, float delta); + } + + @Environment(EnvType.CLIENT) + interface SetScreen { + /** + * Invoked before a new screen is set to open. + * Equivalent to Forge's {@code GuiOpenEvent} event. + * + * @param screen The screen that is going to be opened. + * @return A {@link CompoundEventResult} determining the outcome of the event, + * if an outcome is set, the vanilla screen is overridden. + */ + CompoundEventResult modifyScreen(Screen screen); + } +} diff --git a/common/src/main/java/me/shedaniel/architectury/event/events/client/ClientLifecycleEvent.java b/common/src/main/java/dev/architectury/event/events/client/ClientLifecycleEvent.java similarity index 71% rename from common/src/main/java/me/shedaniel/architectury/event/events/client/ClientLifecycleEvent.java rename to common/src/main/java/dev/architectury/event/events/client/ClientLifecycleEvent.java index 574ad093..742589fa 100644 --- a/common/src/main/java/me/shedaniel/architectury/event/events/client/ClientLifecycleEvent.java +++ b/common/src/main/java/dev/architectury/event/events/client/ClientLifecycleEvent.java @@ -17,11 +17,11 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.event.events.client; +package dev.architectury.event.events.client; -import me.shedaniel.architectury.event.Event; -import me.shedaniel.architectury.event.EventFactory; -import me.shedaniel.architectury.event.events.LifecycleEvent; +import dev.architectury.event.Event; +import dev.architectury.event.EventFactory; +import dev.architectury.event.events.common.LifecycleEvent; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; @@ -40,9 +40,15 @@ public interface ClientLifecycleEvent { @Deprecated Event CLIENT_STOPPING = EventFactory.createLoop(); /** - * Invoked after a world is loaded only on client, equivalent to forge's {@code WorldEvent.Load}. + * Invoked after a level is loaded only on the client-side. + * Equivalent to Forge's {@code WorldEvent.Load} event (on client). + */ + Event CLIENT_LEVEL_LOAD = EventFactory.createLoop(); + /** + * Invoked once client setup has begun. + *

This happens during {@code FMLClientSetupEvent} on Forge, + * or when Architectury API's client entrypoint initialises on Fabric. */ - Event CLIENT_WORLD_LOAD = EventFactory.createLoop(); Event CLIENT_SETUP = EventFactory.createLoop(); @Environment(EnvType.CLIENT) @@ -50,6 +56,6 @@ public interface ClientLifecycleEvent { } @Environment(EnvType.CLIENT) - interface ClientWorldState extends LifecycleEvent.WorldState { + interface ClientLevelState extends LifecycleEvent.LevelState { } } diff --git a/common/src/main/java/me/shedaniel/architectury/event/events/client/ClientPlayerEvent.java b/common/src/main/java/dev/architectury/event/events/client/ClientPlayerEvent.java similarity index 65% rename from common/src/main/java/me/shedaniel/architectury/event/events/client/ClientPlayerEvent.java rename to common/src/main/java/dev/architectury/event/events/client/ClientPlayerEvent.java index 359172d0..8225939a 100644 --- a/common/src/main/java/me/shedaniel/architectury/event/events/client/ClientPlayerEvent.java +++ b/common/src/main/java/dev/architectury/event/events/client/ClientPlayerEvent.java @@ -17,10 +17,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.event.events.client; +package dev.architectury.event.events.client; -import me.shedaniel.architectury.event.Event; -import me.shedaniel.architectury.event.EventFactory; +import dev.architectury.event.Event; +import dev.architectury.event.EventFactory; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.player.LocalPlayer; @@ -28,22 +28,47 @@ import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) public interface ClientPlayerEvent { + /** + * @see ClientPlayerJoin#join(LocalPlayer) + */ Event CLIENT_PLAYER_JOIN = EventFactory.createLoop(); + /** + * @see ClientPlayerQuit#quit(LocalPlayer) + */ Event CLIENT_PLAYER_QUIT = EventFactory.createLoop(); + /** + * @see ClientPlayerRespawn#respawn(LocalPlayer, LocalPlayer) + */ Event CLIENT_PLAYER_RESPAWN = EventFactory.createLoop(); @Environment(EnvType.CLIENT) interface ClientPlayerJoin { + /** + * Invoked whenever a client player joins a level + * + * @param player The player joining. + */ void join(LocalPlayer player); } @Environment(EnvType.CLIENT) interface ClientPlayerQuit { + /** + * Invoked whenever a client player leaves a level and is cleared on the client side. + * + * @param player The player leaving. + */ void quit(@Nullable LocalPlayer player); } @Environment(EnvType.CLIENT) interface ClientPlayerRespawn { + /** + * Invoked whenever the player respawn packet is received by the client. + * + * @param oldPlayer The player before the respawn. + * @param newPlayer The player after the respawn. + */ void respawn(LocalPlayer oldPlayer, LocalPlayer newPlayer); } } diff --git a/common/src/main/java/dev/architectury/event/events/client/ClientRawInputEvent.java b/common/src/main/java/dev/architectury/event/events/client/ClientRawInputEvent.java new file mode 100644 index 00000000..f3cd30f1 --- /dev/null +++ b/common/src/main/java/dev/architectury/event/events/client/ClientRawInputEvent.java @@ -0,0 +1,88 @@ +/* + * This file is part of architectury. + * Copyright (C) 2020, 2021 architectury + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package dev.architectury.event.events.client; + +import dev.architectury.event.Event; +import dev.architectury.event.EventFactory; +import dev.architectury.event.EventResult; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.Minecraft; + +@Environment(EnvType.CLIENT) +public interface ClientRawInputEvent { + /** + * @see MouseScrolled#mouseScrolled(Minecraft, double) + */ + Event MOUSE_SCROLLED = EventFactory.createEventResult(); + /** + * @see MouseClicked#mouseClicked(Minecraft, int, int, int) + */ + Event MOUSE_CLICKED_PRE = EventFactory.createEventResult(); + Event MOUSE_CLICKED_POST = EventFactory.createEventResult(); + /** + * @see KeyPressed#keyPressed(Minecraft, int, int, int, int) + */ + Event KEY_PRESSED = EventFactory.createEventResult(); + + interface KeyPressed { + /** + * Invoked whenever a key input is performed. + * Equivalent to Forge's {@code InputEvent.KeyInputEvent} event. + * + * @param client The Minecraft instance performing it. + * @param keyCode The key code. + * @param scanCode The raw keyboard scan code. + * @param action The action that should be performed. + * @param modifiers Additional modifiers. + * @return A {@link EventResult} determining the outcome of the event, + * the execution of the vanilla pressing mechanism may be cancelled by the result. + */ + EventResult keyPressed(Minecraft client, int keyCode, int scanCode, int action, int modifiers); + } + + interface MouseScrolled { + /** + * Invoked whenever the mouse scroll wheel is used. + * Equivalent to Forge's {@code InputEvent.MouseScrollEvent} event. + * + * @param client The Minecraft instance performing it. + * @param amount The amount of movement. + * @return A {@link EventResult} determining the outcome of the event, + * the execution of the vanilla scrolling mechanism may be cancelled by the result. + */ + EventResult mouseScrolled(Minecraft client, double amount); + } + + interface MouseClicked { + /** + * Invoked whenever a mouse button is pressed. + * There are two variants, either a raw mouse input or the input after it is processed by the game. + * + * @param client The Minecraft instance performing it. + * @param button The pressed mouse button. + * @param action The action that should be performed. + * @param mods Additional modifiers. + * @return A {@link EventResult} determining the outcome of the event, + * the execution of the vanilla clicking mechanism may be cancelled by the result. + */ + EventResult mouseClicked(Minecraft client, int button, int action, int mods); + } +} diff --git a/common/src/main/java/me/shedaniel/architectury/event/events/RecipeUpdateEvent.java b/common/src/main/java/dev/architectury/event/events/client/ClientRecipeUpdateEvent.java similarity index 65% rename from common/src/main/java/me/shedaniel/architectury/event/events/RecipeUpdateEvent.java rename to common/src/main/java/dev/architectury/event/events/client/ClientRecipeUpdateEvent.java index 2bd68e4e..805d3029 100644 --- a/common/src/main/java/me/shedaniel/architectury/event/events/RecipeUpdateEvent.java +++ b/common/src/main/java/dev/architectury/event/events/client/ClientRecipeUpdateEvent.java @@ -17,17 +17,26 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.event.events; +package dev.architectury.event.events.client; -import me.shedaniel.architectury.event.Event; -import me.shedaniel.architectury.event.EventFactory; +import dev.architectury.event.Event; +import dev.architectury.event.EventFactory; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.world.item.crafting.RecipeManager; @Environment(EnvType.CLIENT) -public interface RecipeUpdateEvent { - Event EVENT = EventFactory.createLoop(); +public interface ClientRecipeUpdateEvent { + /** + * @see ClientRecipeUpdateEvent#update(RecipeManager) + */ + Event EVENT = EventFactory.createLoop(); + /** + * Invoked when the client has received an updated list of recipes from the server. + * Equivalent to Forge's {@code RecipesUpdatedEvent} event. + * + * @param recipeManager The recipe manager. + */ void update(RecipeManager recipeManager); } diff --git a/common/src/main/java/dev/architectury/event/events/client/ClientScreenInputEvent.java b/common/src/main/java/dev/architectury/event/events/client/ClientScreenInputEvent.java new file mode 100644 index 00000000..e07fcaec --- /dev/null +++ b/common/src/main/java/dev/architectury/event/events/client/ClientScreenInputEvent.java @@ -0,0 +1,201 @@ +/* + * This file is part of architectury. + * Copyright (C) 2020, 2021 architectury + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package dev.architectury.event.events.client; + +import dev.architectury.event.Event; +import dev.architectury.event.EventFactory; +import dev.architectury.event.EventResult; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.Screen; + +@Environment(EnvType.CLIENT) +public interface ClientScreenInputEvent { + /** + * @see MouseScrolled#mouseScrolled(Minecraft, Screen, double, double, double) + */ + Event MOUSE_SCROLLED_PRE = EventFactory.createEventResult(); + Event MOUSE_SCROLLED_POST = EventFactory.createEventResult(); + /** + * @see MouseClicked#mouseClicked(Minecraft, Screen, double, double, int) + */ + Event MOUSE_CLICKED_PRE = EventFactory.createEventResult(); + Event MOUSE_CLICKED_POST = EventFactory.createEventResult(); + /** + * @see MouseReleased#mouseReleased(Minecraft, Screen, double, double, int) + */ + Event MOUSE_RELEASED_PRE = EventFactory.createEventResult(); + Event MOUSE_RELEASED_POST = EventFactory.createEventResult(); + /** + * @see MouseDragged#mouseDragged(Minecraft, Screen, double, double, int, double, double) + */ + Event MOUSE_DRAGGED_PRE = EventFactory.createEventResult(); + Event MOUSE_DRAGGED_POST = EventFactory.createEventResult(); + /** + * @see KeyTyped#charTyped(Minecraft, Screen, char, int) + */ + Event CHAR_TYPED_PRE = EventFactory.createEventResult(); + Event CHAR_TYPED_POST = EventFactory.createEventResult(); + /** + * @see KeyPressed#keyPressed(Minecraft, Screen, int, int, int) + */ + Event KEY_PRESSED_PRE = EventFactory.createEventResult(); + Event KEY_PRESSED_POST = EventFactory.createEventResult(); + /** + * @see KeyReleased#keyReleased(Minecraft, Screen, int, int, int) + */ + Event KEY_RELEASED_PRE = EventFactory.createEventResult(); + Event KEY_RELEASED_POST = EventFactory.createEventResult(); + + interface KeyPressed { + /** + * Invoked whenever a key press is performed inside a screen. + * Equivalent to Forge's {@code GuiScreenEvent.KeyboardKeyPressedEvent} event. + * + *

This event is handled in two phases PRE and POST, which are invoked + * before and after the keys have been processed by the screen, respectively. + * + * @param client The Minecraft instance performing it. + * @param screen The screen this keystroke was performed in. + * @param keyCode The key code. + * @param scanCode The raw keyboard scan code. + * @param modifiers Additional modifiers. + * @return A {@link EventResult} determining the outcome of the event, + * the execution of the vanilla pressing mechanism may be cancelled by the result. + */ + EventResult keyPressed(Minecraft client, Screen screen, int keyCode, int scanCode, int modifiers); + } + + interface KeyReleased { + /** + * Invoked whenever a held key is released inside a screen. + * Equivalent to Forge's {@code GuiScreenEvent.KeyboardKeyReleasedEvent} event. + * + *

This event is handled in two phases PRE and POST, which are invoked + * before and after the keys have been processed by the screen, respectively. + * + * @param client The Minecraft instance performing it. + * @param screen The screen this keystroke was performed in. + * @param keyCode The key code. + * @param scanCode The raw keyboard scan code. + * @param modifiers Additional modifiers. + * @return A {@link EventResult} determining the outcome of the event, + * the execution of the vanilla releasing mechanism may be cancelled by the result. + */ + EventResult keyReleased(Minecraft client, Screen screen, int keyCode, int scanCode, int modifiers); + } + + interface KeyTyped { + /** + * Invoked whenever a character is typed within a screen. + * Equivalent to Forge's {@code GuiScreenEvent.KeyboardCharTypedEvent} event. + * + *

This event is handled in two phases PRE and POST, which are invoked + * before and after the keys have been processed by the screen, respectively. + * + * @param client The Minecraft instance performing it. + * @param screen The screen this keystroke was performed in. + * @param character The typed character. + * @param keyCode The key code. + * @return A {@link EventResult} determining the outcome of the event, + * the execution of the vanilla typing mechanism may be cancelled by the result. + */ + EventResult charTyped(Minecraft client, Screen screen, char character, int keyCode); + } + + interface MouseScrolled { + /** + * Invoked whenever the mouse scroll wheel is moved. + * Equivalent to Forge's {@code GuiScreenEvent.MouseScrollEvent} event. + * + *

This event is handled in two phases PRE and POST, which are invoked + * before and after the keys have been processed by the screen, respectively. + * + * @param client The Minecraft instance performing it. + * @param screen The screen this keystroke was performed in. + * @param mouseX The scaled x-coordinate of the mouse cursor. + * @param mouseY The scaled y-coordinate of the mouse cursor. + * @param amount The amount the scroll wheel is moved. + * @return A {@link EventResult} determining the outcome of the event, + * the execution of the vanilla scrolling mechanism may be cancelled by the result. + */ + EventResult mouseScrolled(Minecraft client, Screen screen, double mouseX, double mouseY, double amount); + } + + interface MouseReleased { + /** + * Invoked whenever a mouse button is released. + * Equivalent to Forge's {@code GuiScreenEvent.MouseReleasedEvent} event. + * + *

This event is handled in two phases PRE and POST, which are invoked + * before and after the keys have been processed by the screen, respectively. + * + * @param client The Minecraft instance performing it. + * @param screen The screen this keystroke was performed in. + * @param mouseX The scaled x-coordinate of the mouse cursor. + * @param mouseY The scaled y-coordinate of the mouse cursor. + * @param button The released mouse button. + * @return A {@link EventResult} determining the outcome of the event, + * the execution of the vanilla releasing mechanism may be cancelled by the result. + */ + EventResult mouseReleased(Minecraft client, Screen screen, double mouseX, double mouseY, int button); + } + + interface MouseDragged { + /** + * Invoked whenever the mouse is dragged across a screen. + * Equivalent to Forge's {@code GuiScreenEvent.MouseDragEvent} event. + * + *

This event is handled in two phases PRE and POST, which are invoked + * before and after the keys have been processed by the screen, respectively. + * + * @param client The Minecraft instance performing it. + * @param screen The screen this keystroke was performed in. + * @param mouseX1 The initial scaled x-coordinate of the mouse cursor. + * @param mouseY1 The initial scaled y-coordinate of the mouse cursor. + * @param button The dragged mouse button. + * @param mouseX2 The final scaled x-coordinate of the mouse cursor. + * @param mouseY2 The final scaled y-coordinate of the mouse cursor. + * @return A {@link EventResult} determining the outcome of the event, + * the execution of the vanilla dragging mechanism may be cancelled by the result. + */ + EventResult mouseDragged(Minecraft client, Screen screen, double mouseX1, double mouseY1, int button, double mouseX2, double mouseY2); + } + + interface MouseClicked { + /** + * Invoked whenever a mouse click is performed. A click consists of the press and release of a mouse button. + * Equivalent to Forge's {@code GuiScreenEvent.MouseClickedEvent} event. + * + *

This event is handled in two phases PRE and POST, which are invoked + * before and after the keys have been processed by the screen, respectively. + * + * @param client The Minecraft instance performing it. + * @param screen The screen this keystroke was performed in. + * @param mouseX The scaled x-coordinate of the mouse cursor. + * @param mouseY The scaled y-coordinate of the mouse cursor. + * @param button The clicked mouse button. + * @return A {@link EventResult} determining the outcome of the event, + * the execution of the vanilla clicking mechanism may be cancelled by the result. + */ + EventResult mouseClicked(Minecraft client, Screen screen, double mouseX, double mouseY, int button); + } +} diff --git a/common/src/main/java/me/shedaniel/architectury/event/events/TextureStitchEvent.java b/common/src/main/java/dev/architectury/event/events/client/ClientTextureStitchEvent.java similarity index 63% rename from common/src/main/java/me/shedaniel/architectury/event/events/TextureStitchEvent.java rename to common/src/main/java/dev/architectury/event/events/client/ClientTextureStitchEvent.java index 4103ea91..964ba22c 100644 --- a/common/src/main/java/me/shedaniel/architectury/event/events/TextureStitchEvent.java +++ b/common/src/main/java/dev/architectury/event/events/client/ClientTextureStitchEvent.java @@ -17,10 +17,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.event.events; +package dev.architectury.event.events.client; -import me.shedaniel.architectury.event.Event; -import me.shedaniel.architectury.event.EventFactory; +import dev.architectury.event.Event; +import dev.architectury.event.EventFactory; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.renderer.texture.TextureAtlas; @@ -29,17 +29,36 @@ import net.minecraft.resources.ResourceLocation; import java.util.function.Consumer; @Environment(EnvType.CLIENT) -public interface TextureStitchEvent { +public interface ClientTextureStitchEvent { + /** + * @see Pre#stitch(TextureAtlas, Consumer) + */ Event

 PRE = EventFactory.createLoop();
+    /**
+     * @see Post#stitch(TextureAtlas)
+     */
     Event POST = EventFactory.createLoop();
     
     @Environment(EnvType.CLIENT)
     interface Pre {
+        /**
+         * Invoked before the texture atlas is stitched together.
+         * Equivalent to Forge's {@code TextureStitchEvent.Pre} event.
+         *
+         * @param atlas       The TextureAtlas.
+         * @param spriteAdder A consumer where you can add your own sprites to be stitched.
+         */
         void stitch(TextureAtlas atlas, Consumer spriteAdder);
     }
     
     @Environment(EnvType.CLIENT)
     interface Post {
+        /**
+         * Invoked after the texture atlas has been fully stitched.
+         * Equivalent to Forge's {@code TextureStitchEvent.Post} event.
+         *
+         * @param atlas The ready-to-use TextureAtlas.
+         */
         void stitch(TextureAtlas atlas);
     }
 }
diff --git a/common/src/main/java/me/shedaniel/architectury/event/events/client/ClientTickEvent.java b/common/src/main/java/dev/architectury/event/events/client/ClientTickEvent.java
similarity index 76%
rename from common/src/main/java/me/shedaniel/architectury/event/events/client/ClientTickEvent.java
rename to common/src/main/java/dev/architectury/event/events/client/ClientTickEvent.java
index 4695ed7d..ec989eee 100644
--- a/common/src/main/java/me/shedaniel/architectury/event/events/client/ClientTickEvent.java
+++ b/common/src/main/java/dev/architectury/event/events/client/ClientTickEvent.java
@@ -17,21 +17,20 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.event.events.client;
+package dev.architectury.event.events.client;
 
-import me.shedaniel.architectury.event.Event;
-import me.shedaniel.architectury.event.EventFactory;
+import dev.architectury.event.Event;
+import dev.architectury.event.EventFactory;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
 import net.minecraft.client.Minecraft;
-import net.minecraft.client.multiplayer.ClientLevel;
 
 @Environment(EnvType.CLIENT)
 public interface ClientTickEvent {
     Event CLIENT_PRE = EventFactory.createLoop();
     Event CLIENT_POST = EventFactory.createLoop();
-    Event CLIENT_WORLD_PRE = EventFactory.createLoop();
-    Event CLIENT_WORLD_POST = EventFactory.createLoop();
+    Event CLIENT_LEVEL_PRE = EventFactory.createLoop();
+    Event CLIENT_LEVEL_POST = EventFactory.createLoop();
     
     void tick(T instance);
     
@@ -40,6 +39,6 @@ public interface ClientTickEvent {
     }
     
     @Environment(EnvType.CLIENT)
-    interface ClientWorld extends ClientTickEvent {
+    interface ClientLevel extends ClientTickEvent {
     }
 }
diff --git a/common/src/main/java/dev/architectury/event/events/client/ClientTooltipEvent.java b/common/src/main/java/dev/architectury/event/events/client/ClientTooltipEvent.java
new file mode 100644
index 00000000..8d117db1
--- /dev/null
+++ b/common/src/main/java/dev/architectury/event/events/client/ClientTooltipEvent.java
@@ -0,0 +1,160 @@
+/*
+ * This file is part of architectury.
+ * Copyright (C) 2020, 2021 architectury
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+package dev.architectury.event.events.client;
+
+import com.mojang.blaze3d.vertex.PoseStack;
+import dev.architectury.event.Event;
+import dev.architectury.event.EventFactory;
+import dev.architectury.event.EventResult;
+import net.fabricmc.api.EnvType;
+import net.fabricmc.api.Environment;
+import net.minecraft.network.chat.Component;
+import net.minecraft.network.chat.FormattedText;
+import net.minecraft.util.FormattedCharSequence;
+import net.minecraft.world.item.ItemStack;
+import net.minecraft.world.item.TooltipFlag;
+
+import java.util.List;
+
+@Environment(EnvType.CLIENT)
+public interface ClientTooltipEvent {
+    /**
+     * @see Item#append(ItemStack, List, TooltipFlag)
+     */
+    Event ITEM = EventFactory.createLoop();
+    /**
+     * @see RenderVanilla#renderTooltip(PoseStack, List, int, int)
+     */
+    Event RENDER_VANILLA_PRE = EventFactory.createEventResult();
+    /**
+     * @see RenderForge#renderTooltip(PoseStack, List, int, int)
+     */
+    Event RENDER_FORGE_PRE = EventFactory.createEventResult();
+    /**
+     * @see RenderModifyPosition#renderTooltip(PoseStack, PositionContext)
+     */
+    Event RENDER_MODIFY_POSITION = EventFactory.createLoop();
+    /**
+     * @see RenderModifyColor#renderTooltip(PoseStack, int, int, ColorContext)
+     */
+    Event RENDER_MODIFY_COLOR = EventFactory.createLoop();
+    
+    @Environment(EnvType.CLIENT)
+    interface Item {
+        /**
+         * Invoked whenever an item tooltip is rendered.
+         * Equivalent to Forge's {@code ItemTooltipEvent} event and
+         * Fabric's {@code ItemTooltipCallback}.
+         *
+         * @param stack The rendered stack.
+         * @param lines The mutable list of tooltip components.
+         * @param flag  A flag indicating if advanced mode is active.
+         */
+        void append(ItemStack stack, List lines, TooltipFlag flag);
+    }
+    
+    @Environment(EnvType.CLIENT)
+    interface RenderVanilla {
+        /**
+         * Invoked before the tooltip for a tooltip is rendered.
+         *
+         * 

This is not invoked on Forge due to + * {@link RenderForge#renderTooltip(PoseStack, List, int, int) fundamental differences} + * in Forge and vanilla tooltip logic. + * + * @param matrices The pose stack. + * @param texts The mutable list of components that are rendered. + * @param x The x-coordinate of the tooltip. + * @param y The y-coordinate of the tooltip. + * @return A {@link EventResult} determining the outcome of the event, + * the execution of the vanilla tooltip rendering may be cancelled by the result. + */ + EventResult renderTooltip(PoseStack matrices, List texts, int x, int y); + } + + @Environment(EnvType.CLIENT) + interface RenderForge { + /** + * Invoked before the tooltip for a tooltip is rendered. + * + *

This is only invoked on Forge due to + * {@link RenderVanilla#renderTooltip(PoseStack, List, int, int) fundamental differences} + * in Forge and vanilla tooltip logic. + * + * @param matrices The pose stack. + * @param texts The mutable list of components that are rendered. + * @param x The x-coordinate of the tooltip. + * @param y The y-coordinate of the tooltip. + * @return A {@link EventResult} determining the outcome of the event, + * the execution of the forge tooltip rendering may be cancelled by the result. + */ + EventResult renderTooltip(PoseStack matrices, List texts, int x, int y); + } + + @Environment(EnvType.CLIENT) + interface RenderModifyPosition { + /** + * Event to manipulate the position of the tooltip. + * + * @param matrices The pose stack. + * @param context The current position context. + */ + void renderTooltip(PoseStack matrices, PositionContext context); + } + + @Environment(EnvType.CLIENT) + interface RenderModifyColor { + /** + * Event to manipulate the color of the tooltip. + * + * @param matrices The pose stack. + * @param x The x-coordinate of the tooltip. + * @param y The y-coordinate of the tooltip. + * @param context The current color context. + */ + void renderTooltip(PoseStack matrices, int x, int y, ColorContext context); + } + + @Environment(EnvType.CLIENT) + interface PositionContext { + int getTooltipX(); + + void setTooltipX(int x); + + int getTooltipY(); + + void setTooltipY(int y); + } + + @Environment(EnvType.CLIENT) + interface ColorContext { + int getBackgroundColor(); + + void setBackgroundColor(int color); + + int getOutlineGradientTopColor(); + + void setOutlineGradientTopColor(int color); + + int getOutlineGradientBottomColor(); + + void setOutlineGradientBottomColor(int color); + } +} diff --git a/common/src/main/java/dev/architectury/event/events/common/BlockEvent.java b/common/src/main/java/dev/architectury/event/events/common/BlockEvent.java new file mode 100644 index 00000000..d8ac53d8 --- /dev/null +++ b/common/src/main/java/dev/architectury/event/events/common/BlockEvent.java @@ -0,0 +1,89 @@ +/* + * This file is part of architectury. + * Copyright (C) 2020, 2021 architectury + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package dev.architectury.event.events.common; + +import dev.architectury.event.Event; +import dev.architectury.event.EventFactory; +import dev.architectury.event.EventResult; +import dev.architectury.utils.value.IntValue; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.item.FallingBlockEntity; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.Nullable; + +public interface BlockEvent { + /** + * @see Break#breakBlock(Level, BlockPos, BlockState, ServerPlayer, IntValue) + */ + Event BREAK = EventFactory.createEventResult(); + /** + * @see Place#placeBlock(Level, BlockPos, BlockState, Entity) + */ + Event PLACE = EventFactory.createEventResult(); + /** + * @see FallingLand#onLand(Level, BlockPos, BlockState, BlockState, FallingBlockEntity) + */ + Event FALLING_LAND = EventFactory.createLoop(); + + interface Break { + /** + * Invoked when a block is destroyed by a player. + * + * @param level The level the block is in. + * @param pos The position of the block. + * @param state The current state of the block. + * @param player The player who is breaking the block. + * @param xp The experience that are dropped when the block was destroyed. Always {@code null} on fabric. + * @return A {@link EventResult} determining the outcome of the event, + * the execution of the vanilla block breaking may be cancelled by the result. + */ + EventResult breakBlock(Level level, BlockPos pos, BlockState state, ServerPlayer player, @Nullable IntValue xp); + } + + interface Place { + /** + * Invoked when a block is placed. + * + * @param level The level the block is in. + * @param pos The position of the block. + * @param state The future state of the block. + * @param placer The entity who is placing it. Can be {@code null}, e.g. when a dispenser places something. + * @return A {@link EventResult} determining the outcome of the event, + * the execution of the vanilla block placing may be cancelled by the result. + */ + EventResult placeBlock(Level level, BlockPos pos, BlockState state, @Nullable Entity placer); + } + + interface FallingLand { + /** + * Invoked when a falling block is about to land. + * + * @param level The level the block is in. + * @param pos The position of the block. + * @param fallState The current state of the falling block. + * @param landOn The current state of the block the falling one is landing on. + * @param entity The falling block entity. + */ + void onLand(Level level, BlockPos pos, BlockState fallState, BlockState landOn, FallingBlockEntity entity); + } +} diff --git a/common/src/main/java/me/shedaniel/architectury/event/events/ChatEvent.java b/common/src/main/java/dev/architectury/event/events/common/ChatEvent.java similarity index 57% rename from common/src/main/java/me/shedaniel/architectury/event/events/ChatEvent.java rename to common/src/main/java/dev/architectury/event/events/common/ChatEvent.java index 72c6908f..e3f48ea4 100644 --- a/common/src/main/java/me/shedaniel/architectury/event/events/ChatEvent.java +++ b/common/src/main/java/dev/architectury/event/events/common/ChatEvent.java @@ -17,33 +17,42 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.event.events; +package dev.architectury.event.events.common; -import me.shedaniel.architectury.event.Event; -import me.shedaniel.architectury.event.EventFactory; +import dev.architectury.event.Event; +import dev.architectury.event.EventFactory; +import dev.architectury.event.EventResult; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.network.TextFilter; -import net.minecraft.world.InteractionResult; -import net.minecraft.world.InteractionResultHolder; public interface ChatEvent { /** - * Invoked when server receives a message, equivalent to forge's {@code ServerChatEvent}. + * @see Server#process(ServerPlayer, TextFilter.FilteredText, ChatComponent) */ - Event SERVER = EventFactory.createInteractionResultHolder(); + Event SERVER = EventFactory.createEventResult(); interface Server { - InteractionResult process(ServerPlayer player, TextFilter.FilteredText message, ChatComponent component); + /** + * Invoked when the server receives a message from a client. + * Equivalent to Forge's {@code ServerChatEvent} event. + * + * @param player The player who has sent the message. + * @param message The raw message itself. + * @param component The message as component. + * @return A {@link EventResult} determining the outcome of the event, + * the execution of the vanilla message may be cancelled by the result. + */ + EventResult process(ServerPlayer player, TextFilter.FilteredText message, ChatComponent component); } interface ChatComponent { Component getRaw(); Component getFiltered(); - + void setRaw(Component raw); - + void setFiltered(Component filtered); } } diff --git a/common/src/main/java/dev/architectury/event/events/common/ChunkEvent.java b/common/src/main/java/dev/architectury/event/events/common/ChunkEvent.java new file mode 100644 index 00000000..d26c492a --- /dev/null +++ b/common/src/main/java/dev/architectury/event/events/common/ChunkEvent.java @@ -0,0 +1,64 @@ +/* + * This file is part of architectury. + * Copyright (C) 2020, 2021 architectury + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package dev.architectury.event.events.common; + +import dev.architectury.event.Event; +import dev.architectury.event.EventFactory; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.chunk.ChunkAccess; +import org.jetbrains.annotations.Nullable; + +public interface ChunkEvent { + /** + * @see SaveData#save(ChunkAccess, ServerLevel, CompoundTag) + */ + Event SAVE_DATA = EventFactory.createLoop(); + /** + * @see LoadData#load(ChunkAccess, ServerLevel, CompoundTag) + */ + Event LOAD_DATA = EventFactory.createLoop(); + + interface SaveData { + /** + * Invoked when a chunk's data is saved, just before the data is written. + * Add your own data to the {@link CompoundTag} parameter to get your data saved as well. + * Equivalent to Forge's {@code ChunkDataEvent.Save}. + * + * @param chunk The chunk that is saved. + * @param level The level the chunk is in. + * @param nbt The chunk data that is written to the save file. + */ + void save(ChunkAccess chunk, ServerLevel level, CompoundTag nbt); + } + + interface LoadData { + /** + * Invoked just before a chunk's data is fully read. + * You can read out your own data from the {@link CompoundTag} parameter, when you have saved one before. + * Equivalent to Forge's {@code ChunkDataEvent.Load}. + * + * @param chunk The chunk that is loaded. + * @param level The level the chunk is in, may be {@code null}. + * @param nbt The chunk data that was read from the save file. + */ + void load(ChunkAccess chunk, @Nullable ServerLevel level, CompoundTag nbt); + } +} diff --git a/common/src/main/java/me/shedaniel/architectury/event/events/CommandPerformEvent.java b/common/src/main/java/dev/architectury/event/events/common/CommandPerformEvent.java similarity index 59% rename from common/src/main/java/me/shedaniel/architectury/event/events/CommandPerformEvent.java rename to common/src/main/java/dev/architectury/event/events/common/CommandPerformEvent.java index 5e505df0..1257cc7a 100644 --- a/common/src/main/java/me/shedaniel/architectury/event/events/CommandPerformEvent.java +++ b/common/src/main/java/dev/architectury/event/events/common/CommandPerformEvent.java @@ -17,43 +17,65 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.event.events; +package dev.architectury.event.events.common; import com.mojang.brigadier.ParseResults; -import me.shedaniel.architectury.event.Actor; -import me.shedaniel.architectury.event.Event; -import me.shedaniel.architectury.event.EventFactory; +import dev.architectury.event.Event; +import dev.architectury.event.EventActor; +import dev.architectury.event.EventFactory; import net.minecraft.commands.CommandSourceStack; import org.jetbrains.annotations.Nullable; +/** + * This event is invoked whenever a command is issued. + * The {@link ParseResults} can be modified and even a custom {@link Throwable} can be used to tell the source of failure. + * + *

A command fails when any other result than {@link net.minecraft.world.InteractionResult#PASS} is returned. + * When PASS is used, the {@link CommandPerformEvent#getResults()} is used for execution. + * + *

Equivalent to Forge's {@code CommandEvent} event. + */ public class CommandPerformEvent { - /** - * Invoked after server parses a command but before server executes it, equivalent to forge's {@code CommandEvent}. - */ - public static final Event> EVENT = EventFactory.createActorLoop(); + public static final Event> EVENT = EventFactory.createEventActorLoop(); private ParseResults results; @Nullable private Throwable throwable; + /** + * @param results The initial used parsed results. + * @param throwable The initial used throwable. + */ public CommandPerformEvent(ParseResults results, @Nullable Throwable throwable) { this.results = results; this.throwable = throwable; } + /** + * @return The parsed results for the issued command. + */ public ParseResults getResults() { return results; } + /** + * @param results The new results the command should use. + */ public void setResults(ParseResults results) { this.results = results; } + /** + * @return An throwable to be used as why the command has failed. + */ @Nullable public Throwable getThrowable() { return throwable; } + /** + * @param throwable The throwable used when the command has failed. + */ public void setThrowable(@Nullable Throwable throwable) { this.throwable = throwable; } diff --git a/common/src/main/java/me/shedaniel/architectury/event/events/CommandRegistrationEvent.java b/common/src/main/java/dev/architectury/event/events/common/CommandRegistrationEvent.java similarity index 68% rename from common/src/main/java/me/shedaniel/architectury/event/events/CommandRegistrationEvent.java rename to common/src/main/java/dev/architectury/event/events/common/CommandRegistrationEvent.java index cc36daa1..3c9ac31f 100644 --- a/common/src/main/java/me/shedaniel/architectury/event/events/CommandRegistrationEvent.java +++ b/common/src/main/java/dev/architectury/event/events/common/CommandRegistrationEvent.java @@ -17,19 +17,26 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.event.events; +package dev.architectury.event.events.common; import com.mojang.brigadier.CommandDispatcher; -import me.shedaniel.architectury.event.Event; -import me.shedaniel.architectury.event.EventFactory; +import dev.architectury.event.Event; +import dev.architectury.event.EventFactory; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; public interface CommandRegistrationEvent { /** - * Invoked after server registers its commands, equivalent to forge's {@code RegisterCommandsEvent} and fabric's {@code CommandRegistrationCallback}. + * @see CommandRegistrationEvent#register(CommandDispatcher, Commands.CommandSelection) */ Event EVENT = EventFactory.createLoop(); + /** + * This event is invoked after the server registers it's commands. + * Equivalent to Forge's {@code RegisterCommandsEvent} and Fabric's {@code CommandRegistrationCallback}. + * + * @param dispatcher The command dispatcher to register commands to. + * @param selection The selection where the command can be executed. + */ void register(CommandDispatcher dispatcher, Commands.CommandSelection selection); } diff --git a/common/src/main/java/dev/architectury/event/events/common/EntityEvent.java b/common/src/main/java/dev/architectury/event/events/common/EntityEvent.java new file mode 100644 index 00000000..ea9bb4ba --- /dev/null +++ b/common/src/main/java/dev/architectury/event/events/common/EntityEvent.java @@ -0,0 +1,133 @@ +/* + * This file is part of architectury. + * Copyright (C) 2020, 2021 architectury + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package dev.architectury.event.events.common; + +import dev.architectury.event.Event; +import dev.architectury.event.EventFactory; +import dev.architectury.event.EventResult; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.MobSpawnType; +import net.minecraft.world.level.BaseSpawner; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import org.jetbrains.annotations.Nullable; + +public interface EntityEvent { + /** + * @see LivingDeath#die(LivingEntity, DamageSource) + */ + Event LIVING_DEATH = EventFactory.createEventResult(); + /** + * @see LivingHurt#hurt(LivingEntity, DamageSource, float) + */ + Event LIVING_HURT = EventFactory.createEventResult(); + /** + * @see LivingCheckSpawn#canSpawn(LivingEntity, LevelAccessor, double, double, double, MobSpawnType, BaseSpawner) + */ + Event LIVING_CHECK_SPAWN = EventFactory.createEventResult(); + /** + * @see Add#add(Entity, Level) + */ + Event ADD = EventFactory.createEventResult(); + /** + * @see EnterSection#enterSection(Entity, int, int, int, int, int, int) + */ + Event ENTER_SECTION = EventFactory.createLoop(); + + interface LivingDeath { + /** + * Invoked before a living entity dies. + * Equivalent to Forge's {@code LivingDeathEvent} event. + * + * @param entity The entity that is about to die. + * @param source The source of damage triggering the death. + * @return A {@link EventResult} determining the outcome of the event, + * the execution of the entity death may be cancelled by the result. + */ + EventResult die(LivingEntity entity, DamageSource source); + } + + interface LivingHurt { + /** + * Invoked before an entity is hurt by a damage source. + * Equivalent to Forge's {@code LivingAttackEvent} event. + * + *

You currently cannot override the amount of damage the entity receives. + * + * @param entity The entity that is attacked. + * @param source The reason why the entity takes damage. + * @param amount The amount of damage the entity takes. + * @return A {@link EventResult} determining the outcome of the event, + * the execution of the entity attack may be cancelled by the result. + */ + EventResult hurt(LivingEntity entity, DamageSource source, float amount); + } + + interface LivingCheckSpawn { + /** + * Invoked before an entity is spawned into the world. + * This specifically concerns spawning through either a {@link BaseSpawner} or during world generation. + * Equivalent to Forge's {@code LivingSpawnEvent.CheckSpawn} event. + * + * @param entity The entity that is about to spawn. + * @param world The level the entity wants to spawn in. + * @param x The x-coordinate of the spawn position. + * @param y The y-coordinate of the spawn position. + * @param z The z-coordinate the spawn position. + * @param type The source of spawning. + * @param spawner The spawner. Can be {@code null}. + * @return A {@link InteractionResultHolder} determining the outcome of the event, + * if an outcome is set, the vanilla result is overridden. + */ + EventResult canSpawn(LivingEntity entity, LevelAccessor world, double x, double y, double z, MobSpawnType type, @Nullable BaseSpawner spawner); + } + + interface Add { + /** + * Invoked when an entity is about to be added to the world. + * Equivalent to Forge's {@code EntityJoinWorldEvent} event. + * + * @param entity The entity to add to the level. + * @param world The level the entity is added to. + * @return A {@link EventResult} determining the outcome of the event, + * the execution of the entity addition may be cancelled by the result. + */ + EventResult add(Entity entity, Level world); + } + + interface EnterSection { + /** + * Invoked whenever an entity enters a chunk. + * Equivalent to Forge's {@code EnteringChunk} event. + * + * @param entity The entity moving to a different chunk. + * @param sectionX The chunk x-coordinate. + * @param sectionY The chunk y-coordinate. + * @param sectionZ The chunk z-coordinate. + * @param prevX The previous chunk x-coordinate. + * @param prevY The previous chunk y-coordinate. + * @param prevZ The previous chunk z-coordinate. + */ + void enterSection(Entity entity, int sectionX, int sectionY, int sectionZ, int prevX, int prevY, int prevZ); + } +} diff --git a/common/src/main/java/dev/architectury/event/events/common/ExplosionEvent.java b/common/src/main/java/dev/architectury/event/events/common/ExplosionEvent.java new file mode 100644 index 00000000..438bf70b --- /dev/null +++ b/common/src/main/java/dev/architectury/event/events/common/ExplosionEvent.java @@ -0,0 +1,65 @@ +/* + * This file is part of architectury. + * Copyright (C) 2020, 2021 architectury + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package dev.architectury.event.events.common; + +import dev.architectury.event.Event; +import dev.architectury.event.EventFactory; +import dev.architectury.event.EventResult; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.level.Explosion; +import net.minecraft.world.level.Level; + +import java.util.List; + +public interface ExplosionEvent { + /** + * @see Pre#explode(Level, Explosion) + */ + Event

 PRE = EventFactory.createEventResult();
+    /**
+     * @see Detonate#explode(Level, Explosion, List)
+     */
+    Event DETONATE = EventFactory.createLoop();
+    
+    interface Pre {
+        /**
+         * Invoked before an explosion happens.
+         * Equivalent to Forge's {@code ExplosionEvent.Start} event.
+         *
+         * @param level     The level the explosion is happening in.
+         * @param explosion The explosion.
+         * @return A {@link EventResult} determining the outcome of the event,
+         * the execution of the vanilla explosion may be cancelled by the result.
+         */
+        EventResult explode(Level level, Explosion explosion);
+    }
+    
+    interface Detonate {
+        /**
+         * Invoked when an explosion is detonating.
+         * Equivalent to Forge's {@code ExplosionEvent.Detonate} event.
+         *
+         * @param level            The level the explosion happens in.
+         * @param explosion        The explosion happening.
+         * @param affectedEntities The entities affected by the explosion.
+         */
+        void explode(Level level, Explosion explosion, List affectedEntities);
+    }
+}
diff --git a/common/src/main/java/dev/architectury/event/events/common/InteractionEvent.java b/common/src/main/java/dev/architectury/event/events/common/InteractionEvent.java
new file mode 100644
index 00000000..4bd01a7b
--- /dev/null
+++ b/common/src/main/java/dev/architectury/event/events/common/InteractionEvent.java
@@ -0,0 +1,161 @@
+/*
+ * This file is part of architectury.
+ * Copyright (C) 2020, 2021 architectury
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+package dev.architectury.event.events.common;
+
+import dev.architectury.event.CompoundEventResult;
+import dev.architectury.event.Event;
+import dev.architectury.event.EventFactory;
+import dev.architectury.event.EventResult;
+import net.minecraft.core.BlockPos;
+import net.minecraft.core.Direction;
+import net.minecraft.world.InteractionHand;
+import net.minecraft.world.entity.Entity;
+import net.minecraft.world.entity.player.Player;
+import net.minecraft.world.item.ItemStack;
+import net.minecraft.world.level.Level;
+import net.minecraft.world.level.block.state.BlockState;
+
+public interface InteractionEvent {
+    /**
+     * @see LeftClickBlock#click(Player, InteractionHand, BlockPos, Direction)
+     */
+    Event LEFT_CLICK_BLOCK = EventFactory.createEventResult();
+    /**
+     * @see RightClickBlock#click(Player, InteractionHand, BlockPos, Direction)
+     */
+    Event RIGHT_CLICK_BLOCK = EventFactory.createEventResult();
+    /**
+     * @see RightClickItem#click(Player, InteractionHand)
+     */
+    Event RIGHT_CLICK_ITEM = EventFactory.createCompoundEventResult();
+    /**
+     * @see ClientLeftClickAir#click(Player, InteractionHand)
+     */
+    Event CLIENT_LEFT_CLICK_AIR = EventFactory.createLoop();
+    /**
+     * @see ClientRightClickAir#click(Player, InteractionHand)
+     */
+    Event CLIENT_RIGHT_CLICK_AIR = EventFactory.createLoop();
+    /**
+     * @see InteractEntity#interact(Player, Entity, InteractionHand)
+     */
+    Event INTERACT_ENTITY = EventFactory.createEventResult();
+    /**
+     * @see FarmlandTrample#trample(Level, BlockPos, BlockState, float, Entity)
+     */
+    Event FARMLAND_TRAMPLE = EventFactory.createEventResult();
+    
+    interface RightClickBlock {
+        /**
+         * Invoked whenever a player right clicks a block.
+         * Equivalent to Forge's {@code PlayerInteractEvent.RightClickBlock} event and Fabric's {@code UseBlockCallback}.
+         *
+         * @param player The player right clicking the block.
+         * @param hand   The hand that is used.
+         * @param pos    The position of the block in the level.
+         * @param face   The face of the block clicked.
+         * @return A {@link EventResult} determining the outcome of the event,
+         * the action may be cancelled by the result.
+         */
+        EventResult click(Player player, InteractionHand hand, BlockPos pos, Direction face);
+    }
+    
+    interface LeftClickBlock {
+        /**
+         * Invoked whenever a player left clicks a block.
+         * Equivalent to Forge's {@code PlayerInteractEvent.LeftClickBlock} event and Fabric's {@code AttackBlockCallback}.
+         *
+         * @param player The player left clicking the block.
+         * @param hand   The hand that is used.
+         * @param pos    The position of the block in the level. Use {@link Player#getCommandSenderWorld()} to get the level.
+         * @param face   The face of the block clicked.
+         * @return A {@link EventResult} determining the outcome of the event,
+         * the action may be cancelled by the result.
+         */
+        EventResult click(Player player, InteractionHand hand, BlockPos pos, Direction face);
+    }
+    
+    interface RightClickItem {
+        /**
+         * Invoked whenever a player uses an item on a block.
+         * Equivalent to Forge's {@code PlayerInteractEvent.RightClickItem} event and Fabric's {@code UseItemCallback}.
+         *
+         * @param player The player right clicking the block.
+         * @param hand   The hand that is used.
+         * @return A {@link EventResult} determining the outcome of the event,
+         * the action may be cancelled by the result.
+         */
+        CompoundEventResult click(Player player, InteractionHand hand);
+    }
+    
+    interface ClientRightClickAir {
+        /**
+         * Invoked whenever a player right clicks the air.
+         * This only occurs on the client.
+         * Equivalent to Forge's {@code PlayerInteractEvent.RightClickEmpty} event.
+         *
+         * @param player The player. Always {@link net.minecraft.client.player.LocalPlayer}
+         * @param hand   The hand used.
+         */
+        void click(Player player, InteractionHand hand);
+    }
+    
+    interface ClientLeftClickAir {
+        /**
+         * Invoked whenever a player left clicks the air.
+         * This only occurs on the client.
+         * Equivalent to Forge's {@code PlayerInteractEvent.LeftClickEmpty} event.
+         *
+         * @param player The player. Always {@link net.minecraft.client.player.LocalPlayer}
+         * @param hand   The hand used.
+         */
+        void click(Player player, InteractionHand hand);
+    }
+    
+    interface InteractEntity {
+        /**
+         * Invoked whenever a player right clicks an entity.
+         * Equivalent to Forge's {@code PlayerInteractEvent.EntityInteract} event.
+         *
+         * @param player The player clicking the entity.
+         * @param entity Then entity the player clicks.
+         * @param hand   The used hand.
+         * @return A {@link EventResult} determining the outcome of the event,
+         * the action may be cancelled by the result.
+         */
+        EventResult interact(Player player, Entity entity, InteractionHand hand);
+    }
+    
+    interface FarmlandTrample {
+        /**
+         * Invoked when an entity attempts to trample farmland.
+         * Equivalent to Forge's {@code BlockEvent.FarmlandTrampleEvent} event.
+         *
+         * @param world    The level where the block and the player are located in.
+         * @param pos      The position of the block.
+         * @param state    The state of the block.
+         * @param distance The distance of the player to the block.
+         * @param entity   The entity trampling.
+         * @return A {@link EventResult} determining the outcome of the event,
+         * the action may be cancelled by the result.
+         */
+        EventResult trample(Level world, BlockPos pos, BlockState state, float distance, Entity entity);
+    }
+}
diff --git a/common/src/main/java/dev/architectury/event/events/common/LifecycleEvent.java b/common/src/main/java/dev/architectury/event/events/common/LifecycleEvent.java
new file mode 100644
index 00000000..8a7ed49a
--- /dev/null
+++ b/common/src/main/java/dev/architectury/event/events/common/LifecycleEvent.java
@@ -0,0 +1,115 @@
+/*
+ * This file is part of architectury.
+ * Copyright (C) 2020, 2021 architectury
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+package dev.architectury.event.events.common;
+
+import dev.architectury.event.Event;
+import dev.architectury.event.EventFactory;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.level.ServerLevel;
+import net.minecraft.world.level.Level;
+
+public interface LifecycleEvent {
+    /**
+     * Invoked before initial server startup. This is the earliest point at which the server will be available.
+     * Equivalent to Forge's {@code FMLServerAboutToStartEvent} event and
+     * Fabric's {@code ServerLifecycleEvents#SERVER_STARTING}.
+     *
+     * @see ServerState#stateChanged(Object)
+     */
+    Event SERVER_BEFORE_START = EventFactory.createLoop();
+    /**
+     * Invoked during server startup.
+     * Equivalent to Forge's {@code FMLServerStartingEvent} event.
+     *
+     * @see ServerState#stateChanged(Object)
+     */
+    Event SERVER_STARTING = EventFactory.createLoop();
+    /**
+     * Invoked when the server has started and is ready to accept players.
+     * Equivalent to Forge's {@code FMLServerStartedEvent} event
+     * and Fabric's {@code ServerLifecycleEvents#SERVER_STARTED}.
+     *
+     * @see ServerState#stateChanged(Object)
+     */
+    Event SERVER_STARTED = EventFactory.createLoop();
+    /**
+     * Invoked when the server begins shutting down.
+     * Equivalent to Forge's {@code FMLServerStoppingEvent} event and
+     * Fabric's {@code ServerLifecycleEvents#SERVER_STOPPING}.
+     *
+     * @see ServerState#stateChanged(Object)
+     */
+    Event SERVER_STOPPING = EventFactory.createLoop();
+    /**
+     * Invoked when the server has finished stopping, and is about to fully shut down.
+     * Equivalent to Forge's {@code FMLServerStoppedEvent} event and
+     * Fabric's {@code ServerLifecycleEvents#SERVER_STOPPED}.
+     *
+     * @see ServerState#stateChanged(Object)
+     */
+    Event SERVER_STOPPED = EventFactory.createLoop();
+    /**
+     * Invoked when a level is loaded on the server-side.
+     * Equivalent to Forge's {@code WorldEvent.Load} event (on server)
+     * and Fabric's {@code ServerWorldEvents#LOAD}.
+     *
+     * @see ServerLevelState#act(Level)
+     */
+    Event SERVER_LEVEL_LOAD = EventFactory.createLoop();
+    /**
+     * Invoked when a level is unloaded on the server-side.
+     * Equivalent to Forge's {@code WorldEvent.Unload} event (on server)
+     * and Fabric's {@code ServerWorldEvents#UNLOAD}.
+     *
+     * @see ServerLevelState#act(Level)
+     */
+    Event SERVER_LEVEL_UNLOAD = EventFactory.createLoop();
+    /**
+     * Invoked when the level is being saved.
+     * Equivalent to Forge's {@code WorldEvent.Save} event.
+     *
+     * @see ServerLevelState#act(Level)
+     */
+    Event SERVER_LEVEL_SAVE = EventFactory.createLoop();
+    
+    interface InstanceState {
+        /**
+         * Parent event type for any events that are invoked on instance state change.
+         *
+         * @param instance The changed state.
+         */
+        void stateChanged(T instance);
+    }
+    
+    interface ServerState extends InstanceState {
+    }
+    
+    interface LevelState {
+        /**
+         * Parent event type for any events that are invoked on world state change.
+         *
+         * @param world The world that has changed.
+         */
+        void act(T world);
+    }
+    
+    interface ServerLevelState extends LevelState {
+    }
+}
diff --git a/common/src/main/java/me/shedaniel/architectury/event/events/LightningEvent.java b/common/src/main/java/dev/architectury/event/events/common/LightningEvent.java
similarity index 63%
rename from common/src/main/java/me/shedaniel/architectury/event/events/LightningEvent.java
rename to common/src/main/java/dev/architectury/event/events/common/LightningEvent.java
index e5a6dfcb..679d4a90 100644
--- a/common/src/main/java/me/shedaniel/architectury/event/events/LightningEvent.java
+++ b/common/src/main/java/dev/architectury/event/events/common/LightningEvent.java
@@ -17,10 +17,10 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.event.events;
+package dev.architectury.event.events.common;
 
-import me.shedaniel.architectury.event.Event;
-import me.shedaniel.architectury.event.EventFactory;
+import dev.architectury.event.Event;
+import dev.architectury.event.EventFactory;
 import net.minecraft.world.entity.Entity;
 import net.minecraft.world.entity.LightningBolt;
 import net.minecraft.world.level.Level;
@@ -30,16 +30,22 @@ import java.util.List;
 
 public interface LightningEvent {
     
-    // TODO Pre - Called before a lightning bolt entity is added to the world. (cancellable)
+    // TODO Pre - Invoked before a lightning bolt entity is added to the world. (cancellable)
     /**
-     * Invoked after the lightning has gathered a list of entities to strike.
-     * Remove entities from the list to stop them from being hit.
+     * @see Strike#onStrike(LightningBolt, Level, Vec3, List)
      */
     Event STRIKE = EventFactory.createLoop();
-    // TODO Post - Called before a lightning bolt entity is removed from the world.
+    // TODO Post - Invoked before a lightning bolt entity is removed from the world.
     
     interface Strike {
+        /**
+         * Invoked after the lightning has gathered a list of entities to strike.
+         *
+         * @param bolt     The lightning bolt.
+         * @param level    The level the lighting is spawned in.
+         * @param pos      The position the lightning strikes.
+         * @param toStrike A list of all entities the lightning affects.
+         */
         void onStrike(LightningBolt bolt, Level level, Vec3 pos, List toStrike);
     }
-    
 }
diff --git a/common/src/main/java/dev/architectury/event/events/common/PlayerEvent.java b/common/src/main/java/dev/architectury/event/events/common/PlayerEvent.java
new file mode 100644
index 00000000..ffa8e414
--- /dev/null
+++ b/common/src/main/java/dev/architectury/event/events/common/PlayerEvent.java
@@ -0,0 +1,265 @@
+/*
+ * This file is part of architectury.
+ * Copyright (C) 2020, 2021 architectury
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+package dev.architectury.event.events.common;
+
+import dev.architectury.event.CompoundEventResult;
+import dev.architectury.event.Event;
+import dev.architectury.event.EventFactory;
+import dev.architectury.event.EventResult;
+import net.minecraft.advancements.Advancement;
+import net.minecraft.resources.ResourceKey;
+import net.minecraft.server.level.ServerPlayer;
+import net.minecraft.world.Container;
+import net.minecraft.world.entity.item.ItemEntity;
+import net.minecraft.world.entity.player.Player;
+import net.minecraft.world.inventory.AbstractContainerMenu;
+import net.minecraft.world.item.ItemStack;
+import net.minecraft.world.level.Level;
+import net.minecraft.world.phys.HitResult;
+import org.jetbrains.annotations.Nullable;
+
+public interface PlayerEvent {
+    /**
+     * @see PlayerJoin#join(ServerPlayer)
+     */
+    Event PLAYER_JOIN = EventFactory.createLoop();
+    /**
+     * @see PlayerQuit#quit(ServerPlayer)
+     */
+    Event PLAYER_QUIT = EventFactory.createLoop();
+    /**
+     * @see PlayerRespawn#respawn(ServerPlayer, boolean)
+     */
+    Event PLAYER_RESPAWN = EventFactory.createLoop();
+    /**
+     * @see PlayerAdvancement#award(ServerPlayer, Advancement)
+     */
+    Event PLAYER_ADVANCEMENT = EventFactory.createLoop();
+    /**
+     * @see PlayerClone#clone(ServerPlayer, ServerPlayer, boolean)
+     */
+    Event PLAYER_CLONE = EventFactory.createLoop();
+    /**
+     * @see CraftItem#craft(Player, ItemStack, Container)
+     */
+    Event CRAFT_ITEM = EventFactory.createLoop();
+    /**
+     * @see SmeltItem#smelt(Player, ItemStack)
+     */
+    Event SMELT_ITEM = EventFactory.createLoop();
+    /**
+     * @see PickupItemPredicate#canPickup(Player, ItemEntity, ItemStack)
+     */
+    Event PICKUP_ITEM_PRE = EventFactory.createEventResult();
+    /**
+     * @see PickupItem#pickup(Player, ItemEntity, ItemStack)
+     */
+    Event PICKUP_ITEM_POST = EventFactory.createLoop();
+    /**
+     * @see ChangeDimension#change(ServerPlayer, ResourceKey, ResourceKey)
+     */
+    Event CHANGE_DIMENSION = EventFactory.createLoop();
+    /**
+     * @see DropItem#drop(Player, ItemEntity)
+     */
+    Event DROP_ITEM = EventFactory.createEventResult();
+    /**
+     * @see OpenMenu#open(Player, AbstractContainerMenu)
+     */
+    Event OPEN_MENU = EventFactory.createLoop();
+    /**
+     * @see CloseMenu#close(Player, AbstractContainerMenu)
+     */
+    Event CLOSE_MENU = EventFactory.createLoop();
+    /**
+     * @see FillBucket#fill(Player, Level, ItemStack, HitResult)
+     */
+    Event FILL_BUCKET = EventFactory.createCompoundEventResult();
+    
+    interface PlayerJoin {
+        /**
+         * Invoked after a player joined a server level.
+         * Equivalent to Forge's {@code PlayerLoggedInEvent} event.
+         *
+         * @param player The joined player.
+         */
+        void join(ServerPlayer player);
+    }
+    
+    interface PlayerQuit {
+        /**
+         * Invoked after a player logged out of a server level.
+         * Equivalent to Forge's {@code PlayerLoggedOutEvent} event.
+         *
+         * @param player The now logged out player.
+         */
+        void quit(ServerPlayer player);
+    }
+    
+    interface PlayerRespawn {
+        /**
+         * Invoked when a player is respawned (e.g. changing dimension).
+         * Equivalent to Forge's {@code PlayerRespawnEvent} event.
+         * To manipulate the player use {@link PlayerClone#clone(ServerPlayer, ServerPlayer, boolean)}.
+         *
+         * @param newPlayer    The respawned player.
+         * @param conqueredEnd Whether the player has conquered the end. This is true when the player joined the end and now is leaving it. {@link ServerPlayer#wonGame}
+         */
+        void respawn(ServerPlayer newPlayer, boolean conqueredEnd);
+    }
+    
+    interface PlayerClone {
+        /**
+         * Invoked when a player respawns.
+         * This can be used to manipulate the new player.
+         * Equivalent to Forge's {@code PlayerEvent.Clone} event.
+         *
+         * @param oldPlayer The old player.
+         * @param newPlayer The new player.
+         * @param wonGame   This is true when the player joined the end and now is leaving it. {@link ServerPlayer#wonGame}
+         */
+        void clone(ServerPlayer oldPlayer, ServerPlayer newPlayer, boolean wonGame);
+    }
+    
+    interface PlayerAdvancement {
+        /**
+         * Invoked when a player gets an advancement.
+         * Equivalent to Forge's {@code AdvancementEvent} event.
+         *
+         * @param player      The player who got the advancement.
+         * @param advancement The advancement the player got.
+         */
+        void award(ServerPlayer player, Advancement advancement);
+    }
+    
+    interface CraftItem {
+        /**
+         * Invoked when a player crafts an item.
+         * Equivalent to Forge's {@code ItemCraftedEvent} event.
+         * This only applies for the vanilla crafting table (or any crafting table using the {@link net.minecraft.world.inventory.ResultSlot}) and
+         * the player inventory crafting grid.
+         * This is invoked when the player takes something out of the result slot.
+         *
+         * @param player      The player.
+         * @param constructed The ItemStack that has been crafted.
+         * @param inventory   The inventory of the constructor.
+         */
+        void craft(Player player, ItemStack constructed, Container inventory);
+    }
+    
+    interface SmeltItem {
+        /**
+         * Invoked when a player smelts an item.
+         * Equivalent to Forge's {@code ItemSmeltedEvent} event.
+         * This is invoked when the player takes the stack out of the output slot.
+         *
+         * @param player  The player.
+         * @param smelted The smelt result.
+         */
+        void smelt(Player player, ItemStack smelted);
+    }
+    
+    interface PickupItemPredicate {
+        /**
+         * Invoked when a player tries to pickup an {@link ItemEntity}.
+         * Equivalent to Forge's {@code EntityItemPickupEvent} event.
+         *
+         * @param player The player picking up.
+         * @param entity The {@link ItemEntity} that the player tries to pick up.
+         * @param stack  The content of the {@link ItemEntity}.
+         * @return A {@link EventResult} determining the outcome of the event,
+         * the execution of the pickup may be cancelled by the result.
+         */
+        EventResult canPickup(Player player, ItemEntity entity, ItemStack stack);
+    }
+    
+    interface PickupItem {
+        /**
+         * Invoked when a player has picked up an {@link ItemEntity}.
+         * Equivalent to Forge's {@code ItemPickupEvent} event.
+         *
+         * @param player The player.
+         * @param entity The {@link ItemEntity} that the player picked up.
+         * @param stack  The content of the {@link ItemEntity}.
+         */
+        void pickup(Player player, ItemEntity entity, ItemStack stack);
+    }
+    
+    interface ChangeDimension {
+        /**
+         * Invoked when a player changes their dimension.
+         * Equivalent to Forge's {@code PlayerChangedDimensionEvent} event.
+         *
+         * @param player   The teleporting player.
+         * @param oldLevel The level the player comes from.
+         * @param newLevel The level the player teleports into.
+         */
+        void change(ServerPlayer player, ResourceKey oldLevel, ResourceKey newLevel);
+    }
+    
+    interface DropItem {
+        /**
+         * Invoked when a player drops an item.
+         * Equivalent to Forge's {@code ItemTossEvent} event.
+         *
+         * @param player The player dropping something.
+         * @param entity The entity that has spawned when the player dropped a ItemStack.
+         * @return A {@link EventResult} determining the outcome of the event,
+         * the execution of the drop may be cancelled by the result.
+         */
+        EventResult drop(Player player, ItemEntity entity);
+    }
+    
+    interface OpenMenu {
+        /**
+         * Invoked when a player opens a menu.
+         * Equivalent to Forge's {@code PlayerContainerEvent.Open} event.
+         *
+         * @param player The player opening the menu.
+         * @param menu   The menu that is opened.
+         */
+        void open(Player player, AbstractContainerMenu menu);
+    }
+    
+    interface CloseMenu {
+        /**
+         * Invoked when a player closes a menu.
+         * Equivalent to Forge's {@code PlayerContainerEvent.Close} event.
+         *
+         * @param player The player closing the menu.
+         * @param menu   The menu that is closed.
+         */
+        void close(Player player, AbstractContainerMenu menu);
+    }
+    
+    interface FillBucket {
+        /**
+         * Invoked when a player attempts to fill a bucket using right-click.
+         * You can return a non-PASS interaction result to cancel further processing by other mods.
+         *
+         * @param player The player filling the bucket.
+         * @param level  The level the player is in.
+         * @param stack  The bucket stack.
+         * @param target The target which the player has aimed at.
+         * @return A {@link CompoundEventResult} determining the outcome of the event.
+         */
+        CompoundEventResult fill(Player player, Level level, ItemStack stack, @Nullable HitResult target);
+    }
+}
diff --git a/common/src/main/java/dev/architectury/event/events/common/TickEvent.java b/common/src/main/java/dev/architectury/event/events/common/TickEvent.java
new file mode 100644
index 00000000..49ed5dad
--- /dev/null
+++ b/common/src/main/java/dev/architectury/event/events/common/TickEvent.java
@@ -0,0 +1,90 @@
+/*
+ * This file is part of architectury.
+ * Copyright (C) 2020, 2021 architectury
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+package dev.architectury.event.events.common;
+
+import dev.architectury.event.Event;
+import dev.architectury.event.EventFactory;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.level.ServerLevel;
+import net.minecraft.world.level.Level;
+
+public interface TickEvent {
+    /**
+     * Invoked before a server tick is processed.
+     * Equivalent to Forge's {@code ServerTickEvent} event in the START Phase.
+     *
+     * @see #tick(Object)
+     */
+    Event SERVER_PRE = EventFactory.createLoop();
+    /**
+     * Invoked after a server tick has been processed.
+     * Equivalent to Forge's {@code ServerTickEvent} event in the END Phase.
+     *
+     * @see #tick(Object)
+     */
+    Event SERVER_POST = EventFactory.createLoop();
+    /**
+     * Invoked before a server level tick is processed.
+     * Equivalent to Forge's {@code WorldTickEvent} event in the START Phase.
+     *
+     * @see #tick(Object)
+     */
+    Event SERVER_LEVEL_PRE = EventFactory.createLoop();
+    /**
+     * Invoked after a server level tick has been processed.
+     * Equivalent to Forge's {@code WorldTickEvent} event in the END Phase.
+     *
+     * @see #tick(Object)
+     */
+    Event SERVER_LEVEL_POST = EventFactory.createLoop();
+    /**
+     * Invoked before a player tick is processed.
+     * Equivalent to Forge's {@code PlayerTickEvent} event in the START Phase.
+     *
+     * @see #tick(Object)
+     */
+    Event PLAYER_PRE = EventFactory.createLoop();
+    /**
+     * Invoked after a player tick has been processed.
+     * Equivalent to Forge's {@code PlayerTickEvent} event in the END Phase.
+     *
+     * @see #tick(Object)
+     */
+    Event PLAYER_POST = EventFactory.createLoop();
+    
+    /**
+     * Callback method for tick events.
+     *
+     * @param instance The object ticking.
+     */
+    void tick(T instance);
+    
+    interface Server extends TickEvent {
+    }
+    
+    interface LevelTick extends TickEvent {
+    }
+    
+    interface ServerLevelTick extends LevelTick {
+    }
+    
+    interface Player extends TickEvent {
+    }
+}
diff --git a/common/src/main/java/me/shedaniel/architectury/extensions/BlockEntityExtension.java b/common/src/main/java/dev/architectury/extensions/BlockEntityExtension.java
similarity index 94%
rename from common/src/main/java/me/shedaniel/architectury/extensions/BlockEntityExtension.java
rename to common/src/main/java/dev/architectury/extensions/BlockEntityExtension.java
index 0f2f12bc..618f4e5b 100644
--- a/common/src/main/java/me/shedaniel/architectury/extensions/BlockEntityExtension.java
+++ b/common/src/main/java/dev/architectury/extensions/BlockEntityExtension.java
@@ -17,9 +17,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.extensions;
+package dev.architectury.extensions;
 
-import me.shedaniel.architectury.hooks.BlockEntityHooks;
+import dev.architectury.hooks.block.BlockEntityHooks;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
 import net.minecraft.nbt.CompoundTag;
diff --git a/common/src/main/java/me/shedaniel/architectury/extensions/ItemExtension.java b/common/src/main/java/dev/architectury/extensions/ItemExtension.java
similarity index 97%
rename from common/src/main/java/me/shedaniel/architectury/extensions/ItemExtension.java
rename to common/src/main/java/dev/architectury/extensions/ItemExtension.java
index 40fa182a..c1fdf673 100644
--- a/common/src/main/java/me/shedaniel/architectury/extensions/ItemExtension.java
+++ b/common/src/main/java/dev/architectury/extensions/ItemExtension.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.extensions;
+package dev.architectury.extensions;
 
 import net.minecraft.world.entity.EquipmentSlot;
 import net.minecraft.world.entity.player.Player;
diff --git a/common/src/main/java/me/shedaniel/architectury/fluid/FluidStack.java b/common/src/main/java/dev/architectury/fluid/FluidStack.java
similarity index 96%
rename from common/src/main/java/me/shedaniel/architectury/fluid/FluidStack.java
rename to common/src/main/java/dev/architectury/fluid/FluidStack.java
index 474193a3..4a5eed4a 100644
--- a/common/src/main/java/me/shedaniel/architectury/fluid/FluidStack.java
+++ b/common/src/main/java/dev/architectury/fluid/FluidStack.java
@@ -17,10 +17,10 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.fluid;
+package dev.architectury.fluid;
 
-import me.shedaniel.architectury.hooks.FluidStackHooks;
-import me.shedaniel.architectury.utils.NbtType;
+import dev.architectury.hooks.fluid.FluidStackHooks;
+import dev.architectury.utils.NbtType;
 import net.minecraft.nbt.CompoundTag;
 import net.minecraft.network.FriendlyByteBuf;
 import net.minecraft.network.chat.Component;
@@ -133,7 +133,7 @@ public final class FluidStack {
     
     public CompoundTag getOrCreateChildTag(String childName) {
         getOrCreateTag();
-        CompoundTag child = tag.getCompound(childName);
+        var child = tag.getCompound(childName);
         if (!tag.contains(childName, NbtType.COMPOUND)) {
             tag.put(childName, child);
         }
@@ -159,7 +159,7 @@ public final class FluidStack {
     
     @Override
     public final int hashCode() {
-        int code = 1;
+        var code = 1;
         code = 31 * code + getFluid().hashCode();
         code = 31 * code + Long.hashCode(amount);
         if (tag != null)
diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/DyeColorHooks.java b/common/src/main/java/dev/architectury/hooks/DyeColorHooks.java
similarity index 91%
rename from common/src/main/java/me/shedaniel/architectury/hooks/DyeColorHooks.java
rename to common/src/main/java/dev/architectury/hooks/DyeColorHooks.java
index bf70a331..0fcc98a9 100644
--- a/common/src/main/java/me/shedaniel/architectury/hooks/DyeColorHooks.java
+++ b/common/src/main/java/dev/architectury/hooks/DyeColorHooks.java
@@ -17,9 +17,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.hooks;
+package dev.architectury.hooks;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
+import dev.architectury.injectables.annotations.ExpectPlatform;
 import net.minecraft.world.item.DyeColor;
 
 public class DyeColorHooks {
diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/LevelResourceHooks.java b/common/src/main/java/dev/architectury/hooks/LevelResourceHooks.java
similarity index 96%
rename from common/src/main/java/me/shedaniel/architectury/hooks/LevelResourceHooks.java
rename to common/src/main/java/dev/architectury/hooks/LevelResourceHooks.java
index d47b486a..6a89f836 100644
--- a/common/src/main/java/me/shedaniel/architectury/hooks/LevelResourceHooks.java
+++ b/common/src/main/java/dev/architectury/hooks/LevelResourceHooks.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.hooks;
+package dev.architectury.hooks;
 
 import net.minecraft.world.level.storage.LevelResource;
 
diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/PackRepositoryHooks.java b/common/src/main/java/dev/architectury/hooks/PackRepositoryHooks.java
similarity index 92%
rename from common/src/main/java/me/shedaniel/architectury/hooks/PackRepositoryHooks.java
rename to common/src/main/java/dev/architectury/hooks/PackRepositoryHooks.java
index afb842ce..08f23c6f 100644
--- a/common/src/main/java/me/shedaniel/architectury/hooks/PackRepositoryHooks.java
+++ b/common/src/main/java/dev/architectury/hooks/PackRepositoryHooks.java
@@ -17,9 +17,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.hooks;
+package dev.architectury.hooks;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
+import dev.architectury.injectables.annotations.ExpectPlatform;
 import net.minecraft.server.packs.repository.PackRepository;
 import net.minecraft.server.packs.repository.RepositorySource;
 
diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/BlockEntityHooks.java b/common/src/main/java/dev/architectury/hooks/block/BlockEntityHooks.java
similarity index 91%
rename from common/src/main/java/me/shedaniel/architectury/hooks/BlockEntityHooks.java
rename to common/src/main/java/dev/architectury/hooks/block/BlockEntityHooks.java
index b8720687..7e19bb02 100644
--- a/common/src/main/java/me/shedaniel/architectury/hooks/BlockEntityHooks.java
+++ b/common/src/main/java/dev/architectury/hooks/block/BlockEntityHooks.java
@@ -17,9 +17,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.hooks;
+package dev.architectury.hooks.block;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
+import dev.architectury.injectables.annotations.ExpectPlatform;
 import net.minecraft.world.level.block.entity.BlockEntity;
 
 public class BlockEntityHooks {
diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/screen/ScreenAccess.java b/common/src/main/java/dev/architectury/hooks/client/screen/ScreenAccess.java
similarity index 96%
rename from common/src/main/java/me/shedaniel/architectury/hooks/screen/ScreenAccess.java
rename to common/src/main/java/dev/architectury/hooks/client/screen/ScreenAccess.java
index 034e8e3f..2e78f1b0 100644
--- a/common/src/main/java/me/shedaniel/architectury/hooks/screen/ScreenAccess.java
+++ b/common/src/main/java/dev/architectury/hooks/client/screen/ScreenAccess.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.hooks.screen;
+package dev.architectury.hooks.client.screen;
 
 import net.minecraft.client.gui.components.AbstractWidget;
 import net.minecraft.client.gui.components.Widget;
diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/screen/ScreenHooks.java b/common/src/main/java/dev/architectury/hooks/client/screen/ScreenHooks.java
similarity index 95%
rename from common/src/main/java/me/shedaniel/architectury/hooks/screen/ScreenHooks.java
rename to common/src/main/java/dev/architectury/hooks/client/screen/ScreenHooks.java
index a7c60b81..2e2c05dd 100644
--- a/common/src/main/java/me/shedaniel/architectury/hooks/screen/ScreenHooks.java
+++ b/common/src/main/java/dev/architectury/hooks/client/screen/ScreenHooks.java
@@ -17,9 +17,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.hooks.screen;
+package dev.architectury.hooks.client.screen;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
+import dev.architectury.injectables.annotations.ExpectPlatform;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
 import net.minecraft.client.gui.components.AbstractWidget;
diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/FluidStackHooks.java b/common/src/main/java/dev/architectury/hooks/fluid/FluidStackHooks.java
similarity index 96%
rename from common/src/main/java/me/shedaniel/architectury/hooks/FluidStackHooks.java
rename to common/src/main/java/dev/architectury/hooks/fluid/FluidStackHooks.java
index ce752f15..f167227f 100644
--- a/common/src/main/java/me/shedaniel/architectury/hooks/FluidStackHooks.java
+++ b/common/src/main/java/dev/architectury/hooks/fluid/FluidStackHooks.java
@@ -17,10 +17,10 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.hooks;
+package dev.architectury.hooks.fluid;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
-import me.shedaniel.architectury.fluid.FluidStack;
+import dev.architectury.fluid.FluidStack;
+import dev.architectury.injectables.annotations.ExpectPlatform;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
 import net.minecraft.client.renderer.texture.TextureAtlasSprite;
diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/ItemStackHooks.java b/common/src/main/java/dev/architectury/hooks/item/ItemStackHooks.java
similarity index 86%
rename from common/src/main/java/me/shedaniel/architectury/hooks/ItemStackHooks.java
rename to common/src/main/java/dev/architectury/hooks/item/ItemStackHooks.java
index 95dfbd68..4e8caf5f 100644
--- a/common/src/main/java/me/shedaniel/architectury/hooks/ItemStackHooks.java
+++ b/common/src/main/java/dev/architectury/hooks/item/ItemStackHooks.java
@@ -17,12 +17,11 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.hooks;
+package dev.architectury.hooks.item;
 
 import net.minecraft.server.level.ServerPlayer;
 import net.minecraft.sounds.SoundEvents;
 import net.minecraft.sounds.SoundSource;
-import net.minecraft.world.entity.item.ItemEntity;
 import net.minecraft.world.item.ItemStack;
 
 public final class ItemStackHooks {
@@ -30,16 +29,16 @@ public final class ItemStackHooks {
     }
     
     public static ItemStack copyWithCount(ItemStack stack, int count) {
-        ItemStack copy = stack.copy();
+        var copy = stack.copy();
         copy.setCount(count);
         return copy;
     }
     
     public static void giveItem(ServerPlayer player, ItemStack stack) {
-        boolean bl = player.getInventory().add(stack);
+        var bl = player.getInventory().add(stack);
         if (bl && stack.isEmpty()) {
             stack.setCount(1);
-            ItemEntity entity = player.drop(stack, false);
+            var entity = player.drop(stack, false);
             if (entity != null) {
                 entity.makeFakeItem();
             }
@@ -47,7 +46,7 @@ public final class ItemStackHooks {
             player.level.playSound(null, player.getX(), player.getY(), player.getZ(), SoundEvents.ITEM_PICKUP, SoundSource.PLAYERS, 0.2F, ((player.getRandom().nextFloat() - player.getRandom().nextFloat()) * 0.7F + 1.0F) * 2.0F);
             player.inventoryMenu.broadcastChanges();
         } else {
-            ItemEntity entity = player.drop(stack, false);
+            var entity = player.drop(stack, false);
             if (entity != null) {
                 entity.setNoPickUpDelay();
                 entity.setOwner(player.getUUID());
diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/ExplosionHooks.java b/common/src/main/java/dev/architectury/hooks/level/ExplosionHooks.java
similarity index 94%
rename from common/src/main/java/me/shedaniel/architectury/hooks/ExplosionHooks.java
rename to common/src/main/java/dev/architectury/hooks/level/ExplosionHooks.java
index 74ad3a90..6b04542b 100644
--- a/common/src/main/java/me/shedaniel/architectury/hooks/ExplosionHooks.java
+++ b/common/src/main/java/dev/architectury/hooks/level/ExplosionHooks.java
@@ -17,9 +17,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.hooks;
+package dev.architectury.hooks.level;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
+import dev.architectury.injectables.annotations.ExpectPlatform;
 import net.minecraft.world.entity.Entity;
 import net.minecraft.world.level.Explosion;
 import net.minecraft.world.phys.Vec3;
diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/biome/BiomeHooks.java b/common/src/main/java/dev/architectury/hooks/level/biome/BiomeHooks.java
similarity index 99%
rename from common/src/main/java/me/shedaniel/architectury/hooks/biome/BiomeHooks.java
rename to common/src/main/java/dev/architectury/hooks/level/biome/BiomeHooks.java
index 6c4a6887..d9b3971c 100644
--- a/common/src/main/java/me/shedaniel/architectury/hooks/biome/BiomeHooks.java
+++ b/common/src/main/java/dev/architectury/hooks/level/biome/BiomeHooks.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.hooks.biome;
+package dev.architectury.hooks.level.biome;
 
 import net.minecraft.sounds.Music;
 import net.minecraft.sounds.SoundEvent;
diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/biome/BiomeProperties.java b/common/src/main/java/dev/architectury/hooks/level/biome/BiomeProperties.java
similarity index 97%
rename from common/src/main/java/me/shedaniel/architectury/hooks/biome/BiomeProperties.java
rename to common/src/main/java/dev/architectury/hooks/level/biome/BiomeProperties.java
index fcba9cf0..cdc7e034 100644
--- a/common/src/main/java/me/shedaniel/architectury/hooks/biome/BiomeProperties.java
+++ b/common/src/main/java/dev/architectury/hooks/level/biome/BiomeProperties.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.hooks.biome;
+package dev.architectury.hooks.level.biome;
 
 import net.minecraft.world.level.biome.Biome.BiomeCategory;
 
diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/biome/ClimateProperties.java b/common/src/main/java/dev/architectury/hooks/level/biome/ClimateProperties.java
similarity index 96%
rename from common/src/main/java/me/shedaniel/architectury/hooks/biome/ClimateProperties.java
rename to common/src/main/java/dev/architectury/hooks/level/biome/ClimateProperties.java
index 270c7e60..7bc53661 100644
--- a/common/src/main/java/me/shedaniel/architectury/hooks/biome/ClimateProperties.java
+++ b/common/src/main/java/dev/architectury/hooks/level/biome/ClimateProperties.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.hooks.biome;
+package dev.architectury.hooks.level.biome;
 
 import net.minecraft.world.level.biome.Biome.Precipitation;
 import net.minecraft.world.level.biome.Biome.TemperatureModifier;
diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/biome/EffectsProperties.java b/common/src/main/java/dev/architectury/hooks/level/biome/EffectsProperties.java
similarity index 98%
rename from common/src/main/java/me/shedaniel/architectury/hooks/biome/EffectsProperties.java
rename to common/src/main/java/dev/architectury/hooks/level/biome/EffectsProperties.java
index 875c1a23..b5722597 100644
--- a/common/src/main/java/me/shedaniel/architectury/hooks/biome/EffectsProperties.java
+++ b/common/src/main/java/dev/architectury/hooks/level/biome/EffectsProperties.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.hooks.biome;
+package dev.architectury.hooks.level.biome;
 
 import net.minecraft.sounds.Music;
 import net.minecraft.sounds.SoundEvent;
diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/biome/GenerationProperties.java b/common/src/main/java/dev/architectury/hooks/level/biome/GenerationProperties.java
similarity index 98%
rename from common/src/main/java/me/shedaniel/architectury/hooks/biome/GenerationProperties.java
rename to common/src/main/java/dev/architectury/hooks/level/biome/GenerationProperties.java
index a8bc6fad..64e8f7ff 100644
--- a/common/src/main/java/me/shedaniel/architectury/hooks/biome/GenerationProperties.java
+++ b/common/src/main/java/dev/architectury/hooks/level/biome/GenerationProperties.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.hooks.biome;
+package dev.architectury.hooks.level.biome;
 
 import net.minecraft.world.level.levelgen.GenerationStep;
 import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver;
diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/biome/SpawnProperties.java b/common/src/main/java/dev/architectury/hooks/level/biome/SpawnProperties.java
similarity index 97%
rename from common/src/main/java/me/shedaniel/architectury/hooks/biome/SpawnProperties.java
rename to common/src/main/java/dev/architectury/hooks/level/biome/SpawnProperties.java
index 1a7a106a..ebcf00cf 100644
--- a/common/src/main/java/me/shedaniel/architectury/hooks/biome/SpawnProperties.java
+++ b/common/src/main/java/dev/architectury/hooks/level/biome/SpawnProperties.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.hooks.biome;
+package dev.architectury.hooks.level.biome;
 
 import net.minecraft.world.entity.EntityType;
 import net.minecraft.world.entity.MobCategory;
diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/EntityHooks.java b/common/src/main/java/dev/architectury/hooks/level/entity/EntityHooks.java
similarity index 92%
rename from common/src/main/java/me/shedaniel/architectury/hooks/EntityHooks.java
rename to common/src/main/java/dev/architectury/hooks/level/entity/EntityHooks.java
index 51527e1b..63a00054 100644
--- a/common/src/main/java/me/shedaniel/architectury/hooks/EntityHooks.java
+++ b/common/src/main/java/dev/architectury/hooks/level/entity/EntityHooks.java
@@ -17,9 +17,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.hooks;
+package dev.architectury.hooks.level.entity;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
+import dev.architectury.injectables.annotations.ExpectPlatform;
 import net.minecraft.world.entity.Entity;
 import net.minecraft.world.phys.shapes.CollisionContext;
 import org.jetbrains.annotations.Nullable;
diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/ItemEntityHooks.java b/common/src/main/java/dev/architectury/hooks/level/entity/ItemEntityHooks.java
similarity index 89%
rename from common/src/main/java/me/shedaniel/architectury/hooks/ItemEntityHooks.java
rename to common/src/main/java/dev/architectury/hooks/level/entity/ItemEntityHooks.java
index e140f29f..70bacaea 100644
--- a/common/src/main/java/me/shedaniel/architectury/hooks/ItemEntityHooks.java
+++ b/common/src/main/java/dev/architectury/hooks/level/entity/ItemEntityHooks.java
@@ -17,10 +17,10 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.hooks;
+package dev.architectury.hooks.level.entity;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
-import me.shedaniel.architectury.utils.IntValue;
+import dev.architectury.injectables.annotations.ExpectPlatform;
+import dev.architectury.utils.value.IntValue;
 import net.minecraft.world.entity.item.ItemEntity;
 
 public final class ItemEntityHooks {
diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/PlayerHooks.java b/common/src/main/java/dev/architectury/hooks/level/entity/PlayerHooks.java
similarity index 91%
rename from common/src/main/java/me/shedaniel/architectury/hooks/PlayerHooks.java
rename to common/src/main/java/dev/architectury/hooks/level/entity/PlayerHooks.java
index 3ff8bed4..f57b1eb2 100644
--- a/common/src/main/java/me/shedaniel/architectury/hooks/PlayerHooks.java
+++ b/common/src/main/java/dev/architectury/hooks/level/entity/PlayerHooks.java
@@ -17,9 +17,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.hooks;
+package dev.architectury.hooks.level.entity;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
+import dev.architectury.injectables.annotations.ExpectPlatform;
 import net.minecraft.world.entity.player.Player;
 
 public final class PlayerHooks {
diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/TagHooks.java b/common/src/main/java/dev/architectury/hooks/tags/TagHooks.java
similarity index 61%
rename from common/src/main/java/me/shedaniel/architectury/hooks/TagHooks.java
rename to common/src/main/java/dev/architectury/hooks/tags/TagHooks.java
index ac732333..7b9cd5d9 100644
--- a/common/src/main/java/me/shedaniel/architectury/hooks/TagHooks.java
+++ b/common/src/main/java/dev/architectury/hooks/tags/TagHooks.java
@@ -17,10 +17,10 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.hooks;
+package dev.architectury.hooks.tags;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
-import me.shedaniel.architectury.mixin.FluidTagsAccessor;
+import dev.architectury.injectables.annotations.ExpectPlatform;
+import dev.architectury.mixin.FluidTagsAccessor;
 import net.minecraft.resources.ResourceLocation;
 import net.minecraft.tags.*;
 import net.minecraft.world.entity.EntityType;
@@ -35,23 +35,23 @@ public final class TagHooks {
     }
     
     @ExpectPlatform
-    public static  Tag.Named getOptional(ResourceLocation id, Supplier> collection) {
+    public static  Tag.Named optional(ResourceLocation id, Supplier> collection) {
         throw new AssertionError();
     }
     
-    public static Tag.Named getItemOptional(ResourceLocation id) {
-        return getOptional(id, ItemTags::getAllTags);
+    public static Tag.Named optionalItem(ResourceLocation id) {
+        return optional(id, ItemTags::getAllTags);
     }
     
-    public static Tag.Named getBlockOptional(ResourceLocation id) {
-        return getOptional(id, BlockTags::getAllTags);
+    public static Tag.Named optionalBlock(ResourceLocation id) {
+        return optional(id, BlockTags::getAllTags);
     }
     
-    public static Tag.Named getFluidOptional(ResourceLocation id) {
-        return getOptional(id, FluidTagsAccessor.getHelper()::getAllTags);
+    public static Tag.Named optionalFluid(ResourceLocation id) {
+        return optional(id, FluidTagsAccessor.getHelper()::getAllTags);
     }
     
-    public static Tag.Named> getEntityTypeOptional(ResourceLocation id) {
-        return getOptional(id, EntityTypeTags::getAllTags);
+    public static Tag.Named> optionalEntityType(ResourceLocation id) {
+        return optional(id, EntityTypeTags::getAllTags);
     }
 }
diff --git a/common/src/main/java/me/shedaniel/architectury/impl/ScreenAccessImpl.java b/common/src/main/java/dev/architectury/impl/ScreenAccessImpl.java
similarity index 93%
rename from common/src/main/java/me/shedaniel/architectury/impl/ScreenAccessImpl.java
rename to common/src/main/java/dev/architectury/impl/ScreenAccessImpl.java
index 93402006..838bca50 100644
--- a/common/src/main/java/me/shedaniel/architectury/impl/ScreenAccessImpl.java
+++ b/common/src/main/java/dev/architectury/impl/ScreenAccessImpl.java
@@ -17,10 +17,10 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.impl;
+package dev.architectury.impl;
 
-import me.shedaniel.architectury.hooks.screen.ScreenAccess;
-import me.shedaniel.architectury.hooks.screen.ScreenHooks;
+import dev.architectury.hooks.client.screen.ScreenAccess;
+import dev.architectury.hooks.client.screen.ScreenHooks;
 import net.minecraft.client.gui.components.AbstractWidget;
 import net.minecraft.client.gui.components.Widget;
 import net.minecraft.client.gui.components.events.GuiEventListener;
diff --git a/common/src/main/java/me/shedaniel/architectury/impl/TooltipEventColorContextImpl.java b/common/src/main/java/dev/architectury/impl/TooltipEventColorContextImpl.java
similarity index 91%
rename from common/src/main/java/me/shedaniel/architectury/impl/TooltipEventColorContextImpl.java
rename to common/src/main/java/dev/architectury/impl/TooltipEventColorContextImpl.java
index 1803944f..87e362a3 100644
--- a/common/src/main/java/me/shedaniel/architectury/impl/TooltipEventColorContextImpl.java
+++ b/common/src/main/java/dev/architectury/impl/TooltipEventColorContextImpl.java
@@ -17,13 +17,13 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.impl;
+package dev.architectury.impl;
 
-import me.shedaniel.architectury.event.events.TooltipEvent;
+import dev.architectury.event.events.client.ClientTooltipEvent;
 import org.jetbrains.annotations.ApiStatus;
 
 @ApiStatus.Internal
-public class TooltipEventColorContextImpl implements TooltipEvent.ColorContext {
+public class TooltipEventColorContextImpl implements ClientTooltipEvent.ColorContext {
     private int backgroundColor;
     private int outlineGradientTopColor;
     private int outlineGradientBottomColor;
diff --git a/common/src/main/java/me/shedaniel/architectury/impl/TooltipEventPositionContextImpl.java b/common/src/main/java/dev/architectury/impl/TooltipEventPositionContextImpl.java
similarity index 88%
rename from common/src/main/java/me/shedaniel/architectury/impl/TooltipEventPositionContextImpl.java
rename to common/src/main/java/dev/architectury/impl/TooltipEventPositionContextImpl.java
index db50d936..95235c89 100644
--- a/common/src/main/java/me/shedaniel/architectury/impl/TooltipEventPositionContextImpl.java
+++ b/common/src/main/java/dev/architectury/impl/TooltipEventPositionContextImpl.java
@@ -17,13 +17,13 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.impl;
+package dev.architectury.impl;
 
-import me.shedaniel.architectury.event.events.TooltipEvent;
+import dev.architectury.event.events.client.ClientTooltipEvent;
 import org.jetbrains.annotations.ApiStatus;
 
 @ApiStatus.Internal
-public class TooltipEventPositionContextImpl implements TooltipEvent.PositionContext {
+public class TooltipEventPositionContextImpl implements ClientTooltipEvent.PositionContext {
     private int tooltipX;
     private int tooltipY;
     
diff --git a/common/src/main/java/me/shedaniel/architectury/event/Actor.java b/common/src/main/java/dev/architectury/impl/package-info.java
similarity index 82%
rename from common/src/main/java/me/shedaniel/architectury/event/Actor.java
rename to common/src/main/java/dev/architectury/impl/package-info.java
index aafc670c..d406bd93 100644
--- a/common/src/main/java/me/shedaniel/architectury/event/Actor.java
+++ b/common/src/main/java/dev/architectury/impl/package-info.java
@@ -17,11 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.event;
+@ApiStatus.Internal
+package dev.architectury.impl;
 
-import net.minecraft.world.InteractionResult;
-
-@FunctionalInterface
-public interface Actor {
-    InteractionResult act(T t);
-}
+import org.jetbrains.annotations.ApiStatus;
\ No newline at end of file
diff --git a/common/src/main/java/me/shedaniel/architectury/mixin/FluidTagsAccessor.java b/common/src/main/java/dev/architectury/mixin/FluidTagsAccessor.java
similarity index 96%
rename from common/src/main/java/me/shedaniel/architectury/mixin/FluidTagsAccessor.java
rename to common/src/main/java/dev/architectury/mixin/FluidTagsAccessor.java
index bb3426a8..c9a9aac8 100644
--- a/common/src/main/java/me/shedaniel/architectury/mixin/FluidTagsAccessor.java
+++ b/common/src/main/java/dev/architectury/mixin/FluidTagsAccessor.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.mixin;
+package dev.architectury.mixin;
 
 import net.minecraft.tags.FluidTags;
 import net.minecraft.tags.StaticTagHelper;
diff --git a/common/src/main/java/me/shedaniel/architectury/mixin/MixinFallingBlockEntity.java b/common/src/main/java/dev/architectury/mixin/MixinFallingBlockEntity.java
similarity index 78%
rename from common/src/main/java/me/shedaniel/architectury/mixin/MixinFallingBlockEntity.java
rename to common/src/main/java/dev/architectury/mixin/MixinFallingBlockEntity.java
index 1f587e11..c93f8bf8 100644
--- a/common/src/main/java/me/shedaniel/architectury/mixin/MixinFallingBlockEntity.java
+++ b/common/src/main/java/dev/architectury/mixin/MixinFallingBlockEntity.java
@@ -17,18 +17,15 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.mixin;
+package dev.architectury.mixin;
 
-import me.shedaniel.architectury.event.events.BlockEvent;
+import dev.architectury.event.events.common.BlockEvent;
 import net.minecraft.core.BlockPos;
 import net.minecraft.world.entity.Entity;
 import net.minecraft.world.entity.EntityType;
 import net.minecraft.world.entity.item.FallingBlockEntity;
 import net.minecraft.world.level.Level;
-import net.minecraft.world.level.block.AnvilBlock;
 import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.ConcretePowderBlock;
-import net.minecraft.world.level.block.FallingBlock;
 import net.minecraft.world.level.block.state.BlockState;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.Shadow;
@@ -47,7 +44,7 @@ public abstract class MixinFallingBlockEntity extends Entity {
     private BlockState blockState;
     
     @Inject(method = "tick", at = @At(value = "INVOKE",
-                                      target = "Lnet/minecraft/world/level/block/Fallable;onLand(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/entity/item/FallingBlockEntity;)V"),
+            target = "Lnet/minecraft/world/level/block/Fallable;onLand(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/entity/item/FallingBlockEntity;)V"),
             locals = LocalCapture.CAPTURE_FAILHARD)
     public void handleLand(CallbackInfo ci, Block block, BlockPos blockPos2, boolean bl, boolean bl2, BlockState blockState) {
         BlockEvent.FALLING_LAND.invoker().onLand(this.level, blockPos2, this.blockState, blockState, (FallingBlockEntity) (Object) this);
diff --git a/common/src/main/java/me/shedaniel/architectury/mixin/MixinLightningBolt.java b/common/src/main/java/dev/architectury/mixin/MixinLightningBolt.java
similarity index 92%
rename from common/src/main/java/me/shedaniel/architectury/mixin/MixinLightningBolt.java
rename to common/src/main/java/dev/architectury/mixin/MixinLightningBolt.java
index 5c400327..38169468 100644
--- a/common/src/main/java/me/shedaniel/architectury/mixin/MixinLightningBolt.java
+++ b/common/src/main/java/dev/architectury/mixin/MixinLightningBolt.java
@@ -17,9 +17,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.mixin;
+package dev.architectury.mixin;
 
-import me.shedaniel.architectury.event.events.LightningEvent;
+import dev.architectury.event.events.common.LightningEvent;
 import net.minecraft.world.entity.Entity;
 import net.minecraft.world.entity.EntityType;
 import net.minecraft.world.entity.LightningBolt;
@@ -47,7 +47,7 @@ public abstract class MixinLightningBolt extends Entity {
             shift = At.Shift.BY,
             by = 1
     ), locals = LocalCapture.CAPTURE_FAILHARD)
-    public void handleLightning(CallbackInfo ci, double d0, List list) {
+    public void handleLightning(CallbackInfo ci, List list) {
         if (this.isRemoved() || this.level.isClientSide) {
             return;
         }
diff --git a/common/src/main/java/me/shedaniel/architectury/networking/NetworkChannel.java b/common/src/main/java/dev/architectury/networking/NetworkChannel.java
similarity index 71%
rename from common/src/main/java/me/shedaniel/architectury/networking/NetworkChannel.java
rename to common/src/main/java/dev/architectury/networking/NetworkChannel.java
index 1f4c1df2..2f7361d8 100644
--- a/common/src/main/java/me/shedaniel/architectury/networking/NetworkChannel.java
+++ b/common/src/main/java/dev/architectury/networking/NetworkChannel.java
@@ -17,13 +17,13 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.networking;
+package dev.architectury.networking;
 
 import com.google.common.collect.Maps;
+import dev.architectury.networking.NetworkManager.PacketContext;
+import dev.architectury.platform.Platform;
+import dev.architectury.utils.Env;
 import io.netty.buffer.Unpooled;
-import me.shedaniel.architectury.networking.NetworkManager.PacketContext;
-import me.shedaniel.architectury.platform.Platform;
-import me.shedaniel.architectury.utils.Env;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
 import net.minecraft.client.Minecraft;
@@ -31,12 +31,10 @@ import net.minecraft.network.FriendlyByteBuf;
 import net.minecraft.network.protocol.Packet;
 import net.minecraft.resources.ResourceLocation;
 import net.minecraft.server.level.ServerPlayer;
-import org.jetbrains.annotations.ApiStatus;
 
 import java.nio.charset.StandardCharsets;
 import java.util.Map;
 import java.util.Objects;
-import java.util.Optional;
 import java.util.UUID;
 import java.util.function.BiConsumer;
 import java.util.function.Function;
@@ -59,8 +57,8 @@ public final class NetworkChannel {
     
     public  void register(Class type, BiConsumer encoder, Function decoder, BiConsumer> messageConsumer) {
         // TODO: this is pretty wasteful; add a way to specify custom or numeric ids
-        String s = UUID.nameUUIDFromBytes(type.getName().getBytes(StandardCharsets.UTF_8)).toString().replace("-", "");
-        MessageInfo info = new MessageInfo<>(new ResourceLocation(id + "/" + s), encoder, decoder, messageConsumer);
+        var s = UUID.nameUUIDFromBytes(type.getName().getBytes(StandardCharsets.UTF_8)).toString().replace("-", "");
+        var info = new MessageInfo(new ResourceLocation(id + "/" + s), encoder, decoder, messageConsumer);
         encoders.put(type, info);
         NetworkManager.NetworkReceiver receiver = (buf, context) -> {
             info.messageConsumer.accept(info.decoder.apply(buf), () -> context);
@@ -73,16 +71,16 @@ public final class NetworkChannel {
     
     public static long hashCodeString(String str) {
         long h = 0;
-        int length = str.length();
-        for (int i = 0; i < length; i++) {
+        var length = str.length();
+        for (var i = 0; i < length; i++) {
             h = 31 * h + str.charAt(i);
         }
         return h;
     }
     
     public  Packet toPacket(NetworkManager.Side side, T message) {
-        MessageInfo messageInfo = (MessageInfo) Objects.requireNonNull(encoders.get(message.getClass()), "Unknown message type! " + message);
-        FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());
+        var messageInfo = (MessageInfo) Objects.requireNonNull(encoders.get(message.getClass()), "Unknown message type! " + message);
+        var buf = new FriendlyByteBuf(Unpooled.buffer());
         messageInfo.encoder.accept(message, buf);
         return NetworkManager.toPacket(side, messageInfo.packetId, buf);
     }
@@ -92,8 +90,8 @@ public final class NetworkChannel {
     }
     
     public  void sendToPlayers(Iterable players, T message) {
-        Packet packet = toPacket(NetworkManager.s2c(), message);
-        for (ServerPlayer player : players) {
+        var packet = toPacket(NetworkManager.s2c(), message);
+        for (var player : players) {
             Objects.requireNonNull(player, "Unable to send packet to a 'null' player!").connection.send(packet);
         }
     }
@@ -116,17 +114,11 @@ public final class NetworkChannel {
         return NetworkManager.canPlayerReceive(player, encoders.get(type).packetId);
     }
     
-    private static final class MessageInfo {
-        private final ResourceLocation packetId;
-        private final BiConsumer encoder;
-        private final Function decoder;
-        private final BiConsumer> messageConsumer;
-        
-        public MessageInfo(ResourceLocation packetId, BiConsumer encoder, Function decoder, BiConsumer> messageConsumer) {
-            this.packetId = packetId;
-            this.encoder = encoder;
-            this.decoder = decoder;
-            this.messageConsumer = messageConsumer;
-        }
+    private record MessageInfo(
+            ResourceLocation packetId,
+            BiConsumer encoder,
+            Function decoder,
+            BiConsumer> messageConsumer
+    ) {
     }
 }
diff --git a/common/src/main/java/me/shedaniel/architectury/networking/NetworkManager.java b/common/src/main/java/dev/architectury/networking/NetworkManager.java
similarity index 80%
rename from common/src/main/java/me/shedaniel/architectury/networking/NetworkManager.java
rename to common/src/main/java/dev/architectury/networking/NetworkManager.java
index d643596a..480ced18 100644
--- a/common/src/main/java/me/shedaniel/architectury/networking/NetworkManager.java
+++ b/common/src/main/java/dev/architectury/networking/NetworkManager.java
@@ -17,10 +17,10 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.networking;
+package dev.architectury.networking;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
-import me.shedaniel.architectury.utils.Env;
+import dev.architectury.injectables.annotations.ExpectPlatform;
+import dev.architectury.utils.Env;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
 import net.minecraft.client.Minecraft;
@@ -28,6 +28,7 @@ import net.minecraft.network.FriendlyByteBuf;
 import net.minecraft.network.protocol.Packet;
 import net.minecraft.resources.ResourceLocation;
 import net.minecraft.server.level.ServerPlayer;
+import net.minecraft.world.entity.Entity;
 import net.minecraft.world.entity.player.Player;
 
 import java.util.Objects;
@@ -48,8 +49,8 @@ public final class NetworkManager {
     }
     
     public static void sendToPlayers(Iterable players, ResourceLocation id, FriendlyByteBuf buf) {
-        Packet packet = toPacket(serverToClient(), id, buf);
-        for (ServerPlayer player : players) {
+        var packet = toPacket(serverToClient(), id, buf);
+        for (var player : players) {
             Objects.requireNonNull(player, "Unable to send packet to a 'null' player!").connection.send(packet);
         }
     }
@@ -74,6 +75,20 @@ public final class NetworkManager {
         throw new AssertionError();
     }
     
+    /**
+     * Easy to use utility method to create an entity spawn packet.
+     * This packet is needed everytime any mod adds a non-living entity.
+     * The entity should override {@link Entity#getAddEntityPacket()} to point to this method!
+     *
+     * @param entity The entity which should be spawned.
+     * @return The ready to use packet to spawn the entity on the client.
+     * @see Entity#getAddEntityPacket()
+     */
+    @ExpectPlatform
+    public static Packet createAddEntityPacket(Entity entity) {
+        throw new AssertionError();
+    }
+    
     @FunctionalInterface
     public interface NetworkReceiver {
         void receive(FriendlyByteBuf buf, PacketContext context);
diff --git a/common/src/main/java/me/shedaniel/architectury/platform/Mod.java b/common/src/main/java/dev/architectury/platform/Mod.java
similarity index 97%
rename from common/src/main/java/me/shedaniel/architectury/platform/Mod.java
rename to common/src/main/java/dev/architectury/platform/Mod.java
index f3a332ed..7bdc006a 100644
--- a/common/src/main/java/me/shedaniel/architectury/platform/Mod.java
+++ b/common/src/main/java/dev/architectury/platform/Mod.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.platform;
+package dev.architectury.platform;
 
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
diff --git a/common/src/main/java/me/shedaniel/architectury/platform/Platform.java b/common/src/main/java/dev/architectury/platform/Platform.java
similarity index 75%
rename from common/src/main/java/me/shedaniel/architectury/platform/Platform.java
rename to common/src/main/java/dev/architectury/platform/Platform.java
index e85f3327..2394afbc 100644
--- a/common/src/main/java/me/shedaniel/architectury/platform/Platform.java
+++ b/common/src/main/java/dev/architectury/platform/Platform.java
@@ -17,15 +17,13 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.platform;
+package dev.architectury.platform;
 
-import me.shedaniel.architectury.Architectury;
-import me.shedaniel.architectury.annotations.ExpectPlatform;
-import me.shedaniel.architectury.targets.ArchitecturyTarget;
-import me.shedaniel.architectury.utils.Env;
+import dev.architectury.injectables.annotations.ExpectPlatform;
+import dev.architectury.injectables.targets.ArchitecturyTarget;
+import dev.architectury.utils.Env;
 import net.fabricmc.api.EnvType;
 import net.minecraft.SharedConstants;
-import org.jetbrains.annotations.ApiStatus;
 
 import java.nio.file.Path;
 import java.util.Collection;
@@ -37,17 +35,6 @@ public final class Platform {
     
     private static int simpleLoaderCache = -1;
     
-    /**
-     * @return the current mod loader, either "fabric" or "forge"
-     * @deprecated does not reflect the true mod loader, "quilt" is never returned,
-     * use {@link ArchitecturyTarget#getCurrentTarget()} instead.
-     */
-    @Deprecated
-    @ApiStatus.ScheduledForRemoval(inVersion = "2.0")
-    public static String getModLoader() {
-        return Architectury.getModLoader();
-    }
-    
     public static boolean isFabric() {
         updateLoaderCache();
         return simpleLoaderCache == 0;
@@ -63,13 +50,9 @@ public final class Platform {
             return;
         }
         
-        switch (getModLoader()) {
-            case "fabric":
-                simpleLoaderCache = 0;
-                return;
-            case "forge":
-                simpleLoaderCache = 1;
-                return;
+        switch (ArchitecturyTarget.getCurrentTarget()) {
+            case "fabric" -> simpleLoaderCache = 0;
+            case "forge" -> simpleLoaderCache = 1;
         }
     }
     
@@ -87,6 +70,11 @@ public final class Platform {
         throw new AssertionError();
     }
     
+    @ExpectPlatform
+    public static Path getModsFolder() {
+        throw new AssertionError();
+    }
+    
     @ExpectPlatform
     public static Env getEnvironment() {
         throw new AssertionError();
diff --git a/common/src/main/java/me/shedaniel/architectury/registry/CreativeTabs.java b/common/src/main/java/dev/architectury/registry/CreativeTabRegistry.java
similarity index 87%
rename from common/src/main/java/me/shedaniel/architectury/registry/CreativeTabs.java
rename to common/src/main/java/dev/architectury/registry/CreativeTabRegistry.java
index 41726c1b..b11fc9a5 100644
--- a/common/src/main/java/me/shedaniel/architectury/registry/CreativeTabs.java
+++ b/common/src/main/java/dev/architectury/registry/CreativeTabRegistry.java
@@ -17,17 +17,17 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.registry;
+package dev.architectury.registry;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
+import dev.architectury.injectables.annotations.ExpectPlatform;
 import net.minecraft.resources.ResourceLocation;
 import net.minecraft.world.item.CreativeModeTab;
 import net.minecraft.world.item.ItemStack;
 
 import java.util.function.Supplier;
 
-public final class CreativeTabs {
-    private CreativeTabs() {
+public final class CreativeTabRegistry {
+    private CreativeTabRegistry() {
     }
     
     // I am sorry, fabric wants a resource location instead of the translation key for whatever reason
diff --git a/common/src/main/java/me/shedaniel/architectury/registry/ReloadListeners.java b/common/src/main/java/dev/architectury/registry/ReloadListenerRegistry.java
similarity index 78%
rename from common/src/main/java/me/shedaniel/architectury/registry/ReloadListeners.java
rename to common/src/main/java/dev/architectury/registry/ReloadListenerRegistry.java
index 9e176e70..a46502c4 100644
--- a/common/src/main/java/me/shedaniel/architectury/registry/ReloadListeners.java
+++ b/common/src/main/java/dev/architectury/registry/ReloadListenerRegistry.java
@@ -17,18 +17,18 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.registry;
+package dev.architectury.registry;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
+import dev.architectury.injectables.annotations.ExpectPlatform;
 import net.minecraft.server.packs.PackType;
 import net.minecraft.server.packs.resources.PreparableReloadListener;
 
-public final class ReloadListeners {
-    private ReloadListeners() {
+public final class ReloadListenerRegistry {
+    private ReloadListenerRegistry() {
     }
     
     @ExpectPlatform
-    public static void registerReloadListener(PackType type, PreparableReloadListener listener) {
+    public static void register(PackType type, PreparableReloadListener listener) {
         throw new AssertionError();
     }
 }
diff --git a/common/src/main/java/me/shedaniel/architectury/registry/BlockProperties.java b/common/src/main/java/dev/architectury/registry/block/BlockProperties.java
similarity index 95%
rename from common/src/main/java/me/shedaniel/architectury/registry/BlockProperties.java
rename to common/src/main/java/dev/architectury/registry/block/BlockProperties.java
index ccea650a..7e6cf5c6 100644
--- a/common/src/main/java/me/shedaniel/architectury/registry/BlockProperties.java
+++ b/common/src/main/java/dev/architectury/registry/block/BlockProperties.java
@@ -17,9 +17,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.registry;
+package dev.architectury.registry.block;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
+import dev.architectury.injectables.annotations.ExpectPlatform;
 import net.minecraft.world.item.DyeColor;
 import net.minecraft.world.level.block.state.BlockBehaviour;
 import net.minecraft.world.level.block.state.BlockState;
diff --git a/common/src/main/java/me/shedaniel/architectury/registry/BlockPropertiesExtension.java b/common/src/main/java/dev/architectury/registry/block/BlockPropertiesExtension.java
similarity index 95%
rename from common/src/main/java/me/shedaniel/architectury/registry/BlockPropertiesExtension.java
rename to common/src/main/java/dev/architectury/registry/block/BlockPropertiesExtension.java
index 1d13f703..839bb51c 100644
--- a/common/src/main/java/me/shedaniel/architectury/registry/BlockPropertiesExtension.java
+++ b/common/src/main/java/dev/architectury/registry/block/BlockPropertiesExtension.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.registry;
+package dev.architectury.registry.block;
 
 public interface BlockPropertiesExtension {
     default BlockProperties tool(ToolType type) {
diff --git a/common/src/main/java/me/shedaniel/architectury/registry/ToolType.java b/common/src/main/java/dev/architectury/registry/block/ToolType.java
similarity index 95%
rename from common/src/main/java/me/shedaniel/architectury/registry/ToolType.java
rename to common/src/main/java/dev/architectury/registry/block/ToolType.java
index 6c2ec82a..53236a6b 100644
--- a/common/src/main/java/me/shedaniel/architectury/registry/ToolType.java
+++ b/common/src/main/java/dev/architectury/registry/block/ToolType.java
@@ -17,10 +17,10 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.registry;
+package dev.architectury.registry.block;
 
 import com.google.common.collect.Maps;
-import me.shedaniel.architectury.annotations.ExpectPlatform;
+import dev.architectury.injectables.annotations.ExpectPlatform;
 import net.minecraft.tags.Tag;
 import net.minecraft.world.item.Item;
 
diff --git a/common/src/main/java/me/shedaniel/architectury/registry/KeyBindings.java b/common/src/main/java/dev/architectury/registry/client/keymappings/KeyMappingRegistry.java
similarity index 80%
rename from common/src/main/java/me/shedaniel/architectury/registry/KeyBindings.java
rename to common/src/main/java/dev/architectury/registry/client/keymappings/KeyMappingRegistry.java
index 27f66a46..30b56fb4 100644
--- a/common/src/main/java/me/shedaniel/architectury/registry/KeyBindings.java
+++ b/common/src/main/java/dev/architectury/registry/client/keymappings/KeyMappingRegistry.java
@@ -17,20 +17,20 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.registry;
+package dev.architectury.registry.client.keymappings;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
+import dev.architectury.injectables.annotations.ExpectPlatform;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
 import net.minecraft.client.KeyMapping;
 
 @Environment(EnvType.CLIENT)
-public final class KeyBindings {
-    private KeyBindings() {
+public final class KeyMappingRegistry {
+    private KeyMappingRegistry() {
     }
     
     @ExpectPlatform
-    public static void registerKeyBinding(KeyMapping binding) {
+    public static void register(KeyMapping mapping) {
         throw new AssertionError();
     }
 }
diff --git a/common/src/main/java/me/shedaniel/architectury/registry/BlockEntityRenderers.java b/common/src/main/java/dev/architectury/registry/client/rendering/BlockEntityRendererRegistry.java
similarity index 70%
rename from common/src/main/java/me/shedaniel/architectury/registry/BlockEntityRenderers.java
rename to common/src/main/java/dev/architectury/registry/client/rendering/BlockEntityRendererRegistry.java
index 67eb88ff..f6025897 100644
--- a/common/src/main/java/me/shedaniel/architectury/registry/BlockEntityRenderers.java
+++ b/common/src/main/java/dev/architectury/registry/client/rendering/BlockEntityRendererRegistry.java
@@ -17,26 +17,22 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.registry;
+package dev.architectury.registry.client.rendering;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
+import dev.architectury.injectables.annotations.ExpectPlatform;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
-import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher;
-import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
 import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
 import net.minecraft.world.level.block.entity.BlockEntity;
 import net.minecraft.world.level.block.entity.BlockEntityType;
 
-import java.util.function.Function;
-
 @Environment(EnvType.CLIENT)
-public final class BlockEntityRenderers {
-    private BlockEntityRenderers() {
+public final class BlockEntityRendererRegistry {
+    private BlockEntityRendererRegistry() {
     }
     
     @ExpectPlatform
-    public static  void registerRenderer(BlockEntityType type, BlockEntityRendererProvider provider) {
+    public static  void register(BlockEntityType type, BlockEntityRendererProvider provider) {
         throw new AssertionError();
     }
 }
diff --git a/common/src/main/java/me/shedaniel/architectury/registry/ColorHandlers.java b/common/src/main/java/dev/architectury/registry/client/rendering/ColorHandlerRegistry.java
similarity index 81%
rename from common/src/main/java/me/shedaniel/architectury/registry/ColorHandlers.java
rename to common/src/main/java/dev/architectury/registry/client/rendering/ColorHandlerRegistry.java
index 8a4abb80..10cb8b24 100644
--- a/common/src/main/java/me/shedaniel/architectury/registry/ColorHandlers.java
+++ b/common/src/main/java/dev/architectury/registry/client/rendering/ColorHandlerRegistry.java
@@ -17,9 +17,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.registry;
+package dev.architectury.registry.client.rendering;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
+import dev.architectury.injectables.annotations.ExpectPlatform;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
 import net.minecraft.client.color.block.BlockColor;
@@ -31,14 +31,14 @@ import java.util.Objects;
 import java.util.function.Supplier;
 
 @Environment(EnvType.CLIENT)
-public final class ColorHandlers {
-    private ColorHandlers() {
+public final class ColorHandlerRegistry {
+    private ColorHandlerRegistry() {
     }
     
     public static void registerItemColors(ItemColor color, ItemLike... items) {
         Supplier[] array = new Supplier[items.length];
-        for (int i = 0; i < items.length; i++) {
-            ItemLike item = Objects.requireNonNull(items[i], "items[i] is null!");
+        for (var i = 0; i < items.length; i++) {
+            var item = Objects.requireNonNull(items[i], "items[i] is null!");
             array[i] = () -> item;
         }
         registerItemColors(color, array);
@@ -46,8 +46,8 @@ public final class ColorHandlers {
     
     public static void registerBlockColors(BlockColor color, Block... blocks) {
         Supplier[] array = new Supplier[blocks.length];
-        for (int i = 0; i < blocks.length; i++) {
-            Block block = Objects.requireNonNull(blocks[i], "blocks[i] is null!");
+        for (var i = 0; i < blocks.length; i++) {
+            var block = Objects.requireNonNull(blocks[i], "blocks[i] is null!");
             array[i] = () -> block;
         }
         registerBlockColors(color, array);
diff --git a/common/src/main/java/me/shedaniel/architectury/registry/RenderTypes.java b/common/src/main/java/dev/architectury/registry/client/rendering/RenderTypeRegistry.java
similarity index 87%
rename from common/src/main/java/me/shedaniel/architectury/registry/RenderTypes.java
rename to common/src/main/java/dev/architectury/registry/client/rendering/RenderTypeRegistry.java
index a293c853..d775104a 100644
--- a/common/src/main/java/me/shedaniel/architectury/registry/RenderTypes.java
+++ b/common/src/main/java/dev/architectury/registry/client/rendering/RenderTypeRegistry.java
@@ -17,9 +17,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.registry;
+package dev.architectury.registry.client.rendering;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
+import dev.architectury.injectables.annotations.ExpectPlatform;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
 import net.minecraft.client.renderer.RenderType;
@@ -27,8 +27,8 @@ import net.minecraft.world.level.block.Block;
 import net.minecraft.world.level.material.Fluid;
 
 @Environment(EnvType.CLIENT)
-public final class RenderTypes {
-    private RenderTypes() {
+public final class RenderTypeRegistry {
+    private RenderTypeRegistry() {
     }
     
     @ExpectPlatform
diff --git a/common/src/main/java/me/shedaniel/architectury/registry/fuel/FuelRegistry.java b/common/src/main/java/dev/architectury/registry/fuel/FuelRegistry.java
similarity index 93%
rename from common/src/main/java/me/shedaniel/architectury/registry/fuel/FuelRegistry.java
rename to common/src/main/java/dev/architectury/registry/fuel/FuelRegistry.java
index 32bc7cbd..1b694106 100644
--- a/common/src/main/java/me/shedaniel/architectury/registry/fuel/FuelRegistry.java
+++ b/common/src/main/java/dev/architectury/registry/fuel/FuelRegistry.java
@@ -17,9 +17,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.registry.fuel;
+package dev.architectury.registry.fuel;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
+import dev.architectury.injectables.annotations.ExpectPlatform;
 import net.minecraft.world.item.ItemStack;
 import net.minecraft.world.level.ItemLike;
 
diff --git a/common/src/main/java/me/shedaniel/architectury/registry/GameRuleFactory.java b/common/src/main/java/dev/architectury/registry/level/GameRuleFactory.java
similarity index 96%
rename from common/src/main/java/me/shedaniel/architectury/registry/GameRuleFactory.java
rename to common/src/main/java/dev/architectury/registry/level/GameRuleFactory.java
index a4928ec4..4d700ad0 100644
--- a/common/src/main/java/me/shedaniel/architectury/registry/GameRuleFactory.java
+++ b/common/src/main/java/dev/architectury/registry/level/GameRuleFactory.java
@@ -17,9 +17,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.registry;
+package dev.architectury.registry.level;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
+import dev.architectury.injectables.annotations.ExpectPlatform;
 import net.minecraft.server.MinecraftServer;
 import net.minecraft.world.level.GameRules;
 
diff --git a/common/src/main/java/me/shedaniel/architectury/registry/GameRuleRegistry.java b/common/src/main/java/dev/architectury/registry/level/GameRuleRegistry.java
similarity index 93%
rename from common/src/main/java/me/shedaniel/architectury/registry/GameRuleRegistry.java
rename to common/src/main/java/dev/architectury/registry/level/GameRuleRegistry.java
index 3e291d35..2983a5e0 100644
--- a/common/src/main/java/me/shedaniel/architectury/registry/GameRuleRegistry.java
+++ b/common/src/main/java/dev/architectury/registry/level/GameRuleRegistry.java
@@ -17,9 +17,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.registry;
+package dev.architectury.registry.level;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
+import dev.architectury.injectables.annotations.ExpectPlatform;
 import net.minecraft.world.level.GameRules;
 
 /**
diff --git a/common/src/main/java/me/shedaniel/architectury/registry/CriteriaTriggersRegistry.java b/common/src/main/java/dev/architectury/registry/level/advancement/CriteriaTriggersRegistry.java
similarity index 92%
rename from common/src/main/java/me/shedaniel/architectury/registry/CriteriaTriggersRegistry.java
rename to common/src/main/java/dev/architectury/registry/level/advancement/CriteriaTriggersRegistry.java
index 9d4e4995..a3f5a3b6 100644
--- a/common/src/main/java/me/shedaniel/architectury/registry/CriteriaTriggersRegistry.java
+++ b/common/src/main/java/dev/architectury/registry/level/advancement/CriteriaTriggersRegistry.java
@@ -17,9 +17,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.registry;
+package dev.architectury.registry.level.advancement;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
+import dev.architectury.injectables.annotations.ExpectPlatform;
 import net.minecraft.advancements.CriterionTrigger;
 
 public final class CriteriaTriggersRegistry {
diff --git a/common/src/main/java/me/shedaniel/architectury/registry/BiomeModifications.java b/common/src/main/java/dev/architectury/registry/level/biome/BiomeModifications.java
similarity index 94%
rename from common/src/main/java/me/shedaniel/architectury/registry/BiomeModifications.java
rename to common/src/main/java/dev/architectury/registry/level/biome/BiomeModifications.java
index bd2e994f..3c3beef8 100644
--- a/common/src/main/java/me/shedaniel/architectury/registry/BiomeModifications.java
+++ b/common/src/main/java/dev/architectury/registry/level/biome/BiomeModifications.java
@@ -17,11 +17,11 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.registry;
+package dev.architectury.registry.level.biome;
 
 import com.google.common.base.Predicates;
-import me.shedaniel.architectury.annotations.ExpectPlatform;
-import me.shedaniel.architectury.hooks.biome.BiomeProperties;
+import dev.architectury.hooks.level.biome.BiomeProperties;
+import dev.architectury.injectables.annotations.ExpectPlatform;
 import net.minecraft.resources.ResourceLocation;
 
 import java.util.function.BiConsumer;
diff --git a/common/src/main/java/me/shedaniel/architectury/registry/entity/EntityAttributes.java b/common/src/main/java/dev/architectury/registry/level/entity/EntityAttributeRegistry.java
similarity index 88%
rename from common/src/main/java/me/shedaniel/architectury/registry/entity/EntityAttributes.java
rename to common/src/main/java/dev/architectury/registry/level/entity/EntityAttributeRegistry.java
index c17b8958..5353f4a1 100644
--- a/common/src/main/java/me/shedaniel/architectury/registry/entity/EntityAttributes.java
+++ b/common/src/main/java/dev/architectury/registry/level/entity/EntityAttributeRegistry.java
@@ -17,17 +17,17 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.registry.entity;
+package dev.architectury.registry.level.entity;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
+import dev.architectury.injectables.annotations.ExpectPlatform;
 import net.minecraft.world.entity.EntityType;
 import net.minecraft.world.entity.LivingEntity;
 import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
 
 import java.util.function.Supplier;
 
-public final class EntityAttributes {
-    private EntityAttributes() {
+public final class EntityAttributeRegistry {
+    private EntityAttributeRegistry() {
     }
     
     /**
diff --git a/common/src/main/java/me/shedaniel/architectury/registry/entity/EntityRenderers.java b/common/src/main/java/dev/architectury/registry/level/entity/EntityRendererRegistry.java
similarity index 71%
rename from common/src/main/java/me/shedaniel/architectury/registry/entity/EntityRenderers.java
rename to common/src/main/java/dev/architectury/registry/level/entity/EntityRendererRegistry.java
index 5ecd1967..aceb24c1 100644
--- a/common/src/main/java/me/shedaniel/architectury/registry/entity/EntityRenderers.java
+++ b/common/src/main/java/dev/architectury/registry/level/entity/EntityRendererRegistry.java
@@ -17,26 +17,22 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.registry.entity;
+package dev.architectury.registry.level.entity;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
+import dev.architectury.injectables.annotations.ExpectPlatform;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
-import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
-import net.minecraft.client.renderer.entity.EntityRenderer;
 import net.minecraft.client.renderer.entity.EntityRendererProvider;
 import net.minecraft.world.entity.Entity;
 import net.minecraft.world.entity.EntityType;
 
-import java.util.function.Function;
-
 @Environment(EnvType.CLIENT)
-public final class EntityRenderers {
-    private EntityRenderers() {
+public final class EntityRendererRegistry {
+    private EntityRendererRegistry() {
     }
     
     @ExpectPlatform
-    public static  void register(EntityType type, EntityRendererProvider provider) {
+    public static  void register(EntityType type, EntityRendererProvider provider) {
         throw new AssertionError();
     }
 }
diff --git a/common/src/main/java/me/shedaniel/architectury/registry/trade/SimpleTrade.java b/common/src/main/java/dev/architectury/registry/level/entity/trade/SimpleTrade.java
similarity index 79%
rename from common/src/main/java/me/shedaniel/architectury/registry/trade/SimpleTrade.java
rename to common/src/main/java/dev/architectury/registry/level/entity/trade/SimpleTrade.java
index 4a532bf9..8e4d9f83 100644
--- a/common/src/main/java/me/shedaniel/architectury/registry/trade/SimpleTrade.java
+++ b/common/src/main/java/dev/architectury/registry/level/entity/trade/SimpleTrade.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.registry.trade;
+package dev.architectury.registry.level.entity.trade;
 
 import net.minecraft.world.entity.Entity;
 import net.minecraft.world.entity.npc.VillagerTrades;
@@ -37,14 +37,9 @@ import java.util.Random;
  * or
  * {@link TradeRegistry#registerTradeForWanderingTrader(boolean, VillagerTrades.ItemListing...)}.
  */
-public class SimpleTrade implements VillagerTrades.ItemListing {
-    private final ItemStack primaryPrice;
-    private final ItemStack secondaryPrice;
-    private final ItemStack sale;
-    private final int maxTrades;
-    private final int experiencePoints;
-    private final float priceMultiplier;
-    
+public record SimpleTrade(ItemStack primaryPrice, ItemStack secondaryPrice,
+                          ItemStack sale, int maxTrades, int experiencePoints,
+                          float priceMultiplier) implements VillagerTrades.ItemListing {
     /**
      * Constructor for creating the trade.
      * You can take a look at all the values the vanilla game uses right here {@link VillagerTrades#TRADES}.
@@ -56,13 +51,7 @@ public class SimpleTrade implements VillagerTrades.ItemListing {
      * @param experiencePoints How much experience points does the player get, when trading. Vanilla uses between 2 and 30 for this.
      * @param priceMultiplier  How much should the price rise, after the trade is used. It is added to the stack size of the primary price. Vanilla uses between 0.05 and 0.2.
      */
-    public SimpleTrade(ItemStack primaryPrice, ItemStack secondaryPrice, ItemStack sale, int maxTrades, int experiencePoints, float priceMultiplier) {
-        this.primaryPrice = primaryPrice;
-        this.secondaryPrice = secondaryPrice;
-        this.sale = sale;
-        this.maxTrades = maxTrades;
-        this.experiencePoints = experiencePoints;
-        this.priceMultiplier = priceMultiplier;
+    public SimpleTrade {
     }
     
     @Nullable
diff --git a/common/src/main/java/me/shedaniel/architectury/registry/trade/TradeRegistry.java b/common/src/main/java/dev/architectury/registry/level/entity/trade/TradeRegistry.java
similarity index 95%
rename from common/src/main/java/me/shedaniel/architectury/registry/trade/TradeRegistry.java
rename to common/src/main/java/dev/architectury/registry/level/entity/trade/TradeRegistry.java
index c5d96efa..eaccdcef 100644
--- a/common/src/main/java/me/shedaniel/architectury/registry/trade/TradeRegistry.java
+++ b/common/src/main/java/dev/architectury/registry/level/entity/trade/TradeRegistry.java
@@ -17,9 +17,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.registry.trade;
+package dev.architectury.registry.level.entity.trade;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
+import dev.architectury.injectables.annotations.ExpectPlatform;
 import net.minecraft.world.entity.npc.VillagerProfession;
 import net.minecraft.world.entity.npc.VillagerTrades;
 
diff --git a/common/src/main/java/me/shedaniel/architectury/registry/menu/ExtendedMenuProvider.java b/common/src/main/java/dev/architectury/registry/menu/ExtendedMenuProvider.java
similarity index 95%
rename from common/src/main/java/me/shedaniel/architectury/registry/menu/ExtendedMenuProvider.java
rename to common/src/main/java/dev/architectury/registry/menu/ExtendedMenuProvider.java
index 4c96f7f4..aa5d3ee3 100644
--- a/common/src/main/java/me/shedaniel/architectury/registry/menu/ExtendedMenuProvider.java
+++ b/common/src/main/java/dev/architectury/registry/menu/ExtendedMenuProvider.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.registry.menu;
+package dev.architectury.registry.menu;
 
 import net.minecraft.network.FriendlyByteBuf;
 import net.minecraft.world.MenuProvider;
diff --git a/common/src/main/java/me/shedaniel/architectury/registry/MenuRegistry.java b/common/src/main/java/dev/architectury/registry/menu/MenuRegistry.java
similarity index 97%
rename from common/src/main/java/me/shedaniel/architectury/registry/MenuRegistry.java
rename to common/src/main/java/dev/architectury/registry/menu/MenuRegistry.java
index 7376597b..acce7a68 100644
--- a/common/src/main/java/me/shedaniel/architectury/registry/MenuRegistry.java
+++ b/common/src/main/java/dev/architectury/registry/menu/MenuRegistry.java
@@ -17,10 +17,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.registry;
+package dev.architectury.registry.menu;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
-import me.shedaniel.architectury.registry.menu.ExtendedMenuProvider;
+import dev.architectury.injectables.annotations.ExpectPlatform;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
 import net.minecraft.client.gui.screens.Screen;
diff --git a/common/src/main/java/me/shedaniel/architectury/registry/DeferredRegister.java b/common/src/main/java/dev/architectury/registry/registries/DeferredRegister.java
similarity index 84%
rename from common/src/main/java/me/shedaniel/architectury/registry/DeferredRegister.java
rename to common/src/main/java/dev/architectury/registry/registries/DeferredRegister.java
index e9aaed53..7107c9ee 100644
--- a/common/src/main/java/me/shedaniel/architectury/registry/DeferredRegister.java
+++ b/common/src/main/java/dev/architectury/registry/registries/DeferredRegister.java
@@ -17,9 +17,10 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.registry;
+package dev.architectury.registry.registries;
 
 import com.google.common.base.Suppliers;
+import net.minecraft.core.Registry;
 import net.minecraft.resources.ResourceKey;
 import net.minecraft.resources.ResourceLocation;
 import org.jetbrains.annotations.Nullable;
@@ -31,19 +32,19 @@ import java.util.function.Supplier;
 
 public class DeferredRegister {
     private final Supplier registriesSupplier;
-    private final ResourceKey> key;
+    private final ResourceKey> key;
     private final List> entries = new ArrayList<>();
     private boolean registered = false;
     @Nullable
     private String modId;
     
-    private DeferredRegister(Supplier registriesSupplier, ResourceKey> key, @Nullable String modId) {
+    private DeferredRegister(Supplier registriesSupplier, ResourceKey> key, @Nullable String modId) {
         this.registriesSupplier = Objects.requireNonNull(registriesSupplier);
         this.key = Objects.requireNonNull(key);
         this.modId = modId;
     }
     
-    public static  DeferredRegister create(String modId, ResourceKey> key) {
+    public static  DeferredRegister create(String modId, ResourceKey> key) {
         Supplier value = Suppliers.memoize(() -> Registries.get(modId));
         return new DeferredRegister<>(value, key, Objects.requireNonNull(modId));
     }
@@ -57,11 +58,11 @@ public class DeferredRegister {
     }
     
     public  RegistrySupplier register(ResourceLocation id, Supplier supplier) {
-        Entry entry = new Entry<>(id, (Supplier) supplier);
+        var entry = new Entry(id, (Supplier) supplier);
         this.entries.add(entry);
         if (registered) {
-            Registry registry = registriesSupplier.get().get(key);
-            entry.value = registry.registerSupplied(entry.id, entry.supplier);
+            var registrar = registriesSupplier.get().get(key);
+            entry.value = registrar.register(entry.id, entry.supplier);
         }
         return (RegistrySupplier) entry;
     }
@@ -71,9 +72,9 @@ public class DeferredRegister {
             throw new IllegalStateException("Cannot register a deferred register twice!");
         }
         registered = true;
-        Registry registry = registriesSupplier.get().get(key);
-        for (Entry entry : entries) {
-            entry.value = registry.registerSupplied(entry.id, entry.supplier);
+        var registrar = registriesSupplier.get().get(key);
+        for (var entry : entries) {
+            entry.value = registrar.register(entry.id, entry.supplier);
         }
     }
     
@@ -118,8 +119,7 @@ public class DeferredRegister {
         @Override
         public boolean equals(Object obj) {
             if (this == obj) return true;
-            if (!(obj instanceof RegistrySupplier)) return false;
-            RegistrySupplier other = (RegistrySupplier) obj;
+            if (!(obj instanceof RegistrySupplier other)) return false;
             return other.getRegistryId().equals(getRegistryId()) && other.getId().equals(getId());
         }
         
diff --git a/common/src/main/java/me/shedaniel/architectury/registry/Registry.java b/common/src/main/java/dev/architectury/registry/registries/Registrar.java
similarity index 72%
rename from common/src/main/java/me/shedaniel/architectury/registry/Registry.java
rename to common/src/main/java/dev/architectury/registry/registries/Registrar.java
index 972c868e..584af8f1 100644
--- a/common/src/main/java/me/shedaniel/architectury/registry/Registry.java
+++ b/common/src/main/java/dev/architectury/registry/registries/Registrar.java
@@ -17,8 +17,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.registry;
+package dev.architectury.registry.registries;
 
+import net.minecraft.core.Registry;
 import net.minecraft.resources.ResourceKey;
 import net.minecraft.resources.ResourceLocation;
 import org.jetbrains.annotations.Nullable;
@@ -28,18 +29,10 @@ import java.util.Optional;
 import java.util.Set;
 import java.util.function.Supplier;
 
-public interface Registry extends Iterable {
-    default Supplier delegate(ResourceLocation id) {
-        return delegateSupplied(id);
-    }
+public interface Registrar extends Iterable {
+    RegistrySupplier delegate(ResourceLocation id);
     
-    RegistrySupplier delegateSupplied(ResourceLocation id);
-    
-    default  Supplier register(ResourceLocation id, Supplier supplier) {
-        return registerSupplied(id, supplier);
-    }
-    
-     RegistrySupplier registerSupplied(ResourceLocation id, Supplier supplier);
+     RegistrySupplier register(ResourceLocation id, Supplier supplier);
     
     @Nullable
     ResourceLocation getId(T obj);
@@ -62,5 +55,5 @@ public interface Registry extends Iterable {
     
     Set, T>> entrySet();
     
-    ResourceKey> key();
+    ResourceKey> key();
 }
diff --git a/common/src/main/java/me/shedaniel/architectury/registry/registries/RegistryBuilder.java b/common/src/main/java/dev/architectury/registry/registries/RegistrarBuilder.java
similarity index 61%
rename from common/src/main/java/me/shedaniel/architectury/registry/registries/RegistryBuilder.java
rename to common/src/main/java/dev/architectury/registry/registries/RegistrarBuilder.java
index a6e2258a..93c2501c 100644
--- a/common/src/main/java/me/shedaniel/architectury/registry/registries/RegistryBuilder.java
+++ b/common/src/main/java/dev/architectury/registry/registries/RegistrarBuilder.java
@@ -17,21 +17,21 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.registry.registries;
+package dev.architectury.registry.registries;
 
-import me.shedaniel.architectury.core.RegistryEntry;
-import me.shedaniel.architectury.registry.Registry;
+import dev.architectury.registry.registries.options.RegistrarOption;
+import dev.architectury.registry.registries.options.StandardRegistrarOption;
 
-public interface RegistryBuilder> {
-    Registry build();
+public interface RegistrarBuilder {
+    Registrar build();
     
-    RegistryBuilder option(RegistryOption option);
+    RegistrarBuilder option(RegistrarOption option);
     
-    default RegistryBuilder saveToDisc() {
-        return option(StandardRegistryOption.SAVE_TO_DISC);
+    default RegistrarBuilder saveToDisc() {
+        return option(StandardRegistrarOption.SAVE_TO_DISC);
     }
     
-    default RegistryBuilder syncToClients() {
-        return option(StandardRegistryOption.SYNC_TO_CLIENTS);
+    default RegistrarBuilder syncToClients() {
+        return option(StandardRegistrarOption.SYNC_TO_CLIENTS);
     }
 }
diff --git a/common/src/main/java/me/shedaniel/architectury/registry/Registries.java b/common/src/main/java/dev/architectury/registry/registries/Registries.java
similarity index 76%
rename from common/src/main/java/me/shedaniel/architectury/registry/Registries.java
rename to common/src/main/java/dev/architectury/registry/registries/Registries.java
index 7c573ae0..9b9f6dab 100644
--- a/common/src/main/java/me/shedaniel/architectury/registry/Registries.java
+++ b/common/src/main/java/dev/architectury/registry/registries/Registries.java
@@ -17,11 +17,10 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.registry;
+package dev.architectury.registry.registries;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
-import me.shedaniel.architectury.core.RegistryEntry;
-import me.shedaniel.architectury.registry.registries.RegistryBuilder;
+import dev.architectury.injectables.annotations.ExpectPlatform;
+import net.minecraft.core.Registry;
 import net.minecraft.resources.ResourceKey;
 import net.minecraft.resources.ResourceLocation;
 import org.jetbrains.annotations.ApiStatus;
@@ -47,17 +46,17 @@ public final class Registries {
         this.modId = modId;
     }
     
-    public  Registry get(ResourceKey> key) {
+    public  Registrar get(ResourceKey> key) {
         return this.provider.get(key);
     }
     
     @Deprecated
-    public  Registry get(net.minecraft.core.Registry registry) {
+    public  Registrar get(Registry registry) {
         return this.provider.get(registry);
     }
     
     @SafeVarargs
-    public final > RegistryBuilder builder(ResourceLocation registryId, T... typeGetter) {
+    public final  RegistrarBuilder builder(ResourceLocation registryId, T... typeGetter) {
         if (typeGetter.length != 0) throw new IllegalStateException("array must be empty!");
         return this.provider.builder((Class) typeGetter.getClass().getComponentType(), registryId);
     }
@@ -68,7 +67,7 @@ public final class Registries {
      */
     @Nullable
     @ExpectPlatform
-    public static  ResourceLocation getId(T object, @Nullable ResourceKey> fallback) {
+    public static  ResourceLocation getId(T object, @Nullable ResourceKey> fallback) {
         throw new AssertionError();
     }
     
@@ -79,7 +78,7 @@ public final class Registries {
     @Nullable
     @Deprecated
     @ExpectPlatform
-    public static  ResourceLocation getId(T object, @Nullable net.minecraft.core.Registry fallback) {
+    public static  ResourceLocation getId(T object, @Nullable Registry fallback) {
         throw new AssertionError();
     }
     
@@ -90,7 +89,7 @@ public final class Registries {
     @Nullable
     @Deprecated
     public static  ResourceLocation getRegistryName(T object) {
-        return getId(object, (ResourceKey>) null);
+        return getId(object, (ResourceKey>) null);
     }
     
     @ExpectPlatform
@@ -104,11 +103,11 @@ public final class Registries {
     
     @ApiStatus.Internal
     public interface RegistryProvider {
-         Registry get(ResourceKey> key);
+         Registrar get(ResourceKey> key);
         
         @Deprecated
-         Registry get(net.minecraft.core.Registry registry);
+         Registrar get(Registry registry);
         
-        > RegistryBuilder builder(Class type, ResourceLocation registryId);
+         RegistrarBuilder builder(Class type, ResourceLocation registryId);
     }
 }
diff --git a/common/src/main/java/me/shedaniel/architectury/registry/RegistrySupplier.java b/common/src/main/java/dev/architectury/registry/registries/RegistrySupplier.java
similarity index 98%
rename from common/src/main/java/me/shedaniel/architectury/registry/RegistrySupplier.java
rename to common/src/main/java/dev/architectury/registry/registries/RegistrySupplier.java
index 4c8fd4eb..0005962a 100644
--- a/common/src/main/java/me/shedaniel/architectury/registry/RegistrySupplier.java
+++ b/common/src/main/java/dev/architectury/registry/registries/RegistrySupplier.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.registry;
+package dev.architectury.registry.registries;
 
 import net.minecraft.resources.ResourceLocation;
 import org.jetbrains.annotations.Nullable;
diff --git a/common/src/main/java/me/shedaniel/architectury/registry/registries/RegistryOption.java b/common/src/main/java/dev/architectury/registry/registries/options/RegistrarOption.java
similarity index 90%
rename from common/src/main/java/me/shedaniel/architectury/registry/registries/RegistryOption.java
rename to common/src/main/java/dev/architectury/registry/registries/options/RegistrarOption.java
index a02bee9a..d171e414 100644
--- a/common/src/main/java/me/shedaniel/architectury/registry/registries/RegistryOption.java
+++ b/common/src/main/java/dev/architectury/registry/registries/options/RegistrarOption.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.registry.registries;
+package dev.architectury.registry.registries.options;
 
-public interface RegistryOption {
+public interface RegistrarOption {
 }
diff --git a/common/src/main/java/me/shedaniel/architectury/registry/registries/StandardRegistryOption.java b/common/src/main/java/dev/architectury/registry/registries/options/StandardRegistrarOption.java
similarity index 90%
rename from common/src/main/java/me/shedaniel/architectury/registry/registries/StandardRegistryOption.java
rename to common/src/main/java/dev/architectury/registry/registries/options/StandardRegistrarOption.java
index 6b23081c..ca9c3fd7 100644
--- a/common/src/main/java/me/shedaniel/architectury/registry/registries/StandardRegistryOption.java
+++ b/common/src/main/java/dev/architectury/registry/registries/options/StandardRegistrarOption.java
@@ -17,9 +17,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.registry.registries;
+package dev.architectury.registry.registries.options;
 
-public enum StandardRegistryOption implements RegistryOption {
+public enum StandardRegistrarOption implements RegistrarOption {
     /**
      * Denote that the registry should save to disc and persist. Defaulted false.
      */
diff --git a/common/src/main/java/me/shedaniel/architectury/utils/Env.java b/common/src/main/java/dev/architectury/utils/Env.java
similarity index 97%
rename from common/src/main/java/me/shedaniel/architectury/utils/Env.java
rename to common/src/main/java/dev/architectury/utils/Env.java
index de9e27b4..0219b40e 100644
--- a/common/src/main/java/me/shedaniel/architectury/utils/Env.java
+++ b/common/src/main/java/dev/architectury/utils/Env.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.utils;
+package dev.architectury.utils;
 
 import net.fabricmc.api.EnvType;
 
diff --git a/common/src/main/java/me/shedaniel/architectury/utils/EnvExecutor.java b/common/src/main/java/dev/architectury/utils/EnvExecutor.java
similarity index 95%
rename from common/src/main/java/me/shedaniel/architectury/utils/EnvExecutor.java
rename to common/src/main/java/dev/architectury/utils/EnvExecutor.java
index 59de5923..886ef23a 100644
--- a/common/src/main/java/me/shedaniel/architectury/utils/EnvExecutor.java
+++ b/common/src/main/java/dev/architectury/utils/EnvExecutor.java
@@ -17,9 +17,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.utils;
+package dev.architectury.utils;
 
-import me.shedaniel.architectury.platform.Platform;
+import dev.architectury.platform.Platform;
 import net.fabricmc.api.EnvType;
 
 import java.util.Optional;
diff --git a/common/src/main/java/me/shedaniel/architectury/utils/GameInstance.java b/common/src/main/java/dev/architectury/utils/GameInstance.java
similarity index 92%
rename from common/src/main/java/me/shedaniel/architectury/utils/GameInstance.java
rename to common/src/main/java/dev/architectury/utils/GameInstance.java
index d1fc42d3..dad961f4 100644
--- a/common/src/main/java/me/shedaniel/architectury/utils/GameInstance.java
+++ b/common/src/main/java/dev/architectury/utils/GameInstance.java
@@ -17,9 +17,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.utils;
+package dev.architectury.utils;
 
-import me.shedaniel.architectury.annotations.ExpectPlatform;
+import dev.architectury.injectables.annotations.ExpectPlatform;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
 import net.minecraft.client.Minecraft;
diff --git a/common/src/main/java/me/shedaniel/architectury/utils/NbtType.java b/common/src/main/java/dev/architectury/utils/NbtType.java
similarity index 97%
rename from common/src/main/java/me/shedaniel/architectury/utils/NbtType.java
rename to common/src/main/java/dev/architectury/utils/NbtType.java
index 7d3d3f42..e4a4e936 100644
--- a/common/src/main/java/me/shedaniel/architectury/utils/NbtType.java
+++ b/common/src/main/java/dev/architectury/utils/NbtType.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package me.shedaniel.architectury.utils;
+package dev.architectury.utils;
 
 import net.minecraft.nbt.CompoundTag;
 
diff --git a/common/src/main/java/me/shedaniel/architectury/utils/PlatformExpectedError.java b/common/src/main/java/dev/architectury/utils/PlatformExpectedError.java
similarity index 97%
rename from common/src/main/java/me/shedaniel/architectury/utils/PlatformExpectedError.java
rename to common/src/main/java/dev/architectury/utils/PlatformExpectedError.java
index e62cb9b4..be0444fd 100644
--- a/common/src/main/java/me/shedaniel/architectury/utils/PlatformExpectedError.java
+++ b/common/src/main/java/dev/architectury/utils/PlatformExpectedError.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.utils;
+package dev.architectury.utils;
 
 public class PlatformExpectedError extends Error {
     public PlatformExpectedError() {
diff --git a/common/src/main/java/me/shedaniel/architectury/utils/BooleanValue.java b/common/src/main/java/dev/architectury/utils/value/BooleanValue.java
similarity index 96%
rename from common/src/main/java/me/shedaniel/architectury/utils/BooleanValue.java
rename to common/src/main/java/dev/architectury/utils/value/BooleanValue.java
index 8a86b7f4..eeb5c14d 100644
--- a/common/src/main/java/me/shedaniel/architectury/utils/BooleanValue.java
+++ b/common/src/main/java/dev/architectury/utils/value/BooleanValue.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.utils;
+package dev.architectury.utils.value;
 
 import it.unimi.dsi.fastutil.booleans.BooleanConsumer;
 
diff --git a/common/src/main/java/me/shedaniel/architectury/utils/DoubleValue.java b/common/src/main/java/dev/architectury/utils/value/DoubleValue.java
similarity index 96%
rename from common/src/main/java/me/shedaniel/architectury/utils/DoubleValue.java
rename to common/src/main/java/dev/architectury/utils/value/DoubleValue.java
index a861870b..c4dc7b98 100644
--- a/common/src/main/java/me/shedaniel/architectury/utils/DoubleValue.java
+++ b/common/src/main/java/dev/architectury/utils/value/DoubleValue.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.utils;
+package dev.architectury.utils.value;
 
 import it.unimi.dsi.fastutil.doubles.DoubleConsumer;
 
diff --git a/common/src/main/java/me/shedaniel/architectury/utils/FloatSupplier.java b/common/src/main/java/dev/architectury/utils/value/FloatSupplier.java
similarity index 95%
rename from common/src/main/java/me/shedaniel/architectury/utils/FloatSupplier.java
rename to common/src/main/java/dev/architectury/utils/value/FloatSupplier.java
index 33a77df3..aa364d47 100644
--- a/common/src/main/java/me/shedaniel/architectury/utils/FloatSupplier.java
+++ b/common/src/main/java/dev/architectury/utils/value/FloatSupplier.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.utils;
+package dev.architectury.utils.value;
 
 @FunctionalInterface
 public interface FloatSupplier {
diff --git a/common/src/main/java/me/shedaniel/architectury/utils/FloatValue.java b/common/src/main/java/dev/architectury/utils/value/FloatValue.java
similarity index 96%
rename from common/src/main/java/me/shedaniel/architectury/utils/FloatValue.java
rename to common/src/main/java/dev/architectury/utils/value/FloatValue.java
index cc5ea1d0..ae1a1d36 100644
--- a/common/src/main/java/me/shedaniel/architectury/utils/FloatValue.java
+++ b/common/src/main/java/dev/architectury/utils/value/FloatValue.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.utils;
+package dev.architectury.utils.value;
 
 import it.unimi.dsi.fastutil.floats.FloatConsumer;
 
diff --git a/common/src/main/java/me/shedaniel/architectury/utils/IntValue.java b/common/src/main/java/dev/architectury/utils/value/IntValue.java
similarity index 96%
rename from common/src/main/java/me/shedaniel/architectury/utils/IntValue.java
rename to common/src/main/java/dev/architectury/utils/value/IntValue.java
index 0bd936e3..1bbf313b 100644
--- a/common/src/main/java/me/shedaniel/architectury/utils/IntValue.java
+++ b/common/src/main/java/dev/architectury/utils/value/IntValue.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.utils;
+package dev.architectury.utils.value;
 
 import it.unimi.dsi.fastutil.ints.IntConsumer;
 
diff --git a/common/src/main/java/me/shedaniel/architectury/utils/LongValue.java b/common/src/main/java/dev/architectury/utils/value/LongValue.java
similarity index 96%
rename from common/src/main/java/me/shedaniel/architectury/utils/LongValue.java
rename to common/src/main/java/dev/architectury/utils/value/LongValue.java
index 500dbe2c..65ebafd9 100644
--- a/common/src/main/java/me/shedaniel/architectury/utils/LongValue.java
+++ b/common/src/main/java/dev/architectury/utils/value/LongValue.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.utils;
+package dev.architectury.utils.value;
 
 import it.unimi.dsi.fastutil.longs.LongConsumer;
 
diff --git a/common/src/main/java/me/shedaniel/architectury/utils/Value.java b/common/src/main/java/dev/architectury/utils/value/Value.java
similarity index 95%
rename from common/src/main/java/me/shedaniel/architectury/utils/Value.java
rename to common/src/main/java/dev/architectury/utils/value/Value.java
index 27e65a29..88891823 100644
--- a/common/src/main/java/me/shedaniel/architectury/utils/Value.java
+++ b/common/src/main/java/dev/architectury/utils/value/Value.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.utils;
+package dev.architectury.utils.value;
 
 import java.util.function.Consumer;
 import java.util.function.Supplier;
diff --git a/common/src/main/java/me/shedaniel/architectury/Architectury.java b/common/src/main/java/me/shedaniel/architectury/Architectury.java
deleted file mode 100644
index 9d19f01f..00000000
--- a/common/src/main/java/me/shedaniel/architectury/Architectury.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * This file is part of architectury.
- * Copyright (C) 2020, 2021 architectury
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-
-package me.shedaniel.architectury;
-
-import me.shedaniel.architectury.targets.ArchitecturyTarget;
-import org.jetbrains.annotations.ApiStatus;
-
-@ApiStatus.Internal
-public class Architectury {
-    @Deprecated
-    @ApiStatus.ScheduledForRemoval(inVersion = "2.0")
-    public static String getModLoader() {
-        return ArchitecturyTarget.getCurrentTarget();
-    }
-}
diff --git a/common/src/main/java/me/shedaniel/architectury/PlatformMethods.java b/common/src/main/java/me/shedaniel/architectury/PlatformMethods.java
deleted file mode 100644
index 1f774330..00000000
--- a/common/src/main/java/me/shedaniel/architectury/PlatformMethods.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * This file is part of architectury.
- * Copyright (C) 2020, 2021 architectury
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-
-package me.shedaniel.architectury;
-
-import me.shedaniel.architectury.targets.ArchitecturyTarget;
-import me.shedaniel.architectury.utils.PlatformExpectedError;
-import org.jetbrains.annotations.ApiStatus;
-
-import java.lang.invoke.*;
-
-@ApiStatus.Internal
-public class PlatformMethods {
-    public static CallSite platform(MethodHandles.Lookup lookup, String name, MethodType type) {
-        Class lookupClass = lookup.lookupClass();
-        String lookupType = lookupClass.getName().replace("$", "") + "Impl";
-        
-        String platformExpectedClass = lookupType.substring(0, lookupType.lastIndexOf('.')) + "." + ArchitecturyTarget.getCurrentTarget() + "." +
-                lookupType.substring(lookupType.lastIndexOf('.') + 1);
-        Class newClass;
-        try {
-            newClass = Class.forName(platformExpectedClass, false, lookupClass.getClassLoader());
-        } catch (ClassNotFoundException exception) {
-            throw new PlatformExpectedError(lookupClass.getName() + "#" + name + " expected platform implementation in " + platformExpectedClass +
-                    "#" + name + ", but the class doesn't exist!", exception);
-        }
-        MethodHandle platformMethod;
-        try {
-            platformMethod = lookup.findStatic(newClass, name, type);
-        } catch (NoSuchMethodException exception) {
-            throw new PlatformExpectedError(lookupClass.getName() + "#" + name + " expected platform implementation in " + platformExpectedClass +
-                    "#" + name + ", but the method doesn't exist!", exception);
-        } catch (IllegalAccessException exception) {
-            throw new PlatformExpectedError(lookupClass.getName() + "#" + name + " expected platform implementation in " + platformExpectedClass +
-                    "#" + name + ", but the method's modifier doesn't match the access requirements!", exception);
-        }
-        return new ConstantCallSite(platformMethod);
-    }
-}
diff --git a/common/src/main/java/me/shedaniel/architectury/event/events/BlockEvent.java b/common/src/main/java/me/shedaniel/architectury/event/events/BlockEvent.java
deleted file mode 100644
index 2ada5de3..00000000
--- a/common/src/main/java/me/shedaniel/architectury/event/events/BlockEvent.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * This file is part of architectury.
- * Copyright (C) 2020, 2021 architectury
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-
-package me.shedaniel.architectury.event.events;
-
-import me.shedaniel.architectury.event.Event;
-import me.shedaniel.architectury.event.EventFactory;
-import me.shedaniel.architectury.utils.IntValue;
-import net.minecraft.core.BlockPos;
-import net.minecraft.server.level.ServerPlayer;
-import net.minecraft.world.InteractionResult;
-import net.minecraft.world.entity.Entity;
-import net.minecraft.world.entity.item.FallingBlockEntity;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.block.state.BlockState;
-import org.jetbrains.annotations.Nullable;
-
-public interface BlockEvent {
-    
-    // Block interaction events
-    /**
-     * Called when a player breaks a block.
-     */
-    Event BREAK = EventFactory.createInteractionResult();
-    /**
-     * Called when a block is placed in the world by an entity.
-     */
-    Event PLACE = EventFactory.createInteractionResult();
-    
-    /**
-     * Called when a falling block (sand, anvil, etc.) is about to land.
-     * Use fallState#getBlock to get the type of block for more granular control.
-     */
-    Event FALLING_LAND = EventFactory.createLoop();
-    
-    interface Break {
-        InteractionResult breakBlock(Level world, BlockPos pos, BlockState state, ServerPlayer player, @Nullable IntValue xp);
-    }
-    
-    interface Place {
-        InteractionResult placeBlock(Level world, BlockPos pos, BlockState state, @Nullable Entity placer);
-    }
-    
-    interface FallingLand {
-        void onLand(Level level, BlockPos pos, BlockState fallState, BlockState landOn, FallingBlockEntity entity);
-    }
-}
diff --git a/common/src/main/java/me/shedaniel/architectury/event/events/EntityEvent.java b/common/src/main/java/me/shedaniel/architectury/event/events/EntityEvent.java
deleted file mode 100644
index a01a7b90..00000000
--- a/common/src/main/java/me/shedaniel/architectury/event/events/EntityEvent.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * This file is part of architectury.
- * Copyright (C) 2020, 2021 architectury
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-
-package me.shedaniel.architectury.event.events;
-
-import me.shedaniel.architectury.event.Event;
-import me.shedaniel.architectury.event.EventFactory;
-import me.shedaniel.architectury.event.EventResult;
-import net.minecraft.core.BlockPos;
-import net.minecraft.world.InteractionResult;
-import net.minecraft.world.damagesource.DamageSource;
-import net.minecraft.world.entity.Entity;
-import net.minecraft.world.entity.LivingEntity;
-import net.minecraft.world.entity.MobSpawnType;
-import net.minecraft.world.level.BaseSpawner;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.LevelAccessor;
-import net.minecraft.world.level.block.state.BlockState;
-import org.jetbrains.annotations.ApiStatus;
-import org.jetbrains.annotations.Nullable;
-
-public interface EntityEvent {
-    /**
-     * Invoked before LivingEntity#die, equivalent to forge's {@code LivingDeathEvent}.
-     */
-    Event LIVING_DEATH = EventFactory.createInteractionResult();
-    /**
-     * Invoked before LivingEntity#hurt, equivalent to forge's {@code LivingAttackEvent}.
-     */
-    Event LIVING_ATTACK = EventFactory.createInteractionResult();
-    /**
-     * Invoked when an entity is about to be spawned, equivalent to forge's {@code LivingSpawnEvent.CheckSpawn}
-     */
-    Event LIVING_CHECK_SPAWN = EventFactory.createEventResult();
-    /**
-     * Invoked before entity is added to a world, equivalent to forge's {@code EntityJoinWorldEvent}.
-     */
-    Event ADD = EventFactory.createInteractionResult();
-    /**
-     * Invoked when an entity enters a new section
-     */
-    Event ENTER_SECTION = EventFactory.createLoop();
-    
-    interface LivingDeath {
-        InteractionResult die(LivingEntity entity, DamageSource source);
-    }
-    
-    interface LivingAttack {
-        InteractionResult attack(LivingEntity entity, DamageSource source, float amount);
-    }
-    
-    interface LivingCheckSpawn {
-        EventResult canSpawn(LivingEntity entity, LevelAccessor world, double x, double y, double z, MobSpawnType type, @Nullable BaseSpawner spawner);
-    }
-    
-    interface Add {
-        InteractionResult add(Entity entity, Level world);
-    }
-    
-    interface EnterSection {
-        void enterSection(Entity entity, int sectionX, int sectionY, int sectionZ, int prevX, int prevY, int prevZ);
-    }
-    
-}
diff --git a/common/src/main/java/me/shedaniel/architectury/event/events/GuiEvent.java b/common/src/main/java/me/shedaniel/architectury/event/events/GuiEvent.java
deleted file mode 100644
index fbe5ad77..00000000
--- a/common/src/main/java/me/shedaniel/architectury/event/events/GuiEvent.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * This file is part of architectury.
- * Copyright (C) 2020, 2021 architectury
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-
-package me.shedaniel.architectury.event.events;
-
-import com.mojang.blaze3d.vertex.PoseStack;
-import me.shedaniel.architectury.event.Event;
-import me.shedaniel.architectury.event.EventFactory;
-import me.shedaniel.architectury.hooks.screen.ScreenAccess;
-import net.fabricmc.api.EnvType;
-import net.fabricmc.api.Environment;
-import net.minecraft.client.gui.components.AbstractWidget;
-import net.minecraft.client.gui.components.events.GuiEventListener;
-import net.minecraft.client.gui.screens.Screen;
-import net.minecraft.world.InteractionResult;
-import net.minecraft.world.InteractionResultHolder;
-
-import java.util.List;
-
-@Environment(EnvType.CLIENT)
-public interface GuiEvent {
-    /**
-     * Invoked after in-game hud is rendered, equivalent to forge's {@code RenderGameOverlayEvent.Post@ElementType#ALL} and fabric's {@code HudRenderCallback}.
-     */
-    Event RENDER_HUD = EventFactory.createLoop();
-    Event DEBUG_TEXT_LEFT = EventFactory.createLoop();
-    Event DEBUG_TEXT_RIGHT = EventFactory.createLoop();
-    /**
-     * Invoked during Screen#init after previous widgets are cleared, equivalent to forge's {@code GuiScreenEvent.InitGuiEvent.Pre}.
-     */
-    Event INIT_PRE = EventFactory.createInteractionResult();
-    /**
-     * Invoked after Screen#init, equivalent to forge's {@code GuiScreenEvent.InitGuiEvent.Post}.
-     */
-    Event INIT_POST = EventFactory.createLoop();
-    Event RENDER_PRE = EventFactory.createInteractionResult();
-    Event RENDER_POST = EventFactory.createLoop();
-    
-    /**
-     * Invoked during Minecraft#setScreen, equivalent to forge's {@code GuiOpenEvent}.
-     */
-    Event SET_SCREEN = EventFactory.createInteractionResultHolder();
-    
-    @Environment(EnvType.CLIENT)
-    interface RenderHud {
-        void renderHud(PoseStack matrices, float tickDelta);
-    }
-    
-    @Environment(EnvType.CLIENT)
-    interface DebugText {
-        void gatherText(List strings);
-    }
-    
-    @Environment(EnvType.CLIENT)
-    interface ScreenInitPre {
-        InteractionResult init(Screen screen, ScreenAccess access);
-    }
-    
-    @Environment(EnvType.CLIENT)
-    interface ScreenInitPost {
-        void init(Screen screen, ScreenAccess access);
-    }
-    
-    @Environment(EnvType.CLIENT)
-    interface ScreenRenderPre {
-        InteractionResult render(Screen screen, PoseStack matrices, int mouseX, int mouseY, float delta);
-    }
-    
-    @Environment(EnvType.CLIENT)
-    interface ScreenRenderPost {
-        void render(Screen screen, PoseStack matrices, int mouseX, int mouseY, float delta);
-    }
-    
-    @Environment(EnvType.CLIENT)
-    interface SetScreen {
-        InteractionResultHolder modifyScreen(Screen screen);
-    }
-}
diff --git a/common/src/main/java/me/shedaniel/architectury/event/events/InteractionEvent.java b/common/src/main/java/me/shedaniel/architectury/event/events/InteractionEvent.java
deleted file mode 100644
index 8e62f002..00000000
--- a/common/src/main/java/me/shedaniel/architectury/event/events/InteractionEvent.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * This file is part of architectury.
- * Copyright (C) 2020, 2021 architectury
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-
-package me.shedaniel.architectury.event.events;
-
-import me.shedaniel.architectury.event.Event;
-import me.shedaniel.architectury.event.EventFactory;
-import me.shedaniel.architectury.event.EventResult;
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.Direction;
-import net.minecraft.world.InteractionHand;
-import net.minecraft.world.InteractionResult;
-import net.minecraft.world.InteractionResultHolder;
-import net.minecraft.world.entity.Entity;
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.block.state.BlockState;
-
-public interface InteractionEvent {
-    Event LEFT_CLICK_BLOCK = EventFactory.createInteractionResult();
-    Event RIGHT_CLICK_BLOCK = EventFactory.createInteractionResult();
-    Event RIGHT_CLICK_ITEM = EventFactory.createInteractionResultHolder();
-    Event CLIENT_LEFT_CLICK_AIR = EventFactory.createLoop();
-    Event CLIENT_RIGHT_CLICK_AIR = EventFactory.createLoop();
-    Event INTERACT_ENTITY = EventFactory.createInteractionResult();
-    /**
-     * Invoked before a farmland block is trampled by an entity, equivalent to forge's {@code BlockEvent.FarmlandTrampleEvent}
-     */
-    Event FARMLAND_TRAMPLE = EventFactory.createEventResult();
-    
-    interface RightClickBlock {
-        InteractionResult click(Player player, InteractionHand hand, BlockPos pos, Direction face);
-    }
-    
-    interface LeftClickBlock {
-        InteractionResult click(Player player, InteractionHand hand, BlockPos pos, Direction face);
-    }
-    
-    interface RightClickItem {
-        InteractionResultHolder click(Player player, InteractionHand hand);
-    }
-    
-    interface ClientRightClickAir {
-        void click(Player player, InteractionHand hand);
-    }
-    
-    interface ClientLeftClickAir {
-        void click(Player player, InteractionHand hand);
-    }
-    
-    interface InteractEntity {
-        InteractionResult interact(Player player, Entity entity, InteractionHand hand);
-    }
-    
-    interface BlockBreak {
-        InteractionResult breakBlock(Player player, BlockPos pos, BlockState state);
-    }
-    
-    interface FarmlandTrample {
-        EventResult trample(Level world, BlockPos pos, BlockState state, float distance, Entity entity);
-    }
-}
diff --git a/common/src/main/java/me/shedaniel/architectury/event/events/LifecycleEvent.java b/common/src/main/java/me/shedaniel/architectury/event/events/LifecycleEvent.java
deleted file mode 100644
index b71c07ba..00000000
--- a/common/src/main/java/me/shedaniel/architectury/event/events/LifecycleEvent.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * This file is part of architectury.
- * Copyright (C) 2020, 2021 architectury
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-
-package me.shedaniel.architectury.event.events;
-
-import me.shedaniel.architectury.event.Event;
-import me.shedaniel.architectury.event.EventFactory;
-import net.minecraft.server.MinecraftServer;
-import net.minecraft.server.level.ServerLevel;
-import net.minecraft.world.level.Level;
-
-public interface LifecycleEvent {
-    /**
-     * Invoked when server is starting, equivalent to forge's {@code FMLServerAboutToStartEvent} and fabric's {@code ServerLifecycleEvents#SERVER_STARTING}.
-     */
-    Event SERVER_BEFORE_START = EventFactory.createLoop();
-    /**
-     * Invoked when server is starting, equivalent to forge's {@code FMLServerStartingEvent}.
-     */
-    Event SERVER_STARTING = EventFactory.createLoop();
-    /**
-     * Invoked when server has started, equivalent to forge's {@code FMLServerStartedEvent} and fabric's {@code ServerLifecycleEvents#SERVER_STARTED}.
-     */
-    Event SERVER_STARTED = EventFactory.createLoop();
-    /**
-     * Invoked when server is stopping, equivalent to forge's {@code FMLServerStoppingEvent} and fabric's {@code ServerLifecycleEvents#SERVER_STOPPING}.
-     */
-    Event SERVER_STOPPING = EventFactory.createLoop();
-    /**
-     * Invoked when server has stopped, equivalent to forge's {@code FMLServerStoppedEvent} and fabric's {@code ServerLifecycleEvents#SERVER_STOPPED}.
-     */
-    Event SERVER_STOPPED = EventFactory.createLoop();
-    /**
-     * Invoked after a world is loaded only on server, equivalent to forge's {@code WorldEvent.Load} and fabric's {@code ServerWorldEvents#LOAD}.
-     */
-    Event SERVER_WORLD_LOAD = EventFactory.createLoop();
-    /**
-     * Invoked after a world is unloaded, equivalent to forge's {@code WorldEvent.Unload} and fabric's {@code ServerWorldEvents#UNLOAD}.
-     */
-    Event SERVER_WORLD_UNLOAD = EventFactory.createLoop();
-    /**
-     * Invoked during a world is saved, equivalent to forge's {@code WorldEvent.Save}.
-     */
-    Event SERVER_WORLD_SAVE = EventFactory.createLoop();
-    
-    interface InstanceState {
-        void stateChanged(T instance);
-    }
-    
-    interface ServerState extends InstanceState {
-    }
-    
-    interface WorldState {
-        void act(T world);
-    }
-    
-    interface ServerWorldState extends WorldState {
-    }
-}
diff --git a/common/src/main/java/me/shedaniel/architectury/event/events/PlayerEvent.java b/common/src/main/java/me/shedaniel/architectury/event/events/PlayerEvent.java
deleted file mode 100644
index 4a2f2475..00000000
--- a/common/src/main/java/me/shedaniel/architectury/event/events/PlayerEvent.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * This file is part of architectury.
- * Copyright (C) 2020, 2021 architectury
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-
-package me.shedaniel.architectury.event.events;
-
-import me.shedaniel.architectury.event.CompoundEventResult;
-import me.shedaniel.architectury.event.Event;
-import me.shedaniel.architectury.event.EventFactory;
-import me.shedaniel.architectury.utils.IntValue;
-import net.minecraft.advancements.Advancement;
-import net.minecraft.core.BlockPos;
-import net.minecraft.resources.ResourceKey;
-import net.minecraft.server.level.ServerPlayer;
-import net.minecraft.world.Container;
-import net.minecraft.world.InteractionResult;
-import net.minecraft.world.entity.item.ItemEntity;
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.inventory.AbstractContainerMenu;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.phys.HitResult;
-import org.jetbrains.annotations.ApiStatus;
-import org.jetbrains.annotations.Nullable;
-
-public interface PlayerEvent {
-    Event PLAYER_JOIN = EventFactory.createLoop();
-    Event PLAYER_QUIT = EventFactory.createLoop();
-    Event PLAYER_RESPAWN = EventFactory.createLoop();
-    Event PLAYER_ADVANCEMENT = EventFactory.createLoop();
-    Event PLAYER_CLONE = EventFactory.createLoop();
-    Event CRAFT_ITEM = EventFactory.createLoop();
-    Event SMELT_ITEM = EventFactory.createLoop();
-    Event PICKUP_ITEM_PRE = EventFactory.createInteractionResult();
-    Event PICKUP_ITEM_POST = EventFactory.createLoop();
-    Event CHANGE_DIMENSION = EventFactory.createLoop();
-    Event DROP_ITEM = EventFactory.createLoop();
-    Event OPEN_MENU = EventFactory.createLoop();
-    Event CLOSE_MENU = EventFactory.createLoop();
-    /**
-     * Invoked when a player attempts to fill a bucket using right-click.
-     * You can return a non-PASS interaction result to cancel further processing by other mods.
-     * 

- * On Forge, FAIL cancels the event, and SUCCESS sets the event as handled. - * On Fabric, any non-PASS result is returned directly and immediately. - */ - Event FILL_BUCKET = EventFactory.createCompoundEventResult(); - - interface PlayerJoin { - void join(ServerPlayer player); - } - - interface PlayerQuit { - void quit(ServerPlayer player); - } - - interface PlayerRespawn { - void respawn(ServerPlayer newPlayer, boolean conqueredEnd); - } - - interface PlayerClone { - void clone(ServerPlayer oldPlayer, ServerPlayer newPlayer, boolean wonGame); - } - - interface PlayerAdvancement { - void award(ServerPlayer player, Advancement advancement); - } - - interface CraftItem { - void craft(Player player, ItemStack constructed, Container inventory); - } - - interface SmeltItem { - void smelt(Player player, ItemStack smelted); - } - - interface PickupItemPredicate { - InteractionResult canPickup(Player player, ItemEntity entity, ItemStack stack); - } - - interface PickupItem { - void pickup(Player player, ItemEntity entity, ItemStack stack); - } - - interface ChangeDimension { - void change(ServerPlayer player, ResourceKey oldLevel, ResourceKey newLevel); - } - - interface DropItem { - InteractionResult drop(Player player, ItemEntity entity); - } - - interface OpenMenu { - void open(Player player, AbstractContainerMenu menu); - } - - interface CloseMenu { - void close(Player player, AbstractContainerMenu menu); - } - - interface FillBucket { - CompoundEventResult fill(Player player, Level level, ItemStack stack, @Nullable HitResult target); - } -} diff --git a/common/src/main/java/me/shedaniel/architectury/event/events/TickEvent.java b/common/src/main/java/me/shedaniel/architectury/event/events/TickEvent.java deleted file mode 100644 index 6179d956..00000000 --- a/common/src/main/java/me/shedaniel/architectury/event/events/TickEvent.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * This file is part of architectury. - * Copyright (C) 2020, 2021 architectury - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package me.shedaniel.architectury.event.events; - -import me.shedaniel.architectury.event.Event; -import me.shedaniel.architectury.event.EventFactory; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.Level; - -public interface TickEvent { - Event SERVER_PRE = EventFactory.createLoop(); - Event SERVER_POST = EventFactory.createLoop(); - Event SERVER_WORLD_PRE = EventFactory.createLoop(); - Event SERVER_WORLD_POST = EventFactory.createLoop(); - Event PLAYER_PRE = EventFactory.createLoop(); - Event PLAYER_POST = EventFactory.createLoop(); - - void tick(T instance); - - interface Server extends TickEvent { - } - - interface WorldTick extends TickEvent { - } - - interface ServerWorld extends WorldTick { - } - - interface Player extends TickEvent { - } -} diff --git a/common/src/main/java/me/shedaniel/architectury/event/events/TooltipEvent.java b/common/src/main/java/me/shedaniel/architectury/event/events/TooltipEvent.java deleted file mode 100644 index eebb1998..00000000 --- a/common/src/main/java/me/shedaniel/architectury/event/events/TooltipEvent.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * This file is part of architectury. - * Copyright (C) 2020, 2021 architectury - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package me.shedaniel.architectury.event.events; - -import com.mojang.blaze3d.vertex.PoseStack; -import me.shedaniel.architectury.event.Event; -import me.shedaniel.architectury.event.EventFactory; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.FormattedText; -import net.minecraft.util.FormattedCharSequence; -import net.minecraft.world.InteractionResult; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.TooltipFlag; - -import java.util.List; - -@Environment(EnvType.CLIENT) -public interface TooltipEvent { - Event ITEM = EventFactory.createLoop(); - /** - * Render vanilla events are not invoked on the forge side. - */ - Event RENDER_VANILLA_PRE = EventFactory.createInteractionResult(); - /** - * Render forge events are only invoked on the forge side. - */ - Event RENDER_FORGE_PRE = EventFactory.createInteractionResult(); - Event RENDER_MODIFY_POSITION = EventFactory.createLoop(); - Event RENDER_MODIFY_COLOR = EventFactory.createLoop(); - - @Environment(EnvType.CLIENT) - interface Item { - void append(ItemStack stack, List lines, TooltipFlag flag); - } - - @Environment(EnvType.CLIENT) - interface RenderVanilla { - InteractionResult renderTooltip(PoseStack matrices, List texts, int x, int y); - } - - @Environment(EnvType.CLIENT) - interface RenderForge { - InteractionResult renderTooltip(PoseStack matrices, List texts, int x, int y); - } - - @Environment(EnvType.CLIENT) - interface RenderModifyPosition { - void renderTooltip(PoseStack matrices, PositionContext context); - } - - @Environment(EnvType.CLIENT) - interface RenderModifyColor { - void renderTooltip(PoseStack matrices, int x, int y, ColorContext context); - } - - @Environment(EnvType.CLIENT) - interface PositionContext { - int getTooltipX(); - - void setTooltipX(int x); - - int getTooltipY(); - - void setTooltipY(int y); - } - - @Environment(EnvType.CLIENT) - interface ColorContext { - int getBackgroundColor(); - - void setBackgroundColor(int color); - - int getOutlineGradientTopColor(); - - void setOutlineGradientTopColor(int color); - - int getOutlineGradientBottomColor(); - - void setOutlineGradientBottomColor(int color); - } -} diff --git a/common/src/main/java/me/shedaniel/architectury/event/events/client/ClientChatEvent.java b/common/src/main/java/me/shedaniel/architectury/event/events/client/ClientChatEvent.java deleted file mode 100644 index fef7ae3d..00000000 --- a/common/src/main/java/me/shedaniel/architectury/event/events/client/ClientChatEvent.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This file is part of architectury. - * Copyright (C) 2020, 2021 architectury - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package me.shedaniel.architectury.event.events.client; - -import me.shedaniel.architectury.event.Event; -import me.shedaniel.architectury.event.EventFactory; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.network.chat.ChatType; -import net.minecraft.network.chat.Component; -import net.minecraft.world.InteractionResultHolder; -import org.jetbrains.annotations.Nullable; - -import java.util.UUID; - -@Environment(EnvType.CLIENT) -public interface ClientChatEvent { - /** - * Invoked when client tries to send a message, equivalent to forge's {@code ClientChatEvent}. - */ - Event CLIENT = EventFactory.createInteractionResultHolder(); - /** - * Invoked when client receives a message, equivalent to forge's {@code ClientChatReceivedEvent}. - */ - Event CLIENT_RECEIVED = EventFactory.createInteractionResultHolder(); - - @Environment(EnvType.CLIENT) - interface Client { - InteractionResultHolder process(String message); - } - - @Environment(EnvType.CLIENT) - interface ClientReceived { - InteractionResultHolder process(ChatType type, Component message, @Nullable UUID sender); - } -} diff --git a/common/src/main/java/me/shedaniel/architectury/event/events/client/ClientRawInputEvent.java b/common/src/main/java/me/shedaniel/architectury/event/events/client/ClientRawInputEvent.java deleted file mode 100644 index dad3e44a..00000000 --- a/common/src/main/java/me/shedaniel/architectury/event/events/client/ClientRawInputEvent.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * This file is part of architectury. - * Copyright (C) 2020, 2021 architectury - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package me.shedaniel.architectury.event.events.client; - -import me.shedaniel.architectury.event.Event; -import me.shedaniel.architectury.event.EventFactory; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.Minecraft; -import net.minecraft.world.InteractionResult; - -@Environment(EnvType.CLIENT) -public interface ClientRawInputEvent { - /** - * Invoked after the mouse has scrolled, but doesn't have a screen opened, and in a world, equivalent to forge's {@code InputEvent.MouseScrollEvent}. - */ - Event MOUSE_SCROLLED = EventFactory.createInteractionResult(); - /** - * Invoked after the mouse has clicked, before the screen intercepts, equivalent to forge's {@code InputEvent.RawMouseEvent}. - */ - Event MOUSE_CLICKED_PRE = EventFactory.createInteractionResult(); - /** - * Invoked after the mouse has clicked, after the screen intercepts, equivalent to forge's {@code InputEvent.MouseInputEvent}. - */ - Event MOUSE_CLICKED_POST = EventFactory.createInteractionResult(); - /** - * Invoked after a key was pressed, after the screen intercepts, equivalent to forge's {@code InputEvent.KeyInputEvent}. - */ - Event KEY_PRESSED = EventFactory.createInteractionResult(); - - interface KeyPressed { - InteractionResult keyPressed(Minecraft client, int keyCode, int scanCode, int action, int modifiers); - } - - interface MouseScrolled { - InteractionResult mouseScrolled(Minecraft client, double amount); - } - - interface MouseClicked { - InteractionResult mouseClicked(Minecraft client, int button, int action, int mods); - } -} diff --git a/common/src/main/java/me/shedaniel/architectury/event/events/client/ClientScreenInputEvent.java b/common/src/main/java/me/shedaniel/architectury/event/events/client/ClientScreenInputEvent.java deleted file mode 100644 index 2fdec177..00000000 --- a/common/src/main/java/me/shedaniel/architectury/event/events/client/ClientScreenInputEvent.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * This file is part of architectury. - * Copyright (C) 2020, 2021 architectury - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package me.shedaniel.architectury.event.events.client; - -import me.shedaniel.architectury.event.Event; -import me.shedaniel.architectury.event.EventFactory; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.screens.Screen; -import net.minecraft.world.InteractionResult; - -@Environment(EnvType.CLIENT) -public interface ClientScreenInputEvent { - Event MOUSE_SCROLLED_PRE = EventFactory.createInteractionResult(); - Event MOUSE_SCROLLED_POST = EventFactory.createInteractionResult(); - Event MOUSE_CLICKED_PRE = EventFactory.createInteractionResult(); - Event MOUSE_CLICKED_POST = EventFactory.createInteractionResult(); - Event MOUSE_RELEASED_PRE = EventFactory.createInteractionResult(); - Event MOUSE_RELEASED_POST = EventFactory.createInteractionResult(); - Event MOUSE_DRAGGED_PRE = EventFactory.createInteractionResult(); - Event MOUSE_DRAGGED_POST = EventFactory.createInteractionResult(); - Event CHAR_TYPED_PRE = EventFactory.createInteractionResult(); - Event CHAR_TYPED_POST = EventFactory.createInteractionResult(); - Event KEY_PRESSED_PRE = EventFactory.createInteractionResult(); - Event KEY_PRESSED_POST = EventFactory.createInteractionResult(); - Event KEY_RELEASED_PRE = EventFactory.createInteractionResult(); - Event KEY_RELEASED_POST = EventFactory.createInteractionResult(); - - interface KeyPressed { - InteractionResult keyPressed(Minecraft client, Screen screen, int keyCode, int scanCode, int modifiers); - } - - interface KeyReleased { - InteractionResult keyReleased(Minecraft client, Screen screen, int keyCode, int scanCode, int modifiers); - } - - interface KeyTyped { - InteractionResult charTyped(Minecraft client, Screen screen, char character, int keyCode); - } - - interface MouseScrolled { - InteractionResult mouseScrolled(Minecraft client, Screen screen, double mouseX, double mouseY, double amount); - } - - interface MouseReleased { - InteractionResult mouseReleased(Minecraft client, Screen screen, double mouseX, double mouseY, int button); - } - - interface MouseDragged { - InteractionResult mouseDragged(Minecraft client, Screen screen, double mouseX1, double mouseY1, int button, double mouseX2, double mouseY2); - } - - interface MouseClicked { - InteractionResult mouseClicked(Minecraft client, Screen screen, double mouseX, double mouseY, int button); - } -} diff --git a/common/src/main/resources/architectury-common.mixins.json b/common/src/main/resources/architectury-common.mixins.json index 403934b2..f6c5c587 100644 --- a/common/src/main/resources/architectury-common.mixins.json +++ b/common/src/main/resources/architectury-common.mixins.json @@ -1,13 +1,13 @@ { "required": true, - "package": "me.shedaniel.architectury.mixin", + "package": "dev.architectury.mixin", "compatibilityLevel": "JAVA_8", "minVersion": "0.7.11", "client": [ ], "mixins": [ - "MixinFallingBlockEntity", "FluidTagsAccessor", + "MixinFallingBlockEntity", "MixinLightningBolt" ], "injectors": { diff --git a/fabric/src/main/java/me/shedaniel/architectury/compat/fabric/ModMenuCompatibility.java b/fabric/src/main/java/dev/architectury/compat/fabric/ModMenuCompatibility.java similarity index 78% rename from fabric/src/main/java/me/shedaniel/architectury/compat/fabric/ModMenuCompatibility.java rename to fabric/src/main/java/dev/architectury/compat/fabric/ModMenuCompatibility.java index 2d3128ac..8ca12f29 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/compat/fabric/ModMenuCompatibility.java +++ b/fabric/src/main/java/dev/architectury/compat/fabric/ModMenuCompatibility.java @@ -17,13 +17,12 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.compat.fabric; +package dev.architectury.compat.fabric; import com.google.common.collect.Maps; -import io.github.prospector.modmenu.api.ConfigScreenFactory; -import io.github.prospector.modmenu.api.ModMenuApi; -import me.shedaniel.architectury.platform.Mod; -import me.shedaniel.architectury.platform.fabric.PlatformImpl; +import com.terraformersmc.modmenu.api.ConfigScreenFactory; +import com.terraformersmc.modmenu.api.ModMenuApi; +import dev.architectury.platform.fabric.PlatformImpl; import java.util.Map; @@ -37,7 +36,7 @@ public class ModMenuCompatibility implements ModMenuApi { } private void validateMap() { - for (Map.Entry entry : PlatformImpl.CONFIG_SCREENS.entrySet()) { + for (var entry : PlatformImpl.CONFIG_SCREENS.entrySet()) { if (!FACTORIES.containsKey(entry.getKey())) { FACTORIES.put(entry.getKey(), entry.getValue()::provide); } diff --git a/fabric/src/main/java/me/shedaniel/architectury/event/fabric/EventFactoryImpl.java b/fabric/src/main/java/dev/architectury/event/fabric/EventFactoryImpl.java similarity index 76% rename from fabric/src/main/java/me/shedaniel/architectury/event/fabric/EventFactoryImpl.java rename to fabric/src/main/java/dev/architectury/event/fabric/EventFactoryImpl.java index f2f18400..dd28bfeb 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/event/fabric/EventFactoryImpl.java +++ b/fabric/src/main/java/dev/architectury/event/fabric/EventFactoryImpl.java @@ -17,11 +17,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.event.fabric; +package dev.architectury.event.fabric; -import me.shedaniel.architectury.event.Actor; -import me.shedaniel.architectury.event.Event; -import me.shedaniel.architectury.event.EventActor; +import dev.architectury.event.Event; +import dev.architectury.event.EventActor; import org.jetbrains.annotations.ApiStatus; import java.util.function.Consumer; @@ -31,14 +30,6 @@ public class EventFactoryImpl { return event; } - public static Event> attachToForgeActor(Event> event) { - return event; - } - - public static Event> attachToForgeActorCancellable(Event> event) { - return event; - } - @ApiStatus.Internal public static Event> attachToForgeEventActor(Event> event) { return event; diff --git a/fabric/src/main/java/me/shedaniel/architectury/event/fabric/EventHandlerImpl.java b/fabric/src/main/java/dev/architectury/event/fabric/EventHandlerImpl.java similarity index 78% rename from fabric/src/main/java/me/shedaniel/architectury/event/fabric/EventHandlerImpl.java rename to fabric/src/main/java/dev/architectury/event/fabric/EventHandlerImpl.java index a170f860..e0930147 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/event/fabric/EventHandlerImpl.java +++ b/fabric/src/main/java/dev/architectury/event/fabric/EventHandlerImpl.java @@ -17,11 +17,16 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.event.fabric; +package dev.architectury.event.fabric; -import me.shedaniel.architectury.event.events.*; -import me.shedaniel.architectury.event.events.client.ClientLifecycleEvent; -import me.shedaniel.architectury.event.events.client.ClientTickEvent; +import dev.architectury.event.events.client.ClientGuiEvent; +import dev.architectury.event.events.client.ClientLifecycleEvent; +import dev.architectury.event.events.client.ClientTickEvent; +import dev.architectury.event.events.client.ClientTooltipEvent; +import dev.architectury.event.events.common.CommandRegistrationEvent; +import dev.architectury.event.events.common.InteractionEvent; +import dev.architectury.event.events.common.LifecycleEvent; +import dev.architectury.event.events.common.TickEvent; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents; @@ -45,11 +50,11 @@ public class EventHandlerImpl { ClientTickEvents.START_CLIENT_TICK.register(instance -> ClientTickEvent.CLIENT_PRE.invoker().tick(instance)); ClientTickEvents.END_CLIENT_TICK.register(instance -> ClientTickEvent.CLIENT_POST.invoker().tick(instance)); - ClientTickEvents.START_WORLD_TICK.register(instance -> ClientTickEvent.CLIENT_WORLD_PRE.invoker().tick(instance)); - ClientTickEvents.END_WORLD_TICK.register(instance -> ClientTickEvent.CLIENT_WORLD_POST.invoker().tick(instance)); + ClientTickEvents.START_WORLD_TICK.register(instance -> ClientTickEvent.CLIENT_LEVEL_PRE.invoker().tick(instance)); + ClientTickEvents.END_WORLD_TICK.register(instance -> ClientTickEvent.CLIENT_LEVEL_POST.invoker().tick(instance)); - ItemTooltipCallback.EVENT.register((itemStack, tooltipFlag, list) -> TooltipEvent.ITEM.invoker().append(itemStack, list, tooltipFlag)); - HudRenderCallback.EVENT.register((matrices, tickDelta) -> GuiEvent.RENDER_HUD.invoker().renderHud(matrices, tickDelta)); + ItemTooltipCallback.EVENT.register((itemStack, tooltipFlag, list) -> ClientTooltipEvent.ITEM.invoker().append(itemStack, list, tooltipFlag)); + HudRenderCallback.EVENT.register((matrices, tickDelta) -> ClientGuiEvent.RENDER_HUD.invoker().renderHud(matrices, tickDelta)); } public static void registerCommon() { @@ -60,17 +65,17 @@ public class EventHandlerImpl { ServerTickEvents.START_SERVER_TICK.register(instance -> TickEvent.SERVER_PRE.invoker().tick(instance)); ServerTickEvents.END_SERVER_TICK.register(instance -> TickEvent.SERVER_POST.invoker().tick(instance)); - ServerTickEvents.START_WORLD_TICK.register(instance -> TickEvent.SERVER_WORLD_PRE.invoker().tick(instance)); - ServerTickEvents.END_WORLD_TICK.register(instance -> TickEvent.SERVER_WORLD_POST.invoker().tick(instance)); + ServerTickEvents.START_WORLD_TICK.register(instance -> TickEvent.SERVER_LEVEL_PRE.invoker().tick(instance)); + ServerTickEvents.END_WORLD_TICK.register(instance -> TickEvent.SERVER_LEVEL_POST.invoker().tick(instance)); - ServerWorldEvents.LOAD.register((server, world) -> LifecycleEvent.SERVER_WORLD_LOAD.invoker().act(world)); - ServerWorldEvents.UNLOAD.register((server, world) -> LifecycleEvent.SERVER_WORLD_UNLOAD.invoker().act(world)); + ServerWorldEvents.LOAD.register((server, world) -> LifecycleEvent.SERVER_LEVEL_LOAD.invoker().act(world)); + ServerWorldEvents.UNLOAD.register((server, world) -> LifecycleEvent.SERVER_LEVEL_UNLOAD.invoker().act(world)); CommandRegistrationCallback.EVENT.register((commandDispatcher, b) -> CommandRegistrationEvent.EVENT.invoker().register(commandDispatcher, b ? Commands.CommandSelection.DEDICATED : Commands.CommandSelection.INTEGRATED)); - UseItemCallback.EVENT.register((player, world, hand) -> InteractionEvent.RIGHT_CLICK_ITEM.invoker().click(player, hand)); - UseBlockCallback.EVENT.register((player, world, hand, hitResult) -> InteractionEvent.RIGHT_CLICK_BLOCK.invoker().click(player, hand, hitResult.getBlockPos(), hitResult.getDirection())); - AttackBlockCallback.EVENT.register((player, world, hand, pos, face) -> InteractionEvent.LEFT_CLICK_BLOCK.invoker().click(player, hand, pos, face)); + UseItemCallback.EVENT.register((player, world, hand) -> InteractionEvent.RIGHT_CLICK_ITEM.invoker().click(player, hand).asMinecraft()); + UseBlockCallback.EVENT.register((player, world, hand, hitResult) -> InteractionEvent.RIGHT_CLICK_BLOCK.invoker().click(player, hand, hitResult.getBlockPos(), hitResult.getDirection()).asMinecraft()); + AttackBlockCallback.EVENT.register((player, world, hand, pos, face) -> InteractionEvent.LEFT_CLICK_BLOCK.invoker().click(player, hand, pos, face).asMinecraft()); } @Environment(EnvType.SERVER) diff --git a/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/BlockEntityHooksImpl.java b/fabric/src/main/java/dev/architectury/hooks/block/fabric/BlockEntityHooksImpl.java similarity index 93% rename from fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/BlockEntityHooksImpl.java rename to fabric/src/main/java/dev/architectury/hooks/block/fabric/BlockEntityHooksImpl.java index 867ec8d5..d50a203b 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/BlockEntityHooksImpl.java +++ b/fabric/src/main/java/dev/architectury/hooks/block/fabric/BlockEntityHooksImpl.java @@ -17,11 +17,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.hooks.fabric; +package dev.architectury.hooks.block.fabric; import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable; import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; import java.util.Objects; @@ -46,7 +45,7 @@ public class BlockEntityHooksImpl { if (entity instanceof BlockEntityClientSerializable) { ((BlockEntityClientSerializable) entity).sync(); } else { - Level world = Objects.requireNonNull(entity.getLevel()); + var world = Objects.requireNonNull(entity.getLevel()); if (!(world instanceof ServerLevel)) { throw new IllegalStateException("Cannot call sync() on the logical client! Did you check world.isClient first?"); } else { diff --git a/fabric/src/main/java/me/shedaniel/architectury/hooks/screen/fabric/ScreenHooksImpl.java b/fabric/src/main/java/dev/architectury/hooks/client/screen/fabric/ScreenHooksImpl.java similarity index 97% rename from fabric/src/main/java/me/shedaniel/architectury/hooks/screen/fabric/ScreenHooksImpl.java rename to fabric/src/main/java/dev/architectury/hooks/client/screen/fabric/ScreenHooksImpl.java index 6cfecff5..34de43c6 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/hooks/screen/fabric/ScreenHooksImpl.java +++ b/fabric/src/main/java/dev/architectury/hooks/client/screen/fabric/ScreenHooksImpl.java @@ -17,7 +17,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.hooks.screen.fabric; +package dev.architectury.hooks.client.screen.fabric; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; diff --git a/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/DyeColorHooksImpl.java b/fabric/src/main/java/dev/architectury/hooks/fabric/DyeColorHooksImpl.java similarity index 91% rename from fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/DyeColorHooksImpl.java rename to fabric/src/main/java/dev/architectury/hooks/fabric/DyeColorHooksImpl.java index 000d89b6..fb356d0d 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/DyeColorHooksImpl.java +++ b/fabric/src/main/java/dev/architectury/hooks/fabric/DyeColorHooksImpl.java @@ -17,13 +17,13 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.hooks.fabric; +package dev.architectury.hooks.fabric; import net.minecraft.world.item.DyeColor; public class DyeColorHooksImpl { public static int getColorValue(DyeColor color) { - float[] colors = color.getTextureDiffuseColors(); + var colors = color.getTextureDiffuseColors(); return ((int) (colors[0] * 255.0F + 0.5D) & 255) << 16 | ((int) (colors[1] * 255.0F + 0.5D) & 255) << 8 | (int) (colors[2] * 255.0F + 0.5D); } } diff --git a/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/PackRepositoryHooksImpl.java b/fabric/src/main/java/dev/architectury/hooks/fabric/PackRepositoryHooksImpl.java similarity index 96% rename from fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/PackRepositoryHooksImpl.java rename to fabric/src/main/java/dev/architectury/hooks/fabric/PackRepositoryHooksImpl.java index aa0e366f..5d5c05d8 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/PackRepositoryHooksImpl.java +++ b/fabric/src/main/java/dev/architectury/hooks/fabric/PackRepositoryHooksImpl.java @@ -17,7 +17,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.hooks.fabric; +package dev.architectury.hooks.fabric; import com.google.common.collect.ImmutableSet; import net.minecraft.server.packs.repository.PackRepository; diff --git a/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/PersistentEntitySectionManagerHooks.java b/fabric/src/main/java/dev/architectury/hooks/fabric/PersistentEntitySectionManagerHooks.java similarity index 95% rename from fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/PersistentEntitySectionManagerHooks.java rename to fabric/src/main/java/dev/architectury/hooks/fabric/PersistentEntitySectionManagerHooks.java index 74061961..5de1278d 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/PersistentEntitySectionManagerHooks.java +++ b/fabric/src/main/java/dev/architectury/hooks/fabric/PersistentEntitySectionManagerHooks.java @@ -17,7 +17,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.hooks.fabric; +package dev.architectury.hooks.fabric; import net.minecraft.server.level.ServerLevel; diff --git a/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/FluidStackHooksImpl.java b/fabric/src/main/java/dev/architectury/hooks/fluid/fabric/FluidStackHooksImpl.java similarity index 75% rename from fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/FluidStackHooksImpl.java rename to fabric/src/main/java/dev/architectury/hooks/fluid/fabric/FluidStackHooksImpl.java index 49916ad1..f6f4bce3 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/FluidStackHooksImpl.java +++ b/fabric/src/main/java/dev/architectury/hooks/fluid/fabric/FluidStackHooksImpl.java @@ -17,15 +17,14 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.hooks.fabric; +package dev.architectury.hooks.fluid.fabric; -import me.shedaniel.architectury.fluid.FluidStack; -import me.shedaniel.architectury.platform.Platform; -import me.shedaniel.architectury.utils.Env; -import me.shedaniel.architectury.utils.NbtType; +import dev.architectury.fluid.FluidStack; +import dev.architectury.platform.Platform; +import dev.architectury.utils.Env; +import dev.architectury.utils.NbtType; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandler; import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.core.BlockPos; @@ -59,14 +58,14 @@ public class FluidStackHooksImpl { } public static String getTranslationKey(FluidStack stack) { - ResourceLocation id = Registry.FLUID.getKey(stack.getFluid()); + var id = Registry.FLUID.getKey(stack.getFluid()); return "block." + id.getNamespace() + "." + id.getPath(); } public static FluidStack read(FriendlyByteBuf buf) { - Fluid fluid = Objects.requireNonNull(Registry.FLUID.get(buf.readResourceLocation())); - long amount = buf.readVarLong(); - CompoundTag tag = buf.readNbt(); + var fluid = Objects.requireNonNull(Registry.FLUID.get(buf.readResourceLocation())); + var amount = buf.readVarLong(); + var tag = buf.readNbt(); if (fluid == Fluids.EMPTY) return FluidStack.empty(); return FluidStack.create(fluid, amount, tag); } @@ -81,13 +80,13 @@ public class FluidStackHooksImpl { if (tag == null || !tag.contains("id", NbtType.STRING)) { return FluidStack.empty(); } - - Fluid fluid = Registry.FLUID.get(new ResourceLocation(tag.getString("id"))); + + var fluid = Registry.FLUID.get(new ResourceLocation(tag.getString("id"))); if (fluid == null || fluid == Fluids.EMPTY) { return FluidStack.empty(); } - long amount = tag.getLong("amount"); - FluidStack stack = FluidStack.create(fluid, amount); + var amount = tag.getLong("amount"); + var stack = FluidStack.create(fluid, amount); if (tag.contains("tag", NbtType.COMPOUND)) { stack.setTag(tag.getCompound("tag")); @@ -112,7 +111,7 @@ public class FluidStackHooksImpl { @Nullable public static TextureAtlasSprite getStillTexture(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, @NotNull FluidState state) { if (state.getType() == Fluids.EMPTY) return null; - TextureAtlasSprite[] sprites = FluidRenderHandlerRegistry.INSTANCE.get(state.getType()).getFluidSprites(level, pos, state); + var sprites = FluidRenderHandlerRegistry.INSTANCE.get(state.getType()).getFluidSprites(level, pos, state); if (sprites == null) return null; return sprites[0]; } @@ -121,7 +120,7 @@ public class FluidStackHooksImpl { @Nullable public static TextureAtlasSprite getStillTexture(@NotNull FluidStack stack) { if (stack.getFluid() == Fluids.EMPTY) return null; - TextureAtlasSprite[] sprites = FluidRenderHandlerRegistry.INSTANCE.get(stack.getFluid()).getFluidSprites(null, null, stack.getFluid().defaultFluidState()); + var sprites = FluidRenderHandlerRegistry.INSTANCE.get(stack.getFluid()).getFluidSprites(null, null, stack.getFluid().defaultFluidState()); if (sprites == null) return null; return sprites[0]; } @@ -130,7 +129,7 @@ public class FluidStackHooksImpl { @Nullable public static TextureAtlasSprite getStillTexture(@NotNull Fluid fluid) { if (fluid == Fluids.EMPTY) return null; - TextureAtlasSprite[] sprites = FluidRenderHandlerRegistry.INSTANCE.get(fluid).getFluidSprites(null, null, fluid.defaultFluidState()); + var sprites = FluidRenderHandlerRegistry.INSTANCE.get(fluid).getFluidSprites(null, null, fluid.defaultFluidState()); if (sprites == null) return null; return sprites[0]; } @@ -139,9 +138,9 @@ public class FluidStackHooksImpl { @Nullable public static TextureAtlasSprite getFlowingTexture(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, @NotNull FluidState state) { if (state.getType() == Fluids.EMPTY) return null; - FluidRenderHandler handler = FluidRenderHandlerRegistry.INSTANCE.get(state.getType()); + var handler = FluidRenderHandlerRegistry.INSTANCE.get(state.getType()); if (handler == null) return null; - TextureAtlasSprite[] sprites = handler.getFluidSprites(level, pos, state); + var sprites = handler.getFluidSprites(level, pos, state); if (sprites == null) return null; return sprites[1]; } @@ -150,9 +149,9 @@ public class FluidStackHooksImpl { @Nullable public static TextureAtlasSprite getFlowingTexture(@NotNull FluidStack stack) { if (stack.getFluid() == Fluids.EMPTY) return null; - FluidRenderHandler handler = FluidRenderHandlerRegistry.INSTANCE.get(stack.getFluid()); + var handler = FluidRenderHandlerRegistry.INSTANCE.get(stack.getFluid()); if (handler == null) return null; - TextureAtlasSprite[] sprites = handler.getFluidSprites(null, null, stack.getFluid().defaultFluidState()); + var sprites = handler.getFluidSprites(null, null, stack.getFluid().defaultFluidState()); if (sprites == null) return null; return sprites[1]; } @@ -161,7 +160,7 @@ public class FluidStackHooksImpl { @Nullable public static TextureAtlasSprite getFlowingTexture(@NotNull Fluid fluid) { if (fluid == Fluids.EMPTY) return null; - TextureAtlasSprite[] sprites = FluidRenderHandlerRegistry.INSTANCE.get(fluid).getFluidSprites(null, null, fluid.defaultFluidState()); + var sprites = FluidRenderHandlerRegistry.INSTANCE.get(fluid).getFluidSprites(null, null, fluid.defaultFluidState()); if (sprites == null) return null; return sprites[1]; } @@ -169,7 +168,7 @@ public class FluidStackHooksImpl { @Environment(EnvType.CLIENT) public static int getColor(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, @NotNull FluidState state) { if (state.getType() == Fluids.EMPTY) return -1; - FluidRenderHandler handler = FluidRenderHandlerRegistry.INSTANCE.get(state.getType()); + var handler = FluidRenderHandlerRegistry.INSTANCE.get(state.getType()); if (handler == null) return -1; return handler.getFluidColor(level, pos, state); } @@ -177,7 +176,7 @@ public class FluidStackHooksImpl { @Environment(EnvType.CLIENT) public static int getColor(@NotNull FluidStack stack) { if (stack.getFluid() == Fluids.EMPTY) return -1; - FluidRenderHandler handler = FluidRenderHandlerRegistry.INSTANCE.get(stack.getFluid()); + var handler = FluidRenderHandlerRegistry.INSTANCE.get(stack.getFluid()); if (handler == null) return -1; return handler.getFluidColor(null, null, stack.getFluid().defaultFluidState()); } @@ -185,7 +184,7 @@ public class FluidStackHooksImpl { @Environment(EnvType.CLIENT) public static int getColor(@NotNull Fluid fluid) { if (fluid == Fluids.EMPTY) return -1; - FluidRenderHandler handler = FluidRenderHandlerRegistry.INSTANCE.get(fluid); + var handler = FluidRenderHandlerRegistry.INSTANCE.get(fluid); if (handler == null) return -1; return handler.getFluidColor(null, null, fluid.defaultFluidState()); } diff --git a/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/EntityHooksImpl.java b/fabric/src/main/java/dev/architectury/hooks/level/entity/fabric/EntityHooksImpl.java similarity index 93% rename from fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/EntityHooksImpl.java rename to fabric/src/main/java/dev/architectury/hooks/level/entity/fabric/EntityHooksImpl.java index b8e0cfd3..69d2460d 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/EntityHooksImpl.java +++ b/fabric/src/main/java/dev/architectury/hooks/level/entity/fabric/EntityHooksImpl.java @@ -17,9 +17,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.hooks.fabric; +package dev.architectury.hooks.level.entity.fabric; -import me.shedaniel.architectury.event.events.EntityEvent; +import dev.architectury.event.events.common.EntityEvent; import net.minecraft.core.SectionPos; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.entity.EntityInLevelCallback; @@ -46,7 +46,7 @@ public class EntityHooksImpl { @Override public void onMove() { callback.onMove(); - long currentSectionKey = SectionPos.asLong(entity.blockPosition()); + var currentSectionKey = SectionPos.asLong(entity.blockPosition()); if (currentSectionKey != lastSectionKey) { EntityEvent.ENTER_SECTION.invoker().enterSection(entity, SectionPos.x(lastSectionKey), SectionPos.y(lastSectionKey), SectionPos.z(lastSectionKey), SectionPos.x(currentSectionKey), SectionPos.y(currentSectionKey), diff --git a/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/ItemEntityHooksImpl.java b/fabric/src/main/java/dev/architectury/hooks/level/entity/fabric/ItemEntityHooksImpl.java similarity index 92% rename from fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/ItemEntityHooksImpl.java rename to fabric/src/main/java/dev/architectury/hooks/level/entity/fabric/ItemEntityHooksImpl.java index a4022c4c..47fbd1b1 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/ItemEntityHooksImpl.java +++ b/fabric/src/main/java/dev/architectury/hooks/level/entity/fabric/ItemEntityHooksImpl.java @@ -17,9 +17,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.hooks.fabric; +package dev.architectury.hooks.level.entity.fabric; -import me.shedaniel.architectury.utils.IntValue; +import dev.architectury.utils.value.IntValue; import net.minecraft.world.entity.item.ItemEntity; public class ItemEntityHooksImpl { diff --git a/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/PlayerHooksImpl.java b/fabric/src/main/java/dev/architectury/hooks/level/entity/fabric/PlayerHooksImpl.java similarity index 95% rename from fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/PlayerHooksImpl.java rename to fabric/src/main/java/dev/architectury/hooks/level/entity/fabric/PlayerHooksImpl.java index 9febe502..b64cb8db 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/PlayerHooksImpl.java +++ b/fabric/src/main/java/dev/architectury/hooks/level/entity/fabric/PlayerHooksImpl.java @@ -17,7 +17,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.hooks.fabric; +package dev.architectury.hooks.level.entity.fabric; import net.minecraft.world.entity.player.Player; diff --git a/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/ExplosionHooksImpl.java b/fabric/src/main/java/dev/architectury/hooks/level/fabric/ExplosionHooksImpl.java similarity index 97% rename from fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/ExplosionHooksImpl.java rename to fabric/src/main/java/dev/architectury/hooks/level/fabric/ExplosionHooksImpl.java index bf18cc78..ef4c913b 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/ExplosionHooksImpl.java +++ b/fabric/src/main/java/dev/architectury/hooks/level/fabric/ExplosionHooksImpl.java @@ -17,7 +17,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.hooks.fabric; +package dev.architectury.hooks.level.fabric; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.Explosion; diff --git a/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/TagHooksImpl.java b/fabric/src/main/java/dev/architectury/hooks/tags/fabric/TagHooksImpl.java similarity index 87% rename from fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/TagHooksImpl.java rename to fabric/src/main/java/dev/architectury/hooks/tags/fabric/TagHooksImpl.java index 6b848be4..49243263 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/TagHooksImpl.java +++ b/fabric/src/main/java/dev/architectury/hooks/tags/fabric/TagHooksImpl.java @@ -17,7 +17,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.hooks.fabric; +package dev.architectury.hooks.tags.fabric; import net.fabricmc.fabric.api.tag.TagRegistry; import net.minecraft.resources.ResourceLocation; @@ -27,7 +27,7 @@ import net.minecraft.tags.TagCollection; import java.util.function.Supplier; public class TagHooksImpl { - public static Tag.Named getOptional(ResourceLocation id, Supplier> collection) { + public static Tag.Named optional(ResourceLocation id, Supplier> collection) { return TagRegistry.create(id, collection); } } diff --git a/fabric/src/main/java/me/shedaniel/architectury/impl/fabric/ChatComponentImpl.java b/fabric/src/main/java/dev/architectury/impl/fabric/ChatComponentImpl.java similarity index 93% rename from fabric/src/main/java/me/shedaniel/architectury/impl/fabric/ChatComponentImpl.java rename to fabric/src/main/java/dev/architectury/impl/fabric/ChatComponentImpl.java index 8fdd226d..7e55dcd0 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/impl/fabric/ChatComponentImpl.java +++ b/fabric/src/main/java/dev/architectury/impl/fabric/ChatComponentImpl.java @@ -17,9 +17,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.impl.fabric; +package dev.architectury.impl.fabric; -import me.shedaniel.architectury.event.events.ChatEvent; +import dev.architectury.event.events.common.ChatEvent; import net.minecraft.network.chat.Component; public class ChatComponentImpl implements ChatEvent.ChatComponent { diff --git a/fabric/src/main/java/me/shedaniel/architectury/impl/fabric/ScreenInputDelegate.java b/fabric/src/main/java/dev/architectury/impl/fabric/ScreenInputDelegate.java similarity index 81% rename from fabric/src/main/java/me/shedaniel/architectury/impl/fabric/ScreenInputDelegate.java rename to fabric/src/main/java/dev/architectury/impl/fabric/ScreenInputDelegate.java index f3e6e378..b1f53c82 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/impl/fabric/ScreenInputDelegate.java +++ b/fabric/src/main/java/dev/architectury/impl/fabric/ScreenInputDelegate.java @@ -17,13 +17,12 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.impl.fabric; +package dev.architectury.impl.fabric; -import me.shedaniel.architectury.event.events.client.ClientScreenInputEvent; +import dev.architectury.event.events.client.ClientScreenInputEvent; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.TextComponent; -import net.minecraft.world.InteractionResult; public interface ScreenInputDelegate { Screen architectury_delegateInputs(); @@ -38,20 +37,20 @@ public interface ScreenInputDelegate { @Override public boolean mouseDragged(double d, double e, int i, double f, double g) { - if (ClientScreenInputEvent.MOUSE_DRAGGED_PRE.invoker().mouseDragged(Minecraft.getInstance(), parent, d, e, i, f, g) != InteractionResult.PASS) + if (ClientScreenInputEvent.MOUSE_DRAGGED_PRE.invoker().mouseDragged(Minecraft.getInstance(), parent, d, e, i, f, g).isPresent()) return true; if (parent.mouseDragged(d, e, i, f, g)) return true; - return ClientScreenInputEvent.MOUSE_DRAGGED_PRE.invoker().mouseDragged(Minecraft.getInstance(), parent, d, e, i, f, g) != InteractionResult.PASS; + return ClientScreenInputEvent.MOUSE_DRAGGED_PRE.invoker().mouseDragged(Minecraft.getInstance(), parent, d, e, i, f, g).isPresent(); } @Override public boolean charTyped(char c, int i) { - if (ClientScreenInputEvent.CHAR_TYPED_PRE.invoker().charTyped(Minecraft.getInstance(), parent, c, i) != InteractionResult.PASS) + if (ClientScreenInputEvent.CHAR_TYPED_PRE.invoker().charTyped(Minecraft.getInstance(), parent, c, i).isPresent()) return true; if (parent.charTyped(c, i)) return true; - return ClientScreenInputEvent.CHAR_TYPED_POST.invoker().charTyped(Minecraft.getInstance(), parent, c, i) != InteractionResult.PASS; + return ClientScreenInputEvent.CHAR_TYPED_POST.invoker().charTyped(Minecraft.getInstance(), parent, c, i).isPresent(); } } } diff --git a/fabric/src/main/java/me/shedaniel/architectury/init/fabric/ArchitecturyClient.java b/fabric/src/main/java/dev/architectury/init/fabric/ArchitecturyClient.java similarity index 83% rename from fabric/src/main/java/me/shedaniel/architectury/init/fabric/ArchitecturyClient.java rename to fabric/src/main/java/dev/architectury/init/fabric/ArchitecturyClient.java index 3d1f2046..4933f937 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/init/fabric/ArchitecturyClient.java +++ b/fabric/src/main/java/dev/architectury/init/fabric/ArchitecturyClient.java @@ -17,13 +17,16 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.init.fabric; +package dev.architectury.init.fabric; -import me.shedaniel.architectury.event.events.client.ClientLifecycleEvent; +import dev.architectury.event.events.client.ClientLifecycleEvent; +import dev.architectury.networking.fabric.SpawnEntityPacket; import net.minecraft.client.Minecraft; public class ArchitecturyClient { public static void init() { ClientLifecycleEvent.CLIENT_SETUP.invoker().stateChanged(Minecraft.getInstance()); + + SpawnEntityPacket.register(); } } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/ExplosionPreInvoker.java b/fabric/src/main/java/dev/architectury/mixin/fabric/ExplosionPreInvoker.java similarity index 91% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/ExplosionPreInvoker.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/ExplosionPreInvoker.java index ad00385d..2b60cce1 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/ExplosionPreInvoker.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/ExplosionPreInvoker.java @@ -17,11 +17,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.event.events.ExplosionEvent; +import dev.architectury.event.events.common.ExplosionEvent; import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.Explosion; @@ -38,7 +37,7 @@ public class ExplosionPreInvoker { @Inject(method = "explode(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/damagesource/DamageSource;Lnet/minecraft/world/level/ExplosionDamageCalculator;DDDFZLnet/minecraft/world/level/Explosion$BlockInteraction;)Lnet/minecraft/world/level/Explosion;", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Explosion;explode()V"), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD) private void explodePre(Entity entity, DamageSource damageSource, ExplosionDamageCalculator explosionDamageCalculator, double d, double e, double f, float g, boolean bl, Explosion.BlockInteraction blockInteraction, CallbackInfoReturnable cir, Explosion explosion) { - if (ExplosionEvent.PRE.invoker().explode((Level) (Object) this, explosion) == InteractionResult.FAIL) { + if (ExplosionEvent.PRE.invoker().explode((Level) (Object) this, explosion).isFalse()) { cir.setReturnValue(explosion); } } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/LivingDeathInvoker.java b/fabric/src/main/java/dev/architectury/mixin/fabric/LivingDeathInvoker.java similarity index 88% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/LivingDeathInvoker.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/LivingDeathInvoker.java index b48c1935..aebbc4d9 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/LivingDeathInvoker.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/LivingDeathInvoker.java @@ -17,11 +17,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.event.events.EntityEvent; +import dev.architectury.event.events.common.EntityEvent; import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; @@ -34,7 +33,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; public class LivingDeathInvoker { @Inject(method = "die", at = @At("HEAD"), cancellable = true) private void die(DamageSource source, CallbackInfo ci) { - if (EntityEvent.LIVING_DEATH.invoker().die((LivingEntity) (Object) this, source) == InteractionResult.FAIL) { + if (EntityEvent.LIVING_DEATH.invoker().die((LivingEntity) (Object) this, source).isFalse()) { ci.cancel(); } } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinBaseSpawner.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinBaseSpawner.java similarity index 91% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinBaseSpawner.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/MixinBaseSpawner.java index ed0ddec9..44525d50 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinBaseSpawner.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinBaseSpawner.java @@ -17,10 +17,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.event.EventResult; -import me.shedaniel.architectury.event.events.EntityEvent; +import dev.architectury.event.events.common.EntityEvent; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.level.BaseSpawner; @@ -41,7 +40,7 @@ public abstract class MixinBaseSpawner { ) ) private boolean checkSpawnerSpawn(Mob mob, LevelAccessor level, MobSpawnType type) { - EventResult result = EntityEvent.LIVING_CHECK_SPAWN.invoker() + var result = EntityEvent.LIVING_CHECK_SPAWN.invoker() .canSpawn(mob, level, mob.getX(), mob.getY(), mob.getZ(), type, (BaseSpawner) (Object) this); if (result.value() != null) { return result.value(); diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinBlockEntityExtension.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinBlockEntityExtension.java similarity index 90% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinBlockEntityExtension.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/MixinBlockEntityExtension.java index c533a3e3..566b69ea 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinBlockEntityExtension.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinBlockEntityExtension.java @@ -17,9 +17,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.extensions.BlockEntityExtension; +import dev.architectury.extensions.BlockEntityExtension; import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.level.block.entity.BlockEntity; @@ -29,7 +29,7 @@ import org.spongepowered.asm.mixin.Mixin; public interface MixinBlockEntityExtension extends BlockEntityClientSerializable { @Override default void fromClientTag(CompoundTag tag) { - BlockEntity entity = (BlockEntity) this; + var entity = (BlockEntity) this; if (entity.hasLevel()) { ((BlockEntityExtension) this).loadClientData(entity.getBlockState(), tag); } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinBlockItem.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinBlockItem.java similarity index 79% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinBlockItem.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/MixinBlockItem.java index 04405873..0a48a46e 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinBlockItem.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinBlockItem.java @@ -17,9 +17,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.event.events.BlockEvent; +import dev.architectury.event.events.common.BlockEvent; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.context.BlockPlaceContext; @@ -35,9 +35,9 @@ public abstract class MixinBlockItem { target = "Lnet/minecraft/world/item/context/BlockPlaceContext;getClickedPos()Lnet/minecraft/core/BlockPos;"), cancellable = true) private void place(BlockPlaceContext context, CallbackInfoReturnable cir) { - InteractionResult result = BlockEvent.PLACE.invoker().placeBlock(context.getLevel(), context.getClickedPos(), context.getLevel().getBlockState(context.getClickedPos()), context.getPlayer()); - if (result != InteractionResult.PASS) { - cir.setReturnValue(result); + var result = BlockEvent.PLACE.invoker().placeBlock(context.getLevel(), context.getClickedPos(), context.getLevel().getBlockState(context.getClickedPos()), context.getPlayer()); + if (result.isPresent()) { + cir.setReturnValue(result.isTrue() ? InteractionResult.SUCCESS : InteractionResult.FAIL); } } } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinBucketItem.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinBucketItem.java similarity index 87% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinBucketItem.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/MixinBucketItem.java index e02f16a1..1ac03a99 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinBucketItem.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinBucketItem.java @@ -17,10 +17,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.event.CompoundEventResult; -import me.shedaniel.architectury.event.events.PlayerEvent; +import dev.architectury.event.events.common.PlayerEvent; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.player.Player; @@ -28,7 +27,6 @@ import net.minecraft.world.item.BucketItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.HitResult; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -49,7 +47,7 @@ public class MixinBucketItem { cancellable = true ) public void fillBucket(Level level, Player player, InteractionHand hand, CallbackInfoReturnable> cir, ItemStack stack, BlockHitResult target) { - CompoundEventResult result = PlayerEvent.FILL_BUCKET.invoker().fill(player, level, stack, target); + var result = PlayerEvent.FILL_BUCKET.invoker().fill(player, level, stack, target); if (result.interruptsFurtherEvaluation() && result.value() != null) { cir.setReturnValue(result.asMinecraft()); cir.cancel(); diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinCatSpawner.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinCatSpawner.java similarity index 95% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinCatSpawner.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/MixinCatSpawner.java index debdd5dd..797e87b2 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinCatSpawner.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinCatSpawner.java @@ -17,9 +17,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.event.events.EntityEvent; +import dev.architectury.event.events.common.EntityEvent; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.MobSpawnType; diff --git a/fabric/src/main/java/dev/architectury/mixin/fabric/MixinChunkMap.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinChunkMap.java new file mode 100644 index 00000000..00b4f2cf --- /dev/null +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinChunkMap.java @@ -0,0 +1,51 @@ +/* + * This file is part of architectury. + * Copyright (C) 2020, 2021 architectury + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package dev.architectury.mixin.fabric; + +import dev.architectury.event.events.common.ChunkEvent; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.server.level.ChunkMap; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.chunk.ChunkAccess; +import net.minecraft.world.level.chunk.ChunkStatus; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; + +@Mixin(ChunkMap.class) +public class MixinChunkMap { + @Shadow + @Final + ServerLevel level; + + @Inject( + method = "save", + at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ChunkMap;write(Lnet/minecraft/world/level/ChunkPos;Lnet/minecraft/nbt/CompoundTag;)V", ordinal = 0), + locals = LocalCapture.CAPTURE_FAILHARD + ) + private void save(ChunkAccess chunkAccess, CallbackInfoReturnable cir, ChunkPos pos, ChunkStatus chunkStatus, CompoundTag nbt) { + ChunkEvent.SAVE_DATA.invoker().save(chunkAccess, this.level, nbt); + } +} diff --git a/fabric/src/main/java/dev/architectury/mixin/fabric/MixinChunkSerializer.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinChunkSerializer.java new file mode 100644 index 00000000..c9720c11 --- /dev/null +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinChunkSerializer.java @@ -0,0 +1,49 @@ +/* + * This file is part of architectury. + * Copyright (C) 2020, 2021 architectury + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package dev.architectury.mixin.fabric; + +import dev.architectury.event.events.common.ChunkEvent; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.ai.village.poi.PoiManager; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.biome.BiomeSource; +import net.minecraft.world.level.chunk.*; +import net.minecraft.world.level.chunk.storage.ChunkSerializer; +import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager; +import net.minecraft.world.level.lighting.LevelLightEngine; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; + +@Mixin(ChunkSerializer.class) +public class MixinChunkSerializer { + @Inject(method = "read", at = @At("RETURN"), locals = LocalCapture.CAPTURE_FAILHARD) + private static void load(ServerLevel serverLevel, StructureManager structureManager, PoiManager poiManager, ChunkPos chunkPos, CompoundTag compoundTag, + CallbackInfoReturnable cir, ChunkGenerator chunkGenerator, BiomeSource biomeSource, CompoundTag compoundTagLevelData, + ChunkBiomeContainer chunkBiomeContainer, UpgradeData upgradeData, ProtoTickList protoTickList, ProtoTickList protoTickList2, + boolean bl, ListTag listTag, int i, LevelChunkSection[] levelChunkSections, boolean bl2, ChunkSource chunkSource, + LevelLightEngine levelLightEngine, long l, ChunkStatus.ChunkType chunkType, ChunkAccess chunk) { + ChunkEvent.LOAD_DATA.invoker().load(chunk, serverLevel, compoundTag); + } +} diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinCommands.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinCommands.java similarity index 78% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinCommands.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/MixinCommands.java index af5d3be2..89840bdd 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinCommands.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinCommands.java @@ -17,17 +17,15 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; import com.google.common.base.Throwables; import com.mojang.brigadier.CommandDispatcher; -import com.mojang.brigadier.ParseResults; import com.mojang.brigadier.StringReader; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import me.shedaniel.architectury.event.events.CommandPerformEvent; +import dev.architectury.event.events.common.CommandPerformEvent; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; -import net.minecraft.world.InteractionResult; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; @@ -37,10 +35,10 @@ public class MixinCommands { @Redirect(method = "performCommand", at = @At(value = "INVOKE", target = "Lcom/mojang/brigadier/CommandDispatcher;execute(Lcom/mojang/brigadier/StringReader;Ljava/lang/Object;)I", remap = false)) private int performCommand(CommandDispatcher dispatcher, StringReader input, Object source) throws CommandSyntaxException { - CommandSourceStack stack = (CommandSourceStack) source; - ParseResults parse = dispatcher.parse(input, stack); - CommandPerformEvent event = new CommandPerformEvent(parse, null); - if (CommandPerformEvent.EVENT.invoker().act(event) != InteractionResult.PASS) { + var stack = (CommandSourceStack) source; + var parse = dispatcher.parse(input, stack); + var event = new CommandPerformEvent(parse, null); + if (CommandPerformEvent.EVENT.invoker().act(event).isPresent()) { if (event.getThrowable() != null) { Throwables.throwIfUnchecked(event.getThrowable()); } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinDedicatedServer.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinDedicatedServer.java similarity index 93% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinDedicatedServer.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/MixinDedicatedServer.java index c07f4747..c59cec2d 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinDedicatedServer.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinDedicatedServer.java @@ -17,9 +17,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.event.events.LifecycleEvent; +import dev.architectury.event.events.common.LifecycleEvent; import net.minecraft.server.MinecraftServer; import net.minecraft.server.dedicated.DedicatedServer; import org.spongepowered.asm.mixin.Mixin; diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinEntity.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinEntity.java similarity index 89% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinEntity.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/MixinEntity.java index 03031e92..e3527ac4 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinEntity.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinEntity.java @@ -17,14 +17,13 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.hooks.fabric.EntityHooksImpl; +import dev.architectury.hooks.level.entity.fabric.EntityHooksImpl; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.entity.EntityInLevelCallback; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.ModifyArg; import org.spongepowered.asm.mixin.injection.ModifyVariable; @Mixin(Entity.class) diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinExplosion.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinExplosion.java similarity index 93% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinExplosion.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/MixinExplosion.java index a777903f..ab0cf2aa 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinExplosion.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinExplosion.java @@ -17,10 +17,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.event.events.ExplosionEvent; -import me.shedaniel.architectury.hooks.fabric.ExplosionHooksImpl; +import dev.architectury.event.events.common.ExplosionEvent; +import dev.architectury.hooks.level.fabric.ExplosionHooksImpl; import net.minecraft.core.BlockPos; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.Explosion; diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinFarmBlock.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinFarmBlock.java similarity index 93% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinFarmBlock.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/MixinFarmBlock.java index 422df92b..553f5a71 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinFarmBlock.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinFarmBlock.java @@ -17,9 +17,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.event.events.InteractionEvent; +import dev.architectury.event.events.common.InteractionEvent; import net.minecraft.core.BlockPos; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.Level; @@ -50,7 +50,7 @@ public abstract class MixinFarmBlock { @Inject(method = "turnToDirt", at = @At("HEAD"), cancellable = true) private static void turnToDirt(BlockState state, Level level, BlockPos pos, CallbackInfo ci) { - Triple triple = turnToDirtLocal.get(); + var triple = turnToDirtLocal.get(); turnToDirtLocal.remove(); if (triple != null && triple.getLeft() == pos.asLong()) { if (InteractionEvent.FARMLAND_TRAMPLE.invoker().trample(level, pos, state, triple.getMiddle(), triple.getRight()).value() != null) { diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinFurnaceResultSlot.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinFurnaceResultSlot.java similarity index 93% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinFurnaceResultSlot.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/MixinFurnaceResultSlot.java index fcd89347..9a4b123c 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinFurnaceResultSlot.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinFurnaceResultSlot.java @@ -17,9 +17,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.event.events.PlayerEvent; +import dev.architectury.event.events.common.PlayerEvent; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.FurnaceResultSlot; import net.minecraft.world.item.ItemStack; diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinInventory.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinInventory.java similarity index 83% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinInventory.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/MixinInventory.java index 73133306..2ecc36a8 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinInventory.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinInventory.java @@ -17,12 +17,13 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.extensions.ItemExtension; +import dev.architectury.extensions.ItemExtension; import net.minecraft.core.NonNullList; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -43,9 +44,10 @@ public class MixinInventory { @Inject(method = "tick", at = @At("RETURN")) private void updateItems(CallbackInfo ci) { - for (ItemStack stack : armor) { - if (stack.getItem() instanceof ItemExtension) { - ((ItemExtension) stack.getItem()).tickArmor(stack, player); + for (var stack : armor) { + Item item = stack.getItem(); + if (item instanceof ItemExtension extension) { + extension.tickArmor(stack, player); } } } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinItemEntity.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinItemEntity.java similarity index 86% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinItemEntity.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/MixinItemEntity.java index 124b9a52..2eab63bb 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinItemEntity.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinItemEntity.java @@ -17,10 +17,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.event.events.PlayerEvent; -import net.minecraft.world.InteractionResult; +import dev.architectury.event.events.common.PlayerEvent; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; @@ -43,8 +42,8 @@ public abstract class MixinItemEntity { at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/ItemStack;getCount()I"), cancellable = true) private void prePickup(Player player, CallbackInfo ci) { cache = getItem().copy(); - InteractionResult canPickUp = PlayerEvent.PICKUP_ITEM_PRE.invoker().canPickup(player, (ItemEntity) (Object) this, getItem()); - if (canPickUp == InteractionResult.FAIL) { + var canPickUp = PlayerEvent.PICKUP_ITEM_PRE.invoker().canPickup(player, (ItemEntity) (Object) this, getItem()); + if (canPickUp.isFalse()) { ci.cancel(); } } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinLivingEntity.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinLivingEntity.java similarity index 77% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinLivingEntity.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/MixinLivingEntity.java index c38f79bc..dac12e39 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinLivingEntity.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinLivingEntity.java @@ -17,16 +17,14 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.event.events.EntityEvent; -import me.shedaniel.architectury.extensions.ItemExtension; -import net.minecraft.world.InteractionResult; +import dev.architectury.event.events.common.EntityEvent; +import dev.architectury.extensions.ItemExtension; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -38,16 +36,16 @@ public class MixinLivingEntity { @Inject(method = "hurt", at = @At("HEAD"), cancellable = true) private void hurt(DamageSource damageSource, float f, CallbackInfoReturnable cir) { if ((Object) this instanceof Player) return; - if (EntityEvent.LIVING_ATTACK.invoker().attack((LivingEntity) (Object) this, damageSource, f) == InteractionResult.FAIL) { + if (EntityEvent.LIVING_HURT.invoker().hurt((LivingEntity) (Object) this, damageSource, f).isFalse()) { cir.setReturnValue(false); } } @Inject(method = "getEquipmentSlotForItem", at = @At("HEAD"), cancellable = true) private static void getEquipmentSlotForItem(ItemStack stack, CallbackInfoReturnable cir) { - Item item = stack.getItem(); - if (item instanceof ItemExtension) { - EquipmentSlot slot = ((ItemExtension) item).getCustomEquipmentSlot(stack); + var item = stack.getItem(); + if (item instanceof ItemExtension extension) { + var slot = extension.getCustomEquipmentSlot(stack); if (slot != null) { cir.setReturnValue(slot); } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinNaturalSpawner.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinNaturalSpawner.java similarity index 86% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinNaturalSpawner.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/MixinNaturalSpawner.java index c068200f..620560f8 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinNaturalSpawner.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinNaturalSpawner.java @@ -17,10 +17,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.event.EventResult; -import me.shedaniel.architectury.event.events.EntityEvent; +import dev.architectury.event.events.common.EntityEvent; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MobSpawnType; @@ -47,7 +46,7 @@ public abstract class MixinNaturalSpawner { ) ) private static boolean overrideNaturalSpawnCondition(ServerLevel level, Mob entity, double f) { - EventResult result = EntityEvent.LIVING_CHECK_SPAWN.invoker().canSpawn(entity, level, entity.xOld, entity.yOld, entity.zOld, MobSpawnType.NATURAL, null); + var result = EntityEvent.LIVING_CHECK_SPAWN.invoker().canSpawn(entity, level, entity.xOld, entity.yOld, entity.zOld, MobSpawnType.NATURAL, null); if (result.value() != null) { return result.value(); } else { @@ -64,7 +63,7 @@ public abstract class MixinNaturalSpawner { ) ) private static boolean overrideChunkGenSpawnCondition(Mob mob, LevelAccessor level, MobSpawnType type) { - EventResult result = EntityEvent.LIVING_CHECK_SPAWN.invoker().canSpawn(mob, level, mob.xOld, mob.yOld, mob.zOld, MobSpawnType.CHUNK_GENERATION, null); + var result = EntityEvent.LIVING_CHECK_SPAWN.invoker().canSpawn(mob, level, mob.xOld, mob.yOld, mob.zOld, MobSpawnType.CHUNK_GENERATION, null); if (result.value() != null) { return result.value(); } else { diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPatrolSpawner.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinPatrolSpawner.java similarity index 87% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPatrolSpawner.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/MixinPatrolSpawner.java index 9abee30b..b891f66d 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPatrolSpawner.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinPatrolSpawner.java @@ -17,10 +17,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.event.EventResult; -import me.shedaniel.architectury.event.events.EntityEvent; +import dev.architectury.event.events.common.EntityEvent; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.MobSpawnType; @@ -50,7 +49,7 @@ public abstract class MixinPatrolSpawner { locals = LocalCapture.CAPTURE_FAILHARD ) private void checkPatrolSpawn(ServerLevel level, BlockPos pos, Random r, boolean b, CallbackInfoReturnable cir, PatrollingMonster entity) { - EventResult result = EntityEvent.LIVING_CHECK_SPAWN.invoker().canSpawn(entity, level, pos.getX(), pos.getY(), pos.getZ(), MobSpawnType.PATROL, null); + var result = EntityEvent.LIVING_CHECK_SPAWN.invoker().canSpawn(entity, level, pos.getX(), pos.getY(), pos.getZ(), MobSpawnType.PATROL, null); if (result.value() != null) { cir.setReturnValue(result.value()); } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPersistentEntitySectionManager.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinPersistentEntitySectionManager.java similarity index 78% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPersistentEntitySectionManager.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/MixinPersistentEntitySectionManager.java index 924f0aab..11f34e88 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPersistentEntitySectionManager.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinPersistentEntitySectionManager.java @@ -17,12 +17,11 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.event.events.EntityEvent; -import me.shedaniel.architectury.hooks.fabric.PersistentEntitySectionManagerHooks; +import dev.architectury.event.events.common.EntityEvent; +import dev.architectury.hooks.fabric.PersistentEntitySectionManagerHooks; import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.entity.EntityAccess; import net.minecraft.world.level.entity.PersistentEntitySectionManager; @@ -45,16 +44,16 @@ public class MixinPersistentEntitySectionManager impleme } @Inject(method = "addEntity", at = @At(value = "INVOKE", - target = "Lnet/minecraft/core/SectionPos;asLong(Lnet/minecraft/core/BlockPos;)J"), + target = "Lnet/minecraft/core/SectionPos;asLong(Lnet/minecraft/core/BlockPos;)J"), cancellable = true) private void addEntity(T entityAccess, boolean bl, CallbackInfoReturnable cir) { // TODO: Check if other classes implements EntityAccess as well - if (entityAccess instanceof Entity && levelRef != null) { - ServerLevel level = levelRef.get(); + if (entityAccess instanceof Entity entity && levelRef != null) { + var level = levelRef.get(); levelRef = null; if (level != null) { - if (EntityEvent.ADD.invoker().add((Entity) entityAccess, level) == InteractionResult.FAIL) { + if (EntityEvent.ADD.invoker().add(entity, level).isFalse()) { cir.setReturnValue(false); } } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPhantomSpawner.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinPhantomSpawner.java similarity index 96% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPhantomSpawner.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/MixinPhantomSpawner.java index 8c5a5a09..e78244dc 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPhantomSpawner.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinPhantomSpawner.java @@ -17,9 +17,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.event.events.EntityEvent; +import dev.architectury.event.events.common.EntityEvent; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPlayer.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinPlayer.java similarity index 82% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPlayer.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/MixinPlayer.java index 07fd34ad..19545455 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPlayer.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinPlayer.java @@ -17,11 +17,11 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.event.events.InteractionEvent; -import me.shedaniel.architectury.event.events.PlayerEvent; -import me.shedaniel.architectury.event.events.TickEvent; +import dev.architectury.event.events.common.InteractionEvent; +import dev.architectury.event.events.common.PlayerEvent; +import dev.architectury.event.events.common.TickEvent; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; @@ -48,7 +48,7 @@ public class MixinPlayer { @Inject(method = "drop(Lnet/minecraft/world/item/ItemStack;ZZ)Lnet/minecraft/world/entity/item/ItemEntity;", at = @At("RETURN"), cancellable = true) private void drop(ItemStack itemStack, boolean bl, boolean bl2, CallbackInfoReturnable cir) { - if (cir.getReturnValue() != null && PlayerEvent.DROP_ITEM.invoker().drop((Player) (Object) this, cir.getReturnValue()) == InteractionResult.FAIL) { + if (cir.getReturnValue() != null && PlayerEvent.DROP_ITEM.invoker().drop((Player) (Object) this, cir.getReturnValue()).isFalse()) { cir.setReturnValue(null); } } @@ -58,9 +58,9 @@ public class MixinPlayer { ordinal = 0), cancellable = true) private void entityInteract(Entity entity, InteractionHand interactionHand, CallbackInfoReturnable cir) { - InteractionResult result = InteractionEvent.INTERACT_ENTITY.invoker().interact((Player) (Object) this, entity, interactionHand); - if (result != InteractionResult.PASS) { - cir.setReturnValue(result); + var result = InteractionEvent.INTERACT_ENTITY.invoker().interact((Player) (Object) this, entity, interactionHand); + if (result.isPresent()) { + cir.setReturnValue(result.asMinecraft()); } } } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPlayerAdvancements.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinPlayerAdvancements.java similarity index 94% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPlayerAdvancements.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/MixinPlayerAdvancements.java index 4cb98a2c..fa5f77ef 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPlayerAdvancements.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinPlayerAdvancements.java @@ -17,9 +17,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.event.events.PlayerEvent; +import dev.architectury.event.events.common.PlayerEvent; import net.minecraft.advancements.Advancement; import net.minecraft.server.PlayerAdvancements; import net.minecraft.server.level.ServerPlayer; diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPlayerList.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinPlayerList.java similarity index 94% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPlayerList.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/MixinPlayerList.java index 71e6ee93..e5a578c8 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPlayerList.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinPlayerList.java @@ -17,9 +17,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.event.events.PlayerEvent; +import dev.architectury.event.events.common.PlayerEvent; import net.minecraft.network.Connection; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.players.PlayerList; diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinResultSlot.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinResultSlot.java similarity index 94% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinResultSlot.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/MixinResultSlot.java index ba839b75..8f4020b1 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinResultSlot.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinResultSlot.java @@ -17,9 +17,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.event.events.PlayerEvent; +import dev.architectury.event.events.common.PlayerEvent; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.CraftingContainer; import net.minecraft.world.inventory.ResultSlot; diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinServerGamePacketListenerImpl.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinServerGamePacketListenerImpl.java similarity index 77% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinServerGamePacketListenerImpl.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/MixinServerGamePacketListenerImpl.java index fdf7fbab..8c5f6430 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinServerGamePacketListenerImpl.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinServerGamePacketListenerImpl.java @@ -17,10 +17,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.event.events.ChatEvent; -import me.shedaniel.architectury.impl.fabric.ChatComponentImpl; +import dev.architectury.event.events.common.ChatEvent; +import dev.architectury.impl.fabric.ChatComponentImpl; import net.minecraft.network.chat.ChatType; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.TranslatableComponent; @@ -28,8 +28,6 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.network.ServerGamePacketListenerImpl; import net.minecraft.server.network.TextFilter; -import net.minecraft.world.InteractionResult; -import net.minecraft.world.InteractionResultHolder; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -57,14 +55,15 @@ public abstract class MixinServerGamePacketListenerImpl { @Inject(method = "handleChat(Lnet/minecraft/server/network/TextFilter$FilteredText;)V", at = @At(value = "INVOKE", - target = "Lnet/minecraft/server/players/PlayerList;broadcastMessage(Lnet/minecraft/network/chat/Component;Ljava/util/function/Function;Lnet/minecraft/network/chat/ChatType;Ljava/util/UUID;)V"), + target = "Lnet/minecraft/server/players/PlayerList;broadcastMessage(Lnet/minecraft/network/chat/Component;Ljava/util/function/Function;Lnet/minecraft/network/chat/ChatType;Ljava/util/UUID;)V"), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD) private void handleChat(TextFilter.FilteredText message, CallbackInfo ci, String string, Component component, Component component2) { - ChatComponentImpl chatComponent = new ChatComponentImpl(component2, component); - InteractionResult process = ChatEvent.SERVER.invoker().process(this.player, message, chatComponent); - if (process == InteractionResult.FAIL) + var chatComponent = new ChatComponentImpl(component2, component); + var process = ChatEvent.SERVER.invoker().process(this.player, message, chatComponent); + if (process.isEmpty()) return; + if (process.isFalse()) { ci.cancel(); - else if (!Objects.equals(chatComponent.getRaw(), component2) || !Objects.equals(chatComponent.getFiltered(), component)) { + } else if (!Objects.equals(chatComponent.getRaw(), component2) || !Objects.equals(chatComponent.getFiltered(), component)) { this.server.getPlayerList().broadcastMessage(chatComponent.getRaw(), (serverPlayer) -> { return this.player.shouldFilterMessageTo(serverPlayer) ? chatComponent.getFiltered() : chatComponent.getRaw(); }, ChatType.CHAT, this.player.getUUID()); diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinServerLevel.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinServerLevel.java similarity index 79% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinServerLevel.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/MixinServerLevel.java index 631f0afc..89c1f052 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinServerLevel.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinServerLevel.java @@ -17,10 +17,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.event.events.LifecycleEvent; -import me.shedaniel.architectury.hooks.fabric.PersistentEntitySectionManagerHooks; +import dev.architectury.event.events.common.LifecycleEvent; +import dev.architectury.hooks.fabric.PersistentEntitySectionManagerHooks; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.ProgressListener; import net.minecraft.world.entity.Entity; @@ -35,15 +35,17 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(ServerLevel.class) public class MixinServerLevel { - @Shadow @Final private PersistentEntitySectionManager entityManager; + @Shadow + @Final + private PersistentEntitySectionManager entityManager; @Inject(method = "save", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerChunkCache;save(Z)V")) private void save(ProgressListener progressListener, boolean bl, boolean bl2, CallbackInfo ci) { - LifecycleEvent.SERVER_WORLD_SAVE.invoker().act((ServerLevel) (Object) this); + LifecycleEvent.SERVER_LEVEL_SAVE.invoker().act((ServerLevel) (Object) this); } @Inject(method = "addEntity", at = @At(value = "INVOKE", - target = "Lnet/minecraft/world/level/entity/PersistentEntitySectionManager;addNewEntity(Lnet/minecraft/world/level/entity/EntityAccess;)Z"), + target = "Lnet/minecraft/world/level/entity/PersistentEntitySectionManager;addNewEntity(Lnet/minecraft/world/level/entity/EntityAccess;)Z"), cancellable = true) private void addEntity(Entity entity, CallbackInfoReturnable cir) { ((PersistentEntitySectionManagerHooks) this.entityManager).architectury_attachLevel((ServerLevel) (Object) this); diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinServerPlayer.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinServerPlayer.java similarity index 96% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinServerPlayer.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/MixinServerPlayer.java index 746ed323..8cb7cb71 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinServerPlayer.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinServerPlayer.java @@ -17,9 +17,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.event.events.PlayerEvent; +import dev.architectury.event.events.common.PlayerEvent; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.Container; diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinServerPlayerGameMode.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinServerPlayerGameMode.java similarity index 87% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinServerPlayerGameMode.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/MixinServerPlayerGameMode.java index 8d6188a6..6dc26ab6 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinServerPlayerGameMode.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinServerPlayerGameMode.java @@ -17,15 +17,15 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.event.events.BlockEvent; +import dev.architectury.event.events.common.BlockEvent; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayerGameMode; -import net.minecraft.world.InteractionResult; import net.minecraft.world.level.block.state.BlockState; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -36,17 +36,18 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture; @Mixin(ServerPlayerGameMode.class) public class MixinServerPlayerGameMode { @Shadow - public ServerLevel level; + protected ServerLevel level; @Shadow - public ServerPlayer player; + @Final + protected ServerPlayer player; @Inject(method = "destroyBlock", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/state/BlockState;getBlock()Lnet/minecraft/world/level/block/Block;", ordinal = 0), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true) private void onBreak(BlockPos blockPos, CallbackInfoReturnable cir, BlockState state) { - if (BlockEvent.BREAK.invoker().breakBlock(this.level, blockPos, state, this.player, null) == InteractionResult.FAIL) { + if (BlockEvent.BREAK.invoker().breakBlock(this.level, blockPos, state, this.player, null).isFalse()) { cir.setReturnValue(false); } } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/PlayerAttackInvoker.java b/fabric/src/main/java/dev/architectury/mixin/fabric/PlayerAttackInvoker.java similarity index 83% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/PlayerAttackInvoker.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/PlayerAttackInvoker.java index 6ee88088..dada8dab 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/PlayerAttackInvoker.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/PlayerAttackInvoker.java @@ -17,12 +17,11 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric; +package dev.architectury.mixin.fabric; -import me.shedaniel.architectury.event.events.EntityEvent; +import dev.architectury.event.events.common.EntityEvent; import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.player.RemotePlayer; -import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; @@ -35,7 +34,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; public class PlayerAttackInvoker { @Inject(method = "hurt", at = @At("HEAD"), cancellable = true) private void hurt(DamageSource damageSource, float f, CallbackInfoReturnable cir) { - if (EntityEvent.LIVING_ATTACK.invoker().attack((LivingEntity) (Object) this, damageSource, f) == InteractionResult.FAIL && (Object) this instanceof Player) { + if (EntityEvent.LIVING_HURT.invoker().hurt((LivingEntity) (Object) this, damageSource, f).isFalse() && (Object) this instanceof Player) { cir.setReturnValue(false); } } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinClientLevel.java b/fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinClientLevel.java similarity index 86% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinClientLevel.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinClientLevel.java index da1e979f..bcf4a933 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinClientLevel.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinClientLevel.java @@ -17,16 +17,15 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric.client; +package dev.architectury.mixin.fabric.client; -import me.shedaniel.architectury.event.events.EntityEvent; -import me.shedaniel.architectury.event.events.client.ClientLifecycleEvent; +import dev.architectury.event.events.client.ClientLifecycleEvent; +import dev.architectury.event.events.common.EntityEvent; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.multiplayer.ClientPacketListener; import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.resources.ResourceKey; import net.minecraft.util.profiling.ProfilerFiller; -import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.Level; import net.minecraft.world.level.dimension.DimensionType; @@ -41,12 +40,12 @@ import java.util.function.Supplier; public class MixinClientLevel { @Inject(method = "", at = @At("RETURN")) private void construct(ClientPacketListener clientPacketListener, ClientLevel.ClientLevelData clientLevelData, ResourceKey resourceKey, DimensionType dimensionType, int i, Supplier supplier, LevelRenderer levelRenderer, boolean bl, long l, CallbackInfo ci) { - ClientLifecycleEvent.CLIENT_WORLD_LOAD.invoker().act((ClientLevel) (Object) this); + ClientLifecycleEvent.CLIENT_LEVEL_LOAD.invoker().act((ClientLevel) (Object) this); } @Inject(method = "addEntity", at = @At("HEAD"), cancellable = true) private void addEntity(int i, Entity entity, CallbackInfo ci) { - if (EntityEvent.ADD.invoker().add(entity, (ClientLevel) (Object) this) == InteractionResult.FAIL) { + if (EntityEvent.ADD.invoker().add(entity, (ClientLevel) (Object) this).isFalse()) { ci.cancel(); } } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinClientPacketListener.java b/fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinClientPacketListener.java similarity index 81% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinClientPacketListener.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinClientPacketListener.java index c17c5f2e..cf5bfb6c 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinClientPacketListener.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinClientPacketListener.java @@ -17,21 +17,18 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric.client; +package dev.architectury.mixin.fabric.client; -import me.shedaniel.architectury.event.events.RecipeUpdateEvent; -import me.shedaniel.architectury.event.events.client.ClientChatEvent; -import me.shedaniel.architectury.event.events.client.ClientPlayerEvent; +import dev.architectury.event.events.client.ClientChatEvent; +import dev.architectury.event.events.client.ClientPlayerEvent; +import dev.architectury.event.events.client.ClientRecipeUpdateEvent; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientPacketListener; import net.minecraft.client.player.LocalPlayer; -import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.game.ClientboundChatPacket; import net.minecraft.network.protocol.game.ClientboundLoginPacket; import net.minecraft.network.protocol.game.ClientboundRespawnPacket; import net.minecraft.network.protocol.game.ClientboundUpdateRecipesPacket; -import net.minecraft.world.InteractionResult; -import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.item.crafting.RecipeManager; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -44,6 +41,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(ClientPacketListener.class) public class MixinClientPacketListener { @Shadow + @Final private Minecraft minecraft; @Shadow @Final @@ -72,10 +70,11 @@ public class MixinClientPacketListener { target = "Lnet/minecraft/client/gui/Gui;handleChat(Lnet/minecraft/network/chat/ChatType;Lnet/minecraft/network/chat/Component;Ljava/util/UUID;)V"), cancellable = true) private void handleChat(ClientboundChatPacket packet, CallbackInfo ci) { - InteractionResultHolder process = ClientChatEvent.CLIENT_RECEIVED.invoker().process(packet.getType(), packet.getMessage(), packet.getSender()); - if (process.getResult() == InteractionResult.FAIL) + var process = ClientChatEvent.RECEIVED.invoker().process(packet.getType(), packet.getMessage(), packet.getSender()); + if (process.isEmpty()) return; + if (process.isFalse()) { ci.cancel(); - else if (process.getObject() != null && !process.getObject().equals(packet.getMessage())) { + } else if (process.object() != null && !process.object().equals(packet.getMessage())) { this.minecraft.gui.handleChat(packet.getType(), packet.getMessage(), packet.getSender()); ci.cancel(); } @@ -83,6 +82,6 @@ public class MixinClientPacketListener { @Inject(method = "handleUpdateRecipes", at = @At("RETURN")) private void handleUpdateRecipes(ClientboundUpdateRecipesPacket clientboundUpdateRecipesPacket, CallbackInfo ci) { - RecipeUpdateEvent.EVENT.invoker().update(recipeManager); + ClientRecipeUpdateEvent.EVENT.invoker().update(recipeManager); } } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinDebugScreenOverlay.java b/fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinDebugScreenOverlay.java similarity index 84% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinDebugScreenOverlay.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinDebugScreenOverlay.java index c8d65386..dccd8d7d 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinDebugScreenOverlay.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinDebugScreenOverlay.java @@ -17,9 +17,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric.client; +package dev.architectury.mixin.fabric.client; -import me.shedaniel.architectury.event.events.GuiEvent; +import dev.architectury.event.events.client.ClientGuiEvent; import net.minecraft.client.gui.components.DebugScreenOverlay; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -32,11 +32,11 @@ import java.util.List; public class MixinDebugScreenOverlay { @Inject(method = "getGameInformation", at = @At("RETURN")) private void getLeftTexts(CallbackInfoReturnable> cir) { - GuiEvent.DEBUG_TEXT_LEFT.invoker().gatherText(cir.getReturnValue()); + ClientGuiEvent.DEBUG_TEXT_LEFT.invoker().gatherText(cir.getReturnValue()); } @Inject(method = "getSystemInformation", at = @At("RETURN")) private void getRightTexts(CallbackInfoReturnable> cir) { - GuiEvent.DEBUG_TEXT_RIGHT.invoker().gatherText(cir.getReturnValue()); + ClientGuiEvent.DEBUG_TEXT_RIGHT.invoker().gatherText(cir.getReturnValue()); } } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinEffectInstance.java b/fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinEffectInstance.java similarity index 97% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinEffectInstance.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinEffectInstance.java index 48fd1d26..df1aed9e 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinEffectInstance.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinEffectInstance.java @@ -17,7 +17,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric.client; +package dev.architectury.mixin.fabric.client; import com.mojang.blaze3d.shaders.Program; import net.minecraft.client.renderer.EffectInstance; diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinGameRenderer.java b/fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinGameRenderer.java similarity index 84% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinGameRenderer.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinGameRenderer.java index f874f9e7..8a5237f8 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinGameRenderer.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinGameRenderer.java @@ -17,13 +17,12 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric.client; +package dev.architectury.mixin.fabric.client; import com.mojang.blaze3d.vertex.PoseStack; -import me.shedaniel.architectury.event.events.GuiEvent; +import dev.architectury.event.events.client.ClientGuiEvent; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GameRenderer; -import net.minecraft.world.InteractionResult; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -42,7 +41,7 @@ public abstract class MixinGameRenderer { at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/Screen;render(Lcom/mojang/blaze3d/vertex/PoseStack;IIF)V", ordinal = 0), locals = LocalCapture.CAPTURE_FAILEXCEPTION, cancellable = true) public void renderScreenPre(float tickDelta, long startTime, boolean tick, CallbackInfo ci, int mouseX, int mouseY, PoseStack matrices) { - if (GuiEvent.RENDER_PRE.invoker().render(minecraft.screen, matrices, mouseX, mouseY, minecraft.getDeltaFrameTime()) == InteractionResult.FAIL) { + if (ClientGuiEvent.RENDER_PRE.invoker().render(minecraft.screen, matrices, mouseX, mouseY, minecraft.getDeltaFrameTime()).isFalse()) { ci.cancel(); } } @@ -51,6 +50,6 @@ public abstract class MixinGameRenderer { at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/Screen;render(Lcom/mojang/blaze3d/vertex/PoseStack;IIF)V", shift = At.Shift.AFTER, ordinal = 0), locals = LocalCapture.CAPTURE_FAILEXCEPTION) public void renderScreenPost(float tickDelta, long startTime, boolean tick, CallbackInfo ci, int mouseX, int mouseY, PoseStack matrices) { - GuiEvent.RENDER_POST.invoker().render(minecraft.screen, matrices, mouseX, mouseY, minecraft.getDeltaFrameTime()); + ClientGuiEvent.RENDER_POST.invoker().render(minecraft.screen, matrices, mouseX, mouseY, minecraft.getDeltaFrameTime()); } } \ No newline at end of file diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinIntegratedServer.java b/fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinIntegratedServer.java similarity index 92% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinIntegratedServer.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinIntegratedServer.java index d4becaff..6ad899b1 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinIntegratedServer.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinIntegratedServer.java @@ -17,9 +17,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric.client; +package dev.architectury.mixin.fabric.client; -import me.shedaniel.architectury.event.events.LifecycleEvent; +import dev.architectury.event.events.common.LifecycleEvent; import net.minecraft.client.server.IntegratedServer; import net.minecraft.server.MinecraftServer; import org.spongepowered.asm.mixin.Mixin; diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinKeyboardHandler.java b/fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinKeyboardHandler.java similarity index 72% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinKeyboardHandler.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinKeyboardHandler.java index 8cfded04..e268cf63 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinKeyboardHandler.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinKeyboardHandler.java @@ -17,17 +17,16 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric.client; +package dev.architectury.mixin.fabric.client; -import me.shedaniel.architectury.event.events.client.ClientRawInputEvent; -import me.shedaniel.architectury.event.events.client.ClientScreenInputEvent; -import me.shedaniel.architectury.impl.fabric.ScreenInputDelegate; +import dev.architectury.event.EventResult; +import dev.architectury.event.events.client.ClientRawInputEvent; +import dev.architectury.event.events.client.ClientScreenInputEvent; +import dev.architectury.impl.fabric.ScreenInputDelegate; import net.minecraft.client.KeyboardHandler; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.components.events.ContainerEventHandler; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.screens.Screen; -import net.minecraft.world.InteractionResult; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -46,18 +45,18 @@ public class MixinKeyboardHandler { @Shadow private boolean sendRepeatsToGui; - @ModifyVariable(method = {"method_1458", "lambda$charTyped$7"}, at = @At("HEAD"), ordinal = 0, argsOnly = true) + @ModifyVariable(method = {"method_1458", "lambda$charTyped$5"}, at = @At("HEAD"), ordinal = 0, argsOnly = true) private static GuiEventListener wrapCharTypedFirst(GuiEventListener screen) { - if (screen instanceof ScreenInputDelegate) { - return ((ScreenInputDelegate) screen).architectury_delegateInputs(); + if (screen instanceof ScreenInputDelegate delegate) { + return delegate.architectury_delegateInputs(); } return screen; } - @ModifyVariable(method = {"method_1473", "lambda$charTyped$8"}, at = @At("HEAD"), ordinal = 0, argsOnly = true) + @ModifyVariable(method = {"method_1473", "lambda$charTyped$6"}, at = @At("HEAD"), ordinal = 0, argsOnly = true) private static GuiEventListener wrapCharTypedSecond(GuiEventListener screen) { - if (screen instanceof ScreenInputDelegate) { - return ((ScreenInputDelegate) screen).architectury_delegateInputs(); + if (screen instanceof ScreenInputDelegate delegate) { + return delegate.architectury_delegateInputs(); } return screen; } @@ -69,13 +68,13 @@ public class MixinKeyboardHandler { if (!info.isCancelled()) { if (int_3 != 1 && (int_3 != 2 || !this.sendRepeatsToGui)) { if (int_3 == 0) { - InteractionResult result = ClientScreenInputEvent.KEY_RELEASED_PRE.invoker().keyReleased(minecraft, minecraft.screen, int_1, int_2, int_4); - if (result != InteractionResult.PASS) + var result = ClientScreenInputEvent.KEY_RELEASED_PRE.invoker().keyReleased(minecraft, minecraft.screen, int_1, int_2, int_4); + if (result.isPresent()) info.cancel(); } } else { - InteractionResult result = ClientScreenInputEvent.KEY_PRESSED_PRE.invoker().keyPressed(minecraft, minecraft.screen, int_1, int_2, int_4); - if (result != InteractionResult.PASS) + var result = ClientScreenInputEvent.KEY_PRESSED_PRE.invoker().keyPressed(minecraft, minecraft.screen, int_1, int_2, int_4); + if (result.isPresent()) info.cancel(); } } @@ -87,13 +86,13 @@ public class MixinKeyboardHandler { cancellable = true) public void onKeyAfter(long long_1, int int_1, int int_2, int int_3, int int_4, CallbackInfo info, Screen screen, boolean bls[]) { if (!info.isCancelled() && !bls[0]) { - InteractionResult result; + EventResult result; if (int_3 != 1 && (int_3 != 2 || !this.sendRepeatsToGui)) { result = ClientScreenInputEvent.KEY_RELEASED_POST.invoker().keyReleased(minecraft, screen, int_1, int_2, int_4); } else { result = ClientScreenInputEvent.KEY_PRESSED_POST.invoker().keyPressed(minecraft, screen, int_1, int_2, int_4); } - if (result != InteractionResult.PASS) + if (result.isPresent()) info.cancel(); } } @@ -101,8 +100,8 @@ public class MixinKeyboardHandler { @Inject(method = "keyPress", at = @At("RETURN"), cancellable = true) public void onRawKey(long handle, int key, int scanCode, int action, int modifiers, CallbackInfo info) { if (handle == this.minecraft.getWindow().getWindow()) { - InteractionResult result = ClientRawInputEvent.KEY_PRESSED.invoker().keyPressed(minecraft, key, scanCode, action, modifiers); - if (result != InteractionResult.PASS) + var result = ClientRawInputEvent.KEY_PRESSED.invoker().keyPressed(minecraft, key, scanCode, action, modifiers); + if (result.isPresent()) info.cancel(); } } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinMinecraft.java b/fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinMinecraft.java similarity index 84% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinMinecraft.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinMinecraft.java index 25d818c0..0f895f0f 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinMinecraft.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinMinecraft.java @@ -17,16 +17,15 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric.client; +package dev.architectury.mixin.fabric.client; -import me.shedaniel.architectury.event.events.GuiEvent; -import me.shedaniel.architectury.event.events.InteractionEvent; -import me.shedaniel.architectury.event.events.client.ClientPlayerEvent; +import dev.architectury.event.events.client.ClientGuiEvent; +import dev.architectury.event.events.client.ClientPlayerEvent; +import dev.architectury.event.events.common.InteractionEvent; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.player.LocalPlayer; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.item.ItemStack; import net.minecraft.world.phys.HitResult; import org.jetbrains.annotations.Nullable; @@ -65,7 +64,7 @@ public abstract class MixinMinecraft { @Inject(method = "startUseItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/ItemStack;isEmpty()Z", ordinal = 1), locals = LocalCapture.CAPTURE_FAILHARD) - private void rightClickAir(CallbackInfo ci, InteractionHand var1[], int var2, int var3, InteractionHand interactionHand, ItemStack itemStack) { + private void rightClickAir(CallbackInfo ci, InteractionHand[] var1, int var2, int var3, InteractionHand interactionHand, ItemStack itemStack) { if (itemStack.isEmpty() && (this.hitResult == null || this.hitResult.getType() == HitResult.Type.MISS)) { InteractionEvent.CLIENT_RIGHT_CLICK_AIR.invoker().click(player, interactionHand); } @@ -86,21 +85,21 @@ public abstract class MixinMinecraft { argsOnly = true ) public Screen modifyScreen(Screen screen) { - Screen old = screen; - InteractionResultHolder event = GuiEvent.SET_SCREEN.invoker().modifyScreen(screen); - switch (event.getResult()) { - case FAIL: + var old = screen; + var event = ClientGuiEvent.SET_SCREEN.invoker().modifyScreen(screen); + if (event.isPresent()) { + if (event.isFalse()) { setScreenCancelled.set(true); return old; - case SUCCESS: - screen = event.getObject(); + } else { + screen = event.object(); if (old != null && screen != old) { old.removed(); } - default: - setScreenCancelled.set(false); - return screen; + } } + setScreenCancelled.set(false); + return screen; } @Inject( diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinMouseHandler.java b/fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinMouseHandler.java similarity index 71% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinMouseHandler.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinMouseHandler.java index dcedb8c1..5a6fbe38 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinMouseHandler.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinMouseHandler.java @@ -17,16 +17,14 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric.client; +package dev.architectury.mixin.fabric.client; -import me.shedaniel.architectury.event.events.client.ClientRawInputEvent; -import me.shedaniel.architectury.event.events.client.ClientScreenInputEvent; -import me.shedaniel.architectury.impl.fabric.ScreenInputDelegate; +import dev.architectury.event.events.client.ClientRawInputEvent; +import dev.architectury.event.events.client.ClientScreenInputEvent; +import dev.architectury.impl.fabric.ScreenInputDelegate; import net.minecraft.client.Minecraft; import net.minecraft.client.MouseHandler; -import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.screens.Screen; -import net.minecraft.world.InteractionResult; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -56,8 +54,8 @@ public class MixinMouseHandler { ordinal = 0), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD) public void onMouseScrolled(long handle, double xOffset, double yOffset, CallbackInfo info, double amount, double x, double y) { if (!info.isCancelled()) { - InteractionResult result = ClientScreenInputEvent.MOUSE_SCROLLED_PRE.invoker().mouseScrolled(minecraft, minecraft.screen, x, y, amount); - if (result != InteractionResult.PASS) + var result = ClientScreenInputEvent.MOUSE_SCROLLED_PRE.invoker().mouseScrolled(minecraft, minecraft.screen, x, y, amount); + if (result.isPresent()) info.cancel(); } } @@ -67,7 +65,7 @@ public class MixinMouseHandler { ordinal = 0, shift = At.Shift.AFTER), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD) public void onMouseScrolledPost(long handle, double xOffset, double yOffset, CallbackInfo info, double amount, double x, double y) { if (!info.isCancelled()) { - InteractionResult result = ClientScreenInputEvent.MOUSE_SCROLLED_POST.invoker().mouseScrolled(minecraft, minecraft.screen, x, y, amount); + var result = ClientScreenInputEvent.MOUSE_SCROLLED_POST.invoker().mouseScrolled(minecraft, minecraft.screen, x, y, amount); } } @@ -76,8 +74,8 @@ public class MixinMouseHandler { ordinal = 0), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD) public void onRawMouseScrolled(long handle, double xOffset, double yOffset, CallbackInfo info, double amount) { if (!info.isCancelled()) { - InteractionResult result = ClientRawInputEvent.MOUSE_SCROLLED.invoker().mouseScrolled(minecraft, amount); - if (result != InteractionResult.PASS) + var result = ClientRawInputEvent.MOUSE_SCROLLED.invoker().mouseScrolled(minecraft, amount); + if (result.isPresent()) info.cancel(); } } @@ -87,8 +85,8 @@ public class MixinMouseHandler { private static void onGuiMouseClicked(boolean[] bls, Screen screen, double d, double e, int button, CallbackInfo info) { var minecraft = Minecraft.getInstance(); if (!info.isCancelled()) { - InteractionResult result = ClientScreenInputEvent.MOUSE_CLICKED_PRE.invoker().mouseClicked(minecraft, screen, d, e, button); - if (result != InteractionResult.PASS) { + var result = ClientScreenInputEvent.MOUSE_CLICKED_PRE.invoker().mouseClicked(minecraft, screen, d, e, button); + if (result.isPresent()) { bls[0] = true; info.cancel(); } @@ -100,8 +98,8 @@ public class MixinMouseHandler { private static void onGuiMouseClickedPost(boolean[] bls, Screen screen, double d, double e, int button, CallbackInfo info) { var minecraft = Minecraft.getInstance(); if (!info.isCancelled() && !bls[0]) { - InteractionResult result = ClientScreenInputEvent.MOUSE_CLICKED_POST.invoker().mouseClicked(minecraft, screen, d, e, button); - if (result != InteractionResult.PASS) { + var result = ClientScreenInputEvent.MOUSE_CLICKED_POST.invoker().mouseClicked(minecraft, screen, d, e, button); + if (result.isPresent()) { bls[0] = true; info.cancel(); } @@ -109,12 +107,12 @@ public class MixinMouseHandler { } @Inject(method = "onPress", at = @At(value = "INVOKE", - target = "Lnet/minecraft/client/Minecraft;getOverlay()Lnet/minecraft/client/gui/screens/Overlay;", + target = "Lnet/minecraft/client/Minecraft;getOverlay()Lnet/minecraft/client/gui/screens/Overlay;", ordinal = 0), cancellable = true) public void onRawMouseClicked(long handle, int button, int action, int mods, CallbackInfo info) { if (!info.isCancelled()) { - InteractionResult result = ClientRawInputEvent.MOUSE_CLICKED_PRE.invoker().mouseClicked(minecraft, button, action, mods); - if (result != InteractionResult.PASS) + var result = ClientRawInputEvent.MOUSE_CLICKED_PRE.invoker().mouseClicked(minecraft, button, action, mods); + if (result.isPresent()) info.cancel(); } } @@ -122,8 +120,8 @@ public class MixinMouseHandler { @Inject(method = "onPress", at = @At("RETURN"), cancellable = true) public void onRawMouseClickedPost(long handle, int button, int action, int mods, CallbackInfo info) { if (handle == this.minecraft.getWindow().getWindow()) { - InteractionResult result = ClientRawInputEvent.MOUSE_CLICKED_POST.invoker().mouseClicked(minecraft, button, action, mods); - if (result != InteractionResult.PASS) + var result = ClientRawInputEvent.MOUSE_CLICKED_POST.invoker().mouseClicked(minecraft, button, action, mods); + if (result.isPresent()) info.cancel(); } } @@ -133,8 +131,8 @@ public class MixinMouseHandler { private static void onGuiMouseReleased(boolean[] bls, Screen screen, double d, double e, int button, CallbackInfo info) { var minecraft = Minecraft.getInstance(); if (!info.isCancelled()) { - InteractionResult result = ClientScreenInputEvent.MOUSE_RELEASED_PRE.invoker().mouseReleased(minecraft, screen, d, e, button); - if (result != InteractionResult.PASS) { + var result = ClientScreenInputEvent.MOUSE_RELEASED_PRE.invoker().mouseReleased(minecraft, screen, d, e, button); + if (result.isPresent()) { bls[0] = true; info.cancel(); } @@ -146,8 +144,8 @@ public class MixinMouseHandler { private static void onGuiMouseReleasedPost(boolean[] bls, Screen screen, double d, double e, int button, CallbackInfo info) { var minecraft = Minecraft.getInstance(); if (!info.isCancelled() && !bls[0]) { - InteractionResult result = ClientScreenInputEvent.MOUSE_RELEASED_POST.invoker().mouseReleased(minecraft, screen, d, e, button); - if (result != InteractionResult.PASS) { + var result = ClientScreenInputEvent.MOUSE_RELEASED_POST.invoker().mouseReleased(minecraft, screen, d, e, button); + if (result.isPresent()) { bls[0] = true; info.cancel(); } @@ -157,8 +155,8 @@ public class MixinMouseHandler { @SuppressWarnings("UnresolvedMixinReference") @ModifyVariable(method = {"method_1602", "lambda$onMove$11"}, at = @At("HEAD"), ordinal = 0, argsOnly = true) private Screen wrapMouseDragged(Screen screen) { - if (screen instanceof ScreenInputDelegate) { - return ((ScreenInputDelegate) screen).architectury_delegateInputs(); + if (screen instanceof ScreenInputDelegate delegate) { + return delegate.architectury_delegateInputs(); } return screen; } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinMultiPlayerGameMode.java b/fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinMultiPlayerGameMode.java similarity index 84% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinMultiPlayerGameMode.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinMultiPlayerGameMode.java index 653706af..59450a6c 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinMultiPlayerGameMode.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinMultiPlayerGameMode.java @@ -17,9 +17,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric.client; +package dev.architectury.mixin.fabric.client; -import me.shedaniel.architectury.event.events.InteractionEvent; +import dev.architectury.event.events.common.InteractionEvent; import net.minecraft.client.multiplayer.MultiPlayerGameMode; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -37,9 +37,9 @@ public class MixinMultiPlayerGameMode { shift = At.Shift.AFTER), cancellable = true) private void entityInteract(Player player, Entity entity, InteractionHand interactionHand, CallbackInfoReturnable cir) { - InteractionResult result = InteractionEvent.INTERACT_ENTITY.invoker().interact(player, entity, interactionHand); - if (result != InteractionResult.PASS) { - cir.setReturnValue(result); + var result = InteractionEvent.INTERACT_ENTITY.invoker().interact(player, entity, interactionHand); + if (result.isPresent()) { + cir.setReturnValue(result.asMinecraft()); } } } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinScreen.java b/fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinScreen.java similarity index 74% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinScreen.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinScreen.java index c0668aaa..3de86735 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinScreen.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinScreen.java @@ -17,23 +17,21 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric.client; +package dev.architectury.mixin.fabric.client; import com.mojang.blaze3d.vertex.PoseStack; -import me.shedaniel.architectury.event.events.GuiEvent; -import me.shedaniel.architectury.event.events.TooltipEvent; -import me.shedaniel.architectury.event.events.client.ClientChatEvent; -import me.shedaniel.architectury.hooks.screen.ScreenAccess; -import me.shedaniel.architectury.impl.ScreenAccessImpl; -import me.shedaniel.architectury.impl.TooltipEventColorContextImpl; -import me.shedaniel.architectury.impl.TooltipEventPositionContextImpl; -import me.shedaniel.architectury.impl.fabric.ScreenInputDelegate; +import dev.architectury.event.events.client.ClientChatEvent; +import dev.architectury.event.events.client.ClientGuiEvent; +import dev.architectury.event.events.client.ClientTooltipEvent; +import dev.architectury.hooks.client.screen.ScreenAccess; +import dev.architectury.impl.ScreenAccessImpl; +import dev.architectury.impl.TooltipEventColorContextImpl; +import dev.architectury.impl.TooltipEventPositionContextImpl; +import dev.architectury.impl.fabric.ScreenInputDelegate; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.screens.Screen; import net.minecraft.util.FormattedCharSequence; -import net.minecraft.world.InteractionResult; -import net.minecraft.world.InteractionResultHolder; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; @@ -78,38 +76,40 @@ public abstract class MixinScreen implements ScreenInputDelegate { @Inject(method = "init(Lnet/minecraft/client/Minecraft;II)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/Screen;clearWidgets()V", ordinal = 0), cancellable = true) private void preInit(Minecraft minecraft, int i, int j, CallbackInfo ci) { - if (GuiEvent.INIT_PRE.invoker().init((Screen) (Object) this, getAccess()) == InteractionResult.FAIL) { + if (ClientGuiEvent.INIT_PRE.invoker().init((Screen) (Object) this, getAccess()).isFalse()) { ci.cancel(); } } @Inject(method = "init(Lnet/minecraft/client/Minecraft;II)V", at = @At(value = "RETURN")) private void postInit(Minecraft minecraft, int i, int j, CallbackInfo ci) { - GuiEvent.INIT_POST.invoker().init((Screen) (Object) this, getAccess()); + ClientGuiEvent.INIT_POST.invoker().init((Screen) (Object) this, getAccess()); } @ModifyVariable(method = "sendMessage(Ljava/lang/String;Z)V", at = @At("HEAD"), argsOnly = true, ordinal = 0) private String modifyMessage(String message) { - InteractionResultHolder process = ClientChatEvent.CLIENT.invoker().process(message); - if (process.getResult() == InteractionResult.FAIL) - return ""; - if (process.getObject() != null) - return process.getObject(); + var process = ClientChatEvent.PROCESS.invoker().process(message); + if (process.isPresent()) { + if (process.isFalse()) + return ""; + if (process.object() != null) + return process.object(); + } return message; } @Inject(method = "renderTooltipInternal", at = @At("HEAD"), cancellable = true) private void renderTooltip(PoseStack poseStack, List list, int x, int y, CallbackInfo ci) { if (!list.isEmpty()) { - TooltipEventColorContextImpl colorContext = tooltipColorContext.get(); + var colorContext = tooltipColorContext.get(); colorContext.reset(); - TooltipEventPositionContextImpl positionContext = tooltipPositionContext.get(); + var positionContext = tooltipPositionContext.get(); positionContext.reset(x, y); - if (TooltipEvent.RENDER_VANILLA_PRE.invoker().renderTooltip(poseStack, list, x, y) == InteractionResult.FAIL) { + if (ClientTooltipEvent.RENDER_VANILLA_PRE.invoker().renderTooltip(poseStack, list, x, y).isFalse()) { ci.cancel(); } else { - TooltipEvent.RENDER_MODIFY_COLOR.invoker().renderTooltip(poseStack, x, y, colorContext); - TooltipEvent.RENDER_MODIFY_POSITION.invoker().renderTooltip(poseStack, positionContext); + ClientTooltipEvent.RENDER_MODIFY_COLOR.invoker().renderTooltip(poseStack, x, y, colorContext); + ClientTooltipEvent.RENDER_MODIFY_POSITION.invoker().renderTooltip(poseStack, positionContext); } } } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinTextureAtlas.java b/fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinTextureAtlas.java similarity index 87% rename from fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinTextureAtlas.java rename to fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinTextureAtlas.java index adcd07e5..8c4bc4d9 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinTextureAtlas.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinTextureAtlas.java @@ -17,9 +17,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.mixin.fabric.client; +package dev.architectury.mixin.fabric.client; -import me.shedaniel.architectury.event.events.TextureStitchEvent; +import dev.architectury.event.events.client.ClientTextureStitchEvent; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; @@ -40,11 +40,11 @@ public class MixinTextureAtlas { at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiling/ProfilerFiller;popPush(Ljava/lang/String;)V", ordinal = 0, shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD) private void preStitch(ResourceManager resourceManager, Stream stream, ProfilerFiller profilerFiller, int i, CallbackInfoReturnable cir, Set set) { - TextureStitchEvent.PRE.invoker().stitch((TextureAtlas) (Object) this, set::add); + ClientTextureStitchEvent.PRE.invoker().stitch((TextureAtlas) (Object) this, set::add); } @Inject(method = "reload", at = @At("RETURN")) private void postStitch(TextureAtlas.Preparations preparations, CallbackInfo ci) { - TextureStitchEvent.POST.invoker().stitch((TextureAtlas) (Object) this); + ClientTextureStitchEvent.POST.invoker().stitch((TextureAtlas) (Object) this); } } diff --git a/fabric/src/main/java/me/shedaniel/architectury/networking/fabric/NetworkManagerImpl.java b/fabric/src/main/java/dev/architectury/networking/fabric/NetworkManagerImpl.java similarity index 91% rename from fabric/src/main/java/me/shedaniel/architectury/networking/fabric/NetworkManagerImpl.java rename to fabric/src/main/java/dev/architectury/networking/fabric/NetworkManagerImpl.java index 66f421a4..82c364a4 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/networking/fabric/NetworkManagerImpl.java +++ b/fabric/src/main/java/dev/architectury/networking/fabric/NetworkManagerImpl.java @@ -17,11 +17,11 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.networking.fabric; +package dev.architectury.networking.fabric; -import me.shedaniel.architectury.networking.NetworkManager; -import me.shedaniel.architectury.networking.NetworkManager.NetworkReceiver; -import me.shedaniel.architectury.utils.Env; +import dev.architectury.networking.NetworkManager; +import dev.architectury.networking.NetworkManager.NetworkReceiver; +import dev.architectury.utils.Env; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.fabricmc.fabric.api.network.ClientSidePacketRegistry; @@ -31,6 +31,7 @@ import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.protocol.Packet; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; public class NetworkManagerImpl { @@ -88,6 +89,10 @@ public class NetworkManagerImpl { return ServerSidePacketRegistry.INSTANCE.canPlayerReceive(player, id); } + public static Packet createAddEntityPacket(Entity entity) { + return SpawnEntityPacket.create(entity); + } + @Environment(EnvType.CLIENT) private static Packet toC2SPacket(ResourceLocation id, FriendlyByteBuf buf) { return ClientSidePacketRegistry.INSTANCE.toPacket(id, buf); diff --git a/fabric/src/main/java/dev/architectury/networking/fabric/SpawnEntityPacket.java b/fabric/src/main/java/dev/architectury/networking/fabric/SpawnEntityPacket.java new file mode 100644 index 00000000..de8449b4 --- /dev/null +++ b/fabric/src/main/java/dev/architectury/networking/fabric/SpawnEntityPacket.java @@ -0,0 +1,102 @@ +/* + * This file is part of architectury. + * Copyright (C) 2020, 2021 architectury + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package dev.architectury.networking.fabric; + +import dev.architectury.networking.NetworkManager; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.networking.v1.PacketByteBufs; +import net.minecraft.client.Minecraft; +import net.minecraft.core.Registry; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.protocol.Packet; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.Entity; + +/** + * @see net.minecraft.network.protocol.game.ClientboundAddEntityPacket + */ +public class SpawnEntityPacket { + private static final ResourceLocation PACKET_ID = new ResourceLocation("architectury", "spawn_entity_packet"); + + @Environment(EnvType.CLIENT) + public static void register() { + NetworkManager.registerReceiver(NetworkManager.s2c(), PACKET_ID, SpawnEntityPacket::receive); + } + + public static Packet create(Entity entity) { + if (entity.level.isClientSide()) { + throw new IllegalStateException("SpawnPacketUtil.create called on the logical client!"); + } + var buffer = PacketByteBufs.create(); + buffer.writeVarInt(Registry.ENTITY_TYPE.getId(entity.getType())); + buffer.writeUUID(entity.getUUID()); + buffer.writeVarInt(entity.getId()); + var position = entity.position(); + buffer.writeDouble(position.x); + buffer.writeDouble(position.y); + buffer.writeDouble(position.z); + buffer.writeFloat(entity.getXRot()); + buffer.writeFloat(entity.getYRot()); + buffer.writeFloat(entity.getYHeadRot()); + var deltaMovement = entity.getDeltaMovement(); + buffer.writeDouble(deltaMovement.x); + buffer.writeDouble(deltaMovement.y); + buffer.writeDouble(deltaMovement.z); + return NetworkManager.toPacket(NetworkManager.s2c(), PACKET_ID, buffer); + } + + @Environment(EnvType.CLIENT) + public static void receive(FriendlyByteBuf buf, NetworkManager.PacketContext context) { + var entityTypeId = buf.readVarInt(); + var uuid = buf.readUUID(); + var id = buf.readVarInt(); + var x = buf.readDouble(); + var y = buf.readDouble(); + var z = buf.readDouble(); + var xRot = buf.readFloat(); + var yRot = buf.readFloat(); + var yHeadRot = buf.readFloat(); + var deltaX = buf.readDouble(); + var deltaY = buf.readDouble(); + var deltaZ = buf.readDouble(); + context.queue(() -> { + var entityType = Registry.ENTITY_TYPE.byId(entityTypeId); + if (entityType == null) { + throw new IllegalStateException("Entity type (" + entityTypeId + ") is unknown, spawning at (" + x + ", " + y + ", " + z + ")"); + } + if (Minecraft.getInstance().level == null) { + throw new IllegalStateException("Client world is null!"); + } + var entity = entityType.create(Minecraft.getInstance().level); + if (entity == null) { + throw new IllegalStateException("Created entity is null!"); + } + entity.setUUID(uuid); + entity.setId(id); + entity.setPacketCoordinates(x, y, z); + entity.absMoveTo(x, y, z, xRot, yRot); + entity.setYHeadRot(yHeadRot); + entity.setYBodyRot(yHeadRot); + Minecraft.getInstance().level.putNonPlayerEntity(id, entity); + entity.lerpMotion(deltaX, deltaY, deltaZ); + }); + } +} diff --git a/fabric/src/main/java/me/shedaniel/architectury/platform/fabric/PlatformImpl.java b/fabric/src/main/java/dev/architectury/platform/fabric/PlatformImpl.java similarity index 95% rename from fabric/src/main/java/me/shedaniel/architectury/platform/fabric/PlatformImpl.java rename to fabric/src/main/java/dev/architectury/platform/fabric/PlatformImpl.java index 4d173c7c..7d8c37d0 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/platform/fabric/PlatformImpl.java +++ b/fabric/src/main/java/dev/architectury/platform/fabric/PlatformImpl.java @@ -17,10 +17,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.platform.fabric; +package dev.architectury.platform.fabric; -import me.shedaniel.architectury.platform.Mod; -import me.shedaniel.architectury.utils.Env; +import dev.architectury.platform.Mod; +import dev.architectury.utils.Env; import net.fabricmc.api.EnvType; import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.ModContainer; @@ -69,7 +69,7 @@ public class PlatformImpl { } public static Collection getMods() { - for (ModContainer mod : FabricLoader.getInstance().getAllMods()) { + for (var mod : FabricLoader.getInstance().getAllMods()) { getMod(mod.getMetadata().getId()); } return mods.values(); diff --git a/fabric/src/main/java/me/shedaniel/architectury/plugin/fabric/ArchitecturyMixinPlugin.java b/fabric/src/main/java/dev/architectury/plugin/fabric/ArchitecturyMixinPlugin.java similarity index 86% rename from fabric/src/main/java/me/shedaniel/architectury/plugin/fabric/ArchitecturyMixinPlugin.java rename to fabric/src/main/java/dev/architectury/plugin/fabric/ArchitecturyMixinPlugin.java index 4d01f54b..b2b3c646 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/plugin/fabric/ArchitecturyMixinPlugin.java +++ b/fabric/src/main/java/dev/architectury/plugin/fabric/ArchitecturyMixinPlugin.java @@ -17,7 +17,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.plugin.fabric; +package dev.architectury.plugin.fabric; import net.fabricmc.loader.api.FabricLoader; import org.objectweb.asm.tree.ClassNode; @@ -28,7 +28,6 @@ import java.util.List; import java.util.Set; public class ArchitecturyMixinPlugin implements IMixinConfigPlugin { - @Override public void onLoad(String mixinPackage) { // noop @@ -41,12 +40,10 @@ public class ArchitecturyMixinPlugin implements IMixinConfigPlugin { @Override public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { - switch (mixinClassName) { - case "me.shedaniel.architectury.mixin.fabric.client.MixinEffectInstance": - return !FabricLoader.getInstance().isModLoaded("satin"); - default: - return true; + if ("me.shedaniel.architectury.mixin.fabric.client.MixinEffectInstance".equals(mixinClassName)) { + return !FabricLoader.getInstance().isModLoaded("satin"); } + return true; } @Override diff --git a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/BlockPropertiesImpl.java b/fabric/src/main/java/dev/architectury/registry/block/fabric/BlockPropertiesImpl.java similarity index 88% rename from fabric/src/main/java/me/shedaniel/architectury/registry/fabric/BlockPropertiesImpl.java rename to fabric/src/main/java/dev/architectury/registry/block/fabric/BlockPropertiesImpl.java index 93c2b1a7..b970b08a 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/BlockPropertiesImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/block/fabric/BlockPropertiesImpl.java @@ -17,10 +17,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.registry.fabric; +package dev.architectury.registry.block.fabric; -import me.shedaniel.architectury.registry.BlockProperties; -import me.shedaniel.architectury.registry.ToolType; +import dev.architectury.registry.block.BlockProperties; +import dev.architectury.registry.block.ToolType; import net.fabricmc.fabric.impl.object.builder.BlockSettingsInternals; import net.fabricmc.fabric.impl.object.builder.FabricBlockInternals; import net.minecraft.world.level.block.state.BlockBehaviour; @@ -44,7 +44,7 @@ public class BlockPropertiesImpl { } public static BlockProperties copy(BlockBehaviour.Properties old) { - BlockProperties properties = of(old.material, old.materialColor); + var properties = of(old.material, old.materialColor); properties.material = old.material; properties.destroyTime = old.destroyTime; properties.explosionResistance = old.explosionResistance; @@ -59,8 +59,8 @@ public class BlockPropertiesImpl { properties.canOcclude = old.canOcclude; properties.isAir = old.isAir; properties.requiresCorrectToolForDrops = old.requiresCorrectToolForDrops; - BlockSettingsInternals otherInternals = (BlockSettingsInternals) old; - FabricBlockInternals.ExtraData extraData = otherInternals.getExtraData(); + var otherInternals = (BlockSettingsInternals) old; + var extraData = otherInternals.getExtraData(); if (extraData != null) { ((BlockSettingsInternals) properties).setExtraData(extraData); } diff --git a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/ToolTypeImpl.java b/fabric/src/main/java/dev/architectury/registry/block/fabric/ToolTypeImpl.java similarity index 96% rename from fabric/src/main/java/me/shedaniel/architectury/registry/fabric/ToolTypeImpl.java rename to fabric/src/main/java/dev/architectury/registry/block/fabric/ToolTypeImpl.java index 1517b876..93ad473c 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/ToolTypeImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/block/fabric/ToolTypeImpl.java @@ -17,7 +17,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.registry.fabric; +package dev.architectury.registry.block.fabric; import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags; import net.minecraft.tags.Tag; diff --git a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/KeyBindingsImpl.java b/fabric/src/main/java/dev/architectury/registry/client/keymappings/fabric/KeyMappingRegistryImpl.java similarity index 82% rename from fabric/src/main/java/me/shedaniel/architectury/registry/fabric/KeyBindingsImpl.java rename to fabric/src/main/java/dev/architectury/registry/client/keymappings/fabric/KeyMappingRegistryImpl.java index c4345c6e..6e64b1a7 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/KeyBindingsImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/client/keymappings/fabric/KeyMappingRegistryImpl.java @@ -17,13 +17,13 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.registry.fabric; +package dev.architectury.registry.client.keymappings.fabric; import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; import net.minecraft.client.KeyMapping; -public class KeyBindingsImpl { - public static void registerKeyBinding(KeyMapping binding) { - KeyBindingHelper.registerKeyBinding(binding); +public class KeyMappingRegistryImpl { + public static void register(KeyMapping mapping) { + KeyBindingHelper.registerKeyBinding(mapping); } } diff --git a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/BlockEntityRenderersImpl.java b/fabric/src/main/java/dev/architectury/registry/client/rendering/fabric/BlockEntityRendererRegistryImpl.java similarity index 83% rename from fabric/src/main/java/me/shedaniel/architectury/registry/fabric/BlockEntityRenderersImpl.java rename to fabric/src/main/java/dev/architectury/registry/client/rendering/fabric/BlockEntityRendererRegistryImpl.java index 42d83985..7651ede0 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/BlockEntityRenderersImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/client/rendering/fabric/BlockEntityRendererRegistryImpl.java @@ -17,15 +17,15 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.registry.fabric; +package dev.architectury.registry.client.rendering.fabric; import net.fabricmc.fabric.api.client.rendereregistry.v1.BlockEntityRendererRegistry; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; -public class BlockEntityRenderersImpl { - public static void registerRenderer(BlockEntityType type, BlockEntityRendererProvider provider) { +public class BlockEntityRendererRegistryImpl { + public static void register(BlockEntityType type, BlockEntityRendererProvider provider) { BlockEntityRendererRegistry.INSTANCE.register(type, provider); } } diff --git a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/ColorHandlersImpl.java b/fabric/src/main/java/dev/architectury/registry/client/rendering/fabric/ColorHandlerRegistryImpl.java similarity index 87% rename from fabric/src/main/java/me/shedaniel/architectury/registry/fabric/ColorHandlersImpl.java rename to fabric/src/main/java/dev/architectury/registry/client/rendering/fabric/ColorHandlerRegistryImpl.java index ff4bd263..12ed5f16 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/ColorHandlersImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/client/rendering/fabric/ColorHandlerRegistryImpl.java @@ -17,7 +17,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.registry.fabric; +package dev.architectury.registry.client.rendering.fabric; import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry; import net.minecraft.client.color.block.BlockColor; @@ -28,7 +28,7 @@ import net.minecraft.world.level.block.Block; import java.util.Objects; import java.util.function.Supplier; -public class ColorHandlersImpl { +public class ColorHandlerRegistryImpl { @SafeVarargs public static void registerItemColors(ItemColor itemColor, Supplier... items) { Objects.requireNonNull(itemColor, "color is null!"); @@ -42,16 +42,16 @@ public class ColorHandlersImpl { } private static ItemLike[] unpackItems(Supplier[] items) { - ItemLike[] array = new ItemLike[items.length]; - for (int i = 0; i < items.length; i++) { + var array = new ItemLike[items.length]; + for (var i = 0; i < items.length; i++) { array[i] = Objects.requireNonNull(items[i].get()); } return array; } private static Block[] unpackBlocks(Supplier[] blocks) { - Block[] array = new Block[blocks.length]; - for (int i = 0; i < blocks.length; i++) { + var array = new Block[blocks.length]; + for (var i = 0; i < blocks.length; i++) { array[i] = Objects.requireNonNull(blocks[i].get()); } return array; diff --git a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/RenderTypesImpl.java b/fabric/src/main/java/dev/architectury/registry/client/rendering/fabric/RenderTypeRegistryImpl.java similarity index 93% rename from fabric/src/main/java/me/shedaniel/architectury/registry/fabric/RenderTypesImpl.java rename to fabric/src/main/java/dev/architectury/registry/client/rendering/fabric/RenderTypeRegistryImpl.java index 7dfc5ad7..a6522bfa 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/RenderTypesImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/client/rendering/fabric/RenderTypeRegistryImpl.java @@ -17,14 +17,14 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.registry.fabric; +package dev.architectury.registry.client.rendering.fabric; import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; import net.minecraft.client.renderer.RenderType; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.material.Fluid; -public class RenderTypesImpl { +public class RenderTypeRegistryImpl { public static void register(RenderType type, Block... blocks) { BlockRenderLayerMap.INSTANCE.putBlocks(type, blocks); } diff --git a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/CreativeTabsImpl.java b/fabric/src/main/java/dev/architectury/registry/fabric/CreativeTabRegistryImpl.java similarity index 93% rename from fabric/src/main/java/me/shedaniel/architectury/registry/fabric/CreativeTabsImpl.java rename to fabric/src/main/java/dev/architectury/registry/fabric/CreativeTabRegistryImpl.java index 2df5f719..5f600d58 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/CreativeTabsImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/fabric/CreativeTabRegistryImpl.java @@ -17,7 +17,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.registry.fabric; +package dev.architectury.registry.fabric; import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder; import net.minecraft.resources.ResourceLocation; @@ -26,7 +26,7 @@ import net.minecraft.world.item.ItemStack; import java.util.function.Supplier; -public class CreativeTabsImpl { +public class CreativeTabRegistryImpl { public static CreativeModeTab create(ResourceLocation name, Supplier icon) { return FabricItemGroupBuilder.build(name, icon); } diff --git a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/ReloadListenersImpl.java b/fabric/src/main/java/dev/architectury/registry/fabric/ReloadListenerRegistryImpl.java similarity index 86% rename from fabric/src/main/java/me/shedaniel/architectury/registry/fabric/ReloadListenersImpl.java rename to fabric/src/main/java/dev/architectury/registry/fabric/ReloadListenerRegistryImpl.java index 4f27c280..234be9e4 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/ReloadListenersImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/fabric/ReloadListenerRegistryImpl.java @@ -17,7 +17,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.registry.fabric; +package dev.architectury.registry.fabric; import com.google.common.primitives.Longs; import net.fabricmc.fabric.api.resource.IdentifiableResourceReloadListener; @@ -33,13 +33,13 @@ import java.security.SecureRandom; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; -public class ReloadListenersImpl { +public class ReloadListenerRegistryImpl { private static final SecureRandom RANDOM = new SecureRandom(); - public static void registerReloadListener(PackType type, PreparableReloadListener listener) { - byte[] bytes = new byte[8]; + public static void register(PackType type, PreparableReloadListener listener) { + var bytes = new byte[8]; RANDOM.nextBytes(bytes); - ResourceLocation id = new ResourceLocation("architectury:reload_" + StringUtils.leftPad(Math.abs(Longs.fromByteArray(bytes)) + "", 19, '0')); + var id = new ResourceLocation("architectury:reload_" + StringUtils.leftPad(Math.abs(Longs.fromByteArray(bytes)) + "", 19, '0')); ResourceManagerHelper.get(type).registerReloadListener(new IdentifiableResourceReloadListener() { @Override public ResourceLocation getFabricId() { diff --git a/fabric/src/main/java/me/shedaniel/architectury/registry/fuel/fabric/FuelRegistryImpl.java b/fabric/src/main/java/dev/architectury/registry/fuel/fabric/FuelRegistryImpl.java similarity index 89% rename from fabric/src/main/java/me/shedaniel/architectury/registry/fuel/fabric/FuelRegistryImpl.java rename to fabric/src/main/java/dev/architectury/registry/fuel/fabric/FuelRegistryImpl.java index e0981f55..4fb1b944 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/registry/fuel/fabric/FuelRegistryImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/fuel/fabric/FuelRegistryImpl.java @@ -17,7 +17,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.registry.fuel.fabric; +package dev.architectury.registry.fuel.fabric; import net.fabricmc.fabric.api.registry.FuelRegistry; import net.minecraft.world.item.ItemStack; @@ -25,7 +25,7 @@ import net.minecraft.world.level.ItemLike; public class FuelRegistryImpl { public static void register(int time, ItemLike... items) { - for (ItemLike item : items) { + for (var item : items) { if (time >= 0) { FuelRegistry.INSTANCE.add(item, time); } else { @@ -35,7 +35,7 @@ public class FuelRegistryImpl { } public static int get(ItemStack stack) { - Integer time = FuelRegistry.INSTANCE.get(stack.getItem()); + var time = FuelRegistry.INSTANCE.get(stack.getItem()); return time == null ? 0 : time; } } diff --git a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/CriteriaTriggersRegistryImpl.java b/fabric/src/main/java/dev/architectury/registry/level/advancement/fabric/CriteriaTriggersRegistryImpl.java similarity index 94% rename from fabric/src/main/java/me/shedaniel/architectury/registry/fabric/CriteriaTriggersRegistryImpl.java rename to fabric/src/main/java/dev/architectury/registry/level/advancement/fabric/CriteriaTriggersRegistryImpl.java index 79af464a..371c6cfd 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/CriteriaTriggersRegistryImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/level/advancement/fabric/CriteriaTriggersRegistryImpl.java @@ -17,7 +17,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.registry.fabric; +package dev.architectury.registry.level.advancement.fabric; import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.advancements.CriterionTrigger; diff --git a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/BiomeModificationsImpl.java b/fabric/src/main/java/dev/architectury/registry/level/biome/fabric/BiomeModificationsImpl.java similarity index 95% rename from fabric/src/main/java/me/shedaniel/architectury/registry/fabric/BiomeModificationsImpl.java rename to fabric/src/main/java/dev/architectury/registry/level/biome/fabric/BiomeModificationsImpl.java index 3dcfa077..be9263e1 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/BiomeModificationsImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/level/biome/fabric/BiomeModificationsImpl.java @@ -17,12 +17,12 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.registry.fabric; +package dev.architectury.registry.level.biome.fabric; import com.google.common.base.Predicates; import com.google.common.collect.Lists; -import me.shedaniel.architectury.hooks.biome.*; -import me.shedaniel.architectury.registry.BiomeModifications.BiomeContext; +import dev.architectury.hooks.level.biome.*; +import dev.architectury.registry.level.biome.BiomeModifications.BiomeContext; import net.fabricmc.fabric.api.biome.v1.BiomeModification; import net.fabricmc.fabric.api.biome.v1.BiomeModificationContext; import net.fabricmc.fabric.api.biome.v1.BiomeModificationContext.GenerationSettingsContext; @@ -78,7 +78,7 @@ public class BiomeModificationsImpl { } static { - BiomeModification modification = net.fabricmc.fabric.api.biome.v1.BiomeModifications.create(FABRIC_MODIFICATION); + var modification = net.fabricmc.fabric.api.biome.v1.BiomeModifications.create(FABRIC_MODIFICATION); registerModification(modification, ModificationPhase.ADDITIONS, ADDITIONS); registerModification(modification, ModificationPhase.POST_PROCESSING, POST_PROCESSING); registerModification(modification, ModificationPhase.REMOVALS, REMOVALS); @@ -87,9 +87,9 @@ public class BiomeModificationsImpl { private static void registerModification(BiomeModification modification, ModificationPhase phase, List, BiConsumer>> list) { modification.add(phase, Predicates.alwaysTrue(), (biomeSelectionContext, biomeModificationContext) -> { - BiomeContext biomeContext = wrapSelectionContext(biomeSelectionContext); - BiomeProperties.Mutable mutableBiome = wrapMutableBiome(biomeSelectionContext.getBiome(), biomeModificationContext); - for (Pair, BiConsumer> pair : list) { + var biomeContext = wrapSelectionContext(biomeSelectionContext); + var mutableBiome = wrapMutableBiome(biomeSelectionContext.getBiome(), biomeModificationContext); + for (var pair : list) { if (pair.getLeft().test(biomeContext)) { pair.getRight().accept(biomeContext, mutableBiome); } diff --git a/fabric/src/main/java/me/shedaniel/architectury/registry/entity/fabric/EntityAttributesImpl.java b/fabric/src/main/java/dev/architectury/registry/level/entity/fabric/EntityAttributeRegistryImpl.java similarity index 93% rename from fabric/src/main/java/me/shedaniel/architectury/registry/entity/fabric/EntityAttributesImpl.java rename to fabric/src/main/java/dev/architectury/registry/level/entity/fabric/EntityAttributeRegistryImpl.java index 5d881ecf..5199d513 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/registry/entity/fabric/EntityAttributesImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/level/entity/fabric/EntityAttributeRegistryImpl.java @@ -17,7 +17,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.registry.entity.fabric; +package dev.architectury.registry.level.entity.fabric; import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry; import net.minecraft.world.entity.EntityType; @@ -26,7 +26,7 @@ import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import java.util.function.Supplier; -public class EntityAttributesImpl { +public class EntityAttributeRegistryImpl { public static void register(Supplier> type, Supplier attribute) { FabricDefaultAttributeRegistry.register(type.get(), attribute.get()); } diff --git a/fabric/src/main/java/me/shedaniel/architectury/registry/entity/fabric/EntityRenderersImpl.java b/fabric/src/main/java/dev/architectury/registry/level/entity/fabric/EntityRendererRegistryImpl.java similarity index 75% rename from fabric/src/main/java/me/shedaniel/architectury/registry/entity/fabric/EntityRenderersImpl.java rename to fabric/src/main/java/dev/architectury/registry/level/entity/fabric/EntityRendererRegistryImpl.java index c75c1049..e34e46c6 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/registry/entity/fabric/EntityRenderersImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/level/entity/fabric/EntityRendererRegistryImpl.java @@ -17,19 +17,15 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.registry.entity.fabric; +package dev.architectury.registry.level.entity.fabric; import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityRendererRegistry; -import net.minecraft.client.renderer.entity.EntityRenderDispatcher; -import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; -import java.util.function.Function; - -public class EntityRenderersImpl { - public static void register(EntityType type, EntityRendererProvider provider) { +public class EntityRendererRegistryImpl { + public static void register(EntityType type, EntityRendererProvider provider) { EntityRendererRegistry.INSTANCE.register(type, provider); } } diff --git a/fabric/src/main/java/me/shedaniel/architectury/registry/trade/fabric/TradeRegistryImpl.java b/fabric/src/main/java/dev/architectury/registry/level/entity/trade/fabric/TradeRegistryImpl.java similarity index 96% rename from fabric/src/main/java/me/shedaniel/architectury/registry/trade/fabric/TradeRegistryImpl.java rename to fabric/src/main/java/dev/architectury/registry/level/entity/trade/fabric/TradeRegistryImpl.java index b2802972..8e5a543f 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/registry/trade/fabric/TradeRegistryImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/level/entity/trade/fabric/TradeRegistryImpl.java @@ -17,7 +17,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.registry.trade.fabric; +package dev.architectury.registry.level.entity.trade.fabric; import net.fabricmc.fabric.api.object.builder.v1.trade.TradeOfferHelper; import net.minecraft.world.entity.npc.VillagerProfession; diff --git a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/GameRuleFactoryImpl.java b/fabric/src/main/java/dev/architectury/registry/level/fabric/GameRuleFactoryImpl.java similarity index 97% rename from fabric/src/main/java/me/shedaniel/architectury/registry/fabric/GameRuleFactoryImpl.java rename to fabric/src/main/java/dev/architectury/registry/level/fabric/GameRuleFactoryImpl.java index 0506c6d5..8ceb69f7 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/GameRuleFactoryImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/level/fabric/GameRuleFactoryImpl.java @@ -17,7 +17,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.registry.fabric; +package dev.architectury.registry.level.fabric; import net.fabricmc.fabric.api.gamerule.v1.GameRuleFactory; import net.minecraft.server.MinecraftServer; diff --git a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/GameRuleRegistryImpl.java b/fabric/src/main/java/dev/architectury/registry/level/fabric/GameRuleRegistryImpl.java similarity index 95% rename from fabric/src/main/java/me/shedaniel/architectury/registry/fabric/GameRuleRegistryImpl.java rename to fabric/src/main/java/dev/architectury/registry/level/fabric/GameRuleRegistryImpl.java index ecd9288b..e921f7a2 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/GameRuleRegistryImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/level/fabric/GameRuleRegistryImpl.java @@ -17,7 +17,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.registry.fabric; +package dev.architectury.registry.level.fabric; import net.fabricmc.fabric.api.gamerule.v1.GameRuleRegistry; import net.minecraft.world.level.GameRules; diff --git a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/MenuRegistryImpl.java b/fabric/src/main/java/dev/architectury/registry/menu/fabric/MenuRegistryImpl.java similarity index 89% rename from fabric/src/main/java/me/shedaniel/architectury/registry/fabric/MenuRegistryImpl.java rename to fabric/src/main/java/dev/architectury/registry/menu/fabric/MenuRegistryImpl.java index 44753f68..5f4efd34 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/MenuRegistryImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/menu/fabric/MenuRegistryImpl.java @@ -17,12 +17,12 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.registry.fabric; +package dev.architectury.registry.menu.fabric; -import me.shedaniel.architectury.registry.MenuRegistry.ExtendedMenuTypeFactory; -import me.shedaniel.architectury.registry.MenuRegistry.ScreenFactory; -import me.shedaniel.architectury.registry.MenuRegistry.SimpleMenuTypeFactory; -import me.shedaniel.architectury.registry.menu.ExtendedMenuProvider; +import dev.architectury.registry.menu.ExtendedMenuProvider; +import dev.architectury.registry.menu.MenuRegistry.ExtendedMenuTypeFactory; +import dev.architectury.registry.menu.MenuRegistry.ScreenFactory; +import dev.architectury.registry.menu.MenuRegistry.SimpleMenuTypeFactory; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.fabricmc.fabric.api.client.screenhandler.v1.ScreenRegistry; diff --git a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/RegistriesImpl.java b/fabric/src/main/java/dev/architectury/registry/registries/fabric/RegistriesImpl.java similarity index 69% rename from fabric/src/main/java/me/shedaniel/architectury/registry/fabric/RegistriesImpl.java rename to fabric/src/main/java/dev/architectury/registry/registries/fabric/RegistriesImpl.java index a46887f3..6f76d1c6 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/RegistriesImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/registries/fabric/RegistriesImpl.java @@ -17,20 +17,20 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.registry.fabric; +package dev.architectury.registry.registries.fabric; import com.google.common.base.Objects; import com.google.common.base.Suppliers; -import me.shedaniel.architectury.core.RegistryEntry; -import me.shedaniel.architectury.registry.Registries; -import me.shedaniel.architectury.registry.Registry; -import me.shedaniel.architectury.registry.RegistrySupplier; -import me.shedaniel.architectury.registry.registries.RegistryBuilder; -import me.shedaniel.architectury.registry.registries.RegistryOption; -import me.shedaniel.architectury.registry.registries.StandardRegistryOption; +import dev.architectury.registry.registries.Registrar; +import dev.architectury.registry.registries.RegistrarBuilder; +import dev.architectury.registry.registries.Registries; +import dev.architectury.registry.registries.RegistrySupplier; +import dev.architectury.registry.registries.options.RegistrarOption; +import dev.architectury.registry.registries.options.StandardRegistrarOption; import net.fabricmc.fabric.api.event.registry.FabricRegistryBuilder; import net.fabricmc.fabric.api.event.registry.RegistryAttribute; import net.minecraft.core.MappedRegistry; +import net.minecraft.core.Registry; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import org.jetbrains.annotations.NotNull; @@ -47,13 +47,13 @@ public class RegistriesImpl { return RegistryProviderImpl.INSTANCE; } - public static ResourceLocation getId(T object, ResourceKey> fallback) { + public static ResourceLocation getId(T object, ResourceKey> fallback) { if (fallback == null) return null; return RegistryProviderImpl.INSTANCE.get(fallback).getId(object); } - public static ResourceLocation getId(T object, net.minecraft.core.Registry fallback) { + public static ResourceLocation getId(T object, Registry fallback) { if (fallback == null) return null; return RegistryProviderImpl.INSTANCE.get(fallback).getId(object); @@ -63,57 +63,57 @@ public class RegistriesImpl { INSTANCE; @Override - public Registry get(ResourceKey> key) { - return new RegistryImpl<>((net.minecraft.core.Registry) net.minecraft.core.Registry.REGISTRY.get(key.location())); + public Registrar get(ResourceKey> key) { + return new RegistrarImpl<>((Registry) Registry.REGISTRY.get(key.location())); } @Override - public Registry get(net.minecraft.core.Registry registry) { - return new RegistryImpl<>(registry); + public Registrar get(Registry registry) { + return new RegistrarImpl<>(registry); } @Override @NotNull - public > RegistryBuilder builder(Class type, ResourceLocation registryId) { - return new RegistryBuilderWrapper<>(FabricRegistryBuilder.createSimple(type, registryId)); + public RegistrarBuilder builder(Class type, ResourceLocation registryId) { + return new RegistrarBuilderWrapper<>(FabricRegistryBuilder.createSimple(type, registryId)); } } - public static class RegistryBuilderWrapper> implements RegistryBuilder { + public static class RegistrarBuilderWrapper implements RegistrarBuilder { @NotNull private FabricRegistryBuilder> builder; - public RegistryBuilderWrapper(@NotNull FabricRegistryBuilder> builder) { + public RegistrarBuilderWrapper(@NotNull FabricRegistryBuilder> builder) { this.builder = builder; } @Override - public @NotNull Registry build() { + public @NotNull Registrar build() { return RegistryProviderImpl.INSTANCE.get(builder.buildAndRegister()); } @Override - public @NotNull RegistryBuilder option(@NotNull RegistryOption option) { - if (option == StandardRegistryOption.SAVE_TO_DISC) { + public @NotNull RegistrarBuilder option(@NotNull RegistrarOption option) { + if (option == StandardRegistrarOption.SAVE_TO_DISC) { this.builder.attribute(RegistryAttribute.PERSISTED); - } else if (option == StandardRegistryOption.SYNC_TO_CLIENTS) { + } else if (option == StandardRegistrarOption.SYNC_TO_CLIENTS) { this.builder.attribute(RegistryAttribute.SYNCED); } return this; } } - public static class RegistryImpl implements Registry { - private net.minecraft.core.Registry delegate; + public static class RegistrarImpl implements Registrar { + private Registry delegate; - public RegistryImpl(net.minecraft.core.Registry delegate) { + public RegistrarImpl(Registry delegate) { this.delegate = delegate; } @Override - public @NotNull RegistrySupplier delegateSupplied(ResourceLocation id) { + public @NotNull RegistrySupplier delegate(ResourceLocation id) { Supplier value = Suppliers.memoize(() -> get(id)); - return new RegistrySupplier() { + return new RegistrySupplier<>() { @Override public @NotNull ResourceLocation getRegistryId() { return delegate.key().location(); @@ -142,8 +142,7 @@ public class RegistriesImpl { @Override public boolean equals(Object obj) { if (this == obj) return true; - if (!(obj instanceof RegistrySupplier)) return false; - RegistrySupplier other = (RegistrySupplier) obj; + if (!(obj instanceof RegistrySupplier other)) return false; return other.getRegistryId().equals(getRegistryId()) && other.getId().equals(getId()); } @@ -155,9 +154,9 @@ public class RegistriesImpl { } @Override - public @NotNull RegistrySupplier registerSupplied(ResourceLocation id, Supplier supplier) { - net.minecraft.core.Registry.register(delegate, id, supplier.get()); - return (RegistrySupplier) delegateSupplied(id); + public @NotNull RegistrySupplier register(ResourceLocation id, Supplier supplier) { + Registry.register(delegate, id, supplier.get()); + return (RegistrySupplier) delegate(id); } @Override @@ -206,7 +205,7 @@ public class RegistriesImpl { } @Override - public ResourceKey> key() { + public ResourceKey> key() { return delegate.key(); } diff --git a/fabric/src/main/java/me/shedaniel/architectury/utils/fabric/GameInstanceImpl.java b/fabric/src/main/java/dev/architectury/utils/fabric/GameInstanceImpl.java similarity index 87% rename from fabric/src/main/java/me/shedaniel/architectury/utils/fabric/GameInstanceImpl.java rename to fabric/src/main/java/dev/architectury/utils/fabric/GameInstanceImpl.java index 76b7938a..7017363e 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/utils/fabric/GameInstanceImpl.java +++ b/fabric/src/main/java/dev/architectury/utils/fabric/GameInstanceImpl.java @@ -17,12 +17,12 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.utils.fabric; +package dev.architectury.utils.fabric; -import me.shedaniel.architectury.event.EventHandler; -import me.shedaniel.architectury.event.events.LifecycleEvent; -import me.shedaniel.architectury.platform.Platform; -import me.shedaniel.architectury.utils.Env; +import dev.architectury.event.EventHandler; +import dev.architectury.event.events.common.LifecycleEvent; +import dev.architectury.platform.Platform; +import dev.architectury.utils.Env; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; diff --git a/fabric/src/main/resources/architectury.mixins.json b/fabric/src/main/resources/architectury.mixins.json index 59582603..9040d218 100644 --- a/fabric/src/main/resources/architectury.mixins.json +++ b/fabric/src/main/resources/architectury.mixins.json @@ -1,56 +1,58 @@ { - "required": true, - "package": "me.shedaniel.architectury.mixin.fabric", - "plugin": "me.shedaniel.architectury.plugin.fabric.ArchitecturyMixinPlugin", - "compatibilityLevel": "JAVA_8", - "minVersion": "0.7.11", - "client": [ - "client.MixinClientLevel", - "client.MixinClientPacketListener", - "client.MixinDebugScreenOverlay", - "client.MixinEffectInstance", - "client.MixinGameRenderer", - "client.MixinIntegratedServer", - "client.MixinKeyboardHandler", - "client.MixinMinecraft", - "client.MixinMouseHandler", - "client.MixinMultiPlayerGameMode", - "client.MixinScreen", - "client.MixinTextureAtlas" - ], - "mixins": [ - "ExplosionPreInvoker", - "LivingDeathInvoker", - "MixinBaseSpawner", - "MixinBlockEntityExtension", - "MixinBlockItem", - "MixinBucketItem", - "MixinCatSpawner", - "MixinCommands", - "MixinDedicatedServer", - "MixinEntity", - "MixinExplosion", - "MixinFarmBlock", - "MixinFurnaceResultSlot", - "MixinInventory", - "MixinItemEntity", - "MixinLivingEntity", - "MixinNaturalSpawner", - "MixinPatrolSpawner", - "MixinPersistentEntitySectionManager", - "MixinPhantomSpawner", - "MixinPlayer", - "MixinPlayerAdvancements", - "MixinPlayerList", - "MixinResultSlot", - "MixinServerGamePacketListenerImpl", - "MixinServerLevel", - "MixinServerPlayer", - "MixinServerPlayerGameMode", - "PlayerAttackInvoker" - ], - "injectors": { - "maxShiftBy": 5, - "defaultRequire": 1 - } + "required": true, + "package": "dev.architectury.mixin.fabric", + "plugin": "dev.architectury.plugin.fabric.ArchitecturyMixinPlugin", + "compatibilityLevel": "JAVA_8", + "minVersion": "0.7.11", + "client": [ + "client.MixinClientLevel", + "client.MixinClientPacketListener", + "client.MixinDebugScreenOverlay", + "client.MixinEffectInstance", + "client.MixinGameRenderer", + "client.MixinIntegratedServer", + "client.MixinKeyboardHandler", + "client.MixinMinecraft", + "client.MixinMouseHandler", + "client.MixinMultiPlayerGameMode", + "client.MixinScreen", + "client.MixinTextureAtlas" + ], + "mixins": [ + "ExplosionPreInvoker", + "LivingDeathInvoker", + "MixinBaseSpawner", + "MixinBlockEntityExtension", + "MixinBlockItem", + "MixinBucketItem", + "MixinCatSpawner", + "MixinChunkMap", + "MixinChunkSerializer", + "MixinCommands", + "MixinDedicatedServer", + "MixinEntity", + "MixinExplosion", + "MixinFarmBlock", + "MixinFurnaceResultSlot", + "MixinInventory", + "MixinItemEntity", + "MixinLivingEntity", + "MixinNaturalSpawner", + "MixinPatrolSpawner", + "MixinPersistentEntitySectionManager", + "MixinPhantomSpawner", + "MixinPlayer", + "MixinPlayerAdvancements", + "MixinPlayerList", + "MixinResultSlot", + "MixinServerGamePacketListenerImpl", + "MixinServerLevel", + "MixinServerPlayer", + "MixinServerPlayerGameMode", + "PlayerAttackInvoker" + ], + "injectors": { + "maxShiftBy": 5, + "defaultRequire": 1 + } } diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 7970a749..f4465ae8 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -20,13 +20,13 @@ ], "entrypoints": { "main": [ - "me.shedaniel.architectury.utils.fabric.GameInstanceImpl::init" + "dev.architectury.utils.fabric.GameInstanceImpl::init" ], "client": [ - "me.shedaniel.architectury.init.fabric.ArchitecturyClient::init" + "dev.architectury.init.fabric.ArchitecturyClient::init" ], "modmenu": [ - "me.shedaniel.architectury.compat.fabric.ModMenuCompatibility" + "dev.architectury.compat.fabric.ModMenuCompatibility" ] }, "accessWidener": "architectury.accessWidener", diff --git a/forge/src/main/java/me/shedaniel/architectury/event/forge/EventHandlerImplClient.java b/forge/src/main/java/me/shedaniel/architectury/event/forge/EventHandlerImplClient.java index 0db7df7e..41ad3e7f 100644 --- a/forge/src/main/java/me/shedaniel/architectury/event/forge/EventHandlerImplClient.java +++ b/forge/src/main/java/me/shedaniel/architectury/event/forge/EventHandlerImplClient.java @@ -20,9 +20,7 @@ package me.shedaniel.architectury.event.forge; import me.shedaniel.architectury.event.events.TextureStitchEvent; -import me.shedaniel.architectury.event.events.*; import me.shedaniel.architectury.event.events.client.ClientChatEvent; -import me.shedaniel.architectury.event.events.client.*; import me.shedaniel.architectury.hooks.ScreenHooks; import me.shedaniel.architectury.impl.TooltipEventColorContextImpl; import me.shedaniel.architectury.impl.TooltipEventPositionContextImpl; diff --git a/forge/src/main/java/me/shedaniel/architectury/event/forge/EventHandlerImplCommon.java b/forge/src/main/java/me/shedaniel/architectury/event/forge/EventHandlerImplCommon.java index 057476b6..fa509995 100644 --- a/forge/src/main/java/me/shedaniel/architectury/event/forge/EventHandlerImplCommon.java +++ b/forge/src/main/java/me/shedaniel/architectury/event/forge/EventHandlerImplCommon.java @@ -22,7 +22,6 @@ package me.shedaniel.architectury.event.forge; import me.shedaniel.architectury.event.CompoundEventResult; import me.shedaniel.architectury.event.EventResult; import me.shedaniel.architectury.event.events.PlayerEvent; -import me.shedaniel.architectury.event.events.*; import me.shedaniel.architectury.utils.IntValue; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerLevel; @@ -31,6 +30,7 @@ import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; import net.minecraftforge.event.CommandEvent; import net.minecraftforge.event.RegisterCommandsEvent; import net.minecraftforge.event.ServerChatEvent; @@ -49,6 +49,7 @@ import net.minecraftforge.event.entity.player.PlayerEvent.*; import net.minecraftforge.event.world.BlockEvent.BreakEvent; import net.minecraftforge.event.world.BlockEvent.EntityPlaceEvent; import net.minecraftforge.event.world.BlockEvent.FarmlandTrampleEvent; +import net.minecraftforge.event.world.ChunkDataEvent; import net.minecraftforge.event.world.ExplosionEvent.Detonate; import net.minecraftforge.event.world.ExplosionEvent.Start; import net.minecraftforge.event.world.WorldEvent; @@ -371,6 +372,28 @@ public class EventHandlerImplCommon { } } + @SubscribeEvent(priority = EventPriority.HIGH) + public static void event(ChunkDataEvent.Save event) { + if (event.getWorld() instanceof ServerLevel) { + ChunkEvent.SAVE_DATA.invoker().save(event.getChunk(), (ServerLevel) event.getWorld(), event.getData()); + } + } + + @SubscribeEvent(priority = EventPriority.HIGH) + public static void event(ChunkDataEvent.Load event) { + LevelAccessor level = event.getChunk().getWorldForge(); + if (!(level instanceof ServerLevel)) { + level = ((WorldEventAttachment) event).architectury$getAttachedLevel(); + } + ChunkEvent.LOAD_DATA.invoker().load(event.getChunk(), level instanceof ServerLevel ? (ServerLevel) level : null, event.getData()); + } + + public interface WorldEventAttachment { + LevelAccessor architectury$getAttachedLevel(); + + void architectury$attachLevel(LevelAccessor level); + } + public static class ModBasedEventHandler { } diff --git a/forge/src/main/java/me/shedaniel/architectury/mixin/forge/MixinChunkSerializer.java b/forge/src/main/java/me/shedaniel/architectury/mixin/forge/MixinChunkSerializer.java new file mode 100644 index 00000000..48799adb --- /dev/null +++ b/forge/src/main/java/me/shedaniel/architectury/mixin/forge/MixinChunkSerializer.java @@ -0,0 +1,65 @@ +/* + * This file is part of architectury. + * Copyright (C) 2020, 2021 architectury + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package me.shedaniel.architectury.mixin.forge; + +import me.shedaniel.architectury.event.forge.EventHandlerImplCommon; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.ai.village.poi.PoiManager; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.chunk.ProtoChunk; +import net.minecraft.world.level.chunk.storage.ChunkSerializer; +import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager; +import net.minecraftforge.event.world.ChunkDataEvent; +import net.minecraftforge.eventbus.api.Event; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.ModifyArg; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import java.lang.ref.WeakReference; + +@Mixin(ChunkSerializer.class) +public class MixinChunkSerializer { + @Unique + private static ThreadLocal> level = new ThreadLocal<>(); + + @Inject(method = "read", at = @At("HEAD")) + private static void read(ServerLevel worldIn, StructureManager templateManagerIn, PoiManager poiManager, ChunkPos pos, CompoundTag compound, CallbackInfoReturnable cir) { + level.set(new WeakReference<>(worldIn)); + } + + @ModifyArg(method = "read", at = @At(value = "INVOKE", + ordinal = 1, + target = "Lnet/minecraftforge/eventbus/api/IEventBus;post(Lnet/minecraftforge/eventbus/api/Event;)Z"), + index = 0) + private static Event modifyProtoChunkLevel(Event event) { + // We should get this PRed to Forge + WeakReference levelRef = level.get(); + if (levelRef != null && event instanceof ChunkDataEvent.Load) { + ChunkDataEvent.Load load = (ChunkDataEvent.Load) event; + ((EventHandlerImplCommon.WorldEventAttachment) load).architectury$attachLevel(levelRef.get()); + } + level.set(null); + return event; + } +} diff --git a/forge/src/main/java/me/shedaniel/architectury/mixin/forge/MixinClientLevel.java b/forge/src/main/java/me/shedaniel/architectury/mixin/forge/MixinClientLevel.java new file mode 100644 index 00000000..84ed32ea --- /dev/null +++ b/forge/src/main/java/me/shedaniel/architectury/mixin/forge/MixinClientLevel.java @@ -0,0 +1,57 @@ +/* + * This file is part of architectury. + * Copyright (C) 2020, 2021 architectury + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package me.shedaniel.architectury.mixin.forge; + +import me.shedaniel.architectury.event.events.client.ClientTickEvent; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.resources.ResourceKey; +import net.minecraft.util.profiling.ProfilerFiller; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.dimension.DimensionType; +import net.minecraft.world.level.storage.WritableLevelData; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import java.util.function.Supplier; + +@Mixin(ClientLevel.class) +public abstract class MixinClientLevel extends Level { + protected MixinClientLevel(WritableLevelData worldInfo, ResourceKey dimension, DimensionType dimensionType, Supplier profiler, boolean isRemote, boolean isDebug, long seed) { + super(worldInfo, dimension, dimensionType, profiler, isRemote, isDebug, seed); + } + + @Inject(method = "tickEntities", at = @At("HEAD")) + private void tickEntities(CallbackInfo ci) { + ProfilerFiller profiler = getProfiler(); + profiler.push("architecturyClientLevelPreTick"); + ClientTickEvent.CLIENT_WORLD_PRE.invoker().tick((ClientLevel) (Object) this); + profiler.pop(); + } + + @Inject(method = "tickEntities", at = @At("RETURN")) + private void tickEntitiesPost(CallbackInfo ci) { + ProfilerFiller profiler = getProfiler(); + profiler.push("architecturyClientLevelPostTick"); + ClientTickEvent.CLIENT_WORLD_POST.invoker().tick((ClientLevel) (Object) this); + profiler.pop(); + } +} diff --git a/common/src/main/java/me/shedaniel/architectury/event/events/ExplosionEvent.java b/forge/src/main/java/me/shedaniel/architectury/mixin/forge/MixinWorldEvent.java similarity index 53% rename from common/src/main/java/me/shedaniel/architectury/event/events/ExplosionEvent.java rename to forge/src/main/java/me/shedaniel/architectury/mixin/forge/MixinWorldEvent.java index 9c5b8b23..d6cddfcf 100644 --- a/common/src/main/java/me/shedaniel/architectury/event/events/ExplosionEvent.java +++ b/forge/src/main/java/me/shedaniel/architectury/mixin/forge/MixinWorldEvent.java @@ -17,26 +17,28 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package me.shedaniel.architectury.event.events; +package me.shedaniel.architectury.mixin.forge; -import me.shedaniel.architectury.event.Event; -import me.shedaniel.architectury.event.EventFactory; -import net.minecraft.world.InteractionResult; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.level.Explosion; -import net.minecraft.world.level.Level; +import me.shedaniel.architectury.event.forge.EventHandlerImplCommon; +import net.minecraft.world.level.LevelAccessor; +import net.minecraftforge.event.world.WorldEvent; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; -import java.util.List; +import java.lang.ref.WeakReference; -public interface ExplosionEvent { - Event

 PRE = EventFactory.createInteractionResult();
-    Event DETONATE = EventFactory.createLoop();
+@Mixin(WorldEvent.class)
+public class MixinWorldEvent implements EventHandlerImplCommon.WorldEventAttachment {
+    @Unique
+    private WeakReference level;
     
-    interface Pre {
-        InteractionResult explode(Level world, Explosion explosion);
+    @Override
+    public LevelAccessor architectury$getAttachedLevel() {
+        return level == null ? null : level.get();
     }
     
-    interface Detonate {
-        void explode(Level world, Explosion explosion, List affectedEntities);
+    @Override
+    public void architectury$attachLevel(LevelAccessor level) {
+        this.level = new WeakReference<>(level);
     }
 }
diff --git a/forge/src/main/java/me/shedaniel/architectury/networking/forge/NetworkManagerImpl.java b/forge/src/main/java/me/shedaniel/architectury/networking/forge/NetworkManagerImpl.java
index b7975911..ef6ab95e 100644
--- a/forge/src/main/java/me/shedaniel/architectury/networking/forge/NetworkManagerImpl.java
+++ b/forge/src/main/java/me/shedaniel/architectury/networking/forge/NetworkManagerImpl.java
@@ -30,6 +30,7 @@ import net.minecraft.network.FriendlyByteBuf;
 import net.minecraft.network.protocol.Packet;
 import net.minecraft.resources.ResourceLocation;
 import net.minecraft.server.level.ServerPlayer;
+import net.minecraft.world.entity.Entity;
 import net.minecraft.world.entity.player.Player;
 import net.minecraftforge.api.distmarker.Dist;
 import net.minecraftforge.api.distmarker.OnlyIn;
@@ -40,6 +41,7 @@ import net.minecraftforge.fml.LogicalSide;
 import net.minecraftforge.fml.common.Mod;
 import net.minecraftforge.fml.network.NetworkDirection;
 import net.minecraftforge.fml.network.NetworkEvent;
+import net.minecraftforge.fml.network.NetworkHooks;
 import net.minecraftforge.fml.network.NetworkRegistry;
 import net.minecraftforge.fml.network.event.EventNetworkChannel;
 import org.apache.commons.lang3.tuple.Pair;
@@ -148,6 +150,10 @@ public class NetworkManagerImpl {
         return clientReceivables.get(player).contains(id);
     }
     
+    public static Packet createAddEntityPacket(Entity entity){
+        return NetworkHooks.getEntitySpawningPacket(entity);
+    }
+    
     static FriendlyByteBuf sendSyncPacket(Map map) {
         List availableIds = Lists.newArrayList(map.keySet());
         FriendlyByteBuf packetBuffer = new FriendlyByteBuf(Unpooled.buffer());
diff --git a/forge/src/main/java/me/shedaniel/architectury/registry/forge/BiomeModificationsImpl.java b/forge/src/main/java/me/shedaniel/architectury/registry/forge/BiomeModificationsImpl.java
index 83b09db6..9a6b501f 100644
--- a/forge/src/main/java/me/shedaniel/architectury/registry/forge/BiomeModificationsImpl.java
+++ b/forge/src/main/java/me/shedaniel/architectury/registry/forge/BiomeModificationsImpl.java
@@ -21,7 +21,6 @@ package me.shedaniel.architectury.registry.forge;
 
 import com.google.common.collect.Lists;
 import me.shedaniel.architectury.forge.ArchitecturyForge;
-import me.shedaniel.architectury.hooks.biome.*;
 import me.shedaniel.architectury.mixin.forge.BiomeGenerationSettingsBuilderAccessor;
 import me.shedaniel.architectury.mixin.forge.MobSpawnSettingsBuilderAccessor;
 import me.shedaniel.architectury.registry.BiomeModifications.BiomeContext;
diff --git a/forge/src/main/resources/architectury.mixins.json b/forge/src/main/resources/architectury.mixins.json
index c8711807..03998a95 100644
--- a/forge/src/main/resources/architectury.mixins.json
+++ b/forge/src/main/resources/architectury.mixins.json
@@ -15,8 +15,11 @@
     "GameRulesAccessor$IntegerValueSimple",
     "MixinBlockEntity",
     "MixinBlockEntityExtension",
+    "MixinChunkSerializer",
+    "MixinClientLevel",
     "MixinItemExtension",
     "MixinRegistryEntry",
+    "MixinWorldEvent",
     "MobSpawnSettingsBuilderAccessor"
   ],
   "injectors": {
diff --git a/gradle.properties b/gradle.properties
index 28acd776..0129ba03 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,8 +1,8 @@
 org.gradle.jvmargs=-Xmx3G
 org.gradle.daemon=false
 
-minecraft_version=21w20a
-supported_version=21w20a
+minecraft_version=1.17-pre1
+supported_version=1.17-pre1
 
 cf_type=beta
 
@@ -12,7 +12,7 @@ base_version=2.0
 maven_group=me.shedaniel
 
 fabric_loader_version=0.11.3
-fabric_api_version=0.34.5+1.17
-mod_menu_version=2.0.0-beta.4
+fabric_api_version=0.34.8+1.17
+mod_menu_version=2.0.0-beta.5
 
 #forge_version=36.0.42
diff --git a/testmod-common/src/main/java/me/shedaniel/architectury/test/TestMod.java b/testmod-common/src/main/java/dev/architectury/test/TestMod.java
similarity index 51%
rename from testmod-common/src/main/java/me/shedaniel/architectury/test/TestMod.java
rename to testmod-common/src/main/java/dev/architectury/test/TestMod.java
index 1193c342..302c32ac 100644
--- a/testmod-common/src/main/java/me/shedaniel/architectury/test/TestMod.java
+++ b/testmod-common/src/main/java/dev/architectury/test/TestMod.java
@@ -17,20 +17,24 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.test;
+package dev.architectury.test;
 
-import me.shedaniel.architectury.platform.Platform;
-import me.shedaniel.architectury.test.debug.ConsoleMessageSink;
-import me.shedaniel.architectury.test.debug.MessageSink;
-import me.shedaniel.architectury.test.debug.client.ClientOverlayMessageSink;
-import me.shedaniel.architectury.test.events.DebugEvents;
-import me.shedaniel.architectury.test.gamerule.TestGameRules;
-import me.shedaniel.architectury.test.registry.TestRegistries;
-import me.shedaniel.architectury.test.registry.client.TestKeybinds;
-import me.shedaniel.architectury.test.tags.TestTags;
-import me.shedaniel.architectury.test.trade.TestTrades;
-import me.shedaniel.architectury.utils.Env;
-import me.shedaniel.architectury.utils.EnvExecutor;
+import dev.architectury.platform.Platform;
+import dev.architectury.registry.level.entity.EntityRendererRegistry;
+import dev.architectury.test.debug.ConsoleMessageSink;
+import dev.architectury.test.debug.MessageSink;
+import dev.architectury.test.debug.client.ClientOverlayMessageSink;
+import dev.architectury.test.entity.TestEntity;
+import dev.architectury.test.events.DebugEvents;
+import dev.architectury.test.gamerule.TestGameRules;
+import dev.architectury.test.registry.TestRegistries;
+import dev.architectury.test.registry.client.TestKeybinds;
+import dev.architectury.test.tags.TestTags;
+import dev.architectury.test.trade.TestTrades;
+import dev.architectury.utils.Env;
+import dev.architectury.utils.EnvExecutor;
+import net.minecraft.client.model.geom.ModelLayers;
+import net.minecraft.client.renderer.entity.MinecartRenderer;
 
 public class TestMod {
     public static final MessageSink SINK = EnvExecutor.getEnvSpecific(() -> ClientOverlayMessageSink::new, () -> ConsoleMessageSink::new);
@@ -42,7 +46,14 @@ public class TestMod {
         TestGameRules.init();
         TestTags.initialize();
         TestTrades.init();
-        if (Platform.getEnvironment() == Env.CLIENT)
-            TestKeybinds.initialize();
+        if (Platform.getEnvironment() == Env.CLIENT) {
+            initializeClient();
+        }
+    }
+    
+    public static void initializeClient() {
+        TestKeybinds.initialize();
+        EntityRendererRegistry.register(TestEntity.TYPE, context ->
+                new MinecartRenderer<>(context, ModelLayers.MINECART));
     }
 }
diff --git a/testmod-common/src/main/java/me/shedaniel/architectury/test/debug/ConsoleMessageSink.java b/testmod-common/src/main/java/dev/architectury/test/debug/ConsoleMessageSink.java
similarity index 96%
rename from testmod-common/src/main/java/me/shedaniel/architectury/test/debug/ConsoleMessageSink.java
rename to testmod-common/src/main/java/dev/architectury/test/debug/ConsoleMessageSink.java
index 8eb2af8c..47eaf708 100644
--- a/testmod-common/src/main/java/me/shedaniel/architectury/test/debug/ConsoleMessageSink.java
+++ b/testmod-common/src/main/java/dev/architectury/test/debug/ConsoleMessageSink.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.test.debug;
+package dev.architectury.test.debug;
 
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
diff --git a/testmod-common/src/main/java/me/shedaniel/architectury/test/debug/MessageSink.java b/testmod-common/src/main/java/dev/architectury/test/debug/MessageSink.java
similarity index 95%
rename from testmod-common/src/main/java/me/shedaniel/architectury/test/debug/MessageSink.java
rename to testmod-common/src/main/java/dev/architectury/test/debug/MessageSink.java
index d8fc0876..06c1af90 100644
--- a/testmod-common/src/main/java/me/shedaniel/architectury/test/debug/MessageSink.java
+++ b/testmod-common/src/main/java/dev/architectury/test/debug/MessageSink.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.test.debug;
+package dev.architectury.test.debug;
 
 public interface MessageSink {
     void accept(String message);
diff --git a/testmod-common/src/main/java/me/shedaniel/architectury/test/debug/client/ClientOverlayMessageSink.java b/testmod-common/src/main/java/dev/architectury/test/debug/client/ClientOverlayMessageSink.java
similarity index 72%
rename from testmod-common/src/main/java/me/shedaniel/architectury/test/debug/client/ClientOverlayMessageSink.java
rename to testmod-common/src/main/java/dev/architectury/test/debug/client/ClientOverlayMessageSink.java
index a10f3ea8..2d77bfe9 100644
--- a/testmod-common/src/main/java/me/shedaniel/architectury/test/debug/client/ClientOverlayMessageSink.java
+++ b/testmod-common/src/main/java/dev/architectury/test/debug/client/ClientOverlayMessageSink.java
@@ -17,13 +17,13 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.test.debug.client;
+package dev.architectury.test.debug.client;
 
 import com.google.common.collect.Lists;
 import com.mojang.blaze3d.systems.RenderSystem;
 import com.mojang.blaze3d.vertex.PoseStack;
-import me.shedaniel.architectury.event.events.GuiEvent;
-import me.shedaniel.architectury.test.debug.ConsoleMessageSink;
+import dev.architectury.event.events.client.ClientGuiEvent;
+import dev.architectury.test.debug.ConsoleMessageSink;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
 import net.minecraft.Util;
@@ -42,8 +42,8 @@ public class ClientOverlayMessageSink extends ConsoleMessageSink {
     private final List messages = Collections.synchronizedList(Lists.newArrayList());
     
     public ClientOverlayMessageSink() {
-        GuiEvent.RENDER_POST.register((screen, matrices, mouseX, mouseY, delta) -> render(matrices, delta));
-        GuiEvent.RENDER_HUD.register((matrices, tickDelta) -> {
+        ClientGuiEvent.RENDER_POST.register((screen, matrices, mouseX, mouseY, delta) -> render(matrices, delta));
+        ClientGuiEvent.RENDER_HUD.register((matrices, tickDelta) -> {
             if (Minecraft.getInstance().screen == null && !Minecraft.getInstance().options.renderDebug) {
                 render(matrices, tickDelta);
             }
@@ -59,26 +59,26 @@ public class ClientOverlayMessageSink extends ConsoleMessageSink {
     public void render(PoseStack matrices, float delta) {
         matrices.pushPose();
         matrices.scale(0.5f, 0.5f, 1f);
-        Minecraft minecraft = Minecraft.getInstance();
-        long currentMills = Util.getMillis();
-        int lineHeight = minecraft.font.lineHeight;
+        var minecraft = Minecraft.getInstance();
+        var currentMills = Util.getMillis();
+        var lineHeight = minecraft.font.lineHeight;
         
         synchronized (messages) {
-            Iterator messageIterator = messages.iterator();
-            int y = 1;
+            var messageIterator = messages.iterator();
+            var y = 1;
             
             RenderSystem.enableBlend();
             
             while (messageIterator.hasNext()) {
-                Message message = messageIterator.next();
-                int timeExisted = (int) (currentMills - message.created);
+                var message = messageIterator.next();
+                var timeExisted = (int) (currentMills - message.created);
                 
                 if (timeExisted >= 5000) {
                     messageIterator.remove();
                 } else {
                     if (y - 1 < minecraft.getWindow().getGuiScaledHeight()) {
-                        int textWidth = minecraft.font.width(message.text);
-                        int alpha = (int) Mth.clamp((5000 - timeExisted) / 5000f * 400f + 8, 0, 255);
+                        var textWidth = minecraft.font.width(message.text);
+                        var alpha = (int) Mth.clamp((5000 - timeExisted) / 5000f * 400f + 8, 0, 255);
                         GuiComponent.fill(matrices, 0, y - 1, 2 + textWidth + 1, y + lineHeight - 1, 0x505050 + ((alpha * 144 / 255) << 24));
                         minecraft.font.draw(matrices, message.text, 1, y, 0xE0E0E0 + (alpha << 24));
                     }
@@ -91,13 +91,6 @@ public class ClientOverlayMessageSink extends ConsoleMessageSink {
         matrices.popPose();
     }
     
-    private static class Message {
-        private final Component text;
-        private final long created;
-        
-        public Message(Component text, long created) {
-            this.text = text;
-            this.created = created;
-        }
+    private record Message(Component text, long created) {
     }
 }
diff --git a/testmod-common/src/main/java/dev/architectury/test/entity/TestEntity.java b/testmod-common/src/main/java/dev/architectury/test/entity/TestEntity.java
new file mode 100644
index 00000000..4c708bf5
--- /dev/null
+++ b/testmod-common/src/main/java/dev/architectury/test/entity/TestEntity.java
@@ -0,0 +1,45 @@
+/*
+ * This file is part of architectury.
+ * Copyright (C) 2020, 2021 architectury
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+package dev.architectury.test.entity;
+
+import dev.architectury.networking.NetworkManager;
+import net.minecraft.network.protocol.Packet;
+import net.minecraft.world.entity.EntityType;
+import net.minecraft.world.entity.MobCategory;
+import net.minecraft.world.entity.vehicle.AbstractMinecart;
+import net.minecraft.world.level.Level;
+
+public class TestEntity extends AbstractMinecart {
+    public static final EntityType TYPE = EntityType.Builder.of(TestEntity::new, MobCategory.MISC).sized(0.98F, 0.7F).clientTrackingRange(8).build("test_entity");
+    
+    public TestEntity(EntityType entityType, Level level) {
+        super(entityType, level);
+    }
+    
+    @Override
+    public Type getMinecartType() {
+        return Type.RIDEABLE;
+    }
+    
+    @Override
+    public Packet getAddEntityPacket() {
+        return NetworkManager.createAddEntityPacket(this);
+    }
+}
diff --git a/testmod-common/src/main/java/dev/architectury/test/events/DebugEvents.java b/testmod-common/src/main/java/dev/architectury/test/events/DebugEvents.java
new file mode 100644
index 00000000..4c4405ab
--- /dev/null
+++ b/testmod-common/src/main/java/dev/architectury/test/events/DebugEvents.java
@@ -0,0 +1,347 @@
+/*
+ * This file is part of architectury.
+ * Copyright (C) 2020, 2021 architectury
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+package dev.architectury.test.events;
+
+import com.mojang.blaze3d.platform.InputConstants;
+import dev.architectury.event.CompoundEventResult;
+import dev.architectury.event.EventResult;
+import dev.architectury.event.events.client.*;
+import dev.architectury.event.events.common.*;
+import dev.architectury.hooks.level.ExplosionHooks;
+import dev.architectury.platform.Platform;
+import dev.architectury.test.TestMod;
+import dev.architectury.utils.Env;
+import net.fabricmc.api.EnvType;
+import net.fabricmc.api.Environment;
+import net.minecraft.client.gui.screens.inventory.AnvilScreen;
+import net.minecraft.core.Position;
+import net.minecraft.core.Vec3i;
+import net.minecraft.network.chat.TextComponent;
+import net.minecraft.network.chat.TranslatableComponent;
+import net.minecraft.world.InteractionHand;
+import net.minecraft.world.entity.Entity;
+import net.minecraft.world.entity.EquipmentSlot;
+import net.minecraft.world.entity.player.Player;
+import net.minecraft.world.item.Items;
+import net.minecraft.world.level.Level;
+import net.minecraft.world.phys.Vec3;
+
+import java.util.Optional;
+
+public class DebugEvents {
+    public static void initialize() {
+        debugEvents();
+        if (Platform.getEnvironment() == Env.CLIENT)
+            debugEventsClient();
+    }
+    
+    public static void debugEvents() {
+        BlockEvent.BREAK.register((world, pos, state, player, xp) -> {
+            TestMod.SINK.accept(player.getScoreboardName() + " breaks " + toShortString(pos) + logSide(player.level));
+            return EventResult.pass();
+        });
+        BlockEvent.PLACE.register((world, pos, state, placer) -> {
+            TestMod.SINK.accept(Optional.ofNullable(placer).map(Entity::getScoreboardName).orElse("null") + " places block at " + toShortString(pos) + logSide(world));
+            return EventResult.pass();
+        });
+        ChatEvent.SERVER.register((player, message, component) -> {
+            TestMod.SINK.accept("Server chat received: " + message.getRaw());
+            return EventResult.pass();
+        });
+        CommandPerformEvent.EVENT.register(event -> {
+            TestMod.SINK.accept("Server command performed: " + event.getResults().getReader().getString());
+            return EventResult.pass();
+        });
+        CommandRegistrationEvent.EVENT.register((dispatcher, selection) -> {
+            TestMod.SINK.accept("Server commands registers");
+        });
+        EntityEvent.LIVING_DEATH.register((entity, source) -> {
+            if (entity instanceof Player) {
+                TestMod.SINK.accept(entity.getScoreboardName() + " died to " + source.getMsgId() + logSide(entity.level));
+            }
+            return EventResult.pass();
+        });
+        EntityEvent.LIVING_HURT.register((entity, source, amount) -> {
+            if (source.getDirectEntity() instanceof Player) {
+                TestMod.SINK.accept(source.getDirectEntity().getScoreboardName() + " deals %.2f damage" + logSide(entity.level), amount);
+            }
+            return EventResult.pass();
+        });
+        EntityEvent.ADD.register((entity, level) -> {
+            if (entity instanceof Player) {
+                TestMod.SINK.accept(entity.getScoreboardName() + " was added to " + level.dimension().location().toString() + logSide(level));
+            }
+            return EventResult.pass();
+        });
+        EntityEvent.ENTER_SECTION.register(((entity, nx, ny, nz, ox, oy, oz) -> {
+            if (entity instanceof Player player) {
+                TestMod.SINK.accept("%s switched section: %s => %s", entity.getScoreboardName(), sectionPos(ox, oy, oz), sectionPos(nx, oy, nz));
+                player.displayClientMessage(new TextComponent("Entering chunk: " + sectionPos(nx, ny, nz)), true);
+            }
+        }));
+        EntityEvent.LIVING_CHECK_SPAWN.register(((entity, level, x, y, z, type, spawner) -> {
+            var sb = new StringBuilder();
+            sb.append(entity.getType());
+            sb.append(" is trying to spawn");
+            sb.append(" at ");
+            sb.append(toShortString(new Vec3(x, y, z)));
+            if (level instanceof Level) {
+                sb.append(" in world ");
+                sb.append(((Level) level).dimension().location());
+            }
+            sb.append(" from cause ");
+            sb.append(type.name());
+            if (spawner != null) {
+                sb.append(" (");
+                sb.append(spawner);
+                sb.append(") ");
+            }
+            
+            TestMod.SINK.accept(sb.toString());
+            return EventResult.pass();
+        }));
+        ExplosionEvent.DETONATE.register((world, explosion, affectedEntities) -> {
+            TestMod.SINK.accept(world.dimension().location() + " explodes at " + toShortString(ExplosionHooks.getPosition(explosion)) + logSide(world));
+        });
+        InteractionEvent.LEFT_CLICK_BLOCK.register((player, hand, pos, face) -> {
+            TestMod.SINK.accept(player.getScoreboardName() + " left clicks " + toShortString(pos) + logSide(player.level));
+            return EventResult.pass();
+        });
+        InteractionEvent.RIGHT_CLICK_BLOCK.register((player, hand, pos, face) -> {
+            TestMod.SINK.accept(player.getScoreboardName() + " right clicks " + toShortString(pos) + logSide(player.level));
+            return EventResult.pass();
+        });
+        InteractionEvent.RIGHT_CLICK_ITEM.register((player, hand) -> {
+            TestMod.SINK.accept(player.getScoreboardName() + " uses " + (hand == InteractionHand.MAIN_HAND ? "main hand" : "off hand") + logSide(player.level));
+            return CompoundEventResult.pass();
+        });
+        InteractionEvent.INTERACT_ENTITY.register((player, entity, hand) -> {
+            TestMod.SINK.accept(player.getScoreboardName() + " interacts with " + entity.getScoreboardName() + " using " + (hand == InteractionHand.MAIN_HAND ? "main hand" : "off hand") + logSide(player.level));
+            return EventResult.pass();
+        });
+        InteractionEvent.FARMLAND_TRAMPLE.register((level, pos, state, distance, entity) -> {
+            if (entity instanceof Player && ((Player) entity).getItemBySlot(EquipmentSlot.FEET).getItem() == Items.DIAMOND_BOOTS) {
+                return EventResult.interrupt(false);
+            }
+            TestMod.SINK.accept("%s trampled farmland (%s) at %s in %s (Fall height: %f blocks)", entity, state, pos, level, distance);
+            return EventResult.pass();
+        });
+        LifecycleEvent.SERVER_BEFORE_START.register(instance -> {
+            TestMod.SINK.accept("Server ready to start");
+        });
+        LifecycleEvent.SERVER_STARTING.register(instance -> {
+            TestMod.SINK.accept("Server starting");
+        });
+        LifecycleEvent.SERVER_STARTED.register(instance -> {
+            TestMod.SINK.accept("Server started");
+        });
+        LifecycleEvent.SERVER_STOPPING.register(instance -> {
+            TestMod.SINK.accept("Server stopping");
+        });
+        LifecycleEvent.SERVER_STOPPED.register(instance -> {
+            TestMod.SINK.accept("Server stopped");
+        });
+        LifecycleEvent.SERVER_LEVEL_LOAD.register(instance -> {
+            TestMod.SINK.accept("Server world loaded: " + instance.dimension().location());
+        });
+        LifecycleEvent.SERVER_LEVEL_UNLOAD.register(instance -> {
+            TestMod.SINK.accept("Server world unloaded: " + instance.dimension().location());
+        });
+        LifecycleEvent.SERVER_LEVEL_SAVE.register(instance -> {
+            TestMod.SINK.accept("Server world saved: " + instance.dimension().location());
+        });
+        PlayerEvent.PLAYER_JOIN.register(player -> {
+            TestMod.SINK.accept(player.getScoreboardName() + " joined" + logSide(player.level));
+        });
+        PlayerEvent.PLAYER_QUIT.register(player -> {
+            TestMod.SINK.accept(player.getScoreboardName() + " quit" + logSide(player.level));
+        });
+        PlayerEvent.PLAYER_RESPAWN.register((player, conqueredEnd) -> {
+            if (!conqueredEnd) {
+                TestMod.SINK.accept(player.getScoreboardName() + " respawns " + logSide(player.level));
+            }
+        });
+        PlayerEvent.PLAYER_CLONE.register((oldPlayer, newPlayer, wonGame) -> {
+            TestMod.SINK.accept("Player cloned: " + newPlayer.getScoreboardName() + logSide(newPlayer.level));
+        });
+        PlayerEvent.PLAYER_ADVANCEMENT.register((player, advancement) -> {
+            TestMod.SINK.accept(player.getScoreboardName() + " was awarded with %s" + logSide(player.level), advancement.getChatComponent().getString());
+        });
+        PlayerEvent.CRAFT_ITEM.register((player, constructed, inventory) -> {
+            TestMod.SINK.accept(player.getScoreboardName() + " crafts " + new TranslatableComponent(constructed.getDescriptionId()).getString() + logSide(player.level));
+        });
+        PlayerEvent.SMELT_ITEM.register((player, smelted) -> {
+            TestMod.SINK.accept(player.getScoreboardName() + " smelts " + new TranslatableComponent(smelted.getDescriptionId()).getString() + logSide(player.level));
+        });
+        PlayerEvent.PICKUP_ITEM_POST.register((player, entity, stack) -> {
+            TestMod.SINK.accept(player.getScoreboardName() + " picks up " + new TranslatableComponent(stack.getDescriptionId()).getString() + logSide(player.level));
+        });
+        PlayerEvent.DROP_ITEM.register((player, entity) -> {
+            TestMod.SINK.accept(player.getScoreboardName() + " drops " + new TranslatableComponent(entity.getItem().getDescriptionId()).getString() + logSide(player.level));
+            return EventResult.pass();
+        });
+        PlayerEvent.OPEN_MENU.register((player, menu) -> {
+            TestMod.SINK.accept(player.getScoreboardName() + " opens " + toSimpleName(menu) + logSide(player.level));
+        });
+        PlayerEvent.CLOSE_MENU.register((player, menu) -> {
+            TestMod.SINK.accept(player.getScoreboardName() + " closes " + toSimpleName(menu) + logSide(player.level));
+        });
+        PlayerEvent.CHANGE_DIMENSION.register((player, oldLevel, newLevel) -> {
+            TestMod.SINK.accept(player.getScoreboardName() + " switched from " + oldLevel.location() + " to " + newLevel.location() + logSide(player.level));
+        });
+        PlayerEvent.FILL_BUCKET.register(((player, level, stack, target) -> {
+            TestMod.SINK.accept("%s used a bucket (%s) in %s%s while looking at %s", player.getScoreboardName(), stack, level.dimension().location(), logSide(level), target == null ? "nothing" : target.getLocation());
+            return CompoundEventResult.pass();
+        }));
+        LightningEvent.STRIKE.register((bolt, level, pos, toStrike) -> {
+            TestMod.SINK.accept(bolt.getScoreboardName() + " struck at " + toShortString(pos) + logSide(level));
+        });
+        ChunkEvent.LOAD_DATA.register((chunk, level, nbt) -> {
+            TestMod.SINK.accept("Chunk loaded at x=" + chunk.getPos().x + ", z=" + chunk.getPos().z + " in dimension '" + level.dimension().location() + "'");
+        });
+        ChunkEvent.SAVE_DATA.register((chunk, level, nbt) -> {
+            TestMod.SINK.accept("Chunk saved at x=" + chunk.getPos().x + ", z=" + chunk.getPos().z + " in dimension '" + level.dimension().location() + "'");
+        });
+    }
+    
+    public static String toShortString(Vec3i pos) {
+        return pos.getX() + ", " + pos.getY() + ", " + pos.getZ();
+    }
+    
+    public static String toShortString(Position pos) {
+        return pos.x() + ", " + pos.y() + ", " + pos.z();
+    }
+    
+    public static String logSide(Level level) {
+        if (level.isClientSide())
+            return " (client)";
+        return " (server)";
+    }
+    
+    @Environment(EnvType.CLIENT)
+    public static void debugEventsClient() {
+        ClientTickEvent.CLIENT_LEVEL_PRE.register(instance -> {
+            try {
+                // Uncomment the following line to see the profiler spike for root.tick.level.architecturyClientLevelPreTick
+                //Thread.sleep(10);
+            } catch (Throwable e) {
+                e.printStackTrace();
+            }
+        });
+        ClientChatEvent.PROCESS.register(message -> {
+            TestMod.SINK.accept("Client chat sent: " + message);
+            return CompoundEventResult.pass();
+        });
+        ClientChatEvent.RECEIVED.register((type, message, sender) -> {
+            TestMod.SINK.accept("Client chat received: " + message.getString());
+            return CompoundEventResult.pass();
+        });
+        ClientLifecycleEvent.CLIENT_LEVEL_LOAD.register(world -> {
+            TestMod.SINK.accept("Client world loaded: " + world.dimension().location().toString());
+        });
+        ClientPlayerEvent.CLIENT_PLAYER_JOIN.register(player -> {
+            TestMod.SINK.accept(player.getScoreboardName() + " joined (client)");
+        });
+        ClientPlayerEvent.CLIENT_PLAYER_QUIT.register(player -> {
+            if (player != null) {
+                TestMod.SINK.accept(player.getScoreboardName() + " quit (client)");
+            }
+        });
+        ClientPlayerEvent.CLIENT_PLAYER_RESPAWN.register((oldPlayer, newPlayer) -> {
+            TestMod.SINK.accept(newPlayer.getScoreboardName() + " respawned (client)");
+        });
+        ClientGuiEvent.INIT_PRE.register((screen, access) -> {
+            TestMod.SINK.accept(toSimpleName(screen) + " initializes");
+            return EventResult.pass();
+        });
+        InteractionEvent.CLIENT_LEFT_CLICK_AIR.register((player, hand) -> {
+            TestMod.SINK.accept(player.getScoreboardName() + " left clicks air" + logSide(player.level));
+        });
+        InteractionEvent.CLIENT_RIGHT_CLICK_AIR.register((player, hand) -> {
+            TestMod.SINK.accept(player.getScoreboardName() + " right clicks air" + logSide(player.level));
+        });
+        ClientRecipeUpdateEvent.EVENT.register(recipeManager -> {
+            TestMod.SINK.accept("Client recipes received");
+        });
+        ClientTextureStitchEvent.POST.register(atlas -> {
+            TestMod.SINK.accept("Client texture stitched: " + atlas.location());
+        });
+        ClientScreenInputEvent.MOUSE_SCROLLED_PRE.register((client, screen, mouseX, mouseY, amount) -> {
+            TestMod.SINK.accept("Screen Mouse scrolled: %.2f distance", amount);
+            return EventResult.pass();
+        });
+        ClientScreenInputEvent.MOUSE_CLICKED_PRE.register((client, screen, mouseX, mouseY, button) -> {
+            TestMod.SINK.accept("Screen Mouse clicked: " + button);
+            return EventResult.pass();
+        });
+        ClientScreenInputEvent.MOUSE_RELEASED_PRE.register((client, screen, mouseX, mouseY, button) -> {
+            TestMod.SINK.accept("Screen Mouse released: " + button);
+            return EventResult.pass();
+        });
+        ClientScreenInputEvent.MOUSE_DRAGGED_PRE.register((client, screen, mouseX1, mouseY1, button, mouseX2, mouseY2) -> {
+            TestMod.SINK.accept("Screen Mouse dragged: %d (%d,%d) by (%d,%d)", button, (int) mouseX1, (int) mouseY1, (int) mouseX2, (int) mouseY2);
+            return EventResult.pass();
+        });
+        ClientScreenInputEvent.CHAR_TYPED_PRE.register((client, screen, character, keyCode) -> {
+            TestMod.SINK.accept("Screen Char typed: " + character);
+            return EventResult.pass();
+        });
+        ClientScreenInputEvent.KEY_PRESSED_PRE.register((client, screen, keyCode, scanCode, modifiers) -> {
+            TestMod.SINK.accept("Screen Key pressed: " + InputConstants.getKey(keyCode, scanCode).getDisplayName().getString());
+            return EventResult.pass();
+        });
+        ClientScreenInputEvent.KEY_RELEASED_PRE.register((client, screen, keyCode, scanCode, modifiers) -> {
+            TestMod.SINK.accept("Screen Key released: " + InputConstants.getKey(keyCode, scanCode).getDisplayName().getString());
+            return EventResult.pass();
+        });
+        ClientRawInputEvent.MOUSE_SCROLLED.register((client, amount) -> {
+            TestMod.SINK.accept("Raw Mouse scrolled: %.2f distance", amount);
+            return EventResult.pass();
+        });
+        ClientRawInputEvent.MOUSE_CLICKED_PRE.register((client, button, action, mods) -> {
+            TestMod.SINK.accept("Raw Mouse clicked: " + button);
+            return EventResult.pass();
+        });
+        ClientRawInputEvent.KEY_PRESSED.register((client, keyCode, scanCode, action, modifiers) -> {
+            TestMod.SINK.accept("Raw Key pressed: " + InputConstants.getKey(keyCode, scanCode).getDisplayName().getString());
+            return EventResult.pass();
+        });
+        ClientGuiEvent.SET_SCREEN.register(screen -> {
+            if (screen instanceof AnvilScreen) {
+                return CompoundEventResult.interruptFalse(screen);
+            }
+            
+            TestMod.SINK.accept("Screen has been changed to " + toSimpleName(screen));
+            return CompoundEventResult.pass();
+        });
+    }
+    
+    private static String chunkPos(int x, int z) {
+        return "[" + x + ", " + z + "]";
+    }
+    
+    private static String sectionPos(int x, int y, int z) {
+        return "[" + x + ", " + y + ", " + z + "]";
+    }
+    
+    private static String toSimpleName(Object o) {
+        return o == null ? "null" : o.getClass().getSimpleName() + "@" + Integer.toHexString(o.hashCode());
+    }
+}
diff --git a/testmod-common/src/main/java/me/shedaniel/architectury/test/gamerule/TestGameRules.java b/testmod-common/src/main/java/dev/architectury/test/gamerule/TestGameRules.java
similarity index 91%
rename from testmod-common/src/main/java/me/shedaniel/architectury/test/gamerule/TestGameRules.java
rename to testmod-common/src/main/java/dev/architectury/test/gamerule/TestGameRules.java
index 64baaf7a..eaf7f60b 100644
--- a/testmod-common/src/main/java/me/shedaniel/architectury/test/gamerule/TestGameRules.java
+++ b/testmod-common/src/main/java/dev/architectury/test/gamerule/TestGameRules.java
@@ -17,14 +17,14 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.test.gamerule;
+package dev.architectury.test.gamerule;
 
-import me.shedaniel.architectury.registry.GameRuleFactory;
+import dev.architectury.registry.level.GameRuleFactory;
 import net.minecraft.world.level.GameRules;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 
-import static me.shedaniel.architectury.registry.GameRuleRegistry.register;
+import static dev.architectury.registry.level.GameRuleRegistry.register;
 
 public class TestGameRules {
     private static final Logger LOGGER = LogManager.getLogger();
diff --git a/testmod-common/src/main/java/me/shedaniel/architectury/test/registry/TestRegistries.java b/testmod-common/src/main/java/dev/architectury/test/registry/TestRegistries.java
similarity index 77%
rename from testmod-common/src/main/java/me/shedaniel/architectury/test/registry/TestRegistries.java
rename to testmod-common/src/main/java/dev/architectury/test/registry/TestRegistries.java
index ff485c8a..00702053 100644
--- a/testmod-common/src/main/java/me/shedaniel/architectury/test/registry/TestRegistries.java
+++ b/testmod-common/src/main/java/dev/architectury/test/registry/TestRegistries.java
@@ -17,17 +17,19 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.test.registry;
+package dev.architectury.test.registry;
 
-import me.shedaniel.architectury.hooks.EntityHooks;
-import me.shedaniel.architectury.registry.BlockProperties;
-import me.shedaniel.architectury.registry.DeferredRegister;
-import me.shedaniel.architectury.registry.RegistrySupplier;
-import me.shedaniel.architectury.test.TestMod;
-import me.shedaniel.architectury.test.registry.objects.EquippableTickingItem;
-import me.shedaniel.architectury.test.tab.TestCreativeTabs;
+import dev.architectury.hooks.level.entity.EntityHooks;
+import dev.architectury.registry.block.BlockProperties;
+import dev.architectury.registry.registries.DeferredRegister;
+import dev.architectury.registry.registries.RegistrySupplier;
+import dev.architectury.test.entity.TestEntity;
+import dev.architectury.test.registry.objects.EquippableTickingItem;
+import dev.architectury.test.tab.TestCreativeTabs;
+import dev.architectury.test.TestMod;
 import net.minecraft.core.BlockPos;
 import net.minecraft.core.Registry;
+import net.minecraft.world.entity.EntityType;
 import net.minecraft.world.item.BlockItem;
 import net.minecraft.world.item.Item;
 import net.minecraft.world.level.BlockGetter;
@@ -37,11 +39,12 @@ import net.minecraft.world.level.block.state.BlockState;
 import net.minecraft.world.phys.shapes.CollisionContext;
 import net.minecraft.world.phys.shapes.VoxelShape;
 
-import static me.shedaniel.architectury.test.TestMod.SINK;
+import static dev.architectury.test.TestMod.SINK;
 
 public class TestRegistries {
     public static final DeferredRegister ITEMS = DeferredRegister.create(TestMod.MOD_ID, Registry.ITEM_REGISTRY);
     public static final DeferredRegister BLOCKS = DeferredRegister.create(TestMod.MOD_ID, Registry.BLOCK_REGISTRY);
+    public static final DeferredRegister> ENTITY_TYPES = DeferredRegister.create(TestMod.MOD_ID, Registry.ENTITY_TYPE_REGISTRY);
     
     public static final RegistrySupplier TEST_ITEM = ITEMS.register("test_item", () ->
             new Item(new Item.Properties().tab(TestCreativeTabs.TEST_TAB)));
@@ -64,8 +67,11 @@ public class TestRegistries {
     public static final RegistrySupplier COLLISION_BLOCK_ITEM = ITEMS.register("collision_block", () ->
             new BlockItem(COLLISION_BLOCK.get(), new Item.Properties().tab(TestCreativeTabs.TEST_TAB)));
     
+    public static final RegistrySupplier> TEST_ENTITY = ENTITY_TYPES.register("test_entity", () -> TestEntity.TYPE);
+    
     public static void initialize() {
         BLOCKS.register();
         ITEMS.register();
+        ENTITY_TYPES.register();
     }
 }
diff --git a/testmod-common/src/main/java/me/shedaniel/architectury/test/registry/client/TestKeybinds.java b/testmod-common/src/main/java/dev/architectury/test/registry/client/TestKeybinds.java
similarity index 76%
rename from testmod-common/src/main/java/me/shedaniel/architectury/test/registry/client/TestKeybinds.java
rename to testmod-common/src/main/java/dev/architectury/test/registry/client/TestKeybinds.java
index 539a6d7a..62fcb1c0 100644
--- a/testmod-common/src/main/java/me/shedaniel/architectury/test/registry/client/TestKeybinds.java
+++ b/testmod-common/src/main/java/dev/architectury/test/registry/client/TestKeybinds.java
@@ -17,12 +17,12 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.test.registry.client;
+package dev.architectury.test.registry.client;
 
 import com.mojang.blaze3d.platform.InputConstants;
-import me.shedaniel.architectury.event.events.client.ClientTickEvent;
-import me.shedaniel.architectury.registry.KeyBindings;
-import me.shedaniel.architectury.test.TestMod;
+import dev.architectury.event.events.client.ClientTickEvent;
+import dev.architectury.registry.client.keymappings.KeyMappingRegistry;
+import dev.architectury.test.TestMod;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
 import net.minecraft.client.KeyMapping;
@@ -32,8 +32,8 @@ import org.lwjgl.glfw.GLFW;
 public class TestKeybinds {
     @Environment(EnvType.CLIENT)
     public static void initialize() {
-        KeyMapping mapping = new KeyMapping("key.architectury-test.test", InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_O, "category.architectury-test");
-        KeyBindings.registerKeyBinding(mapping);
+        var mapping = new KeyMapping("key.architectury-test.test", InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_O, "category.architectury-test");
+        KeyMappingRegistry.register(mapping);
         ClientTickEvent.CLIENT_POST.register(instance -> {
             while (mapping.consumeClick()) {
                 TestMod.SINK.accept("Key \"%s\" pressed!", I18n.get("key.architectury-test.test"));
diff --git a/testmod-common/src/main/java/me/shedaniel/architectury/test/registry/objects/EquippableTickingItem.java b/testmod-common/src/main/java/dev/architectury/test/registry/objects/EquippableTickingItem.java
similarity index 90%
rename from testmod-common/src/main/java/me/shedaniel/architectury/test/registry/objects/EquippableTickingItem.java
rename to testmod-common/src/main/java/dev/architectury/test/registry/objects/EquippableTickingItem.java
index 75c45971..c382cd68 100644
--- a/testmod-common/src/main/java/me/shedaniel/architectury/test/registry/objects/EquippableTickingItem.java
+++ b/testmod-common/src/main/java/dev/architectury/test/registry/objects/EquippableTickingItem.java
@@ -17,10 +17,10 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.test.registry.objects;
+package dev.architectury.test.registry.objects;
 
-import me.shedaniel.architectury.extensions.ItemExtension;
-import me.shedaniel.architectury.test.TestMod;
+import dev.architectury.extensions.ItemExtension;
+import dev.architectury.test.TestMod;
 import net.minecraft.network.chat.TranslatableComponent;
 import net.minecraft.world.entity.EquipmentSlot;
 import net.minecraft.world.entity.player.Player;
diff --git a/testmod-common/src/main/java/me/shedaniel/architectury/test/tab/TestCreativeTabs.java b/testmod-common/src/main/java/dev/architectury/test/tab/TestCreativeTabs.java
similarity index 76%
rename from testmod-common/src/main/java/me/shedaniel/architectury/test/tab/TestCreativeTabs.java
rename to testmod-common/src/main/java/dev/architectury/test/tab/TestCreativeTabs.java
index ec4c2396..3a38bfed 100644
--- a/testmod-common/src/main/java/me/shedaniel/architectury/test/tab/TestCreativeTabs.java
+++ b/testmod-common/src/main/java/dev/architectury/test/tab/TestCreativeTabs.java
@@ -17,16 +17,16 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.test.tab;
+package dev.architectury.test.tab;
 
-import me.shedaniel.architectury.registry.CreativeTabs;
-import me.shedaniel.architectury.test.TestMod;
-import me.shedaniel.architectury.test.registry.TestRegistries;
+import dev.architectury.registry.CreativeTabRegistry;
+import dev.architectury.test.TestMod;
+import dev.architectury.test.registry.TestRegistries;
 import net.minecraft.resources.ResourceLocation;
 import net.minecraft.world.item.CreativeModeTab;
 import net.minecraft.world.item.ItemStack;
 
 public class TestCreativeTabs {
-    public static final CreativeModeTab TEST_TAB = CreativeTabs.create(new ResourceLocation(TestMod.MOD_ID, "test_tab"),
+    public static final CreativeModeTab TEST_TAB = CreativeTabRegistry.create(new ResourceLocation(TestMod.MOD_ID, "test_tab"),
             () -> new ItemStack(TestRegistries.TEST_ITEM.get()));
 }
diff --git a/testmod-common/src/main/java/me/shedaniel/architectury/test/tags/TestTags.java b/testmod-common/src/main/java/dev/architectury/test/tags/TestTags.java
similarity index 75%
rename from testmod-common/src/main/java/me/shedaniel/architectury/test/tags/TestTags.java
rename to testmod-common/src/main/java/dev/architectury/test/tags/TestTags.java
index ca95936d..18386189 100644
--- a/testmod-common/src/main/java/me/shedaniel/architectury/test/tags/TestTags.java
+++ b/testmod-common/src/main/java/dev/architectury/test/tags/TestTags.java
@@ -17,31 +17,31 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.test.tags;
+package dev.architectury.test.tags;
 
-import me.shedaniel.architectury.event.events.BlockEvent;
-import me.shedaniel.architectury.hooks.TagHooks;
-import me.shedaniel.architectury.test.TestMod;
+import dev.architectury.event.EventResult;
+import dev.architectury.event.events.common.BlockEvent;
+import dev.architectury.hooks.tags.TagHooks;
+import dev.architectury.test.TestMod;
 import net.minecraft.core.particles.ParticleTypes;
 import net.minecraft.resources.ResourceLocation;
 import net.minecraft.server.level.ServerLevel;
 import net.minecraft.tags.Tag;
-import net.minecraft.world.InteractionResult;
 import net.minecraft.world.level.block.Block;
 
 public class TestTags {
     public static void initialize() {
         // This will not be present, but it should return an empty tag
-        Tag.Named heartParticles = TagHooks.getBlockOptional(new ResourceLocation(TestMod.MOD_ID, "heart_particles"));
+        var heartParticles = TagHooks.optionalBlock(new ResourceLocation(TestMod.MOD_ID, "heart_particles"));
         // This will act like a normal tag, we have emerald block here
-        Tag.Named heartParticles2 = TagHooks.getBlockOptional(new ResourceLocation(TestMod.MOD_ID, "heart_particles2"));
+        var heartParticles2 = TagHooks.optionalBlock(new ResourceLocation(TestMod.MOD_ID, "heart_particles2"));
         
         BlockEvent.BREAK.register((world, pos, state, player, xp) -> {
             if (player != null && !world.isClientSide() && (state.is(heartParticles) || state.is(heartParticles2))) {
                 ((ServerLevel) world).sendParticles(player, ParticleTypes.HEART, false, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 10, 0.0, 0.0, 0.0, 0.0);
             }
             
-            return InteractionResult.PASS;
+            return EventResult.pass();
         });
     }
 }
diff --git a/testmod-common/src/main/java/me/shedaniel/architectury/test/trade/TestTrades.java b/testmod-common/src/main/java/dev/architectury/test/trade/TestTrades.java
similarity index 78%
rename from testmod-common/src/main/java/me/shedaniel/architectury/test/trade/TestTrades.java
rename to testmod-common/src/main/java/dev/architectury/test/trade/TestTrades.java
index bb92779c..6c03883c 100644
--- a/testmod-common/src/main/java/me/shedaniel/architectury/test/trade/TestTrades.java
+++ b/testmod-common/src/main/java/dev/architectury/test/trade/TestTrades.java
@@ -17,10 +17,10 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-package me.shedaniel.architectury.test.trade;
+package dev.architectury.test.trade;
 
-import me.shedaniel.architectury.registry.trade.SimpleTrade;
-import me.shedaniel.architectury.registry.trade.TradeRegistry;
+import dev.architectury.registry.level.entity.trade.SimpleTrade;
+import dev.architectury.registry.level.entity.trade.TradeRegistry;
 import net.minecraft.core.Registry;
 import net.minecraft.world.entity.npc.VillagerProfession;
 import net.minecraft.world.entity.npc.VillagerTrades;
@@ -29,14 +29,14 @@ import net.minecraft.world.item.Items;
 
 public class TestTrades {
     public static void init() {
-        for (VillagerProfession villagerProfession : Registry.VILLAGER_PROFESSION) {
+        for (var villagerProfession : Registry.VILLAGER_PROFESSION) {
             TradeRegistry.registerVillagerTrade(villagerProfession, 1, TestTrades.createTrades());
         }
         TradeRegistry.registerTradeForWanderingTrader(false, TestTrades.createTrades());
     }
     
     private static VillagerTrades.ItemListing[] createTrades() {
-        SimpleTrade trade = new SimpleTrade(Items.APPLE.getDefaultInstance(), ItemStack.EMPTY, Items.ACACIA_BOAT.getDefaultInstance(), 1, 0, 1.0F);
+        var trade = new SimpleTrade(Items.APPLE.getDefaultInstance(), ItemStack.EMPTY, Items.ACACIA_BOAT.getDefaultInstance(), 1, 0, 1.0F);
         return new VillagerTrades.ItemListing[]{trade};
     }
 }
diff --git a/testmod-common/src/main/java/me/shedaniel/architectury/test/events/DebugEvents.java b/testmod-common/src/main/java/me/shedaniel/architectury/test/events/DebugEvents.java
deleted file mode 100644
index f0883ee8..00000000
--- a/testmod-common/src/main/java/me/shedaniel/architectury/test/events/DebugEvents.java
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
- * This file is part of architectury.
- * Copyright (C) 2020, 2021 architectury
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-
-package me.shedaniel.architectury.test.events;
-
-import com.mojang.blaze3d.platform.InputConstants;
-import me.shedaniel.architectury.event.CompoundEventResult;
-import me.shedaniel.architectury.event.EventResult;
-import me.shedaniel.architectury.event.events.*;
-import me.shedaniel.architectury.event.events.client.*;
-import me.shedaniel.architectury.hooks.ExplosionHooks;
-import me.shedaniel.architectury.platform.Platform;
-import me.shedaniel.architectury.utils.Env;
-import net.fabricmc.api.EnvType;
-import net.fabricmc.api.Environment;
-import net.minecraft.client.gui.screens.inventory.AnvilScreen;
-import net.minecraft.core.Position;
-import net.minecraft.core.Vec3i;
-import net.minecraft.network.chat.TextComponent;
-import net.minecraft.network.chat.TranslatableComponent;
-import net.minecraft.world.InteractionHand;
-import net.minecraft.world.InteractionResult;
-import net.minecraft.world.InteractionResultHolder;
-import net.minecraft.world.entity.Entity;
-import net.minecraft.world.entity.EquipmentSlot;
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.item.Items;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.phys.Vec3;
-
-import java.util.Optional;
-
-import static me.shedaniel.architectury.test.TestMod.SINK;
-
-public class DebugEvents {
-    public static void initialize() {
-        debugEvents();
-        if (Platform.getEnvironment() == Env.CLIENT)
-            debugEventsClient();
-    }
-    
-    public static void debugEvents() {
-        BlockEvent.BREAK.register((world, pos, state, player, xp) -> {
-            SINK.accept(player.getScoreboardName() + " breaks " + toShortString(pos) + logSide(player.level));
-            return InteractionResult.PASS;
-        });
-        BlockEvent.PLACE.register((world, pos, state, placer) -> {
-            SINK.accept(Optional.ofNullable(placer).map(Entity::getScoreboardName).orElse("null") + " places block at " + toShortString(pos) + logSide(world));
-            return InteractionResult.PASS;
-        });
-        ChatEvent.SERVER.register((player, message, component) -> {
-            SINK.accept("Server chat received: " + message.getRaw());
-            return InteractionResult.PASS;
-        });
-        CommandPerformEvent.EVENT.register(event -> {
-            SINK.accept("Server command performed: " + event.getResults().getReader().getString());
-            return InteractionResult.PASS;
-        });
-        CommandRegistrationEvent.EVENT.register((dispatcher, selection) -> {
-            SINK.accept("Server commands registers");
-        });
-        EntityEvent.LIVING_DEATH.register((entity, source) -> {
-            if (entity instanceof Player) {
-                SINK.accept(entity.getScoreboardName() + " died to " + source.getMsgId() + logSide(entity.level));
-            }
-            return InteractionResult.PASS;
-        });
-        EntityEvent.LIVING_ATTACK.register((entity, source, amount) -> {
-            if (source.getDirectEntity() instanceof Player) {
-                SINK.accept(source.getDirectEntity().getScoreboardName() + " deals %.2f damage" + logSide(entity.level), amount);
-            }
-            return InteractionResult.PASS;
-        });
-        EntityEvent.ADD.register((entity, level) -> {
-            if (entity instanceof Player) {
-                SINK.accept(entity.getScoreboardName() + " was added to " + level.dimension().location().toString() + logSide(level));
-            }
-            return InteractionResult.PASS;
-        });
-        EntityEvent.ENTER_SECTION.register(((entity, nx, ny, nz, ox, oy, oz) -> {
-            if (entity instanceof Player) {
-                Player player = (Player) entity;
-                SINK.accept("%s switched section: %s => %s", entity.getScoreboardName(), sectionPos(ox, oy, oz), sectionPos(nx, oy, nz));
-                player.displayClientMessage(new TextComponent("Entering chunk: " + sectionPos(nx, ny, nz)), true);
-            }
-        }));
-        EntityEvent.LIVING_CHECK_SPAWN.register(((entity, level, x, y, z, type, spawner) -> {
-            StringBuilder sb = new StringBuilder();
-            sb.append(entity.getType());
-            sb.append(" is trying to spawn");
-            sb.append(" at ");
-            sb.append(toShortString(new Vec3(x, y, z)));
-            if (level instanceof Level) {
-                sb.append(" in world ");
-                sb.append(((Level) level).dimension().location());
-            }
-            sb.append(" from cause ");
-            sb.append(type.name());
-            if (spawner != null) {
-                sb.append(" (");
-                sb.append(spawner);
-                sb.append(") ");
-            }
-            
-            SINK.accept(sb.toString());
-            return EventResult.pass();
-        }));
-        ExplosionEvent.DETONATE.register((world, explosion, affectedEntities) -> {
-            SINK.accept(world.dimension().location() + " explodes at " + toShortString(ExplosionHooks.getPosition(explosion)) + logSide(world));
-        });
-        InteractionEvent.LEFT_CLICK_BLOCK.register((player, hand, pos, face) -> {
-            SINK.accept(player.getScoreboardName() + " left clicks " + toShortString(pos) + logSide(player.level));
-            return InteractionResult.PASS;
-        });
-        InteractionEvent.RIGHT_CLICK_BLOCK.register((player, hand, pos, face) -> {
-            SINK.accept(player.getScoreboardName() + " right clicks " + toShortString(pos) + logSide(player.level));
-            return InteractionResult.PASS;
-        });
-        InteractionEvent.RIGHT_CLICK_ITEM.register((player, hand) -> {
-            SINK.accept(player.getScoreboardName() + " uses " + (hand == InteractionHand.MAIN_HAND ? "main hand" : "off hand") + logSide(player.level));
-            return InteractionResultHolder.pass(player.getItemInHand(hand));
-        });
-        InteractionEvent.INTERACT_ENTITY.register((player, entity, hand) -> {
-            SINK.accept(player.getScoreboardName() + " interacts with " + entity.getScoreboardName() + " using " + (hand == InteractionHand.MAIN_HAND ? "main hand" : "off hand") + logSide(player.level));
-            return InteractionResult.PASS;
-        });
-        InteractionEvent.FARMLAND_TRAMPLE.register((level, pos, state, distance, entity) -> {
-            if (entity instanceof Player && ((Player) entity).getItemBySlot(EquipmentSlot.FEET).getItem() == Items.DIAMOND_BOOTS) {
-                return EventResult.interrupt(false);
-            }
-            SINK.accept("%s trampled farmland (%s) at %s in %s (Fall height: %f blocks)", entity, state, pos, level, distance);
-            return EventResult.pass();
-        });
-        LifecycleEvent.SERVER_BEFORE_START.register(instance -> {
-            SINK.accept("Server ready to start");
-        });
-        LifecycleEvent.SERVER_STARTING.register(instance -> {
-            SINK.accept("Server starting");
-        });
-        LifecycleEvent.SERVER_STARTED.register(instance -> {
-            SINK.accept("Server started");
-        });
-        LifecycleEvent.SERVER_STOPPING.register(instance -> {
-            SINK.accept("Server stopping");
-        });
-        LifecycleEvent.SERVER_STOPPED.register(instance -> {
-            SINK.accept("Server stopped");
-        });
-        LifecycleEvent.SERVER_WORLD_LOAD.register(instance -> {
-            SINK.accept("Server world loaded: " + instance.dimension().location());
-        });
-        LifecycleEvent.SERVER_WORLD_UNLOAD.register(instance -> {
-            SINK.accept("Server world unloaded: " + instance.dimension().location());
-        });
-        LifecycleEvent.SERVER_WORLD_SAVE.register(instance -> {
-            SINK.accept("Server world saved: " + instance.dimension().location());
-        });
-        PlayerEvent.PLAYER_JOIN.register(player -> {
-            SINK.accept(player.getScoreboardName() + " joined" + logSide(player.level));
-        });
-        PlayerEvent.PLAYER_QUIT.register(player -> {
-            SINK.accept(player.getScoreboardName() + " quit" + logSide(player.level));
-        });
-        PlayerEvent.PLAYER_RESPAWN.register((player, conqueredEnd) -> {
-            if (!conqueredEnd) {
-                SINK.accept(player.getScoreboardName() + " respawns " + logSide(player.level));
-            }
-        });
-        PlayerEvent.PLAYER_CLONE.register((oldPlayer, newPlayer, wonGame) -> {
-            SINK.accept("Player cloned: " + newPlayer.getScoreboardName() + logSide(newPlayer.level));
-        });
-        PlayerEvent.PLAYER_ADVANCEMENT.register((player, advancement) -> {
-            SINK.accept(player.getScoreboardName() + " was awarded with %s" + logSide(player.level), advancement.getChatComponent().getString());
-        });
-        PlayerEvent.CRAFT_ITEM.register((player, constructed, inventory) -> {
-            SINK.accept(player.getScoreboardName() + " crafts " + new TranslatableComponent(constructed.getDescriptionId()).getString() + logSide(player.level));
-        });
-        PlayerEvent.SMELT_ITEM.register((player, smelted) -> {
-            SINK.accept(player.getScoreboardName() + " smelts " + new TranslatableComponent(smelted.getDescriptionId()).getString() + logSide(player.level));
-        });
-        PlayerEvent.PICKUP_ITEM_POST.register((player, entity, stack) -> {
-            SINK.accept(player.getScoreboardName() + " picks up " + new TranslatableComponent(stack.getDescriptionId()).getString() + logSide(player.level));
-        });
-        PlayerEvent.DROP_ITEM.register((player, entity) -> {
-            SINK.accept(player.getScoreboardName() + " drops " + new TranslatableComponent(entity.getItem().getDescriptionId()).getString() + logSide(player.level));
-            return InteractionResult.PASS;
-        });
-        PlayerEvent.OPEN_MENU.register((player, menu) -> {
-            SINK.accept(player.getScoreboardName() + " opens " + toSimpleName(menu) + logSide(player.level));
-        });
-        PlayerEvent.CLOSE_MENU.register((player, menu) -> {
-            SINK.accept(player.getScoreboardName() + " closes " + toSimpleName(menu) + logSide(player.level));
-        });
-        PlayerEvent.CHANGE_DIMENSION.register((player, oldLevel, newLevel) -> {
-            SINK.accept(player.getScoreboardName() + " switched from " + oldLevel.location() + " to " + newLevel.location() + logSide(player.level));
-        });
-        PlayerEvent.FILL_BUCKET.register(((player, level, stack, target) -> {
-            SINK.accept("%s used a bucket (%s) in %s%s while looking at %s", player.getScoreboardName(), stack, level.dimension().location(), logSide(level), target == null ? "nothing" : target.getLocation());
-            return CompoundEventResult.pass();
-        }));
-        LightningEvent.STRIKE.register((bolt, level, pos, toStrike) -> {
-            SINK.accept(bolt.getScoreboardName() + " struck at " + toShortString(pos) + logSide(level));
-        });
-    }
-    
-    public static String toShortString(Vec3i pos) {
-        return pos.getX() + ", " + pos.getY() + ", " + pos.getZ();
-    }
-    
-    public static String toShortString(Position pos) {
-        return pos.x() + ", " + pos.y() + ", " + pos.z();
-    }
-    
-    public static String logSide(Level level) {
-        if (level.isClientSide())
-            return " (client)";
-        return " (server)";
-    }
-    
-    @Environment(EnvType.CLIENT)
-    public static void debugEventsClient() {
-        ClientChatEvent.CLIENT.register(message -> {
-            SINK.accept("Client chat sent: " + message);
-            return InteractionResultHolder.pass(message);
-        });
-        ClientChatEvent.CLIENT_RECEIVED.register((type, message, sender) -> {
-            SINK.accept("Client chat received: " + message.getString());
-            return InteractionResultHolder.pass(message);
-        });
-        ClientLifecycleEvent.CLIENT_WORLD_LOAD.register(world -> {
-            SINK.accept("Client world loaded: " + world.dimension().location().toString());
-        });
-        ClientPlayerEvent.CLIENT_PLAYER_JOIN.register(player -> {
-            SINK.accept(player.getScoreboardName() + " joined (client)");
-        });
-        ClientPlayerEvent.CLIENT_PLAYER_QUIT.register(player -> {
-            if (player != null) {
-                SINK.accept(player.getScoreboardName() + " quit (client)");
-            }
-        });
-        ClientPlayerEvent.CLIENT_PLAYER_RESPAWN.register((oldPlayer, newPlayer) -> {
-            SINK.accept(newPlayer.getScoreboardName() + " respawned (client)");
-        });
-        GuiEvent.INIT_PRE.register((screen, access) -> {
-            SINK.accept(toSimpleName(screen) + " initializes");
-            return InteractionResult.PASS;
-        });
-        InteractionEvent.CLIENT_LEFT_CLICK_AIR.register((player, hand) -> {
-            SINK.accept(player.getScoreboardName() + " left clicks air" + logSide(player.level));
-        });
-        InteractionEvent.CLIENT_RIGHT_CLICK_AIR.register((player, hand) -> {
-            SINK.accept(player.getScoreboardName() + " right clicks air" + logSide(player.level));
-        });
-        RecipeUpdateEvent.EVENT.register(recipeManager -> {
-            SINK.accept("Client recipes received");
-        });
-        TextureStitchEvent.POST.register(atlas -> {
-            SINK.accept("Client texture stitched: " + atlas.location());
-        });
-        ClientScreenInputEvent.MOUSE_SCROLLED_PRE.register((client, screen, mouseX, mouseY, amount) -> {
-            SINK.accept("Screen Mouse scrolled: %.2f distance", amount);
-            return InteractionResult.PASS;
-        });
-        ClientScreenInputEvent.MOUSE_CLICKED_PRE.register((client, screen, mouseX, mouseY, button) -> {
-            SINK.accept("Screen Mouse clicked: " + button);
-            return InteractionResult.PASS;
-        });
-        ClientScreenInputEvent.MOUSE_RELEASED_PRE.register((client, screen, mouseX, mouseY, button) -> {
-            SINK.accept("Screen Mouse released: " + button);
-            return InteractionResult.PASS;
-        });
-        ClientScreenInputEvent.MOUSE_DRAGGED_PRE.register((client, screen, mouseX1, mouseY1, button, mouseX2, mouseY2) -> {
-            SINK.accept("Screen Mouse dragged: %d (%d,%d) by (%d,%d)", button, (int) mouseX1, (int) mouseY1, (int) mouseX2, (int) mouseY2);
-            return InteractionResult.PASS;
-        });
-        ClientScreenInputEvent.CHAR_TYPED_PRE.register((client, screen, character, keyCode) -> {
-            SINK.accept("Screen Char typed: " + character);
-            return InteractionResult.PASS;
-        });
-        ClientScreenInputEvent.KEY_PRESSED_PRE.register((client, screen, keyCode, scanCode, modifiers) -> {
-            SINK.accept("Screen Key pressed: " + InputConstants.getKey(keyCode, scanCode).getDisplayName().getString());
-            return InteractionResult.PASS;
-        });
-        ClientScreenInputEvent.KEY_RELEASED_PRE.register((client, screen, keyCode, scanCode, modifiers) -> {
-            SINK.accept("Screen Key released: " + InputConstants.getKey(keyCode, scanCode).getDisplayName().getString());
-            return InteractionResult.PASS;
-        });
-        ClientRawInputEvent.MOUSE_SCROLLED.register((client, amount) -> {
-            SINK.accept("Raw Mouse scrolled: %.2f distance", amount);
-            return InteractionResult.PASS;
-        });
-        ClientRawInputEvent.MOUSE_CLICKED_PRE.register((client, button, action, mods) -> {
-            SINK.accept("Raw Mouse clicked: " + button);
-            return InteractionResult.PASS;
-        });
-        ClientRawInputEvent.KEY_PRESSED.register((client, keyCode, scanCode, action, modifiers) -> {
-            SINK.accept("Raw Key pressed: " + InputConstants.getKey(keyCode, scanCode).getDisplayName().getString());
-            return InteractionResult.PASS;
-        });
-        GuiEvent.SET_SCREEN.register(screen -> {
-            if (screen instanceof AnvilScreen) {
-                return InteractionResultHolder.fail(screen);
-            }
-            
-            SINK.accept("Screen has been changed to " + toSimpleName(screen));
-            return InteractionResultHolder.pass(screen);
-        });
-    }
-    
-    private static String chunkPos(int x, int z) {
-        return "[" + x + ", " + z + "]";
-    }
-    
-    private static String sectionPos(int x, int y, int z) {
-        return "[" + x + ", " + y + ", " + z + "]";
-    }
-    
-    private static String toSimpleName(Object o) {
-        return o == null ? "null" : o.getClass().getSimpleName() + "@" + Integer.toHexString(o.hashCode());
-    }
-}
diff --git a/testmod-fabric/src/main/resources/fabric.mod.json b/testmod-fabric/src/main/resources/fabric.mod.json
index 04202eb8..33c2915f 100644
--- a/testmod-fabric/src/main/resources/fabric.mod.json
+++ b/testmod-fabric/src/main/resources/fabric.mod.json
@@ -11,7 +11,7 @@
   "environment": "*",
   "entrypoints": {
     "main": [
-      "me.shedaniel.architectury.test.TestMod::initialize"
+      "dev.architectury.test.TestMod::initialize"
     ]
   }
 }
\ No newline at end of file