From dff44ec84fc704b31607ed3409fc1e9991c90c72 Mon Sep 17 00:00:00 2001 From: Adrian Siekierka Date: Wed, 24 Apr 2019 00:46:23 +0200 Subject: [PATCH] [#148] Migrate to a modular JAR-in-JAR system, update to Loader 0.4.x --- .gitignore | 6 +- build.gradle | 159 +++++++++++++----- fabric-client-registries/build.gradle | 6 + .../client/keybinding/FabricKeyBinding.java | 0 .../client/keybinding/KeyBindingRegistry.java | 0 .../render/BlockEntityRendererRegistry.java | 0 .../client/render/ColorProviderRegistry.java | 0 .../client/render/EntityRendererRegistry.java | 0 .../keybinding/KeyBindingRegistryImpl.java | 0 .../render/ColorProviderRegistryImpl.java | 0 .../client/keybinding/MixinGameOptions.java | 0 .../client/keybinding/MixinKeyBinding.java | 0 .../client/render/MixinBlockColorMap.java | 0 .../render/MixinBlockEntityRenderManager.java | 0 .../render/MixinEntityRenderManager.java | 0 .../client/render/MixinItemColorMap.java | 0 .../fabric-client-registries.mixins.json | 16 ++ .../src/main/resources/fabric.mod.json | 9 + fabric-commands/build.gradle | 6 + .../fabric/api/registry/CommandRegistry.java | 25 +-- .../impl/registry/CommandRegistryImpl.java | 34 ++++ .../MixinMinecraftDedicatedServer.java | 7 +- .../MixinServerCommandManager.java | 5 +- .../resources/fabric-commands.mixins.json | 12 ++ .../src/main/resources/fabric.mod.json | 9 + fabric-containers/build.gradle | 7 + .../client/screen/ContainerScreenFactory.java | 0 .../client/screen/ScreenProviderRegistry.java | 0 .../api/container/ContainerFactory.java | 0 .../container/ContainerProviderRegistry.java | 0 .../gui/ScreenProviderRegistryImpl.java | 2 +- .../impl/container/ContainerProviderImpl.java | 0 .../fabric/impl/container/SyncIdProvider.java | 0 .../container/MixinServerPlayerEntity.java | 0 .../resources/fabric-containers.mixins.json | 11 ++ .../src/main/resources/fabric.mod.json | 14 ++ fabric-content-registries/build.gradle | 7 + .../registry/CompostingChanceRegistry.java | 0 .../api/registry/FlammableBlockRegistry.java | 0 .../fabric/api/registry/FuelRegistry.java | 0 .../api/registry/LootEntryTypeRegistry.java | 0 .../fabric/api/util/Block2ObjectMap.java | 0 .../fabric/api/util/Item2ObjectMap.java | 0 .../CompostingChanceRegistryImpl.java | 0 .../fabric/impl/registry/FireBlockHooks.java | 0 .../registry/FlammableBlockRegistryImpl.java | 0 .../impl/registry/FuelRegistryImpl.java | 0 .../registry/LootEntryTypeRegistryImpl.java | 0 .../MixinAbstractFurnaceBlockEntity.java | 2 +- .../mixin/registryextras}/MixinFireBlock.java | 2 +- .../fabric-content-registries.mixins.json | 12 ++ .../src/main/resources/fabric.mod.json | 9 + fabric-crash-report-info/build.gradle | 2 + .../fabric/mixin/crash}/MixinCrashReport.java | 6 +- .../fabric-crash-report-info.mixins.json | 11 ++ .../src/main/resources/fabric.mod.json | 9 + fabric-creative-tabs/build.gradle | 6 + .../itemgroup/FabricItemGroupBuilder.java | 0 .../impl/itemgroup/CreativeGuiExtensions.java | 0 .../FabricCreativeGuiComponents.java | 0 .../impl/itemgroup/ItemGroupExtensions.java | 0 .../mixin/itemgroup/MixinItemGroup.java | 0 .../MixinCreativePlayerInventoryGui.java | 2 +- .../itemgroup/client}/MixinItemGroup.java | 2 +- .../resources/assets/fabric/lang/en_us.json | 0 .../fabric/textures/gui/creative_buttons.png | Bin .../fabric-creative-tabs.mixins.json | 15 ++ .../src/main/resources/fabric.mod.json | 9 + fabric-events-interaction/build.gradle | 6 + .../block/BlockAttackInteractionAware.java | 0 .../api/block/BlockPickInteractionAware.java | 0 .../entity/EntityPickInteractionAware.java | 0 .../player/ClientPickBlockApplyCallback.java | 0 .../player/ClientPickBlockCallback.java | 0 .../player/ClientPickBlockGatherCallback.java | 0 .../api/event/player/AttackBlockCallback.java | 0 .../event/player/AttackEntityCallback.java | 0 .../api/event/player/UseBlockCallback.java | 0 .../api/event/player/UseEntityCallback.java | 0 .../api/event/player/UseItemCallback.java | 0 .../impl/event/InteractionEventsRouter.java | 27 +++ .../event/InteractionEventsRouterClient.java | 38 +++++ .../MixinClientPlayerInteractionManager.java | 2 +- .../MixinMinecraftClient.java | 2 +- .../MixinServerPlayNetworkHandler.java | 2 +- .../MixinServerPlayerEntity.java | 2 +- .../MixinServerPlayerInteractionManager.java | 2 +- .../fabric-events-interaction.mixins.json | 17 ++ .../src/main/resources/fabric.mod.json | 9 + fabric-events-lifecycle/build.gradle | 6 + .../api/event/client/ClientTickCallback.java | 0 .../api/event/server/ServerStartCallback.java | 0 .../api/event/server/ServerStopCallback.java | 0 .../api/event/server/ServerTickCallback.java | 0 .../api/event/world/WorldTickCallback.java | 0 .../MixinMinecraftClient.java | 2 +- .../MixinMinecraftServer.java | 12 +- .../mixin/eventslifecycle}/MixinWorld.java | 2 +- .../fabric-events-lifecycle.mixins.json | 15 ++ .../src/main/resources/fabric.mod.json | 9 + fabric-lib/build.gradle | 2 + .../net/fabricmc/fabric/api/event/Event.java | 0 .../fabric/api/event/EventFactory.java | 0 .../net/fabricmc/fabric/api/util/NbtType.java | 0 .../fabricmc/fabric/api/util/TriState.java | 0 .../fabric/impl/event/ArrayBackedEvent.java | 0 .../fabric/impl/event/EventFactoryImpl.java | 0 fabric-lib/src/main/resources/fabric.mod.json | 6 + fabric-mining-levels/build.gradle | 7 + .../fabric/api/tag/FabricItemTags.java | 38 ++--- .../fabric/api/tools/FabricToolTags.java | 10 +- .../fabric/impl/tools/ToolManager.java | 38 +---- .../mixin/tools}/MiningToolItemAccessor.java | 8 +- .../fabric/mixin/tools/MixinItemStack.java | 1 - .../data/fabric/tags/items/axes.json | 0 .../data/fabric/tags/items/hoes.json | 0 .../data/fabric/tags/items/pickaxes.json | 0 .../data/fabric/tags/items/shovels.json | 0 .../data/fabric/tags/items/swords.json | 0 .../fabric-mining-levels.mixins.json | 12 ++ .../src/main/resources/fabric.mod.json | 9 + fabric-models/build.gradle | 6 + .../api/client/model/ModelAppender.java | 0 .../client/model/ModelLoadingRegistry.java | 0 .../client/model/ModelProviderContext.java | 0 .../client/model/ModelProviderException.java | 0 .../client/model/ModelResourceProvider.java | 0 .../client/model/ModelVariantProvider.java | 0 .../impl/client/model/ModelLoaderHooks.java | 4 +- .../model/ModelLoadingRegistryImpl.java | 2 +- .../mixin/client/model/MixinModelLoader.java | 0 .../main/resources/fabric-models.mixins.json | 11 ++ .../src/main/resources/fabric.mod.json | 10 ++ fabric-networking-blockentity/build.gradle | 7 + .../entity/BlockEntityClientSerializable.java | 0 .../MixinBlockEntity.java | 2 +- .../MixinClientPlayNetworkHandler.java | 2 +- .../fabric-networking-blockentity.mixins.json | 12 ++ .../src/main/resources/fabric.mod.json | 9 + fabric-networking/build.gradle | 6 + .../event/network/C2SPacketTypeCallback.java | 0 .../event/network/S2CPacketTypeCallback.java | 1 - .../api/network/ClientSidePacketRegistry.java | 0 .../fabric/api/network/PacketConsumer.java | 0 .../fabric/api/network/PacketContext.java | 0 .../fabric/api/network/PacketRegistry.java | 0 .../api/network/ServerSidePacketRegistry.java | 0 .../fabric/api/server/PlayerStream.java | 0 .../network/ClientSidePacketRegistryImpl.java | 1 - .../CustomPayloadC2SPacketAccessor.java | 5 +- .../impl/network/PacketRegistryImpl.java | 2 - .../fabric/impl/network/PacketTypes.java | 0 .../network/ServerSidePacketRegistryImpl.java | 4 - .../server/EntityTrackerStorageAccessor.java | 0 .../server/EntityTrackerStreamAccessor.java | 0 .../MixinClientPlayNetworkHandler.java | 7 +- .../network}/MixinCustomPayloadC2SPacket.java | 4 +- .../mixin/network}/MixinEntityTracker.java | 2 +- .../MixinServerPlayNetworkHandler.java | 2 +- .../MixinThreadedAnvilChunkStorage.java | 2 +- .../resources/fabric-networking.mixins.json | 17 ++ .../src/main/resources/fabric.mod.json | 9 + fabric-object-builders/build.gradle | 7 + .../fabric/api/block/FabricBlockSettings.java | 60 +++++-- .../api/entity/EntityTrackingRegistry.java | 3 - .../api/entity/FabricEntityTypeBuilder.java | 0 .../registry/BlockConstructedCallback.java | 0 .../registry/ItemConstructedCallback.java | 0 .../block/FabricBlockSettingsDelegate.java | 18 ++ .../fabric/impl/entity/FabricEntityType.java | 62 +++++++ .../fabric/mixin/builders}/MixinBlock.java | 2 +- .../mixin/builders}/MixinBlockBuilder.java | 6 +- .../fabric/mixin/builders}/MixinItem.java | 2 +- .../fabric-object-builders.mixins.json | 13 ++ .../src/main/resources/fabric.mod.json | 9 + fabric-registry-sync/build.gradle | 7 + .../fabric/impl/registry/ExtendedIdList.java | 0 .../registry/FabricRegistryClientInit.java | 28 +++ .../fabric/impl/registry/IdListUpdater.java | 0 .../impl/registry/ListenableRegistry.java | 0 .../impl/registry/RegistryListener.java | 0 .../impl/registry/RegistrySyncManager.java | 0 .../fabric/impl/registry/RemapException.java | 0 .../impl/registry/RemappableRegistry.java | 0 .../BootstrapBiomeRegistryListener.java | 4 +- .../BootstrapBlockRegistryListener.java | 4 +- .../BootstrapFluidRegistryListener.java | 4 +- .../BootstrapItemRegistryListener.java | 3 +- .../fabric/mixin/registry/MixinBootstrap.java | 8 +- .../fabric/mixin/registry/MixinIdList.java | 0 .../mixin/registry/MixinIdRegistry.java | 0 .../mixin/registry/MixinPlayerManager.java | 5 - .../mixin/registry/MixinWorldSaveHandler.java | 0 .../registry/client/MixinBlockColorMap.java | 0 .../registry/client/MixinItemColorMap.java | 0 .../registry/client/MixinItemModelMap.java | 0 .../registry/client/MixinMinecraftClient.java | 0 .../registry/client/MixinParticleManager.java | 0 .../fabric-registry-sync.mixins.json | 22 +++ .../src/main/resources/fabric.mod.json | 14 ++ fabric-resource-loader/build.gradle | 2 + .../IdentifiableResourceReloadListener.java | 0 .../fabric/api/resource/ModResourcePack.java | 0 .../api/resource/ResourceManagerHelper.java | 0 .../resource/ResourceReloadListenerKeys.java | 0 .../SimpleResourceReloadListener.java | 0 ...mpleSynchronousResourceReloadListener.java | 0 .../impl/resources/DeferredInputStream.java | 0 .../DeferredNioExecutionHandler.java | 0 .../impl/resources/ModNioResourcePack.java | 0 .../resources/ModResourcePackCreator.java | 0 .../impl/resources/ModResourcePackUtil.java | 4 +- .../resources/ResourceManagerHelperImpl.java | 0 .../MixinKeyedResourceReloadListener.java | 0 .../mixin/resources/MixinMinecraftGame.java | 0 .../mixin/resources/MixinMinecraftServer.java | 4 +- .../MixinReloadableResourceManagerImpl.java | 0 ...inReloadableResourceManagerImplClient.java | 0 .../fabric-resource-loader.mixins.json | 17 ++ .../src/main/resources/fabric.mod.json | 9 + fabric-tag-hooks/build.gradle | 7 + .../fabricmc/fabric/api/tag/TagRegistry.java | 94 +++++++++++ .../fabric/impl}/tag/TagDelegate.java | 2 +- .../src/main/resources/fabric.mod.json | 6 + .../net/fabricmc/fabric/block/FireMod.java | 0 .../fabric/colormapper/ColorProviderMod.java | 0 .../fabricmc/fabric/commands/CommandMod.java | 0 .../fabric/containers/ContainerMod.java | 0 .../fabric/containers/ContainerModClient.java | 0 .../events/PickBlockEventModClient.java | 0 .../fabric/events/ServerEventMod.java | 0 .../net/fabricmc/fabric/item/FuelMod.java | 0 .../fabric/itemgroup/ItemGroupMod.java | 0 .../keybinding/KeyBindingModClient.java | 0 .../fabricmc/fabric/loot/LootEntryMod.java | 0 .../fabricmc/fabric/model/ModelModClient.java | 0 .../resources/ResourceReloadModClient.java | 0 .../minecraft/loot_tables/blocks/stone.json | 0 .../resources/mod.json | 0 fabric-textures/build.gradle | 6 + .../client/texture/CustomSpriteLoader.java | 0 .../api/client/texture/DependentSprite.java | 0 .../client/ClientSpriteRegistryCallback.java | 0 .../impl/client/texture/FabricSprite.java | 0 .../texture/MixinSpriteAtlasTexture.java | 0 .../resources/fabric-textures.mixins.json | 11 ++ .../src/main/resources/fabric.mod.json | 10 ++ gradle.properties | 1 + settings.gradle | 30 ++++ .../fabric/api/tag/FabricBlockTags.java | 34 ---- .../impl/FabricAPIClientInitializer.java | 78 --------- .../fabric/impl/FabricAPIInitializer.java | 43 ----- .../fabric/mixin/bugfix/MixinBiomeColors.java | 43 ----- .../events/tick/MixinMinecraftServer.java | 36 ---- .../mixin/tools/MixinMiningToolItem.java | 33 ---- src/main/resources/assets/fabric/icon.png | Bin 0 -> 229 bytes .../fabric/textures/misc/default_icon.png | Bin 247 -> 0 bytes src/main/resources/fabric.mod.json | 17 +- .../net.fabricmc.fabric.mixins.client.json | 33 ---- .../net.fabricmc.fabric.mixins.common.json | 41 ----- 260 files changed, 1101 insertions(+), 574 deletions(-) create mode 100644 fabric-client-registries/build.gradle rename {src => fabric-client-registries/src}/main/java/net/fabricmc/fabric/api/client/keybinding/FabricKeyBinding.java (100%) rename {src => fabric-client-registries/src}/main/java/net/fabricmc/fabric/api/client/keybinding/KeyBindingRegistry.java (100%) rename {src => fabric-client-registries/src}/main/java/net/fabricmc/fabric/api/client/render/BlockEntityRendererRegistry.java (100%) rename {src => fabric-client-registries/src}/main/java/net/fabricmc/fabric/api/client/render/ColorProviderRegistry.java (100%) rename {src => fabric-client-registries/src}/main/java/net/fabricmc/fabric/api/client/render/EntityRendererRegistry.java (100%) rename {src => fabric-client-registries/src}/main/java/net/fabricmc/fabric/impl/client/keybinding/KeyBindingRegistryImpl.java (100%) rename {src => fabric-client-registries/src}/main/java/net/fabricmc/fabric/impl/client/render/ColorProviderRegistryImpl.java (100%) rename {src => fabric-client-registries/src}/main/java/net/fabricmc/fabric/mixin/client/keybinding/MixinGameOptions.java (100%) rename {src => fabric-client-registries/src}/main/java/net/fabricmc/fabric/mixin/client/keybinding/MixinKeyBinding.java (100%) rename {src => fabric-client-registries/src}/main/java/net/fabricmc/fabric/mixin/client/render/MixinBlockColorMap.java (100%) rename {src => fabric-client-registries/src}/main/java/net/fabricmc/fabric/mixin/client/render/MixinBlockEntityRenderManager.java (100%) rename {src => fabric-client-registries/src}/main/java/net/fabricmc/fabric/mixin/client/render/MixinEntityRenderManager.java (100%) rename {src => fabric-client-registries/src}/main/java/net/fabricmc/fabric/mixin/client/render/MixinItemColorMap.java (100%) create mode 100644 fabric-client-registries/src/main/resources/fabric-client-registries.mixins.json create mode 100644 fabric-client-registries/src/main/resources/fabric.mod.json create mode 100644 fabric-commands/build.gradle rename {src => fabric-commands/src}/main/java/net/fabricmc/fabric/api/registry/CommandRegistry.java (63%) create mode 100644 fabric-commands/src/main/java/net/fabricmc/fabric/impl/registry/CommandRegistryImpl.java rename {src/main/java/net/fabricmc/fabric/mixin/commands => fabric-commands/src/main/java/net/fabricmc/fabric/mixin/registrycommands}/MixinMinecraftDedicatedServer.java (88%) rename {src/main/java/net/fabricmc/fabric/mixin/commands => fabric-commands/src/main/java/net/fabricmc/fabric/mixin/registrycommands}/MixinServerCommandManager.java (88%) create mode 100644 fabric-commands/src/main/resources/fabric-commands.mixins.json create mode 100644 fabric-commands/src/main/resources/fabric.mod.json create mode 100644 fabric-containers/build.gradle rename {src => fabric-containers/src}/main/java/net/fabricmc/fabric/api/client/screen/ContainerScreenFactory.java (100%) rename {src => fabric-containers/src}/main/java/net/fabricmc/fabric/api/client/screen/ScreenProviderRegistry.java (100%) rename {src => fabric-containers/src}/main/java/net/fabricmc/fabric/api/container/ContainerFactory.java (100%) rename {src => fabric-containers/src}/main/java/net/fabricmc/fabric/api/container/ContainerProviderRegistry.java (100%) rename {src => fabric-containers/src}/main/java/net/fabricmc/fabric/impl/client/gui/ScreenProviderRegistryImpl.java (99%) rename {src => fabric-containers/src}/main/java/net/fabricmc/fabric/impl/container/ContainerProviderImpl.java (100%) rename {src => fabric-containers/src}/main/java/net/fabricmc/fabric/impl/container/SyncIdProvider.java (100%) rename {src => fabric-containers/src}/main/java/net/fabricmc/fabric/mixin/container/MixinServerPlayerEntity.java (100%) create mode 100644 fabric-containers/src/main/resources/fabric-containers.mixins.json create mode 100644 fabric-containers/src/main/resources/fabric.mod.json create mode 100644 fabric-content-registries/build.gradle rename {src => fabric-content-registries/src}/main/java/net/fabricmc/fabric/api/registry/CompostingChanceRegistry.java (100%) rename {src => fabric-content-registries/src}/main/java/net/fabricmc/fabric/api/registry/FlammableBlockRegistry.java (100%) rename {src => fabric-content-registries/src}/main/java/net/fabricmc/fabric/api/registry/FuelRegistry.java (100%) rename {src => fabric-content-registries/src}/main/java/net/fabricmc/fabric/api/registry/LootEntryTypeRegistry.java (100%) rename {src => fabric-content-registries/src}/main/java/net/fabricmc/fabric/api/util/Block2ObjectMap.java (100%) rename {src => fabric-content-registries/src}/main/java/net/fabricmc/fabric/api/util/Item2ObjectMap.java (100%) rename {src => fabric-content-registries/src}/main/java/net/fabricmc/fabric/impl/registry/CompostingChanceRegistryImpl.java (100%) rename {src => fabric-content-registries/src}/main/java/net/fabricmc/fabric/impl/registry/FireBlockHooks.java (100%) rename {src => fabric-content-registries/src}/main/java/net/fabricmc/fabric/impl/registry/FlammableBlockRegistryImpl.java (100%) rename {src => fabric-content-registries/src}/main/java/net/fabricmc/fabric/impl/registry/FuelRegistryImpl.java (100%) rename {src => fabric-content-registries/src}/main/java/net/fabricmc/fabric/impl/registry/LootEntryTypeRegistryImpl.java (100%) rename {src/main/java/net/fabricmc/fabric/mixin/item => fabric-content-registries/src/main/java/net/fabricmc/fabric/mixin/registryextras}/MixinAbstractFurnaceBlockEntity.java (96%) rename {src/main/java/net/fabricmc/fabric/mixin/block => fabric-content-registries/src/main/java/net/fabricmc/fabric/mixin/registryextras}/MixinFireBlock.java (98%) create mode 100644 fabric-content-registries/src/main/resources/fabric-content-registries.mixins.json create mode 100644 fabric-content-registries/src/main/resources/fabric.mod.json create mode 100644 fabric-crash-report-info/build.gradle rename {src/main/java/net/fabricmc/fabric/mixin/misc => fabric-crash-report-info/src/main/java/net/fabricmc/fabric/mixin/crash}/MixinCrashReport.java (87%) create mode 100644 fabric-crash-report-info/src/main/resources/fabric-crash-report-info.mixins.json create mode 100644 fabric-crash-report-info/src/main/resources/fabric.mod.json create mode 100644 fabric-creative-tabs/build.gradle rename {src => fabric-creative-tabs/src}/main/java/net/fabricmc/fabric/api/client/itemgroup/FabricItemGroupBuilder.java (100%) rename {src => fabric-creative-tabs/src}/main/java/net/fabricmc/fabric/impl/itemgroup/CreativeGuiExtensions.java (100%) rename {src => fabric-creative-tabs/src}/main/java/net/fabricmc/fabric/impl/itemgroup/FabricCreativeGuiComponents.java (100%) rename {src => fabric-creative-tabs/src}/main/java/net/fabricmc/fabric/impl/itemgroup/ItemGroupExtensions.java (100%) rename {src => fabric-creative-tabs/src}/main/java/net/fabricmc/fabric/mixin/itemgroup/MixinItemGroup.java (100%) rename {src/main/java/net/fabricmc/fabric/mixin/client/itemgroup => fabric-creative-tabs/src/main/java/net/fabricmc/fabric/mixin/itemgroup/client}/MixinCreativePlayerInventoryGui.java (99%) rename {src/main/java/net/fabricmc/fabric/mixin/client/itemgroup => fabric-creative-tabs/src/main/java/net/fabricmc/fabric/mixin/itemgroup/client}/MixinItemGroup.java (97%) rename {src => fabric-creative-tabs/src}/main/resources/assets/fabric/lang/en_us.json (100%) rename {src => fabric-creative-tabs/src}/main/resources/assets/fabric/textures/gui/creative_buttons.png (100%) create mode 100644 fabric-creative-tabs/src/main/resources/fabric-creative-tabs.mixins.json create mode 100644 fabric-creative-tabs/src/main/resources/fabric.mod.json create mode 100644 fabric-events-interaction/build.gradle rename {src => fabric-events-interaction/src}/main/java/net/fabricmc/fabric/api/block/BlockAttackInteractionAware.java (100%) rename {src => fabric-events-interaction/src}/main/java/net/fabricmc/fabric/api/block/BlockPickInteractionAware.java (100%) rename {src => fabric-events-interaction/src}/main/java/net/fabricmc/fabric/api/entity/EntityPickInteractionAware.java (100%) rename {src => fabric-events-interaction/src}/main/java/net/fabricmc/fabric/api/event/client/player/ClientPickBlockApplyCallback.java (100%) rename {src => fabric-events-interaction/src}/main/java/net/fabricmc/fabric/api/event/client/player/ClientPickBlockCallback.java (100%) rename {src => fabric-events-interaction/src}/main/java/net/fabricmc/fabric/api/event/client/player/ClientPickBlockGatherCallback.java (100%) rename {src => fabric-events-interaction/src}/main/java/net/fabricmc/fabric/api/event/player/AttackBlockCallback.java (100%) rename {src => fabric-events-interaction/src}/main/java/net/fabricmc/fabric/api/event/player/AttackEntityCallback.java (100%) rename {src => fabric-events-interaction/src}/main/java/net/fabricmc/fabric/api/event/player/UseBlockCallback.java (100%) rename {src => fabric-events-interaction/src}/main/java/net/fabricmc/fabric/api/event/player/UseEntityCallback.java (100%) rename {src => fabric-events-interaction/src}/main/java/net/fabricmc/fabric/api/event/player/UseItemCallback.java (100%) create mode 100644 fabric-events-interaction/src/main/java/net/fabricmc/fabric/impl/event/InteractionEventsRouter.java create mode 100644 fabric-events-interaction/src/main/java/net/fabricmc/fabric/impl/event/InteractionEventsRouterClient.java rename {src/main/java/net/fabricmc/fabric/mixin/events/playerinteraction => fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction}/MixinClientPlayerInteractionManager.java (99%) rename {src/main/java/net/fabricmc/fabric/mixin/events/playerinteraction => fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction}/MixinMinecraftClient.java (98%) rename {src/main/java/net/fabricmc/fabric/mixin/events/playerinteraction => fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction}/MixinServerPlayNetworkHandler.java (97%) rename {src/main/java/net/fabricmc/fabric/mixin/events/playerinteraction => fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction}/MixinServerPlayerEntity.java (96%) rename {src/main/java/net/fabricmc/fabric/mixin/events/playerinteraction => fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction}/MixinServerPlayerInteractionManager.java (98%) create mode 100644 fabric-events-interaction/src/main/resources/fabric-events-interaction.mixins.json create mode 100644 fabric-events-interaction/src/main/resources/fabric.mod.json create mode 100644 fabric-events-lifecycle/build.gradle rename {src => fabric-events-lifecycle/src}/main/java/net/fabricmc/fabric/api/event/client/ClientTickCallback.java (100%) rename {src => fabric-events-lifecycle/src}/main/java/net/fabricmc/fabric/api/event/server/ServerStartCallback.java (100%) rename {src => fabric-events-lifecycle/src}/main/java/net/fabricmc/fabric/api/event/server/ServerStopCallback.java (100%) rename {src => fabric-events-lifecycle/src}/main/java/net/fabricmc/fabric/api/event/server/ServerTickCallback.java (100%) rename {src => fabric-events-lifecycle/src}/main/java/net/fabricmc/fabric/api/event/world/WorldTickCallback.java (100%) rename {src/main/java/net/fabricmc/fabric/mixin/events/tick => fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/mixin/eventslifecycle}/MixinMinecraftClient.java (96%) rename {src/main/java/net/fabricmc/fabric/mixin/events/server => fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/mixin/eventslifecycle}/MixinMinecraftServer.java (77%) rename {src/main/java/net/fabricmc/fabric/mixin/events/tick => fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/mixin/eventslifecycle}/MixinWorld.java (96%) create mode 100644 fabric-events-lifecycle/src/main/resources/fabric-events-lifecycle.mixins.json create mode 100644 fabric-events-lifecycle/src/main/resources/fabric.mod.json create mode 100644 fabric-lib/build.gradle rename {src => fabric-lib/src}/main/java/net/fabricmc/fabric/api/event/Event.java (100%) rename {src => fabric-lib/src}/main/java/net/fabricmc/fabric/api/event/EventFactory.java (100%) rename {src => fabric-lib/src}/main/java/net/fabricmc/fabric/api/util/NbtType.java (100%) rename {src => fabric-lib/src}/main/java/net/fabricmc/fabric/api/util/TriState.java (100%) rename {src => fabric-lib/src}/main/java/net/fabricmc/fabric/impl/event/ArrayBackedEvent.java (100%) rename {src => fabric-lib/src}/main/java/net/fabricmc/fabric/impl/event/EventFactoryImpl.java (100%) create mode 100644 fabric-lib/src/main/resources/fabric.mod.json create mode 100644 fabric-mining-levels/build.gradle rename src/main/java/net/fabricmc/fabric/api/tag/TagRegistry.java => fabric-mining-levels/src/main/java/net/fabricmc/fabric/api/tag/FabricItemTags.java (53%) rename src/main/java/net/fabricmc/fabric/api/tag/FabricItemTags.java => fabric-mining-levels/src/main/java/net/fabricmc/fabric/api/tools/FabricToolTags.java (85%) rename {src => fabric-mining-levels/src}/main/java/net/fabricmc/fabric/impl/tools/ToolManager.java (71%) rename {src/main/java/net/fabricmc/fabric/impl/accessors => fabric-mining-levels/src/main/java/net/fabricmc/fabric/mixin/tools}/MiningToolItemAccessor.java (76%) rename {src => fabric-mining-levels/src}/main/java/net/fabricmc/fabric/mixin/tools/MixinItemStack.java (96%) rename {src => fabric-mining-levels/src}/main/resources/data/fabric/tags/items/axes.json (100%) rename {src => fabric-mining-levels/src}/main/resources/data/fabric/tags/items/hoes.json (100%) rename {src => fabric-mining-levels/src}/main/resources/data/fabric/tags/items/pickaxes.json (100%) rename {src => fabric-mining-levels/src}/main/resources/data/fabric/tags/items/shovels.json (100%) rename {src => fabric-mining-levels/src}/main/resources/data/fabric/tags/items/swords.json (100%) create mode 100644 fabric-mining-levels/src/main/resources/fabric-mining-levels.mixins.json create mode 100644 fabric-mining-levels/src/main/resources/fabric.mod.json create mode 100644 fabric-models/build.gradle rename {src => fabric-models/src}/main/java/net/fabricmc/fabric/api/client/model/ModelAppender.java (100%) rename {src => fabric-models/src}/main/java/net/fabricmc/fabric/api/client/model/ModelLoadingRegistry.java (100%) rename {src => fabric-models/src}/main/java/net/fabricmc/fabric/api/client/model/ModelProviderContext.java (100%) rename {src => fabric-models/src}/main/java/net/fabricmc/fabric/api/client/model/ModelProviderException.java (100%) rename {src => fabric-models/src}/main/java/net/fabricmc/fabric/api/client/model/ModelResourceProvider.java (100%) rename {src => fabric-models/src}/main/java/net/fabricmc/fabric/api/client/model/ModelVariantProvider.java (100%) rename {src => fabric-models/src}/main/java/net/fabricmc/fabric/impl/client/model/ModelLoaderHooks.java (88%) rename {src => fabric-models/src}/main/java/net/fabricmc/fabric/impl/client/model/ModelLoadingRegistryImpl.java (99%) rename {src => fabric-models/src}/main/java/net/fabricmc/fabric/mixin/client/model/MixinModelLoader.java (100%) create mode 100644 fabric-models/src/main/resources/fabric-models.mixins.json create mode 100644 fabric-models/src/main/resources/fabric.mod.json create mode 100644 fabric-networking-blockentity/build.gradle rename {src => fabric-networking-blockentity/src}/main/java/net/fabricmc/fabric/api/block/entity/BlockEntityClientSerializable.java (100%) rename {src/main/java/net/fabricmc/fabric/mixin/block/entity => fabric-networking-blockentity/src/main/java/net/fabricmc/fabric/mixin/networkingblockentity}/MixinBlockEntity.java (97%) rename {src/main/java/net/fabricmc/fabric/mixin/block/entity => fabric-networking-blockentity/src/main/java/net/fabricmc/fabric/mixin/networkingblockentity}/MixinClientPlayNetworkHandler.java (98%) create mode 100644 fabric-networking-blockentity/src/main/resources/fabric-networking-blockentity.mixins.json create mode 100644 fabric-networking-blockentity/src/main/resources/fabric.mod.json create mode 100644 fabric-networking/build.gradle rename {src => fabric-networking/src}/main/java/net/fabricmc/fabric/api/event/network/C2SPacketTypeCallback.java (100%) rename {src => fabric-networking/src}/main/java/net/fabricmc/fabric/api/event/network/S2CPacketTypeCallback.java (97%) rename {src => fabric-networking/src}/main/java/net/fabricmc/fabric/api/network/ClientSidePacketRegistry.java (100%) rename {src => fabric-networking/src}/main/java/net/fabricmc/fabric/api/network/PacketConsumer.java (100%) rename {src => fabric-networking/src}/main/java/net/fabricmc/fabric/api/network/PacketContext.java (100%) rename {src => fabric-networking/src}/main/java/net/fabricmc/fabric/api/network/PacketRegistry.java (100%) rename {src => fabric-networking/src}/main/java/net/fabricmc/fabric/api/network/ServerSidePacketRegistry.java (100%) rename {src => fabric-networking/src}/main/java/net/fabricmc/fabric/api/server/PlayerStream.java (100%) rename {src => fabric-networking/src}/main/java/net/fabricmc/fabric/impl/network/ClientSidePacketRegistryImpl.java (97%) rename {src/main/java/net/fabricmc/fabric/impl/accessors => fabric-networking/src/main/java/net/fabricmc/fabric/impl/network}/CustomPayloadC2SPacketAccessor.java (81%) rename {src => fabric-networking/src}/main/java/net/fabricmc/fabric/impl/network/PacketRegistryImpl.java (97%) rename {src => fabric-networking/src}/main/java/net/fabricmc/fabric/impl/network/PacketTypes.java (100%) rename {src => fabric-networking/src}/main/java/net/fabricmc/fabric/impl/network/ServerSidePacketRegistryImpl.java (95%) rename {src => fabric-networking/src}/main/java/net/fabricmc/fabric/impl/server/EntityTrackerStorageAccessor.java (100%) rename {src => fabric-networking/src}/main/java/net/fabricmc/fabric/impl/server/EntityTrackerStreamAccessor.java (100%) rename {src/main/java/net/fabricmc/fabric/mixin/networking => fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network}/MixinClientPlayNetworkHandler.java (91%) rename {src/main/java/net/fabricmc/fabric/mixin/networking => fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network}/MixinCustomPayloadC2SPacket.java (90%) rename {src/main/java/net/fabricmc/fabric/mixin/entity => fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network}/MixinEntityTracker.java (96%) rename {src/main/java/net/fabricmc/fabric/mixin/networking => fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network}/MixinServerPlayNetworkHandler.java (97%) rename {src/main/java/net/fabricmc/fabric/mixin/entity => fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network}/MixinThreadedAnvilChunkStorage.java (97%) create mode 100644 fabric-networking/src/main/resources/fabric-networking.mixins.json create mode 100644 fabric-networking/src/main/resources/fabric.mod.json create mode 100644 fabric-object-builders/build.gradle rename {src => fabric-object-builders/src}/main/java/net/fabricmc/fabric/api/block/FabricBlockSettings.java (75%) rename {src => fabric-object-builders/src}/main/java/net/fabricmc/fabric/api/entity/EntityTrackingRegistry.java (96%) rename {src => fabric-object-builders/src}/main/java/net/fabricmc/fabric/api/entity/FabricEntityTypeBuilder.java (100%) rename {src => fabric-object-builders/src}/main/java/net/fabricmc/fabric/api/event/registry/BlockConstructedCallback.java (100%) rename {src => fabric-object-builders/src}/main/java/net/fabricmc/fabric/api/event/registry/ItemConstructedCallback.java (100%) create mode 100644 fabric-object-builders/src/main/java/net/fabricmc/fabric/impl/block/FabricBlockSettingsDelegate.java create mode 100644 fabric-object-builders/src/main/java/net/fabricmc/fabric/impl/entity/FabricEntityType.java rename {src/main/java/net/fabricmc/fabric/mixin/events/objectbuilder => fabric-object-builders/src/main/java/net/fabricmc/fabric/mixin/builders}/MixinBlock.java (95%) rename {src/main/java/net/fabricmc/fabric/mixin/block => fabric-object-builders/src/main/java/net/fabricmc/fabric/mixin/builders}/MixinBlockBuilder.java (92%) rename {src/main/java/net/fabricmc/fabric/mixin/events/objectbuilder => fabric-object-builders/src/main/java/net/fabricmc/fabric/mixin/builders}/MixinItem.java (95%) create mode 100644 fabric-object-builders/src/main/resources/fabric-object-builders.mixins.json create mode 100644 fabric-object-builders/src/main/resources/fabric.mod.json create mode 100644 fabric-registry-sync/build.gradle rename {src => fabric-registry-sync/src}/main/java/net/fabricmc/fabric/impl/registry/ExtendedIdList.java (100%) create mode 100644 fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/FabricRegistryClientInit.java rename {src => fabric-registry-sync/src}/main/java/net/fabricmc/fabric/impl/registry/IdListUpdater.java (100%) rename {src => fabric-registry-sync/src}/main/java/net/fabricmc/fabric/impl/registry/ListenableRegistry.java (100%) rename {src => fabric-registry-sync/src}/main/java/net/fabricmc/fabric/impl/registry/RegistryListener.java (100%) rename {src => fabric-registry-sync/src}/main/java/net/fabricmc/fabric/impl/registry/RegistrySyncManager.java (100%) rename {src => fabric-registry-sync/src}/main/java/net/fabricmc/fabric/impl/registry/RemapException.java (100%) rename {src => fabric-registry-sync/src}/main/java/net/fabricmc/fabric/impl/registry/RemappableRegistry.java (100%) rename {src/main/java/net/fabricmc/fabric/impl/registry => fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla}/BootstrapBiomeRegistryListener.java (87%) rename {src/main/java/net/fabricmc/fabric/impl/registry => fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla}/BootstrapBlockRegistryListener.java (89%) rename {src/main/java/net/fabricmc/fabric/impl/registry => fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla}/BootstrapFluidRegistryListener.java (88%) rename {src/main/java/net/fabricmc/fabric/impl/registry => fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla}/BootstrapItemRegistryListener.java (91%) rename {src => fabric-registry-sync/src}/main/java/net/fabricmc/fabric/mixin/registry/MixinBootstrap.java (86%) rename {src => fabric-registry-sync/src}/main/java/net/fabricmc/fabric/mixin/registry/MixinIdList.java (100%) rename {src => fabric-registry-sync/src}/main/java/net/fabricmc/fabric/mixin/registry/MixinIdRegistry.java (100%) rename {src => fabric-registry-sync/src}/main/java/net/fabricmc/fabric/mixin/registry/MixinPlayerManager.java (87%) rename {src => fabric-registry-sync/src}/main/java/net/fabricmc/fabric/mixin/registry/MixinWorldSaveHandler.java (100%) rename {src => fabric-registry-sync/src}/main/java/net/fabricmc/fabric/mixin/registry/client/MixinBlockColorMap.java (100%) rename {src => fabric-registry-sync/src}/main/java/net/fabricmc/fabric/mixin/registry/client/MixinItemColorMap.java (100%) rename {src => fabric-registry-sync/src}/main/java/net/fabricmc/fabric/mixin/registry/client/MixinItemModelMap.java (100%) rename {src => fabric-registry-sync/src}/main/java/net/fabricmc/fabric/mixin/registry/client/MixinMinecraftClient.java (100%) rename {src => fabric-registry-sync/src}/main/java/net/fabricmc/fabric/mixin/registry/client/MixinParticleManager.java (100%) create mode 100644 fabric-registry-sync/src/main/resources/fabric-registry-sync.mixins.json create mode 100644 fabric-registry-sync/src/main/resources/fabric.mod.json create mode 100644 fabric-resource-loader/build.gradle rename {src => fabric-resource-loader/src}/main/java/net/fabricmc/fabric/api/resource/IdentifiableResourceReloadListener.java (100%) rename {src => fabric-resource-loader/src}/main/java/net/fabricmc/fabric/api/resource/ModResourcePack.java (100%) rename {src => fabric-resource-loader/src}/main/java/net/fabricmc/fabric/api/resource/ResourceManagerHelper.java (100%) rename {src => fabric-resource-loader/src}/main/java/net/fabricmc/fabric/api/resource/ResourceReloadListenerKeys.java (100%) rename {src => fabric-resource-loader/src}/main/java/net/fabricmc/fabric/api/resource/SimpleResourceReloadListener.java (100%) rename {src => fabric-resource-loader/src}/main/java/net/fabricmc/fabric/api/resource/SimpleSynchronousResourceReloadListener.java (100%) rename {src => fabric-resource-loader/src}/main/java/net/fabricmc/fabric/impl/resources/DeferredInputStream.java (100%) rename {src => fabric-resource-loader/src}/main/java/net/fabricmc/fabric/impl/resources/DeferredNioExecutionHandler.java (100%) rename {src => fabric-resource-loader/src}/main/java/net/fabricmc/fabric/impl/resources/ModNioResourcePack.java (100%) rename {src => fabric-resource-loader/src}/main/java/net/fabricmc/fabric/impl/resources/ModResourcePackCreator.java (100%) rename {src => fabric-resource-loader/src}/main/java/net/fabricmc/fabric/impl/resources/ModResourcePackUtil.java (91%) rename {src => fabric-resource-loader/src}/main/java/net/fabricmc/fabric/impl/resources/ResourceManagerHelperImpl.java (100%) rename {src => fabric-resource-loader/src}/main/java/net/fabricmc/fabric/mixin/resources/MixinKeyedResourceReloadListener.java (100%) rename {src => fabric-resource-loader/src}/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftGame.java (100%) rename {src => fabric-resource-loader/src}/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftServer.java (83%) rename {src => fabric-resource-loader/src}/main/java/net/fabricmc/fabric/mixin/resources/MixinReloadableResourceManagerImpl.java (100%) rename {src => fabric-resource-loader/src}/main/java/net/fabricmc/fabric/mixin/resources/MixinReloadableResourceManagerImplClient.java (100%) create mode 100644 fabric-resource-loader/src/main/resources/fabric-resource-loader.mixins.json create mode 100644 fabric-resource-loader/src/main/resources/fabric.mod.json create mode 100644 fabric-tag-hooks/build.gradle create mode 100644 fabric-tag-hooks/src/main/java/net/fabricmc/fabric/api/tag/TagRegistry.java rename {src/main/java/net/fabricmc/fabric/api => fabric-tag-hooks/src/main/java/net/fabricmc/fabric/impl}/tag/TagDelegate.java (96%) create mode 100644 fabric-tag-hooks/src/main/resources/fabric.mod.json rename {src/test => fabric-testmods}/java/net/fabricmc/fabric/block/FireMod.java (100%) rename {src/test => fabric-testmods}/java/net/fabricmc/fabric/colormapper/ColorProviderMod.java (100%) rename {src/test => fabric-testmods}/java/net/fabricmc/fabric/commands/CommandMod.java (100%) rename {src/test => fabric-testmods}/java/net/fabricmc/fabric/containers/ContainerMod.java (100%) rename {src/test => fabric-testmods}/java/net/fabricmc/fabric/containers/ContainerModClient.java (100%) rename {src/test => fabric-testmods}/java/net/fabricmc/fabric/events/PickBlockEventModClient.java (100%) rename {src/test => fabric-testmods}/java/net/fabricmc/fabric/events/ServerEventMod.java (100%) rename {src/test => fabric-testmods}/java/net/fabricmc/fabric/item/FuelMod.java (100%) rename {src/test => fabric-testmods}/java/net/fabricmc/fabric/itemgroup/ItemGroupMod.java (100%) rename {src/test => fabric-testmods}/java/net/fabricmc/fabric/keybinding/KeyBindingModClient.java (100%) rename {src/test => fabric-testmods}/java/net/fabricmc/fabric/loot/LootEntryMod.java (100%) rename {src/test => fabric-testmods}/java/net/fabricmc/fabric/model/ModelModClient.java (100%) rename {src/test => fabric-testmods}/java/net/fabricmc/fabric/resources/ResourceReloadModClient.java (100%) rename {src/test => fabric-testmods}/resources/data/minecraft/loot_tables/blocks/stone.json (100%) rename {src/test => fabric-testmods}/resources/mod.json (100%) create mode 100644 fabric-textures/build.gradle rename {src => fabric-textures/src}/main/java/net/fabricmc/fabric/api/client/texture/CustomSpriteLoader.java (100%) rename {src => fabric-textures/src}/main/java/net/fabricmc/fabric/api/client/texture/DependentSprite.java (100%) rename {src => fabric-textures/src}/main/java/net/fabricmc/fabric/api/event/client/ClientSpriteRegistryCallback.java (100%) rename {src => fabric-textures/src}/main/java/net/fabricmc/fabric/impl/client/texture/FabricSprite.java (100%) rename {src => fabric-textures/src}/main/java/net/fabricmc/fabric/mixin/client/texture/MixinSpriteAtlasTexture.java (100%) create mode 100644 fabric-textures/src/main/resources/fabric-textures.mixins.json create mode 100644 fabric-textures/src/main/resources/fabric.mod.json create mode 100644 settings.gradle delete mode 100644 src/main/java/net/fabricmc/fabric/api/tag/FabricBlockTags.java delete mode 100644 src/main/java/net/fabricmc/fabric/impl/FabricAPIClientInitializer.java delete mode 100644 src/main/java/net/fabricmc/fabric/impl/FabricAPIInitializer.java delete mode 100644 src/main/java/net/fabricmc/fabric/mixin/bugfix/MixinBiomeColors.java delete mode 100644 src/main/java/net/fabricmc/fabric/mixin/events/tick/MixinMinecraftServer.java delete mode 100644 src/main/java/net/fabricmc/fabric/mixin/tools/MixinMiningToolItem.java create mode 100644 src/main/resources/assets/fabric/icon.png delete mode 100644 src/main/resources/assets/fabric/textures/misc/default_icon.png delete mode 100644 src/main/resources/net.fabricmc.fabric.mixins.client.json delete mode 100644 src/main/resources/net.fabricmc.fabric.mixins.common.json diff --git a/.gitignore b/.gitignore index 3a765e3b0..d0b6b71d0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,10 @@ # Ignore everything /* +# Subprojects +!/fabric-* +/fabric-*/build + # Folders !/gradle !/src @@ -17,4 +21,4 @@ !/Jenkinsfile !/LICENSE !/README.md -!/settings.gradle \ No newline at end of file +!/settings.gradle diff --git a/build.gradle b/build.gradle index 2f94e84c2..15f847ca9 100644 --- a/build.gradle +++ b/build.gradle @@ -1,65 +1,138 @@ -buildscript { - repositories { - jcenter() - gradlePluginPortal() - maven { - name = 'Fabric' - url = 'https://maven.fabricmc.net/' - } - } - dependencies { - classpath "net.fabricmc:fabric-loom:0.2.2-SNAPSHOT" - } -} - plugins { id 'java' id 'eclipse' id 'idea' id 'maven-publish' + id 'fabric-loom' version '0.2.2-SNAPSHOT' apply false id 'com.matthewprenger.cursegradle' version "1.1.2" } -apply plugin: net.fabricmc.loom.LoomGradlePlugin +def ENV = System.getenv() -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -archivesBaseName = "fabric" - -def baseVersion = "0.2.7" +def baseVersion = "0.3.0" def mcVersion = "1.14 Pre-Release 5" -def ENV = System.getenv() -version = baseVersion + "+" + (ENV.BUILD_NUMBER ? ("build." + ENV.BUILD_NUMBER) : "local") +allprojects { + apply plugin: 'maven-publish' + apply plugin: 'fabric-loom' -minecraft { - refmapName = "net.fabricmc.fabric.refmap.json" + sourceCompatibility = 1.8 + targetCompatibility = 1.8 + + dependencies { + minecraft "com.mojang:minecraft:$mcVersion" + mappings "net.fabricmc:yarn:$mcVersion+build.6" + modCompile "net.fabricmc:fabric-loader:0.4.2+build.131" + } + + configurations { + dev + } + + repositories { + mavenLocal() + } + + publishing { + publications { + mavenJava(MavenPublication) { + artifact(file("${project.buildDir}/libs/$archivesBaseName-${version}-maven.jar")) { + builtBy remapMavenJar + } + artifact(sourcesJar) { + builtBy remapSourcesJar + } + } + } + + repositories { + maven { + url "http://mavenupload.modmuss50.me/" + if (project.hasProperty('mavenPass')) { + credentials { + username 'buildslave' + password project.getProperty('mavenPass') + } + } + } + } + } + + afterEvaluate { + artifacts { + dev file: file("${project.buildDir}/libs/$archivesBaseName-${version}-dev.jar"), type: "jar", builtBy: remapJar + } + + processResources { + inputs.property "version", project.version + + from(sourceSets.main.resources.srcDirs) { + include "fabric.mod.json" + expand "version": project.version + } + + from(sourceSets.main.resources.srcDirs) { + exclude "fabric.mod.json" + } + } + } + + task sourcesJar(type: Jar, dependsOn: classes) { + classifier = 'sources' + from sourceSets.main.allSource + } +} + +subprojects { + task remapMavenJar(type: Copy, dependsOn: remapJar) { + afterEvaluate { + from("${project.buildDir}/libs/$archivesBaseName-${version}.jar") + into("${project.buildDir}/libs/") + rename { String fn -> "$archivesBaseName-${version}-maven.jar" } + } + } +} + +task remapMavenJar(type: net.fabricmc.loom.task.RemapJar, dependsOn: remapJar) { + afterEvaluate { + println("${project.buildDir}/libs/${archivesBaseName}-${version}-dev.jar") + jar = file("${project.buildDir}/libs/${archivesBaseName}-${version}-dev.jar") + destination = file("${project.buildDir}/libs/${archivesBaseName}-${version}-maven.jar") + nestJar = false + } +} + +publishing { + publications { + mavenJava(MavenPublication) { + pom.withXml { + def depsNode = asNode().appendNode("dependencies") + subprojects.each { + def depNode = depsNode.appendNode("dependency") + depNode.appendNode("groupId", it.group) + depNode.appendNode("artifactId", it.name) + depNode.appendNode("version", it.version) + depNode.appendNode("scope", "compile") + } + } + } + } } dependencies { - minecraft "com.mojang:minecraft:$mcVersion" - mappings "net.fabricmc:yarn:$mcVersion+build.2" - modCompile "net.fabricmc:fabric-loader:0.4.2+build.131" -} - -processResources { - inputs.property "version", project.version - - from(sourceSets.main.resources.srcDirs) { - include "fabric.mod.json" - expand "version": project.version + afterEvaluate { + subprojects.each { + compile project(path: ":${it.name}", configuration: "dev") + include project("${it.name}:") + } } - from(sourceSets.main.resources.srcDirs) { - exclude "fabric.mod.json" - } + // workaround linux segfault + compile "org.lwjgl:lwjgl-jemalloc:3.2.1" } -task sourcesJar(type: Jar, dependsOn: classes) { - classifier = 'sources' - from sourceSets.main.allSource -} +archivesBaseName = "fabric" +version = baseVersion + "+" + (ENV.BUILD_NUMBER ? ("build." + ENV.BUILD_NUMBER) : "local") curseforge { if (project.hasProperty('curse_api_key')){ diff --git a/fabric-client-registries/build.gradle b/fabric-client-registries/build.gradle new file mode 100644 index 000000000..536e4e38e --- /dev/null +++ b/fabric-client-registries/build.gradle @@ -0,0 +1,6 @@ +archivesBaseName = "fabric-client-registries" +version = "0.1.0" + +dependencies { + compile project(path: ':fabric-lib', configuration: 'dev') +} diff --git a/src/main/java/net/fabricmc/fabric/api/client/keybinding/FabricKeyBinding.java b/fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/keybinding/FabricKeyBinding.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/client/keybinding/FabricKeyBinding.java rename to fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/keybinding/FabricKeyBinding.java diff --git a/src/main/java/net/fabricmc/fabric/api/client/keybinding/KeyBindingRegistry.java b/fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/keybinding/KeyBindingRegistry.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/client/keybinding/KeyBindingRegistry.java rename to fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/keybinding/KeyBindingRegistry.java diff --git a/src/main/java/net/fabricmc/fabric/api/client/render/BlockEntityRendererRegistry.java b/fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/render/BlockEntityRendererRegistry.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/client/render/BlockEntityRendererRegistry.java rename to fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/render/BlockEntityRendererRegistry.java diff --git a/src/main/java/net/fabricmc/fabric/api/client/render/ColorProviderRegistry.java b/fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/render/ColorProviderRegistry.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/client/render/ColorProviderRegistry.java rename to fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/render/ColorProviderRegistry.java diff --git a/src/main/java/net/fabricmc/fabric/api/client/render/EntityRendererRegistry.java b/fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/render/EntityRendererRegistry.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/client/render/EntityRendererRegistry.java rename to fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/render/EntityRendererRegistry.java diff --git a/src/main/java/net/fabricmc/fabric/impl/client/keybinding/KeyBindingRegistryImpl.java b/fabric-client-registries/src/main/java/net/fabricmc/fabric/impl/client/keybinding/KeyBindingRegistryImpl.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/client/keybinding/KeyBindingRegistryImpl.java rename to fabric-client-registries/src/main/java/net/fabricmc/fabric/impl/client/keybinding/KeyBindingRegistryImpl.java diff --git a/src/main/java/net/fabricmc/fabric/impl/client/render/ColorProviderRegistryImpl.java b/fabric-client-registries/src/main/java/net/fabricmc/fabric/impl/client/render/ColorProviderRegistryImpl.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/client/render/ColorProviderRegistryImpl.java rename to fabric-client-registries/src/main/java/net/fabricmc/fabric/impl/client/render/ColorProviderRegistryImpl.java diff --git a/src/main/java/net/fabricmc/fabric/mixin/client/keybinding/MixinGameOptions.java b/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/keybinding/MixinGameOptions.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/mixin/client/keybinding/MixinGameOptions.java rename to fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/keybinding/MixinGameOptions.java diff --git a/src/main/java/net/fabricmc/fabric/mixin/client/keybinding/MixinKeyBinding.java b/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/keybinding/MixinKeyBinding.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/mixin/client/keybinding/MixinKeyBinding.java rename to fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/keybinding/MixinKeyBinding.java diff --git a/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinBlockColorMap.java b/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinBlockColorMap.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/mixin/client/render/MixinBlockColorMap.java rename to fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinBlockColorMap.java diff --git a/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinBlockEntityRenderManager.java b/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinBlockEntityRenderManager.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/mixin/client/render/MixinBlockEntityRenderManager.java rename to fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinBlockEntityRenderManager.java diff --git a/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinEntityRenderManager.java b/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinEntityRenderManager.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/mixin/client/render/MixinEntityRenderManager.java rename to fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinEntityRenderManager.java diff --git a/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinItemColorMap.java b/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinItemColorMap.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/mixin/client/render/MixinItemColorMap.java rename to fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinItemColorMap.java diff --git a/fabric-client-registries/src/main/resources/fabric-client-registries.mixins.json b/fabric-client-registries/src/main/resources/fabric-client-registries.mixins.json new file mode 100644 index 000000000..a5b09a384 --- /dev/null +++ b/fabric-client-registries/src/main/resources/fabric-client-registries.mixins.json @@ -0,0 +1,16 @@ +{ + "required": true, + "package": "net.fabricmc.fabric.mixin.client", + "compatibilityLevel": "JAVA_8", + "client": [ + "keybinding.MixinGameOptions", + "keybinding.MixinKeyBinding", + "render.MixinBlockColorMap", + "render.MixinBlockEntityRenderManager", + "render.MixinEntityRenderManager", + "render.MixinItemColorMap" + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/fabric-client-registries/src/main/resources/fabric.mod.json b/fabric-client-registries/src/main/resources/fabric.mod.json new file mode 100644 index 000000000..4317819c3 --- /dev/null +++ b/fabric-client-registries/src/main/resources/fabric.mod.json @@ -0,0 +1,9 @@ +{ + "schemaVersion": 1, + "id": "fabric-client-registries", + "version": "${version}", + "license": "Apache-2.0", + "mixins": [ + "fabric-client-registries.mixins.json" + ] +} \ No newline at end of file diff --git a/fabric-commands/build.gradle b/fabric-commands/build.gradle new file mode 100644 index 000000000..0857ffbe8 --- /dev/null +++ b/fabric-commands/build.gradle @@ -0,0 +1,6 @@ +archivesBaseName = "fabric-registry-commands" +version = "0.1.0" + +dependencies { + compile project(path: ':fabric-lib', configuration: 'dev') +} diff --git a/src/main/java/net/fabricmc/fabric/api/registry/CommandRegistry.java b/fabric-commands/src/main/java/net/fabricmc/fabric/api/registry/CommandRegistry.java similarity index 63% rename from src/main/java/net/fabricmc/fabric/api/registry/CommandRegistry.java rename to fabric-commands/src/main/java/net/fabricmc/fabric/api/registry/CommandRegistry.java index 4a798fa4d..da0c1177c 100644 --- a/src/main/java/net/fabricmc/fabric/api/registry/CommandRegistry.java +++ b/fabric-commands/src/main/java/net/fabricmc/fabric/api/registry/CommandRegistry.java @@ -17,6 +17,7 @@ package net.fabricmc.fabric.api.registry; import com.mojang.brigadier.CommandDispatcher; +import net.fabricmc.fabric.impl.registry.CommandRegistryImpl; import net.minecraft.server.command.ServerCommandSource; import java.util.ArrayList; @@ -30,32 +31,12 @@ import java.util.function.Consumer; public class CommandRegistry { public static final CommandRegistry INSTANCE = new CommandRegistry(); - private final List>> serverCommands; - private final List>> dedicatedServerCommands; - - protected CommandRegistry() { - this.serverCommands = new ArrayList<>(); - this.dedicatedServerCommands = new ArrayList<>(); - } - - /** - * @deprecated Will be removed in 0.3.0; should not have been exposed. - */ - @Deprecated - public List>> entries(boolean dedicated) { - return Collections.unmodifiableList(dedicated ? dedicatedServerCommands : serverCommands); - } - /** * Register a command provider. * @param dedicated If true, the command is only registered on the dedicated server. * @param consumer The command provider, consuming {@link CommandDispatcher}. */ - public void register(boolean dedicated, Consumer> consumer) { - if (dedicated) { - dedicatedServerCommands.add(consumer); - } else { - serverCommands.add(consumer); - } + public void register(boolean dedicated, Consumer> consumer) { + CommandRegistryImpl.INSTANCE.register(dedicated, consumer); } } diff --git a/fabric-commands/src/main/java/net/fabricmc/fabric/impl/registry/CommandRegistryImpl.java b/fabric-commands/src/main/java/net/fabricmc/fabric/impl/registry/CommandRegistryImpl.java new file mode 100644 index 000000000..c70c41020 --- /dev/null +++ b/fabric-commands/src/main/java/net/fabricmc/fabric/impl/registry/CommandRegistryImpl.java @@ -0,0 +1,34 @@ +package net.fabricmc.fabric.impl.registry; + +import com.mojang.brigadier.CommandDispatcher; +import net.fabricmc.fabric.api.registry.CommandRegistry; +import net.minecraft.server.command.ServerCommandSource; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.function.Consumer; + +public class CommandRegistryImpl { + public static final CommandRegistryImpl INSTANCE = new CommandRegistryImpl(); + + private final List>> serverCommands; + private final List>> dedicatedServerCommands; + + public CommandRegistryImpl() { + this.serverCommands = new ArrayList<>(); + this.dedicatedServerCommands = new ArrayList<>(); + } + + public List>> entries(boolean dedicated) { + return Collections.unmodifiableList(dedicated ? dedicatedServerCommands : serverCommands); + } + + public void register(boolean dedicated, Consumer> consumer) { + if (dedicated) { + dedicatedServerCommands.add(consumer); + } else { + serverCommands.add(consumer); + } + } +} diff --git a/src/main/java/net/fabricmc/fabric/mixin/commands/MixinMinecraftDedicatedServer.java b/fabric-commands/src/main/java/net/fabricmc/fabric/mixin/registrycommands/MixinMinecraftDedicatedServer.java similarity index 88% rename from src/main/java/net/fabricmc/fabric/mixin/commands/MixinMinecraftDedicatedServer.java rename to fabric-commands/src/main/java/net/fabricmc/fabric/mixin/registrycommands/MixinMinecraftDedicatedServer.java index 59bd21d30..abc8ecc75 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/commands/MixinMinecraftDedicatedServer.java +++ b/fabric-commands/src/main/java/net/fabricmc/fabric/mixin/registrycommands/MixinMinecraftDedicatedServer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin.commands; +package net.fabricmc.fabric.mixin.registrycommands; import com.mojang.authlib.GameProfileRepository; import com.mojang.authlib.minecraft.MinecraftSessionService; @@ -22,6 +22,7 @@ import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; import com.mojang.brigadier.CommandDispatcher; import com.mojang.datafixers.DataFixer; import net.fabricmc.fabric.api.registry.CommandRegistry; +import net.fabricmc.fabric.impl.registry.CommandRegistryImpl; import net.minecraft.server.MinecraftServer; import net.minecraft.server.WorldGenerationProgressListenerFactory; import net.minecraft.server.command.CommandManager; @@ -46,7 +47,7 @@ public abstract class MixinMinecraftDedicatedServer extends MinecraftServer { @Inject(method = "setupServer", at = @At("HEAD")) private void setupServer(CallbackInfoReturnable info){ - CommandRegistry.INSTANCE.entries(false).forEach((e) -> e.accept(getCommandManager().getDispatcher())); - CommandRegistry.INSTANCE.entries(true).forEach((e) -> e.accept(getCommandManager().getDispatcher())); + CommandRegistryImpl.INSTANCE.entries(false).forEach((e) -> e.accept(getCommandManager().getDispatcher())); + CommandRegistryImpl.INSTANCE.entries(true).forEach((e) -> e.accept(getCommandManager().getDispatcher())); } } diff --git a/src/main/java/net/fabricmc/fabric/mixin/commands/MixinServerCommandManager.java b/fabric-commands/src/main/java/net/fabricmc/fabric/mixin/registrycommands/MixinServerCommandManager.java similarity index 88% rename from src/main/java/net/fabricmc/fabric/mixin/commands/MixinServerCommandManager.java rename to fabric-commands/src/main/java/net/fabricmc/fabric/mixin/registrycommands/MixinServerCommandManager.java index 42e2b83c3..da6c65c1a 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/commands/MixinServerCommandManager.java +++ b/fabric-commands/src/main/java/net/fabricmc/fabric/mixin/registrycommands/MixinServerCommandManager.java @@ -14,10 +14,11 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin.commands; +package net.fabricmc.fabric.mixin.registrycommands; import com.mojang.brigadier.CommandDispatcher; import net.fabricmc.fabric.api.registry.CommandRegistry; +import net.fabricmc.fabric.impl.registry.CommandRegistryImpl; import net.minecraft.server.command.CommandManager; import net.minecraft.server.command.ServerCommandSource; import org.apache.logging.log4j.Logger; @@ -38,7 +39,7 @@ public class MixinServerCommandManager { public void addMethods(boolean dedicated, CallbackInfo info) { // TODO: Run before findAmbiguities if(!dedicated){ - CommandRegistry.INSTANCE.entries(false).forEach((e) -> e.accept(dispatcher)); + CommandRegistryImpl.INSTANCE.entries(false).forEach((e) -> e.accept(dispatcher)); } } } diff --git a/fabric-commands/src/main/resources/fabric-commands.mixins.json b/fabric-commands/src/main/resources/fabric-commands.mixins.json new file mode 100644 index 000000000..25bbd5bc7 --- /dev/null +++ b/fabric-commands/src/main/resources/fabric-commands.mixins.json @@ -0,0 +1,12 @@ +{ + "required": true, + "package": "net.fabricmc.fabric.mixin.registrycommands", + "compatibilityLevel": "JAVA_8", + "mixins": [ + "MixinMinecraftDedicatedServer", + "MixinServerCommandManager" + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/fabric-commands/src/main/resources/fabric.mod.json b/fabric-commands/src/main/resources/fabric.mod.json new file mode 100644 index 000000000..f5868b7b1 --- /dev/null +++ b/fabric-commands/src/main/resources/fabric.mod.json @@ -0,0 +1,9 @@ +{ + "schemaVersion": 1, + "id": "fabric-commands", + "version": "${version}", + "license": "Apache-2.0", + "mixins": [ + "fabric-commands.mixins.json" + ] +} \ No newline at end of file diff --git a/fabric-containers/build.gradle b/fabric-containers/build.gradle new file mode 100644 index 000000000..64baa01f8 --- /dev/null +++ b/fabric-containers/build.gradle @@ -0,0 +1,7 @@ +archivesBaseName = "fabric-containers" +version = "0.1.0" + +dependencies { + compile project(path: ':fabric-lib', configuration: 'dev') + compile project(path: ':fabric-networking', configuration: 'dev') +} diff --git a/src/main/java/net/fabricmc/fabric/api/client/screen/ContainerScreenFactory.java b/fabric-containers/src/main/java/net/fabricmc/fabric/api/client/screen/ContainerScreenFactory.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/client/screen/ContainerScreenFactory.java rename to fabric-containers/src/main/java/net/fabricmc/fabric/api/client/screen/ContainerScreenFactory.java diff --git a/src/main/java/net/fabricmc/fabric/api/client/screen/ScreenProviderRegistry.java b/fabric-containers/src/main/java/net/fabricmc/fabric/api/client/screen/ScreenProviderRegistry.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/client/screen/ScreenProviderRegistry.java rename to fabric-containers/src/main/java/net/fabricmc/fabric/api/client/screen/ScreenProviderRegistry.java diff --git a/src/main/java/net/fabricmc/fabric/api/container/ContainerFactory.java b/fabric-containers/src/main/java/net/fabricmc/fabric/api/container/ContainerFactory.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/container/ContainerFactory.java rename to fabric-containers/src/main/java/net/fabricmc/fabric/api/container/ContainerFactory.java diff --git a/src/main/java/net/fabricmc/fabric/api/container/ContainerProviderRegistry.java b/fabric-containers/src/main/java/net/fabricmc/fabric/api/container/ContainerProviderRegistry.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/container/ContainerProviderRegistry.java rename to fabric-containers/src/main/java/net/fabricmc/fabric/api/container/ContainerProviderRegistry.java diff --git a/src/main/java/net/fabricmc/fabric/impl/client/gui/ScreenProviderRegistryImpl.java b/fabric-containers/src/main/java/net/fabricmc/fabric/impl/client/gui/ScreenProviderRegistryImpl.java similarity index 99% rename from src/main/java/net/fabricmc/fabric/impl/client/gui/ScreenProviderRegistryImpl.java rename to fabric-containers/src/main/java/net/fabricmc/fabric/impl/client/gui/ScreenProviderRegistryImpl.java index a45b09faf..672b5d957 100644 --- a/src/main/java/net/fabricmc/fabric/impl/client/gui/ScreenProviderRegistryImpl.java +++ b/fabric-containers/src/main/java/net/fabricmc/fabric/impl/client/gui/ScreenProviderRegistryImpl.java @@ -62,7 +62,7 @@ public class ScreenProviderRegistryImpl implements ScreenProviderRegistry { }); } - public void init() { + public static void init() { ClientSidePacketRegistry.INSTANCE.register(PacketTypes.OPEN_CONTAINER, (packetContext, packetByteBuf) -> { Identifier identifier = packetByteBuf.readIdentifier(); int syncId = packetByteBuf.readUnsignedByte(); diff --git a/src/main/java/net/fabricmc/fabric/impl/container/ContainerProviderImpl.java b/fabric-containers/src/main/java/net/fabricmc/fabric/impl/container/ContainerProviderImpl.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/container/ContainerProviderImpl.java rename to fabric-containers/src/main/java/net/fabricmc/fabric/impl/container/ContainerProviderImpl.java diff --git a/src/main/java/net/fabricmc/fabric/impl/container/SyncIdProvider.java b/fabric-containers/src/main/java/net/fabricmc/fabric/impl/container/SyncIdProvider.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/container/SyncIdProvider.java rename to fabric-containers/src/main/java/net/fabricmc/fabric/impl/container/SyncIdProvider.java diff --git a/src/main/java/net/fabricmc/fabric/mixin/container/MixinServerPlayerEntity.java b/fabric-containers/src/main/java/net/fabricmc/fabric/mixin/container/MixinServerPlayerEntity.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/mixin/container/MixinServerPlayerEntity.java rename to fabric-containers/src/main/java/net/fabricmc/fabric/mixin/container/MixinServerPlayerEntity.java diff --git a/fabric-containers/src/main/resources/fabric-containers.mixins.json b/fabric-containers/src/main/resources/fabric-containers.mixins.json new file mode 100644 index 000000000..cf38f370d --- /dev/null +++ b/fabric-containers/src/main/resources/fabric-containers.mixins.json @@ -0,0 +1,11 @@ +{ + "required": true, + "package": "net.fabricmc.fabric.mixin.container", + "compatibilityLevel": "JAVA_8", + "mixins": [ + "MixinServerPlayerEntity" + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/fabric-containers/src/main/resources/fabric.mod.json b/fabric-containers/src/main/resources/fabric.mod.json new file mode 100644 index 000000000..e20db5e28 --- /dev/null +++ b/fabric-containers/src/main/resources/fabric.mod.json @@ -0,0 +1,14 @@ +{ + "schemaVersion": 1, + "id": "fabric-containers", + "version": "${version}", + "license": "Apache-2.0", + "mixins": [ + "fabric-containers.mixins.json" + ], + "entrypoints": { + "client": [ + "net.fabricmc.fabric.impl.client.gui.ScreenProviderRegistryImpl::init" + ] + } +} \ No newline at end of file diff --git a/fabric-content-registries/build.gradle b/fabric-content-registries/build.gradle new file mode 100644 index 000000000..ce422f375 --- /dev/null +++ b/fabric-content-registries/build.gradle @@ -0,0 +1,7 @@ +archivesBaseName = "fabric-content-registries" +version = "0.1.0" + +dependencies { + compile project(path: ':fabric-lib', configuration: 'dev') + compile project(path: ':fabric-resource-loader', configuration: 'dev') +} diff --git a/src/main/java/net/fabricmc/fabric/api/registry/CompostingChanceRegistry.java b/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/registry/CompostingChanceRegistry.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/registry/CompostingChanceRegistry.java rename to fabric-content-registries/src/main/java/net/fabricmc/fabric/api/registry/CompostingChanceRegistry.java diff --git a/src/main/java/net/fabricmc/fabric/api/registry/FlammableBlockRegistry.java b/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/registry/FlammableBlockRegistry.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/registry/FlammableBlockRegistry.java rename to fabric-content-registries/src/main/java/net/fabricmc/fabric/api/registry/FlammableBlockRegistry.java diff --git a/src/main/java/net/fabricmc/fabric/api/registry/FuelRegistry.java b/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/registry/FuelRegistry.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/registry/FuelRegistry.java rename to fabric-content-registries/src/main/java/net/fabricmc/fabric/api/registry/FuelRegistry.java diff --git a/src/main/java/net/fabricmc/fabric/api/registry/LootEntryTypeRegistry.java b/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/registry/LootEntryTypeRegistry.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/registry/LootEntryTypeRegistry.java rename to fabric-content-registries/src/main/java/net/fabricmc/fabric/api/registry/LootEntryTypeRegistry.java diff --git a/src/main/java/net/fabricmc/fabric/api/util/Block2ObjectMap.java b/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/util/Block2ObjectMap.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/util/Block2ObjectMap.java rename to fabric-content-registries/src/main/java/net/fabricmc/fabric/api/util/Block2ObjectMap.java diff --git a/src/main/java/net/fabricmc/fabric/api/util/Item2ObjectMap.java b/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/util/Item2ObjectMap.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/util/Item2ObjectMap.java rename to fabric-content-registries/src/main/java/net/fabricmc/fabric/api/util/Item2ObjectMap.java diff --git a/src/main/java/net/fabricmc/fabric/impl/registry/CompostingChanceRegistryImpl.java b/fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/CompostingChanceRegistryImpl.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/registry/CompostingChanceRegistryImpl.java rename to fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/CompostingChanceRegistryImpl.java diff --git a/src/main/java/net/fabricmc/fabric/impl/registry/FireBlockHooks.java b/fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/FireBlockHooks.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/registry/FireBlockHooks.java rename to fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/FireBlockHooks.java diff --git a/src/main/java/net/fabricmc/fabric/impl/registry/FlammableBlockRegistryImpl.java b/fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/FlammableBlockRegistryImpl.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/registry/FlammableBlockRegistryImpl.java rename to fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/FlammableBlockRegistryImpl.java diff --git a/src/main/java/net/fabricmc/fabric/impl/registry/FuelRegistryImpl.java b/fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/FuelRegistryImpl.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/registry/FuelRegistryImpl.java rename to fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/FuelRegistryImpl.java diff --git a/src/main/java/net/fabricmc/fabric/impl/registry/LootEntryTypeRegistryImpl.java b/fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/LootEntryTypeRegistryImpl.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/registry/LootEntryTypeRegistryImpl.java rename to fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/LootEntryTypeRegistryImpl.java diff --git a/src/main/java/net/fabricmc/fabric/mixin/item/MixinAbstractFurnaceBlockEntity.java b/fabric-content-registries/src/main/java/net/fabricmc/fabric/mixin/registryextras/MixinAbstractFurnaceBlockEntity.java similarity index 96% rename from src/main/java/net/fabricmc/fabric/mixin/item/MixinAbstractFurnaceBlockEntity.java rename to fabric-content-registries/src/main/java/net/fabricmc/fabric/mixin/registryextras/MixinAbstractFurnaceBlockEntity.java index 84c7b2a3f..7cb1587c4 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/item/MixinAbstractFurnaceBlockEntity.java +++ b/fabric-content-registries/src/main/java/net/fabricmc/fabric/mixin/registryextras/MixinAbstractFurnaceBlockEntity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin.item; +package net.fabricmc.fabric.mixin.registryextras; import net.fabricmc.fabric.impl.registry.FuelRegistryImpl; import net.minecraft.block.entity.AbstractFurnaceBlockEntity; diff --git a/src/main/java/net/fabricmc/fabric/mixin/block/MixinFireBlock.java b/fabric-content-registries/src/main/java/net/fabricmc/fabric/mixin/registryextras/MixinFireBlock.java similarity index 98% rename from src/main/java/net/fabricmc/fabric/mixin/block/MixinFireBlock.java rename to fabric-content-registries/src/main/java/net/fabricmc/fabric/mixin/registryextras/MixinFireBlock.java index 6341dd4e5..43ee0279d 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/block/MixinFireBlock.java +++ b/fabric-content-registries/src/main/java/net/fabricmc/fabric/mixin/registryextras/MixinFireBlock.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin.block; +package net.fabricmc.fabric.mixin.registryextras; import net.fabricmc.fabric.api.registry.FlammableBlockRegistry; import net.fabricmc.fabric.impl.registry.FireBlockHooks; diff --git a/fabric-content-registries/src/main/resources/fabric-content-registries.mixins.json b/fabric-content-registries/src/main/resources/fabric-content-registries.mixins.json new file mode 100644 index 000000000..b63f2c3ca --- /dev/null +++ b/fabric-content-registries/src/main/resources/fabric-content-registries.mixins.json @@ -0,0 +1,12 @@ +{ + "required": true, + "package": "net.fabricmc.fabric.mixin.registryextras", + "compatibilityLevel": "JAVA_8", + "mixins": [ + "MixinAbstractFurnaceBlockEntity", + "MixinFireBlock" + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/fabric-content-registries/src/main/resources/fabric.mod.json b/fabric-content-registries/src/main/resources/fabric.mod.json new file mode 100644 index 000000000..8a1991286 --- /dev/null +++ b/fabric-content-registries/src/main/resources/fabric.mod.json @@ -0,0 +1,9 @@ +{ + "schemaVersion": 1, + "id": "fabric-content-registries", + "version": "${version}", + "license": "Apache-2.0", + "mixins": [ + "fabric-content-registries.mixins.json" + ] +} \ No newline at end of file diff --git a/fabric-crash-report-info/build.gradle b/fabric-crash-report-info/build.gradle new file mode 100644 index 000000000..54c2f2743 --- /dev/null +++ b/fabric-crash-report-info/build.gradle @@ -0,0 +1,2 @@ +archivesBaseName = "fabric-crash-report-info" +version = "0.1.0" diff --git a/src/main/java/net/fabricmc/fabric/mixin/misc/MixinCrashReport.java b/fabric-crash-report-info/src/main/java/net/fabricmc/fabric/mixin/crash/MixinCrashReport.java similarity index 87% rename from src/main/java/net/fabricmc/fabric/mixin/misc/MixinCrashReport.java rename to fabric-crash-report-info/src/main/java/net/fabricmc/fabric/mixin/crash/MixinCrashReport.java index 57fce6f8d..6f23d54e8 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/misc/MixinCrashReport.java +++ b/fabric-crash-report-info/src/main/java/net/fabricmc/fabric/mixin/crash/MixinCrashReport.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin.misc; +package net.fabricmc.fabric.mixin.crash; import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.ModContainer; @@ -38,9 +38,7 @@ public abstract class MixinCrashReport { getSystemDetailsSection().add("Fabric Mods", () -> { Map mods = new TreeMap<>(); for (ModContainer container : FabricLoader.getInstance().getAllMods()) { - // mods.put(container.getInfo().getName(), container.getInfo().getVersionString() + " (" + container.getOriginUrl().getFile() + ")"); - // TODO getName, getOriginUrl - mods.put(container.getMetadata().getId(), container.getMetadata().getVersion().getFriendlyString()); + mods.put(container.getMetadata().getId(), container.getMetadata().getName() + " " + container.getMetadata().getVersion().getFriendlyString()); } StringBuilder modString = new StringBuilder(); diff --git a/fabric-crash-report-info/src/main/resources/fabric-crash-report-info.mixins.json b/fabric-crash-report-info/src/main/resources/fabric-crash-report-info.mixins.json new file mode 100644 index 000000000..ab5a73cd3 --- /dev/null +++ b/fabric-crash-report-info/src/main/resources/fabric-crash-report-info.mixins.json @@ -0,0 +1,11 @@ +{ + "required": true, + "package": "net.fabricmc.fabric.mixin.crash", + "compatibilityLevel": "JAVA_8", + "mixins": [ + "MixinCrashReport" + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/fabric-crash-report-info/src/main/resources/fabric.mod.json b/fabric-crash-report-info/src/main/resources/fabric.mod.json new file mode 100644 index 000000000..0a0ae9a3d --- /dev/null +++ b/fabric-crash-report-info/src/main/resources/fabric.mod.json @@ -0,0 +1,9 @@ +{ + "schemaVersion": 1, + "id": "fabric-crash-report-info", + "version": "${version}", + "license": "Apache-2.0", + "mixins": [ + "fabric-crash-report-info.mixins.json" + ] +} \ No newline at end of file diff --git a/fabric-creative-tabs/build.gradle b/fabric-creative-tabs/build.gradle new file mode 100644 index 000000000..70effab55 --- /dev/null +++ b/fabric-creative-tabs/build.gradle @@ -0,0 +1,6 @@ +archivesBaseName = "fabric-creative-tabs" +version = "0.1.0" + +dependencies { + compile project(path: ':fabric-resource-loader', configuration: 'dev') +} diff --git a/src/main/java/net/fabricmc/fabric/api/client/itemgroup/FabricItemGroupBuilder.java b/fabric-creative-tabs/src/main/java/net/fabricmc/fabric/api/client/itemgroup/FabricItemGroupBuilder.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/client/itemgroup/FabricItemGroupBuilder.java rename to fabric-creative-tabs/src/main/java/net/fabricmc/fabric/api/client/itemgroup/FabricItemGroupBuilder.java diff --git a/src/main/java/net/fabricmc/fabric/impl/itemgroup/CreativeGuiExtensions.java b/fabric-creative-tabs/src/main/java/net/fabricmc/fabric/impl/itemgroup/CreativeGuiExtensions.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/itemgroup/CreativeGuiExtensions.java rename to fabric-creative-tabs/src/main/java/net/fabricmc/fabric/impl/itemgroup/CreativeGuiExtensions.java diff --git a/src/main/java/net/fabricmc/fabric/impl/itemgroup/FabricCreativeGuiComponents.java b/fabric-creative-tabs/src/main/java/net/fabricmc/fabric/impl/itemgroup/FabricCreativeGuiComponents.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/itemgroup/FabricCreativeGuiComponents.java rename to fabric-creative-tabs/src/main/java/net/fabricmc/fabric/impl/itemgroup/FabricCreativeGuiComponents.java diff --git a/src/main/java/net/fabricmc/fabric/impl/itemgroup/ItemGroupExtensions.java b/fabric-creative-tabs/src/main/java/net/fabricmc/fabric/impl/itemgroup/ItemGroupExtensions.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/itemgroup/ItemGroupExtensions.java rename to fabric-creative-tabs/src/main/java/net/fabricmc/fabric/impl/itemgroup/ItemGroupExtensions.java diff --git a/src/main/java/net/fabricmc/fabric/mixin/itemgroup/MixinItemGroup.java b/fabric-creative-tabs/src/main/java/net/fabricmc/fabric/mixin/itemgroup/MixinItemGroup.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/mixin/itemgroup/MixinItemGroup.java rename to fabric-creative-tabs/src/main/java/net/fabricmc/fabric/mixin/itemgroup/MixinItemGroup.java diff --git a/src/main/java/net/fabricmc/fabric/mixin/client/itemgroup/MixinCreativePlayerInventoryGui.java b/fabric-creative-tabs/src/main/java/net/fabricmc/fabric/mixin/itemgroup/client/MixinCreativePlayerInventoryGui.java similarity index 99% rename from src/main/java/net/fabricmc/fabric/mixin/client/itemgroup/MixinCreativePlayerInventoryGui.java rename to fabric-creative-tabs/src/main/java/net/fabricmc/fabric/mixin/itemgroup/client/MixinCreativePlayerInventoryGui.java index c03d2ef92..616532467 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/client/itemgroup/MixinCreativePlayerInventoryGui.java +++ b/fabric-creative-tabs/src/main/java/net/fabricmc/fabric/mixin/itemgroup/client/MixinCreativePlayerInventoryGui.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin.client.itemgroup; +package net.fabricmc.fabric.mixin.itemgroup.client; import net.fabricmc.fabric.impl.itemgroup.CreativeGuiExtensions; import net.fabricmc.fabric.impl.itemgroup.FabricCreativeGuiComponents; diff --git a/src/main/java/net/fabricmc/fabric/mixin/client/itemgroup/MixinItemGroup.java b/fabric-creative-tabs/src/main/java/net/fabricmc/fabric/mixin/itemgroup/client/MixinItemGroup.java similarity index 97% rename from src/main/java/net/fabricmc/fabric/mixin/client/itemgroup/MixinItemGroup.java rename to fabric-creative-tabs/src/main/java/net/fabricmc/fabric/mixin/itemgroup/client/MixinItemGroup.java index 88c332190..7ca966b78 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/client/itemgroup/MixinItemGroup.java +++ b/fabric-creative-tabs/src/main/java/net/fabricmc/fabric/mixin/itemgroup/client/MixinItemGroup.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin.client.itemgroup; +package net.fabricmc.fabric.mixin.itemgroup.client; import net.fabricmc.fabric.impl.itemgroup.FabricCreativeGuiComponents; import net.minecraft.item.ItemGroup; diff --git a/src/main/resources/assets/fabric/lang/en_us.json b/fabric-creative-tabs/src/main/resources/assets/fabric/lang/en_us.json similarity index 100% rename from src/main/resources/assets/fabric/lang/en_us.json rename to fabric-creative-tabs/src/main/resources/assets/fabric/lang/en_us.json diff --git a/src/main/resources/assets/fabric/textures/gui/creative_buttons.png b/fabric-creative-tabs/src/main/resources/assets/fabric/textures/gui/creative_buttons.png similarity index 100% rename from src/main/resources/assets/fabric/textures/gui/creative_buttons.png rename to fabric-creative-tabs/src/main/resources/assets/fabric/textures/gui/creative_buttons.png diff --git a/fabric-creative-tabs/src/main/resources/fabric-creative-tabs.mixins.json b/fabric-creative-tabs/src/main/resources/fabric-creative-tabs.mixins.json new file mode 100644 index 000000000..5873fc547 --- /dev/null +++ b/fabric-creative-tabs/src/main/resources/fabric-creative-tabs.mixins.json @@ -0,0 +1,15 @@ +{ + "required": true, + "package": "net.fabricmc.fabric.mixin.itemgroup", + "compatibilityLevel": "JAVA_8", + "mixins": [ + "MixinItemGroup" + ], + "client": [ + "client.MixinItemGroup", + "client.MixinCreativePlayerInventoryGui" + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/fabric-creative-tabs/src/main/resources/fabric.mod.json b/fabric-creative-tabs/src/main/resources/fabric.mod.json new file mode 100644 index 000000000..01175f743 --- /dev/null +++ b/fabric-creative-tabs/src/main/resources/fabric.mod.json @@ -0,0 +1,9 @@ +{ + "schemaVersion": 1, + "id": "fabric-creative-tabs", + "version": "${version}", + "license": "Apache-2.0", + "mixins": [ + "fabric-creative-tabs.mixins.json" + ] +} \ No newline at end of file diff --git a/fabric-events-interaction/build.gradle b/fabric-events-interaction/build.gradle new file mode 100644 index 000000000..550388c09 --- /dev/null +++ b/fabric-events-interaction/build.gradle @@ -0,0 +1,6 @@ +archivesBaseName = "fabric-events-interaction" +version = "0.1.0" + +dependencies { + compile project(path: ':fabric-lib', configuration: 'dev') +} diff --git a/src/main/java/net/fabricmc/fabric/api/block/BlockAttackInteractionAware.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/block/BlockAttackInteractionAware.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/block/BlockAttackInteractionAware.java rename to fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/block/BlockAttackInteractionAware.java diff --git a/src/main/java/net/fabricmc/fabric/api/block/BlockPickInteractionAware.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/block/BlockPickInteractionAware.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/block/BlockPickInteractionAware.java rename to fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/block/BlockPickInteractionAware.java diff --git a/src/main/java/net/fabricmc/fabric/api/entity/EntityPickInteractionAware.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/entity/EntityPickInteractionAware.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/entity/EntityPickInteractionAware.java rename to fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/entity/EntityPickInteractionAware.java diff --git a/src/main/java/net/fabricmc/fabric/api/event/client/player/ClientPickBlockApplyCallback.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/client/player/ClientPickBlockApplyCallback.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/event/client/player/ClientPickBlockApplyCallback.java rename to fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/client/player/ClientPickBlockApplyCallback.java diff --git a/src/main/java/net/fabricmc/fabric/api/event/client/player/ClientPickBlockCallback.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/client/player/ClientPickBlockCallback.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/event/client/player/ClientPickBlockCallback.java rename to fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/client/player/ClientPickBlockCallback.java diff --git a/src/main/java/net/fabricmc/fabric/api/event/client/player/ClientPickBlockGatherCallback.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/client/player/ClientPickBlockGatherCallback.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/event/client/player/ClientPickBlockGatherCallback.java rename to fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/client/player/ClientPickBlockGatherCallback.java diff --git a/src/main/java/net/fabricmc/fabric/api/event/player/AttackBlockCallback.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/AttackBlockCallback.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/event/player/AttackBlockCallback.java rename to fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/AttackBlockCallback.java diff --git a/src/main/java/net/fabricmc/fabric/api/event/player/AttackEntityCallback.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/AttackEntityCallback.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/event/player/AttackEntityCallback.java rename to fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/AttackEntityCallback.java diff --git a/src/main/java/net/fabricmc/fabric/api/event/player/UseBlockCallback.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/UseBlockCallback.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/event/player/UseBlockCallback.java rename to fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/UseBlockCallback.java diff --git a/src/main/java/net/fabricmc/fabric/api/event/player/UseEntityCallback.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/UseEntityCallback.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/event/player/UseEntityCallback.java rename to fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/UseEntityCallback.java diff --git a/src/main/java/net/fabricmc/fabric/api/event/player/UseItemCallback.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/UseItemCallback.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/event/player/UseItemCallback.java rename to fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/UseItemCallback.java diff --git a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/impl/event/InteractionEventsRouter.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/impl/event/InteractionEventsRouter.java new file mode 100644 index 000000000..9d7669a1c --- /dev/null +++ b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/impl/event/InteractionEventsRouter.java @@ -0,0 +1,27 @@ +package net.fabricmc.fabric.impl.event; + +import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.block.BlockAttackInteractionAware; +import net.fabricmc.fabric.api.event.player.AttackBlockCallback; +import net.minecraft.block.BlockState; +import net.minecraft.util.ActionResult; + +public class InteractionEventsRouter implements ModInitializer { + @Override + public void onInitialize() { + AttackBlockCallback.EVENT.register((player, world, hand, pos, direction) -> { + BlockState state = world.getBlockState(pos); + if (state instanceof BlockAttackInteractionAware) { + if (((BlockAttackInteractionAware) state).onAttackInteraction(state, world, pos, player, hand, direction)) { + return ActionResult.FAIL; + } + } else if (state.getBlock() instanceof BlockAttackInteractionAware) { + if (((BlockAttackInteractionAware) state.getBlock()).onAttackInteraction(state, world, pos, player, hand, direction)) { + return ActionResult.FAIL; + } + } + + return ActionResult.PASS; + }); + } +} diff --git a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/impl/event/InteractionEventsRouterClient.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/impl/event/InteractionEventsRouterClient.java new file mode 100644 index 000000000..20214c2ed --- /dev/null +++ b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/impl/event/InteractionEventsRouterClient.java @@ -0,0 +1,38 @@ +package net.fabricmc.fabric.impl.event; + +import net.fabricmc.api.ClientModInitializer; +import net.fabricmc.fabric.api.block.BlockPickInteractionAware; +import net.fabricmc.fabric.api.entity.EntityPickInteractionAware; +import net.fabricmc.fabric.api.event.client.player.ClientPickBlockGatherCallback; +import net.minecraft.block.BlockState; +import net.minecraft.entity.Entity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.hit.EntityHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.BlockView; + +public class InteractionEventsRouterClient implements ClientModInitializer { + @Override + public void onInitializeClient() { + ClientPickBlockGatherCallback.EVENT.register(((player, result) -> { + if (result instanceof BlockHitResult) { + BlockView view = player.getEntityWorld(); + BlockPos pos = ((BlockHitResult) result).getBlockPos(); + BlockState state = view.getBlockState(pos); + + if (state.getBlock() instanceof BlockPickInteractionAware) { + return (((BlockPickInteractionAware) state.getBlock()).getPickedStack(state, view, pos, player, result)); + } + } else if (result instanceof EntityHitResult) { + Entity entity = ((EntityHitResult) result).getEntity(); + + if (entity instanceof EntityPickInteractionAware) { + return ((EntityPickInteractionAware) entity).getPickedStack(player, result); + } + } + + return ItemStack.EMPTY; + })); + } +} diff --git a/src/main/java/net/fabricmc/fabric/mixin/events/playerinteraction/MixinClientPlayerInteractionManager.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinClientPlayerInteractionManager.java similarity index 99% rename from src/main/java/net/fabricmc/fabric/mixin/events/playerinteraction/MixinClientPlayerInteractionManager.java rename to fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinClientPlayerInteractionManager.java index a1b5c5fc7..04ac335b6 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/events/playerinteraction/MixinClientPlayerInteractionManager.java +++ b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinClientPlayerInteractionManager.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin.events.playerinteraction; +package net.fabricmc.fabric.mixin.eventsinteraction; import net.fabricmc.fabric.api.event.player.*; import net.minecraft.client.MinecraftClient; diff --git a/src/main/java/net/fabricmc/fabric/mixin/events/playerinteraction/MixinMinecraftClient.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinMinecraftClient.java similarity index 98% rename from src/main/java/net/fabricmc/fabric/mixin/events/playerinteraction/MixinMinecraftClient.java rename to fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinMinecraftClient.java index b8ec4b02b..0d7bf3beb 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/events/playerinteraction/MixinMinecraftClient.java +++ b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinMinecraftClient.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin.events.playerinteraction; +package net.fabricmc.fabric.mixin.eventsinteraction; import net.fabricmc.fabric.api.event.client.player.ClientPickBlockApplyCallback; import net.fabricmc.fabric.api.event.client.player.ClientPickBlockCallback; diff --git a/src/main/java/net/fabricmc/fabric/mixin/events/playerinteraction/MixinServerPlayNetworkHandler.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinServerPlayNetworkHandler.java similarity index 97% rename from src/main/java/net/fabricmc/fabric/mixin/events/playerinteraction/MixinServerPlayNetworkHandler.java rename to fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinServerPlayNetworkHandler.java index c60a08645..d29f79a5f 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/events/playerinteraction/MixinServerPlayNetworkHandler.java +++ b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinServerPlayNetworkHandler.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin.events.playerinteraction; +package net.fabricmc.fabric.mixin.eventsinteraction; import net.fabricmc.fabric.api.event.player.UseEntityCallback; import net.minecraft.entity.Entity; diff --git a/src/main/java/net/fabricmc/fabric/mixin/events/playerinteraction/MixinServerPlayerEntity.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinServerPlayerEntity.java similarity index 96% rename from src/main/java/net/fabricmc/fabric/mixin/events/playerinteraction/MixinServerPlayerEntity.java rename to fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinServerPlayerEntity.java index 13a276294..e17115991 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/events/playerinteraction/MixinServerPlayerEntity.java +++ b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinServerPlayerEntity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin.events.playerinteraction; +package net.fabricmc.fabric.mixin.eventsinteraction; import net.fabricmc.fabric.api.event.player.AttackEntityCallback; import net.minecraft.entity.Entity; diff --git a/src/main/java/net/fabricmc/fabric/mixin/events/playerinteraction/MixinServerPlayerInteractionManager.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinServerPlayerInteractionManager.java similarity index 98% rename from src/main/java/net/fabricmc/fabric/mixin/events/playerinteraction/MixinServerPlayerInteractionManager.java rename to fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinServerPlayerInteractionManager.java index ce5f862e7..95e7fac06 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/events/playerinteraction/MixinServerPlayerInteractionManager.java +++ b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinServerPlayerInteractionManager.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin.events.playerinteraction; +package net.fabricmc.fabric.mixin.eventsinteraction; import net.fabricmc.fabric.api.event.player.AttackBlockCallback; import net.fabricmc.fabric.api.event.player.UseBlockCallback; diff --git a/fabric-events-interaction/src/main/resources/fabric-events-interaction.mixins.json b/fabric-events-interaction/src/main/resources/fabric-events-interaction.mixins.json new file mode 100644 index 000000000..28d314f8d --- /dev/null +++ b/fabric-events-interaction/src/main/resources/fabric-events-interaction.mixins.json @@ -0,0 +1,17 @@ +{ + "required": true, + "package": "net.fabricmc.fabric.mixin.eventsinteraction", + "compatibilityLevel": "JAVA_8", + "mixins": [ + "MixinServerPlayerEntity", + "MixinServerPlayerInteractionManager", + "MixinServerPlayNetworkHandler" + ], + "client": [ + "MixinClientPlayerInteractionManager", + "MixinMinecraftClient" + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/fabric-events-interaction/src/main/resources/fabric.mod.json b/fabric-events-interaction/src/main/resources/fabric.mod.json new file mode 100644 index 000000000..543220d0d --- /dev/null +++ b/fabric-events-interaction/src/main/resources/fabric.mod.json @@ -0,0 +1,9 @@ +{ + "schemaVersion": 1, + "id": "fabric-events-interaction", + "version": "${version}", + "license": "Apache-2.0", + "mixins": [ + "fabric-events-interaction.mixins.json" + ] +} \ No newline at end of file diff --git a/fabric-events-lifecycle/build.gradle b/fabric-events-lifecycle/build.gradle new file mode 100644 index 000000000..9728c1aaa --- /dev/null +++ b/fabric-events-lifecycle/build.gradle @@ -0,0 +1,6 @@ +archivesBaseName = "fabric-events-lifecycle" +version = "0.1.0" + +dependencies { + compile project(path: ':fabric-lib', configuration: 'dev') +} diff --git a/src/main/java/net/fabricmc/fabric/api/event/client/ClientTickCallback.java b/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/client/ClientTickCallback.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/event/client/ClientTickCallback.java rename to fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/client/ClientTickCallback.java diff --git a/src/main/java/net/fabricmc/fabric/api/event/server/ServerStartCallback.java b/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/server/ServerStartCallback.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/event/server/ServerStartCallback.java rename to fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/server/ServerStartCallback.java diff --git a/src/main/java/net/fabricmc/fabric/api/event/server/ServerStopCallback.java b/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/server/ServerStopCallback.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/event/server/ServerStopCallback.java rename to fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/server/ServerStopCallback.java diff --git a/src/main/java/net/fabricmc/fabric/api/event/server/ServerTickCallback.java b/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/server/ServerTickCallback.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/event/server/ServerTickCallback.java rename to fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/server/ServerTickCallback.java diff --git a/src/main/java/net/fabricmc/fabric/api/event/world/WorldTickCallback.java b/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/world/WorldTickCallback.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/event/world/WorldTickCallback.java rename to fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/world/WorldTickCallback.java diff --git a/src/main/java/net/fabricmc/fabric/mixin/events/tick/MixinMinecraftClient.java b/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/mixin/eventslifecycle/MixinMinecraftClient.java similarity index 96% rename from src/main/java/net/fabricmc/fabric/mixin/events/tick/MixinMinecraftClient.java rename to fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/mixin/eventslifecycle/MixinMinecraftClient.java index 4d481b07a..0a5239932 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/events/tick/MixinMinecraftClient.java +++ b/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/mixin/eventslifecycle/MixinMinecraftClient.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin.events.tick; +package net.fabricmc.fabric.mixin.eventslifecycle; import net.fabricmc.fabric.api.event.client.ClientTickCallback; import net.fabricmc.fabric.api.event.world.WorldTickCallback; diff --git a/src/main/java/net/fabricmc/fabric/mixin/events/server/MixinMinecraftServer.java b/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/mixin/eventslifecycle/MixinMinecraftServer.java similarity index 77% rename from src/main/java/net/fabricmc/fabric/mixin/events/server/MixinMinecraftServer.java rename to fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/mixin/eventslifecycle/MixinMinecraftServer.java index 64c2c2cb3..86dafe3bb 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/events/server/MixinMinecraftServer.java +++ b/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/mixin/eventslifecycle/MixinMinecraftServer.java @@ -14,16 +14,21 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin.events.server; +package net.fabricmc.fabric.mixin.eventslifecycle; import net.fabricmc.fabric.api.event.server.ServerStartCallback; import net.fabricmc.fabric.api.event.server.ServerStopCallback; +import net.fabricmc.fabric.api.event.server.ServerTickCallback; import net.minecraft.server.MinecraftServer; +import net.minecraft.util.profiler.DisableableProfiler; 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.CallbackInfo; +import java.util.function.BooleanSupplier; + @Mixin(MinecraftServer.class) public class MixinMinecraftServer { @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/MinecraftServer;setFavicon(Lnet/minecraft/server/ServerMetadata;)V", ordinal = 0), method = "run") @@ -35,4 +40,9 @@ public class MixinMinecraftServer { public void beforeShutdownServer(CallbackInfo info) { ServerStopCallback.EVENT.invoker().onStopServer((MinecraftServer) (Object) this); } + + @Inject(at = @At("RETURN"), method = "tick") + protected void tick(BooleanSupplier var1, CallbackInfo info) { + ServerTickCallback.EVENT.invoker().tick((MinecraftServer) (Object) this); + } } diff --git a/src/main/java/net/fabricmc/fabric/mixin/events/tick/MixinWorld.java b/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/mixin/eventslifecycle/MixinWorld.java similarity index 96% rename from src/main/java/net/fabricmc/fabric/mixin/events/tick/MixinWorld.java rename to fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/mixin/eventslifecycle/MixinWorld.java index e40c71859..70689d178 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/events/tick/MixinWorld.java +++ b/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/mixin/eventslifecycle/MixinWorld.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin.events.tick; +package net.fabricmc.fabric.mixin.eventslifecycle; import net.fabricmc.fabric.api.event.world.WorldTickCallback; import net.minecraft.util.profiler.Profiler; diff --git a/fabric-events-lifecycle/src/main/resources/fabric-events-lifecycle.mixins.json b/fabric-events-lifecycle/src/main/resources/fabric-events-lifecycle.mixins.json new file mode 100644 index 000000000..80c705e4e --- /dev/null +++ b/fabric-events-lifecycle/src/main/resources/fabric-events-lifecycle.mixins.json @@ -0,0 +1,15 @@ +{ + "required": true, + "package": "net.fabricmc.fabric.mixin.eventslifecycle", + "compatibilityLevel": "JAVA_8", + "mixins": [ + "MixinMinecraftServer", + "MixinWorld" + ], + "client": [ + "MixinMinecraftClient" + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/fabric-events-lifecycle/src/main/resources/fabric.mod.json b/fabric-events-lifecycle/src/main/resources/fabric.mod.json new file mode 100644 index 000000000..262c5f3d6 --- /dev/null +++ b/fabric-events-lifecycle/src/main/resources/fabric.mod.json @@ -0,0 +1,9 @@ +{ + "schemaVersion": 1, + "id": "fabric-events-lifecycle", + "version": "${version}", + "license": "Apache-2.0", + "mixins": [ + "fabric-events-lifecycle.mixins.json" + ] +} \ No newline at end of file diff --git a/fabric-lib/build.gradle b/fabric-lib/build.gradle new file mode 100644 index 000000000..009558738 --- /dev/null +++ b/fabric-lib/build.gradle @@ -0,0 +1,2 @@ +archivesBaseName = "fabric-lib" +version = "0.1.0" diff --git a/src/main/java/net/fabricmc/fabric/api/event/Event.java b/fabric-lib/src/main/java/net/fabricmc/fabric/api/event/Event.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/event/Event.java rename to fabric-lib/src/main/java/net/fabricmc/fabric/api/event/Event.java diff --git a/src/main/java/net/fabricmc/fabric/api/event/EventFactory.java b/fabric-lib/src/main/java/net/fabricmc/fabric/api/event/EventFactory.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/event/EventFactory.java rename to fabric-lib/src/main/java/net/fabricmc/fabric/api/event/EventFactory.java diff --git a/src/main/java/net/fabricmc/fabric/api/util/NbtType.java b/fabric-lib/src/main/java/net/fabricmc/fabric/api/util/NbtType.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/util/NbtType.java rename to fabric-lib/src/main/java/net/fabricmc/fabric/api/util/NbtType.java diff --git a/src/main/java/net/fabricmc/fabric/api/util/TriState.java b/fabric-lib/src/main/java/net/fabricmc/fabric/api/util/TriState.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/util/TriState.java rename to fabric-lib/src/main/java/net/fabricmc/fabric/api/util/TriState.java diff --git a/src/main/java/net/fabricmc/fabric/impl/event/ArrayBackedEvent.java b/fabric-lib/src/main/java/net/fabricmc/fabric/impl/event/ArrayBackedEvent.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/event/ArrayBackedEvent.java rename to fabric-lib/src/main/java/net/fabricmc/fabric/impl/event/ArrayBackedEvent.java diff --git a/src/main/java/net/fabricmc/fabric/impl/event/EventFactoryImpl.java b/fabric-lib/src/main/java/net/fabricmc/fabric/impl/event/EventFactoryImpl.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/event/EventFactoryImpl.java rename to fabric-lib/src/main/java/net/fabricmc/fabric/impl/event/EventFactoryImpl.java diff --git a/fabric-lib/src/main/resources/fabric.mod.json b/fabric-lib/src/main/resources/fabric.mod.json new file mode 100644 index 000000000..65fa3cf63 --- /dev/null +++ b/fabric-lib/src/main/resources/fabric.mod.json @@ -0,0 +1,6 @@ +{ + "schemaVersion": 1, + "id": "fabric-lib", + "version": "${version}", + "license": "Apache-2.0" +} \ No newline at end of file diff --git a/fabric-mining-levels/build.gradle b/fabric-mining-levels/build.gradle new file mode 100644 index 000000000..4cefef467 --- /dev/null +++ b/fabric-mining-levels/build.gradle @@ -0,0 +1,7 @@ +archivesBaseName = "fabric-mining-levels" +version = "0.1.0" + +dependencies { + compile project(path: ':fabric-lib', configuration: 'dev') + compile project(path: ':fabric-tag-hooks', configuration: 'dev') +} diff --git a/src/main/java/net/fabricmc/fabric/api/tag/TagRegistry.java b/fabric-mining-levels/src/main/java/net/fabricmc/fabric/api/tag/FabricItemTags.java similarity index 53% rename from src/main/java/net/fabricmc/fabric/api/tag/TagRegistry.java rename to fabric-mining-levels/src/main/java/net/fabricmc/fabric/api/tag/FabricItemTags.java index b03e21c7e..69e36f3a5 100644 --- a/src/main/java/net/fabricmc/fabric/api/tag/TagRegistry.java +++ b/fabric-mining-levels/src/main/java/net/fabricmc/fabric/api/tag/FabricItemTags.java @@ -16,37 +16,29 @@ package net.fabricmc.fabric.api.tag; -import net.minecraft.block.Block; +import net.fabricmc.fabric.api.tools.FabricToolTags; import net.minecraft.item.Item; -import net.minecraft.tag.BlockTags; -import net.minecraft.tag.ItemTags; import net.minecraft.tag.Tag; -import net.minecraft.tag.TagContainer; import net.minecraft.util.Identifier; /** - * Helper methods for registering Tags. + * Item tags provided by Fabric. + * + * @deprecated Use dedicated classes, such as {@link net.fabricmc.fabric.api.tools.FabricToolTags} */ -public final class TagRegistry { - private TagRegistry() { +@Deprecated +public class FabricItemTags { + public static final Tag AXES = FabricToolTags.AXES; + public static final Tag HOES = FabricToolTags.HOES; + public static final Tag PICKAXES = FabricToolTags.PICKAXES; + public static final Tag SHOVELS = FabricToolTags.SHOVELS; + public static final Tag SWORDS = FabricToolTags.SWORDS; + + private FabricItemTags() { } - public static Tag block(Identifier id) { - return new TagDelegate(id, null) { - private TagContainer container; - - @Override - protected void onAccess() { - if (container != BlockTags.getContainer()) { - container = BlockTags.getContainer(); - delegate = container.getOrCreate(this.getId()); - } - } - }; - } - - public static Tag item(Identifier id) { - return new ItemTags.class_3490(id); + private static Tag register(String id) { + return TagRegistry.item(new Identifier("fabric", id)); } } diff --git a/src/main/java/net/fabricmc/fabric/api/tag/FabricItemTags.java b/fabric-mining-levels/src/main/java/net/fabricmc/fabric/api/tools/FabricToolTags.java similarity index 85% rename from src/main/java/net/fabricmc/fabric/api/tag/FabricItemTags.java rename to fabric-mining-levels/src/main/java/net/fabricmc/fabric/api/tools/FabricToolTags.java index ed1929ee0..47e9bfcac 100644 --- a/src/main/java/net/fabricmc/fabric/api/tag/FabricItemTags.java +++ b/fabric-mining-levels/src/main/java/net/fabricmc/fabric/api/tools/FabricToolTags.java @@ -14,23 +14,25 @@ * limitations under the License. */ -package net.fabricmc.fabric.api.tag; +package net.fabricmc.fabric.api.tools; +import net.fabricmc.fabric.api.tag.TagRegistry; import net.minecraft.item.Item; import net.minecraft.tag.Tag; import net.minecraft.util.Identifier; /** - * Item tags provdied by Fabric. + * Tool item tags provided by Fabric. */ -public class FabricItemTags { +@Deprecated +public class FabricToolTags { public static final Tag AXES = register("axes"); public static final Tag HOES = register("hoes"); public static final Tag PICKAXES = register("pickaxes"); public static final Tag SHOVELS = register("shovels"); public static final Tag SWORDS = register("swords"); - private FabricItemTags() { + private FabricToolTags() { } diff --git a/src/main/java/net/fabricmc/fabric/impl/tools/ToolManager.java b/fabric-mining-levels/src/main/java/net/fabricmc/fabric/impl/tools/ToolManager.java similarity index 71% rename from src/main/java/net/fabricmc/fabric/impl/tools/ToolManager.java rename to fabric-mining-levels/src/main/java/net/fabricmc/fabric/impl/tools/ToolManager.java index aa05969a6..b98fb2914 100644 --- a/src/main/java/net/fabricmc/fabric/impl/tools/ToolManager.java +++ b/fabric-mining-levels/src/main/java/net/fabricmc/fabric/impl/tools/ToolManager.java @@ -16,8 +16,6 @@ package net.fabricmc.fabric.impl.tools; -import net.fabricmc.fabric.api.event.registry.BlockConstructedCallback; -import net.fabricmc.fabric.api.block.FabricBlockSettings; import net.fabricmc.fabric.api.util.TriState; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -67,55 +65,21 @@ public final class ToolManager { } } - private static final Map entriesPre = new HashMap<>(); private static final Map entries = new HashMap<>(); private ToolManager() { } - static { - BlockConstructedCallback.EVENT.register(ToolManager::onBlockRegistered); - } - - private static void onBlockRegistered(Block.Settings settings, Block block) { - EntryImpl entry = entriesPre.get(settings); - if (entry != null) { - entries.put(block, entry); - } - } - - /** - * Get the Entry for a given instance of Block.Settings. - * - * This method is meant to be used by Block.Settings wrappers, and it is - * recommended that you simply use the wrapper methods in - * {@link FabricBlockSettings} instead. - * - * @param settings - * @return - */ - public static Entry entry(Block.Settings settings) { - return entriesPre.computeIfAbsent(settings, (bb) -> new EntryImpl()); - } - - private static Entry entry(Block block) { + public static Entry entry(Block block) { return entries.computeIfAbsent(block, (bb) -> new EntryImpl()); } - /** - * @deprecated Use {@link FabricBlockSettings FabricBlockSettings} for your own blocks. - * TODO: Add a way to manipulate the values for non-owned blocks. - */ @Deprecated public static void registerBreakByHand(Block block, boolean value) { entry(block).setBreakByHand(value); } - /** - * @deprecated Use {@link FabricBlockSettings FabricBlockSettings} for your own blocks. - * TODO: Add a way to manipulate the values for non-owned blocks. - */ @Deprecated public static void registerBreakByTool(Block block, Tag tag, int miningLevel) { entry(block).putBreakByTool(tag, miningLevel); diff --git a/src/main/java/net/fabricmc/fabric/impl/accessors/MiningToolItemAccessor.java b/fabric-mining-levels/src/main/java/net/fabricmc/fabric/mixin/tools/MiningToolItemAccessor.java similarity index 76% rename from src/main/java/net/fabricmc/fabric/impl/accessors/MiningToolItemAccessor.java rename to fabric-mining-levels/src/main/java/net/fabricmc/fabric/mixin/tools/MiningToolItemAccessor.java index 660c3a847..620ec9b3d 100644 --- a/src/main/java/net/fabricmc/fabric/impl/accessors/MiningToolItemAccessor.java +++ b/fabric-mining-levels/src/main/java/net/fabricmc/fabric/mixin/tools/MiningToolItemAccessor.java @@ -14,8 +14,14 @@ * limitations under the License. */ -package net.fabricmc.fabric.impl.accessors; +package net.fabricmc.fabric.mixin.tools; +import net.minecraft.item.MiningToolItem; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(MiningToolItem.class) public interface MiningToolItemAccessor { + @Accessor float getBlockBreakingSpeed(); } diff --git a/src/main/java/net/fabricmc/fabric/mixin/tools/MixinItemStack.java b/fabric-mining-levels/src/main/java/net/fabricmc/fabric/mixin/tools/MixinItemStack.java similarity index 96% rename from src/main/java/net/fabricmc/fabric/mixin/tools/MixinItemStack.java rename to fabric-mining-levels/src/main/java/net/fabricmc/fabric/mixin/tools/MixinItemStack.java index 1c1a2c203..ee959aff1 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/tools/MixinItemStack.java +++ b/fabric-mining-levels/src/main/java/net/fabricmc/fabric/mixin/tools/MixinItemStack.java @@ -16,7 +16,6 @@ package net.fabricmc.fabric.mixin.tools; -import net.fabricmc.fabric.impl.accessors.MiningToolItemAccessor; import net.fabricmc.fabric.impl.tools.ToolManager; import net.fabricmc.fabric.api.util.TriState; import net.minecraft.block.BlockState; diff --git a/src/main/resources/data/fabric/tags/items/axes.json b/fabric-mining-levels/src/main/resources/data/fabric/tags/items/axes.json similarity index 100% rename from src/main/resources/data/fabric/tags/items/axes.json rename to fabric-mining-levels/src/main/resources/data/fabric/tags/items/axes.json diff --git a/src/main/resources/data/fabric/tags/items/hoes.json b/fabric-mining-levels/src/main/resources/data/fabric/tags/items/hoes.json similarity index 100% rename from src/main/resources/data/fabric/tags/items/hoes.json rename to fabric-mining-levels/src/main/resources/data/fabric/tags/items/hoes.json diff --git a/src/main/resources/data/fabric/tags/items/pickaxes.json b/fabric-mining-levels/src/main/resources/data/fabric/tags/items/pickaxes.json similarity index 100% rename from src/main/resources/data/fabric/tags/items/pickaxes.json rename to fabric-mining-levels/src/main/resources/data/fabric/tags/items/pickaxes.json diff --git a/src/main/resources/data/fabric/tags/items/shovels.json b/fabric-mining-levels/src/main/resources/data/fabric/tags/items/shovels.json similarity index 100% rename from src/main/resources/data/fabric/tags/items/shovels.json rename to fabric-mining-levels/src/main/resources/data/fabric/tags/items/shovels.json diff --git a/src/main/resources/data/fabric/tags/items/swords.json b/fabric-mining-levels/src/main/resources/data/fabric/tags/items/swords.json similarity index 100% rename from src/main/resources/data/fabric/tags/items/swords.json rename to fabric-mining-levels/src/main/resources/data/fabric/tags/items/swords.json diff --git a/fabric-mining-levels/src/main/resources/fabric-mining-levels.mixins.json b/fabric-mining-levels/src/main/resources/fabric-mining-levels.mixins.json new file mode 100644 index 000000000..51b9f89c8 --- /dev/null +++ b/fabric-mining-levels/src/main/resources/fabric-mining-levels.mixins.json @@ -0,0 +1,12 @@ +{ + "required": true, + "package": "net.fabricmc.fabric.mixin.tools", + "compatibilityLevel": "JAVA_8", + "mixins": [ + "MiningToolItemAccessor", + "MixinItemStack" + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/fabric-mining-levels/src/main/resources/fabric.mod.json b/fabric-mining-levels/src/main/resources/fabric.mod.json new file mode 100644 index 000000000..e2f279a5d --- /dev/null +++ b/fabric-mining-levels/src/main/resources/fabric.mod.json @@ -0,0 +1,9 @@ +{ + "schemaVersion": 1, + "id": "fabric-mining-levels", + "version": "${version}", + "license": "Apache-2.0", + "mixins": [ + "fabric-mining-levels.mixins.json" + ] +} \ No newline at end of file diff --git a/fabric-models/build.gradle b/fabric-models/build.gradle new file mode 100644 index 000000000..c69b90ade --- /dev/null +++ b/fabric-models/build.gradle @@ -0,0 +1,6 @@ +archivesBaseName = "fabric-models" +version = "0.1.0" + +dependencies { + compile project(path: ':fabric-lib', configuration: 'dev') +} diff --git a/src/main/java/net/fabricmc/fabric/api/client/model/ModelAppender.java b/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelAppender.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/client/model/ModelAppender.java rename to fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelAppender.java diff --git a/src/main/java/net/fabricmc/fabric/api/client/model/ModelLoadingRegistry.java b/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelLoadingRegistry.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/client/model/ModelLoadingRegistry.java rename to fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelLoadingRegistry.java diff --git a/src/main/java/net/fabricmc/fabric/api/client/model/ModelProviderContext.java b/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelProviderContext.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/client/model/ModelProviderContext.java rename to fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelProviderContext.java diff --git a/src/main/java/net/fabricmc/fabric/api/client/model/ModelProviderException.java b/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelProviderException.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/client/model/ModelProviderException.java rename to fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelProviderException.java diff --git a/src/main/java/net/fabricmc/fabric/api/client/model/ModelResourceProvider.java b/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelResourceProvider.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/client/model/ModelResourceProvider.java rename to fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelResourceProvider.java diff --git a/src/main/java/net/fabricmc/fabric/api/client/model/ModelVariantProvider.java b/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelVariantProvider.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/client/model/ModelVariantProvider.java rename to fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelVariantProvider.java diff --git a/src/main/java/net/fabricmc/fabric/impl/client/model/ModelLoaderHooks.java b/fabric-models/src/main/java/net/fabricmc/fabric/impl/client/model/ModelLoaderHooks.java similarity index 88% rename from src/main/java/net/fabricmc/fabric/impl/client/model/ModelLoaderHooks.java rename to fabric-models/src/main/java/net/fabricmc/fabric/impl/client/model/ModelLoaderHooks.java index 2c07c8364..333978e37 100644 --- a/src/main/java/net/fabricmc/fabric/impl/client/model/ModelLoaderHooks.java +++ b/fabric-models/src/main/java/net/fabricmc/fabric/impl/client/model/ModelLoaderHooks.java @@ -21,6 +21,6 @@ import net.minecraft.client.util.ModelIdentifier; import net.minecraft.util.Identifier; public interface ModelLoaderHooks { - public void fabric_addModel(ModelIdentifier id); - public UnbakedModel fabric_loadModel(Identifier id); + void fabric_addModel(ModelIdentifier id); + UnbakedModel fabric_loadModel(Identifier id); } diff --git a/src/main/java/net/fabricmc/fabric/impl/client/model/ModelLoadingRegistryImpl.java b/fabric-models/src/main/java/net/fabricmc/fabric/impl/client/model/ModelLoadingRegistryImpl.java similarity index 99% rename from src/main/java/net/fabricmc/fabric/impl/client/model/ModelLoadingRegistryImpl.java rename to fabric-models/src/main/java/net/fabricmc/fabric/impl/client/model/ModelLoadingRegistryImpl.java index 493dbcc60..f0a85a5ef 100644 --- a/src/main/java/net/fabricmc/fabric/impl/client/model/ModelLoadingRegistryImpl.java +++ b/fabric-models/src/main/java/net/fabricmc/fabric/impl/client/model/ModelLoadingRegistryImpl.java @@ -37,7 +37,7 @@ public class ModelLoadingRegistryImpl implements ModelLoadingRegistry { || Boolean.valueOf(System.getProperty("fabric.debugModelLoading", "false")); @FunctionalInterface - private static interface CustomModelItf { + private interface CustomModelItf { UnbakedModel load(T obj) throws ModelProviderException; } diff --git a/src/main/java/net/fabricmc/fabric/mixin/client/model/MixinModelLoader.java b/fabric-models/src/main/java/net/fabricmc/fabric/mixin/client/model/MixinModelLoader.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/mixin/client/model/MixinModelLoader.java rename to fabric-models/src/main/java/net/fabricmc/fabric/mixin/client/model/MixinModelLoader.java diff --git a/fabric-models/src/main/resources/fabric-models.mixins.json b/fabric-models/src/main/resources/fabric-models.mixins.json new file mode 100644 index 000000000..b12e845ac --- /dev/null +++ b/fabric-models/src/main/resources/fabric-models.mixins.json @@ -0,0 +1,11 @@ +{ + "required": true, + "package": "net.fabricmc.fabric.mixin.client.model", + "compatibilityLevel": "JAVA_8", + "client": [ + "MixinModelLoader" + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/fabric-models/src/main/resources/fabric.mod.json b/fabric-models/src/main/resources/fabric.mod.json new file mode 100644 index 000000000..3b1765e82 --- /dev/null +++ b/fabric-models/src/main/resources/fabric.mod.json @@ -0,0 +1,10 @@ +{ + "schemaVersion": 1, + "id": "fabric-models", + "version": "${version}", + "license": "Apache-2.0", + "environment": "client", + "mixins": [ + "fabric-models.mixins.json" + ] +} \ No newline at end of file diff --git a/fabric-networking-blockentity/build.gradle b/fabric-networking-blockentity/build.gradle new file mode 100644 index 000000000..76113fab7 --- /dev/null +++ b/fabric-networking-blockentity/build.gradle @@ -0,0 +1,7 @@ +archivesBaseName = "fabric-networking-blockentity" +version = "0.1.0" + +dependencies { + compile project(path: ':fabric-lib', configuration: 'dev') +} + diff --git a/src/main/java/net/fabricmc/fabric/api/block/entity/BlockEntityClientSerializable.java b/fabric-networking-blockentity/src/main/java/net/fabricmc/fabric/api/block/entity/BlockEntityClientSerializable.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/block/entity/BlockEntityClientSerializable.java rename to fabric-networking-blockentity/src/main/java/net/fabricmc/fabric/api/block/entity/BlockEntityClientSerializable.java diff --git a/src/main/java/net/fabricmc/fabric/mixin/block/entity/MixinBlockEntity.java b/fabric-networking-blockentity/src/main/java/net/fabricmc/fabric/mixin/networkingblockentity/MixinBlockEntity.java similarity index 97% rename from src/main/java/net/fabricmc/fabric/mixin/block/entity/MixinBlockEntity.java rename to fabric-networking-blockentity/src/main/java/net/fabricmc/fabric/mixin/networkingblockentity/MixinBlockEntity.java index 0f5d3c7b8..39a0a36dc 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/block/entity/MixinBlockEntity.java +++ b/fabric-networking-blockentity/src/main/java/net/fabricmc/fabric/mixin/networkingblockentity/MixinBlockEntity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin.block.entity; +package net.fabricmc.fabric.mixin.networkingblockentity; import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable; import net.minecraft.block.entity.BlockEntity; diff --git a/src/main/java/net/fabricmc/fabric/mixin/block/entity/MixinClientPlayNetworkHandler.java b/fabric-networking-blockentity/src/main/java/net/fabricmc/fabric/mixin/networkingblockentity/MixinClientPlayNetworkHandler.java similarity index 98% rename from src/main/java/net/fabricmc/fabric/mixin/block/entity/MixinClientPlayNetworkHandler.java rename to fabric-networking-blockentity/src/main/java/net/fabricmc/fabric/mixin/networkingblockentity/MixinClientPlayNetworkHandler.java index 287fd8308..3fbda363e 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/block/entity/MixinClientPlayNetworkHandler.java +++ b/fabric-networking-blockentity/src/main/java/net/fabricmc/fabric/mixin/networkingblockentity/MixinClientPlayNetworkHandler.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin.block.entity; +package net.fabricmc.fabric.mixin.networkingblockentity; import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable; import net.minecraft.block.entity.BlockEntity; diff --git a/fabric-networking-blockentity/src/main/resources/fabric-networking-blockentity.mixins.json b/fabric-networking-blockentity/src/main/resources/fabric-networking-blockentity.mixins.json new file mode 100644 index 000000000..ca751fc87 --- /dev/null +++ b/fabric-networking-blockentity/src/main/resources/fabric-networking-blockentity.mixins.json @@ -0,0 +1,12 @@ +{ + "required": true, + "package": "net.fabricmc.fabric.mixin.networkingblockentity", + "compatibilityLevel": "JAVA_8", + "mixins": [ + "MixinBlockEntity", + "MixinClientPlayNetworkHandler" + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/fabric-networking-blockentity/src/main/resources/fabric.mod.json b/fabric-networking-blockentity/src/main/resources/fabric.mod.json new file mode 100644 index 000000000..2bacd583a --- /dev/null +++ b/fabric-networking-blockentity/src/main/resources/fabric.mod.json @@ -0,0 +1,9 @@ +{ + "schemaVersion": 1, + "id": "fabric-networking-blockentity", + "version": "${version}", + "license": "Apache-2.0", + "mixins": [ + "fabric-networking-blockentity.mixins.json" + ] +} \ No newline at end of file diff --git a/fabric-networking/build.gradle b/fabric-networking/build.gradle new file mode 100644 index 000000000..16f6b4b67 --- /dev/null +++ b/fabric-networking/build.gradle @@ -0,0 +1,6 @@ +archivesBaseName = "fabric-networking" +version = "0.1.0" + +dependencies { + compile project(path: ':fabric-lib', configuration: 'dev') +} \ No newline at end of file diff --git a/src/main/java/net/fabricmc/fabric/api/event/network/C2SPacketTypeCallback.java b/fabric-networking/src/main/java/net/fabricmc/fabric/api/event/network/C2SPacketTypeCallback.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/event/network/C2SPacketTypeCallback.java rename to fabric-networking/src/main/java/net/fabricmc/fabric/api/event/network/C2SPacketTypeCallback.java diff --git a/src/main/java/net/fabricmc/fabric/api/event/network/S2CPacketTypeCallback.java b/fabric-networking/src/main/java/net/fabricmc/fabric/api/event/network/S2CPacketTypeCallback.java similarity index 97% rename from src/main/java/net/fabricmc/fabric/api/event/network/S2CPacketTypeCallback.java rename to fabric-networking/src/main/java/net/fabricmc/fabric/api/event/network/S2CPacketTypeCallback.java index 5c865e1ff..a2d616934 100644 --- a/src/main/java/net/fabricmc/fabric/api/event/network/S2CPacketTypeCallback.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/api/event/network/S2CPacketTypeCallback.java @@ -18,7 +18,6 @@ package net.fabricmc.fabric.api.event.network; import net.fabricmc.fabric.api.event.Event; import net.fabricmc.fabric.api.event.EventFactory; -import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.Identifier; import java.util.Collection; diff --git a/src/main/java/net/fabricmc/fabric/api/network/ClientSidePacketRegistry.java b/fabric-networking/src/main/java/net/fabricmc/fabric/api/network/ClientSidePacketRegistry.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/network/ClientSidePacketRegistry.java rename to fabric-networking/src/main/java/net/fabricmc/fabric/api/network/ClientSidePacketRegistry.java diff --git a/src/main/java/net/fabricmc/fabric/api/network/PacketConsumer.java b/fabric-networking/src/main/java/net/fabricmc/fabric/api/network/PacketConsumer.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/network/PacketConsumer.java rename to fabric-networking/src/main/java/net/fabricmc/fabric/api/network/PacketConsumer.java diff --git a/src/main/java/net/fabricmc/fabric/api/network/PacketContext.java b/fabric-networking/src/main/java/net/fabricmc/fabric/api/network/PacketContext.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/network/PacketContext.java rename to fabric-networking/src/main/java/net/fabricmc/fabric/api/network/PacketContext.java diff --git a/src/main/java/net/fabricmc/fabric/api/network/PacketRegistry.java b/fabric-networking/src/main/java/net/fabricmc/fabric/api/network/PacketRegistry.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/network/PacketRegistry.java rename to fabric-networking/src/main/java/net/fabricmc/fabric/api/network/PacketRegistry.java diff --git a/src/main/java/net/fabricmc/fabric/api/network/ServerSidePacketRegistry.java b/fabric-networking/src/main/java/net/fabricmc/fabric/api/network/ServerSidePacketRegistry.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/network/ServerSidePacketRegistry.java rename to fabric-networking/src/main/java/net/fabricmc/fabric/api/network/ServerSidePacketRegistry.java diff --git a/src/main/java/net/fabricmc/fabric/api/server/PlayerStream.java b/fabric-networking/src/main/java/net/fabricmc/fabric/api/server/PlayerStream.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/server/PlayerStream.java rename to fabric-networking/src/main/java/net/fabricmc/fabric/api/server/PlayerStream.java diff --git a/src/main/java/net/fabricmc/fabric/impl/network/ClientSidePacketRegistryImpl.java b/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/ClientSidePacketRegistryImpl.java similarity index 97% rename from src/main/java/net/fabricmc/fabric/impl/network/ClientSidePacketRegistryImpl.java rename to fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/ClientSidePacketRegistryImpl.java index 66e5279be..1118b1300 100644 --- a/src/main/java/net/fabricmc/fabric/impl/network/ClientSidePacketRegistryImpl.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/ClientSidePacketRegistryImpl.java @@ -21,7 +21,6 @@ import io.netty.util.concurrent.GenericFutureListener; import net.fabricmc.fabric.api.event.network.S2CPacketTypeCallback; import net.fabricmc.fabric.api.network.ClientSidePacketRegistry; import net.fabricmc.fabric.api.network.PacketContext; -import net.fabricmc.fabric.mixin.networking.MixinClientPlayNetworkHandler; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.client.network.packet.CustomPayloadS2CPacket; diff --git a/src/main/java/net/fabricmc/fabric/impl/accessors/CustomPayloadC2SPacketAccessor.java b/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/CustomPayloadC2SPacketAccessor.java similarity index 81% rename from src/main/java/net/fabricmc/fabric/impl/accessors/CustomPayloadC2SPacketAccessor.java rename to fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/CustomPayloadC2SPacketAccessor.java index 0c775baef..56782353a 100644 --- a/src/main/java/net/fabricmc/fabric/impl/accessors/CustomPayloadC2SPacketAccessor.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/CustomPayloadC2SPacketAccessor.java @@ -14,13 +14,10 @@ * limitations under the License. */ -package net.fabricmc.fabric.impl.accessors; +package net.fabricmc.fabric.impl.network; -import net.minecraft.server.network.packet.CustomPayloadC2SPacket; import net.minecraft.util.Identifier; import net.minecraft.util.PacketByteBuf; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; /** * Helper interface containing getters for CustomPayloadC2SPacket diff --git a/src/main/java/net/fabricmc/fabric/impl/network/PacketRegistryImpl.java b/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/PacketRegistryImpl.java similarity index 97% rename from src/main/java/net/fabricmc/fabric/impl/network/PacketRegistryImpl.java rename to fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/PacketRegistryImpl.java index 4e2bf00c5..4264107de 100644 --- a/src/main/java/net/fabricmc/fabric/impl/network/PacketRegistryImpl.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/PacketRegistryImpl.java @@ -16,12 +16,10 @@ package net.fabricmc.fabric.impl.network; -import com.google.common.base.Charsets; import io.netty.buffer.Unpooled; import net.fabricmc.fabric.api.network.PacketConsumer; import net.fabricmc.fabric.api.network.PacketContext; import net.fabricmc.fabric.api.network.PacketRegistry; -import net.fabricmc.fabric.api.network.ServerSidePacketRegistry; import net.minecraft.network.Packet; import net.minecraft.util.Identifier; import net.minecraft.util.PacketByteBuf; diff --git a/src/main/java/net/fabricmc/fabric/impl/network/PacketTypes.java b/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/PacketTypes.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/network/PacketTypes.java rename to fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/PacketTypes.java diff --git a/src/main/java/net/fabricmc/fabric/impl/network/ServerSidePacketRegistryImpl.java b/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/ServerSidePacketRegistryImpl.java similarity index 95% rename from src/main/java/net/fabricmc/fabric/impl/network/ServerSidePacketRegistryImpl.java rename to fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/ServerSidePacketRegistryImpl.java index cf9f5c75f..52215f8f9 100644 --- a/src/main/java/net/fabricmc/fabric/impl/network/ServerSidePacketRegistryImpl.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/ServerSidePacketRegistryImpl.java @@ -21,12 +21,9 @@ import io.netty.util.concurrent.GenericFutureListener; import net.fabricmc.fabric.api.event.network.C2SPacketTypeCallback; import net.fabricmc.fabric.api.network.PacketContext; import net.fabricmc.fabric.api.network.ServerSidePacketRegistry; -import net.fabricmc.fabric.api.server.PlayerStream; -import net.fabricmc.fabric.impl.accessors.CustomPayloadC2SPacketAccessor; import net.minecraft.client.network.packet.CustomPayloadS2CPacket; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.network.Packet; -import net.minecraft.server.MinecraftServer; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.packet.CustomPayloadC2SPacket; import net.minecraft.server.network.packet.LoginQueryResponseC2SPacket; @@ -34,7 +31,6 @@ import net.minecraft.util.Identifier; import net.minecraft.util.PacketByteBuf; import java.util.Collection; -import java.util.Collections; import java.util.HashSet; import java.util.WeakHashMap; diff --git a/src/main/java/net/fabricmc/fabric/impl/server/EntityTrackerStorageAccessor.java b/fabric-networking/src/main/java/net/fabricmc/fabric/impl/server/EntityTrackerStorageAccessor.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/server/EntityTrackerStorageAccessor.java rename to fabric-networking/src/main/java/net/fabricmc/fabric/impl/server/EntityTrackerStorageAccessor.java diff --git a/src/main/java/net/fabricmc/fabric/impl/server/EntityTrackerStreamAccessor.java b/fabric-networking/src/main/java/net/fabricmc/fabric/impl/server/EntityTrackerStreamAccessor.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/server/EntityTrackerStreamAccessor.java rename to fabric-networking/src/main/java/net/fabricmc/fabric/impl/server/EntityTrackerStreamAccessor.java diff --git a/src/main/java/net/fabricmc/fabric/mixin/networking/MixinClientPlayNetworkHandler.java b/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinClientPlayNetworkHandler.java similarity index 91% rename from src/main/java/net/fabricmc/fabric/mixin/networking/MixinClientPlayNetworkHandler.java rename to fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinClientPlayNetworkHandler.java index 26a697978..cba82f37a 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/networking/MixinClientPlayNetworkHandler.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinClientPlayNetworkHandler.java @@ -14,9 +14,8 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin.networking; +package net.fabricmc.fabric.mixin.network; -import com.mojang.authlib.GameProfile; import net.fabricmc.api.EnvType; import net.fabricmc.fabric.api.network.ClientSidePacketRegistry; import net.fabricmc.fabric.api.network.PacketContext; @@ -24,15 +23,11 @@ import net.fabricmc.fabric.impl.network.ClientSidePacketRegistryImpl; import net.fabricmc.fabric.impl.network.PacketRegistryImpl; import net.fabricmc.fabric.impl.network.PacketTypes; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.Screen; import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.client.network.packet.CustomPayloadS2CPacket; import net.minecraft.client.network.packet.GameJoinS2CPacket; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.network.ClientConnection; import net.minecraft.network.Packet; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.util.ThreadExecutor; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; diff --git a/src/main/java/net/fabricmc/fabric/mixin/networking/MixinCustomPayloadC2SPacket.java b/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinCustomPayloadC2SPacket.java similarity index 90% rename from src/main/java/net/fabricmc/fabric/mixin/networking/MixinCustomPayloadC2SPacket.java rename to fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinCustomPayloadC2SPacket.java index a5a571b05..e7c67c3c5 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/networking/MixinCustomPayloadC2SPacket.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinCustomPayloadC2SPacket.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin.networking; +package net.fabricmc.fabric.mixin.network; -import net.fabricmc.fabric.impl.accessors.CustomPayloadC2SPacketAccessor; +import net.fabricmc.fabric.impl.network.CustomPayloadC2SPacketAccessor; import net.minecraft.server.network.packet.CustomPayloadC2SPacket; import net.minecraft.util.Identifier; import net.minecraft.util.PacketByteBuf; diff --git a/src/main/java/net/fabricmc/fabric/mixin/entity/MixinEntityTracker.java b/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinEntityTracker.java similarity index 96% rename from src/main/java/net/fabricmc/fabric/mixin/entity/MixinEntityTracker.java rename to fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinEntityTracker.java index 0de554849..ef0f7e443 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/entity/MixinEntityTracker.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinEntityTracker.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin.entity; +package net.fabricmc.fabric.mixin.network; import net.fabricmc.fabric.impl.server.EntityTrackerStreamAccessor; import net.minecraft.server.network.ServerPlayerEntity; diff --git a/src/main/java/net/fabricmc/fabric/mixin/networking/MixinServerPlayNetworkHandler.java b/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinServerPlayNetworkHandler.java similarity index 97% rename from src/main/java/net/fabricmc/fabric/mixin/networking/MixinServerPlayNetworkHandler.java rename to fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinServerPlayNetworkHandler.java index aca88890a..ec617ce6a 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/networking/MixinServerPlayNetworkHandler.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinServerPlayNetworkHandler.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin.networking; +package net.fabricmc.fabric.mixin.network; import net.fabricmc.api.EnvType; import net.fabricmc.fabric.api.network.PacketContext; diff --git a/src/main/java/net/fabricmc/fabric/mixin/entity/MixinThreadedAnvilChunkStorage.java b/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinThreadedAnvilChunkStorage.java similarity index 97% rename from src/main/java/net/fabricmc/fabric/mixin/entity/MixinThreadedAnvilChunkStorage.java rename to fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinThreadedAnvilChunkStorage.java index 6533f6a5a..553759641 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/entity/MixinThreadedAnvilChunkStorage.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinThreadedAnvilChunkStorage.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin.entity; +package net.fabricmc.fabric.mixin.network; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.fabricmc.fabric.impl.server.EntityTrackerStreamAccessor; diff --git a/fabric-networking/src/main/resources/fabric-networking.mixins.json b/fabric-networking/src/main/resources/fabric-networking.mixins.json new file mode 100644 index 000000000..12a261327 --- /dev/null +++ b/fabric-networking/src/main/resources/fabric-networking.mixins.json @@ -0,0 +1,17 @@ +{ + "required": true, + "package": "net.fabricmc.fabric.mixin.network", + "compatibilityLevel": "JAVA_8", + "mixins": [ + "MixinCustomPayloadC2SPacket", + "MixinEntityTracker", + "MixinServerPlayNetworkHandler", + "MixinThreadedAnvilChunkStorage" + ], + "client": [ + "MixinClientPlayNetworkHandler" + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/fabric-networking/src/main/resources/fabric.mod.json b/fabric-networking/src/main/resources/fabric.mod.json new file mode 100644 index 000000000..ea14a5ba2 --- /dev/null +++ b/fabric-networking/src/main/resources/fabric.mod.json @@ -0,0 +1,9 @@ +{ + "schemaVersion": 1, + "id": "fabric-networking", + "version": "${version}", + "license": "Apache-2.0", + "mixins": [ + "fabric-networking.mixins.json" + ] +} \ No newline at end of file diff --git a/fabric-object-builders/build.gradle b/fabric-object-builders/build.gradle new file mode 100644 index 000000000..af6670948 --- /dev/null +++ b/fabric-object-builders/build.gradle @@ -0,0 +1,7 @@ +archivesBaseName = "fabric-object-builders" +version = "0.1.0" + +dependencies { + compile project(path: ':fabric-lib', configuration: 'dev') + compile project(path: ':fabric-mining-levels', configuration: 'dev') +} diff --git a/src/main/java/net/fabricmc/fabric/api/block/FabricBlockSettings.java b/fabric-object-builders/src/main/java/net/fabricmc/fabric/api/block/FabricBlockSettings.java similarity index 75% rename from src/main/java/net/fabricmc/fabric/api/block/FabricBlockSettings.java rename to fabric-object-builders/src/main/java/net/fabricmc/fabric/api/block/FabricBlockSettings.java index 5ccbb105a..c90842270 100644 --- a/src/main/java/net/fabricmc/fabric/api/block/FabricBlockSettings.java +++ b/fabric-object-builders/src/main/java/net/fabricmc/fabric/api/block/FabricBlockSettings.java @@ -16,6 +16,8 @@ package net.fabricmc.fabric.api.block; +import net.fabricmc.fabric.api.event.registry.BlockConstructedCallback; +import net.fabricmc.fabric.impl.block.FabricBlockSettingsDelegate; import net.fabricmc.fabric.impl.tools.ToolManager; import net.minecraft.block.Block; import net.minecraft.block.Material; @@ -27,6 +29,10 @@ import net.minecraft.util.DyeColor; import net.minecraft.util.Identifier; import net.minecraft.world.loot.LootTables; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.function.Function; /** @@ -38,21 +44,43 @@ import java.util.function.Function; * vanilla Block.Settings instance beneath. */ public class FabricBlockSettings { - public interface Delegate { - void fabric_setMaterialColor(MaterialColor color); - void fabric_setCollidable(boolean value); - void fabric_setSoundGroup(BlockSoundGroup group); - void fabric_setLightLevel(int value); - void fabric_setHardness(float value); - void fabric_setResistance(float value); - void fabric_setRandomTicks(boolean value); - void fabric_setFriction(float value); - void fabric_setDropTable(Identifier id); - void fabric_setDynamicBounds(boolean value); + static { + BlockConstructedCallback.EVENT.register(FabricBlockSettings::onBuild); } protected final Block.Settings delegate; - private final FabricBlockSettings.Delegate castDelegate; + private final FabricBlockSettingsDelegate castDelegate; + + private static class MiningInformation { + private final Tag tag; + private final int miningLevel; + + MiningInformation(Tag tag, int miningLevel) { + this.tag = tag; + this.miningLevel = miningLevel; + } + } + + private static class Information { + private Boolean breakByHand; + private List miningInformation = new ArrayList<>(); + } + + private static Map info = new HashMap<>(); + + private static void onBuild(Block.Settings settings, Block block) { + // TODO: Load only if fabric-mining-levels present + Information i = info.get(settings); + if (i != null) { + if (i.breakByHand != null) { + ToolManager.entry(block).setBreakByHand(i.breakByHand); + } + + for (MiningInformation mi : i.miningInformation) { + ToolManager.entry(block).putBreakByTool(mi.tag, mi.miningLevel); + } + } + } protected FabricBlockSettings(Material material, MaterialColor color) { this(Block.Settings.of(material, color)); @@ -64,7 +92,7 @@ public class FabricBlockSettings { protected FabricBlockSettings(final Block.Settings delegate) { this.delegate = delegate; - castDelegate = (FabricBlockSettings.Delegate) delegate; + castDelegate = (FabricBlockSettingsDelegate) delegate; } public static FabricBlockSettings of(Material material) { @@ -86,7 +114,7 @@ public class FabricBlockSettings { /* FABRIC HELPERS */ public FabricBlockSettings breakByHand(boolean value) { - ToolManager.entry(delegate).setBreakByHand(value); + info.computeIfAbsent(delegate, (k) -> new Information()).breakByHand = value; return this; } @@ -95,7 +123,9 @@ public class FabricBlockSettings { } public FabricBlockSettings breakByTool(Tag tag, int miningLevel) { - ToolManager.entry(delegate).putBreakByTool(tag, miningLevel); + info.computeIfAbsent(delegate, (k) -> new Information()).miningInformation.add( + new MiningInformation(tag, miningLevel) + ); return this; } diff --git a/src/main/java/net/fabricmc/fabric/api/entity/EntityTrackingRegistry.java b/fabric-object-builders/src/main/java/net/fabricmc/fabric/api/entity/EntityTrackingRegistry.java similarity index 96% rename from src/main/java/net/fabricmc/fabric/api/entity/EntityTrackingRegistry.java rename to fabric-object-builders/src/main/java/net/fabricmc/fabric/api/entity/EntityTrackingRegistry.java index 43aadadd3..8f486bf08 100644 --- a/src/main/java/net/fabricmc/fabric/api/entity/EntityTrackingRegistry.java +++ b/fabric-object-builders/src/main/java/net/fabricmc/fabric/api/entity/EntityTrackingRegistry.java @@ -16,16 +16,13 @@ package net.fabricmc.fabric.api.entity; -import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; -import net.minecraft.network.Packet; import net.minecraft.util.registry.Registry; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.util.HashMap; import java.util.Map; -import java.util.function.Function; /** * Registry for server->client entity tracking values. diff --git a/src/main/java/net/fabricmc/fabric/api/entity/FabricEntityTypeBuilder.java b/fabric-object-builders/src/main/java/net/fabricmc/fabric/api/entity/FabricEntityTypeBuilder.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/entity/FabricEntityTypeBuilder.java rename to fabric-object-builders/src/main/java/net/fabricmc/fabric/api/entity/FabricEntityTypeBuilder.java diff --git a/src/main/java/net/fabricmc/fabric/api/event/registry/BlockConstructedCallback.java b/fabric-object-builders/src/main/java/net/fabricmc/fabric/api/event/registry/BlockConstructedCallback.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/event/registry/BlockConstructedCallback.java rename to fabric-object-builders/src/main/java/net/fabricmc/fabric/api/event/registry/BlockConstructedCallback.java diff --git a/src/main/java/net/fabricmc/fabric/api/event/registry/ItemConstructedCallback.java b/fabric-object-builders/src/main/java/net/fabricmc/fabric/api/event/registry/ItemConstructedCallback.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/event/registry/ItemConstructedCallback.java rename to fabric-object-builders/src/main/java/net/fabricmc/fabric/api/event/registry/ItemConstructedCallback.java diff --git a/fabric-object-builders/src/main/java/net/fabricmc/fabric/impl/block/FabricBlockSettingsDelegate.java b/fabric-object-builders/src/main/java/net/fabricmc/fabric/impl/block/FabricBlockSettingsDelegate.java new file mode 100644 index 000000000..4e1e91aa2 --- /dev/null +++ b/fabric-object-builders/src/main/java/net/fabricmc/fabric/impl/block/FabricBlockSettingsDelegate.java @@ -0,0 +1,18 @@ +package net.fabricmc.fabric.impl.block; + +import net.minecraft.block.MaterialColor; +import net.minecraft.sound.BlockSoundGroup; +import net.minecraft.util.Identifier; + +public interface FabricBlockSettingsDelegate { + void fabric_setMaterialColor(MaterialColor color); + void fabric_setCollidable(boolean value); + void fabric_setSoundGroup(BlockSoundGroup group); + void fabric_setLightLevel(int value); + void fabric_setHardness(float value); + void fabric_setResistance(float value); + void fabric_setRandomTicks(boolean value); + void fabric_setFriction(float value); + void fabric_setDropTable(Identifier id); + void fabric_setDynamicBounds(boolean value); +} diff --git a/fabric-object-builders/src/main/java/net/fabricmc/fabric/impl/entity/FabricEntityType.java b/fabric-object-builders/src/main/java/net/fabricmc/fabric/impl/entity/FabricEntityType.java new file mode 100644 index 000000000..657d0fedf --- /dev/null +++ b/fabric-object-builders/src/main/java/net/fabricmc/fabric/impl/entity/FabricEntityType.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2016, 2017, 2018 FabricMC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.fabricmc.fabric.impl.entity; + +import com.mojang.datafixers.types.Type; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityCategory; +import net.minecraft.entity.EntitySize; +import net.minecraft.entity.EntityType; + +public class FabricEntityType extends EntityType { + private final int maxTrackDistance, trackTickInterval; + private final Boolean alwaysUpdateVelocity; + + public FabricEntityType(EntityFactory entityType$EntityFactory_1, EntityCategory entityCategory_1, boolean boolean_1, boolean boolean_2, boolean boolean_3, Type type_1, EntitySize entitySize_1, int maxTrackDistance, int trackTickInterval, Boolean alwaysUpdateVelocity) { + super(entityType$EntityFactory_1, entityCategory_1, boolean_1, boolean_2, boolean_3, type_1, entitySize_1); + this.maxTrackDistance = maxTrackDistance; + this.trackTickInterval = trackTickInterval; + this.alwaysUpdateVelocity = alwaysUpdateVelocity; + } + + @Override + public int getMaxTrackDistance() { + if (maxTrackDistance != -1) { + return (maxTrackDistance + 15) / 16; + } + + return super.getMaxTrackDistance(); + } + + @Override + public int getTrackTickInterval() { + if (trackTickInterval != -1) { + return trackTickInterval; + } + + return super.getTrackTickInterval(); + } + + @Override + public boolean alwaysUpdateVelocity() { + if (alwaysUpdateVelocity != null) { + return alwaysUpdateVelocity; + } + + return super.alwaysUpdateVelocity(); + } +} diff --git a/src/main/java/net/fabricmc/fabric/mixin/events/objectbuilder/MixinBlock.java b/fabric-object-builders/src/main/java/net/fabricmc/fabric/mixin/builders/MixinBlock.java similarity index 95% rename from src/main/java/net/fabricmc/fabric/mixin/events/objectbuilder/MixinBlock.java rename to fabric-object-builders/src/main/java/net/fabricmc/fabric/mixin/builders/MixinBlock.java index 2c4209d1c..7333dc250 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/events/objectbuilder/MixinBlock.java +++ b/fabric-object-builders/src/main/java/net/fabricmc/fabric/mixin/builders/MixinBlock.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin.events.objectbuilder; +package net.fabricmc.fabric.mixin.builders; import net.fabricmc.fabric.api.event.registry.BlockConstructedCallback; import net.minecraft.block.Block; diff --git a/src/main/java/net/fabricmc/fabric/mixin/block/MixinBlockBuilder.java b/fabric-object-builders/src/main/java/net/fabricmc/fabric/mixin/builders/MixinBlockBuilder.java similarity index 92% rename from src/main/java/net/fabricmc/fabric/mixin/block/MixinBlockBuilder.java rename to fabric-object-builders/src/main/java/net/fabricmc/fabric/mixin/builders/MixinBlockBuilder.java index affb26469..a74eb2289 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/block/MixinBlockBuilder.java +++ b/fabric-object-builders/src/main/java/net/fabricmc/fabric/mixin/builders/MixinBlockBuilder.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin.block; +package net.fabricmc.fabric.mixin.builders; -import net.fabricmc.fabric.api.block.FabricBlockSettings; +import net.fabricmc.fabric.impl.block.FabricBlockSettingsDelegate; import net.minecraft.block.Block; import net.minecraft.block.Material; import net.minecraft.block.MaterialColor; @@ -26,7 +26,7 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @Mixin(Block.Settings.class) -public class MixinBlockBuilder implements FabricBlockSettings.Delegate { +public class MixinBlockBuilder implements FabricBlockSettingsDelegate { @Shadow private Material material; @Shadow diff --git a/src/main/java/net/fabricmc/fabric/mixin/events/objectbuilder/MixinItem.java b/fabric-object-builders/src/main/java/net/fabricmc/fabric/mixin/builders/MixinItem.java similarity index 95% rename from src/main/java/net/fabricmc/fabric/mixin/events/objectbuilder/MixinItem.java rename to fabric-object-builders/src/main/java/net/fabricmc/fabric/mixin/builders/MixinItem.java index ddd1b9422..a1e56893c 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/events/objectbuilder/MixinItem.java +++ b/fabric-object-builders/src/main/java/net/fabricmc/fabric/mixin/builders/MixinItem.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin.events.objectbuilder; +package net.fabricmc.fabric.mixin.builders; import net.fabricmc.fabric.api.event.registry.ItemConstructedCallback; import net.minecraft.item.Item; diff --git a/fabric-object-builders/src/main/resources/fabric-object-builders.mixins.json b/fabric-object-builders/src/main/resources/fabric-object-builders.mixins.json new file mode 100644 index 000000000..727a6be1e --- /dev/null +++ b/fabric-object-builders/src/main/resources/fabric-object-builders.mixins.json @@ -0,0 +1,13 @@ +{ + "required": true, + "package": "net.fabricmc.fabric.mixin.builders", + "compatibilityLevel": "JAVA_8", + "mixins": [ + "MixinBlock", + "MixinBlockBuilder", + "MixinItem" + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/fabric-object-builders/src/main/resources/fabric.mod.json b/fabric-object-builders/src/main/resources/fabric.mod.json new file mode 100644 index 000000000..5225f7a11 --- /dev/null +++ b/fabric-object-builders/src/main/resources/fabric.mod.json @@ -0,0 +1,9 @@ +{ + "schemaVersion": 1, + "id": "fabric-object-builders", + "version": "${version}", + "license": "Apache-2.0", + "mixins": [ + "fabric-object-builders.mixins.json" + ] +} \ No newline at end of file diff --git a/fabric-registry-sync/build.gradle b/fabric-registry-sync/build.gradle new file mode 100644 index 000000000..eac7327a8 --- /dev/null +++ b/fabric-registry-sync/build.gradle @@ -0,0 +1,7 @@ +archivesBaseName = "fabric-registry-sync" +version = "0.1.0" + +dependencies { + compile project(path: ':fabric-lib', configuration: 'dev') + compile project(path: ':fabric-networking', configuration: 'dev') +} diff --git a/src/main/java/net/fabricmc/fabric/impl/registry/ExtendedIdList.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/ExtendedIdList.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/registry/ExtendedIdList.java rename to fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/ExtendedIdList.java diff --git a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/FabricRegistryClientInit.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/FabricRegistryClientInit.java new file mode 100644 index 000000000..4d2e57f33 --- /dev/null +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/FabricRegistryClientInit.java @@ -0,0 +1,28 @@ +package net.fabricmc.fabric.impl.registry; + +import net.fabricmc.api.ClientModInitializer; +import net.fabricmc.fabric.api.network.ClientSidePacketRegistry; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.network.ClientPlayerEntity; +import net.minecraft.text.StringTextComponent; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class FabricRegistryClientInit implements ClientModInitializer { + private static final Logger LOGGER = LogManager.getLogger(); + + @Override + public void onInitializeClient() { + ClientSidePacketRegistry.INSTANCE.register(RegistrySyncManager.ID, (ctx, buf) -> { + // if not hosting server, apply packet + RegistrySyncManager.receivePacket(ctx, buf, !MinecraftClient.getInstance().isInSingleplayer(), (e) -> { + LOGGER.error("Registry remapping failed!", e); + MinecraftClient.getInstance().execute(() -> { + ((ClientPlayerEntity) ctx.getPlayer()).networkHandler.getClientConnection().disconnect( + new StringTextComponent("Registry remapping failed: " + e.getMessage()) + ); + }); + }); + }); + } +} diff --git a/src/main/java/net/fabricmc/fabric/impl/registry/IdListUpdater.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/IdListUpdater.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/registry/IdListUpdater.java rename to fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/IdListUpdater.java diff --git a/src/main/java/net/fabricmc/fabric/impl/registry/ListenableRegistry.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/ListenableRegistry.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/registry/ListenableRegistry.java rename to fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/ListenableRegistry.java diff --git a/src/main/java/net/fabricmc/fabric/impl/registry/RegistryListener.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/RegistryListener.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/registry/RegistryListener.java rename to fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/RegistryListener.java diff --git a/src/main/java/net/fabricmc/fabric/impl/registry/RegistrySyncManager.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/RegistrySyncManager.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/registry/RegistrySyncManager.java rename to fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/RegistrySyncManager.java diff --git a/src/main/java/net/fabricmc/fabric/impl/registry/RemapException.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/RemapException.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/registry/RemapException.java rename to fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/RemapException.java diff --git a/src/main/java/net/fabricmc/fabric/impl/registry/RemappableRegistry.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/RemappableRegistry.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/registry/RemappableRegistry.java rename to fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/RemappableRegistry.java diff --git a/src/main/java/net/fabricmc/fabric/impl/registry/BootstrapBiomeRegistryListener.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapBiomeRegistryListener.java similarity index 87% rename from src/main/java/net/fabricmc/fabric/impl/registry/BootstrapBiomeRegistryListener.java rename to fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapBiomeRegistryListener.java index 14bd8a4f5..439fef913 100644 --- a/src/main/java/net/fabricmc/fabric/impl/registry/BootstrapBiomeRegistryListener.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapBiomeRegistryListener.java @@ -14,8 +14,10 @@ * limitations under the License. */ -package net.fabricmc.fabric.impl.registry; +package net.fabricmc.fabric.impl.registry.vanilla; +import net.fabricmc.fabric.impl.registry.ExtendedIdList; +import net.fabricmc.fabric.impl.registry.RegistryListener; import net.minecraft.util.Identifier; import net.minecraft.util.registry.Registry; import net.minecraft.world.biome.Biome; diff --git a/src/main/java/net/fabricmc/fabric/impl/registry/BootstrapBlockRegistryListener.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapBlockRegistryListener.java similarity index 89% rename from src/main/java/net/fabricmc/fabric/impl/registry/BootstrapBlockRegistryListener.java rename to fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapBlockRegistryListener.java index 21e1527b1..cd7d9f413 100644 --- a/src/main/java/net/fabricmc/fabric/impl/registry/BootstrapBlockRegistryListener.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapBlockRegistryListener.java @@ -14,8 +14,10 @@ * limitations under the License. */ -package net.fabricmc.fabric.impl.registry; +package net.fabricmc.fabric.impl.registry.vanilla; +import net.fabricmc.fabric.impl.registry.ExtendedIdList; +import net.fabricmc.fabric.impl.registry.RegistryListener; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.util.Identifier; diff --git a/src/main/java/net/fabricmc/fabric/impl/registry/BootstrapFluidRegistryListener.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapFluidRegistryListener.java similarity index 88% rename from src/main/java/net/fabricmc/fabric/impl/registry/BootstrapFluidRegistryListener.java rename to fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapFluidRegistryListener.java index a08366253..77b4ac700 100644 --- a/src/main/java/net/fabricmc/fabric/impl/registry/BootstrapFluidRegistryListener.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapFluidRegistryListener.java @@ -14,8 +14,10 @@ * limitations under the License. */ -package net.fabricmc.fabric.impl.registry; +package net.fabricmc.fabric.impl.registry.vanilla; +import net.fabricmc.fabric.impl.registry.ExtendedIdList; +import net.fabricmc.fabric.impl.registry.RegistryListener; import net.minecraft.fluid.Fluid; import net.minecraft.fluid.FluidState; import net.minecraft.util.Identifier; diff --git a/src/main/java/net/fabricmc/fabric/impl/registry/BootstrapItemRegistryListener.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapItemRegistryListener.java similarity index 91% rename from src/main/java/net/fabricmc/fabric/impl/registry/BootstrapItemRegistryListener.java rename to fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapItemRegistryListener.java index 474b9b2b7..d319356cb 100644 --- a/src/main/java/net/fabricmc/fabric/impl/registry/BootstrapItemRegistryListener.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapItemRegistryListener.java @@ -14,8 +14,9 @@ * limitations under the License. */ -package net.fabricmc.fabric.impl.registry; +package net.fabricmc.fabric.impl.registry.vanilla; +import net.fabricmc.fabric.impl.registry.RegistryListener; import net.minecraft.item.Item; import net.minecraft.item.BlockItem; import net.minecraft.util.Identifier; diff --git a/src/main/java/net/fabricmc/fabric/mixin/registry/MixinBootstrap.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinBootstrap.java similarity index 86% rename from src/main/java/net/fabricmc/fabric/mixin/registry/MixinBootstrap.java rename to fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinBootstrap.java index 6e45bda6d..fb06b9928 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/registry/MixinBootstrap.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinBootstrap.java @@ -17,10 +17,10 @@ package net.fabricmc.fabric.mixin.registry; import net.fabricmc.fabric.impl.registry.ListenableRegistry; -import net.fabricmc.fabric.impl.registry.BootstrapBiomeRegistryListener; -import net.fabricmc.fabric.impl.registry.BootstrapBlockRegistryListener; -import net.fabricmc.fabric.impl.registry.BootstrapFluidRegistryListener; -import net.fabricmc.fabric.impl.registry.BootstrapItemRegistryListener; +import net.fabricmc.fabric.impl.registry.vanilla.BootstrapBiomeRegistryListener; +import net.fabricmc.fabric.impl.registry.vanilla.BootstrapBlockRegistryListener; +import net.fabricmc.fabric.impl.registry.vanilla.BootstrapFluidRegistryListener; +import net.fabricmc.fabric.impl.registry.vanilla.BootstrapItemRegistryListener; import net.minecraft.Bootstrap; import net.minecraft.block.Block; import net.minecraft.block.Blocks; diff --git a/src/main/java/net/fabricmc/fabric/mixin/registry/MixinIdList.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinIdList.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/mixin/registry/MixinIdList.java rename to fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinIdList.java diff --git a/src/main/java/net/fabricmc/fabric/mixin/registry/MixinIdRegistry.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinIdRegistry.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/mixin/registry/MixinIdRegistry.java rename to fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinIdRegistry.java diff --git a/src/main/java/net/fabricmc/fabric/mixin/registry/MixinPlayerManager.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinPlayerManager.java similarity index 87% rename from src/main/java/net/fabricmc/fabric/mixin/registry/MixinPlayerManager.java rename to fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinPlayerManager.java index e78e67ab2..5a9cfb246 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/registry/MixinPlayerManager.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinPlayerManager.java @@ -18,16 +18,11 @@ package net.fabricmc.fabric.mixin.registry; import net.fabricmc.fabric.api.network.ServerSidePacketRegistry; import net.fabricmc.fabric.impl.network.PacketRegistryImpl; -import net.fabricmc.fabric.impl.network.ServerSidePacketRegistryImpl; import net.fabricmc.fabric.impl.registry.RegistrySyncManager; import net.minecraft.network.ClientConnection; -import net.minecraft.network.Packet; -import net.minecraft.server.MinecraftServer; import net.minecraft.server.PlayerManager; -import net.minecraft.server.network.ServerPlayNetworkHandler; import net.minecraft.server.network.ServerPlayerEntity; 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.CallbackInfo; diff --git a/src/main/java/net/fabricmc/fabric/mixin/registry/MixinWorldSaveHandler.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinWorldSaveHandler.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/mixin/registry/MixinWorldSaveHandler.java rename to fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinWorldSaveHandler.java diff --git a/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinBlockColorMap.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinBlockColorMap.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinBlockColorMap.java rename to fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinBlockColorMap.java diff --git a/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinItemColorMap.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinItemColorMap.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinItemColorMap.java rename to fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinItemColorMap.java diff --git a/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinItemModelMap.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinItemModelMap.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinItemModelMap.java rename to fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinItemModelMap.java diff --git a/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinMinecraftClient.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinMinecraftClient.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinMinecraftClient.java rename to fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinMinecraftClient.java diff --git a/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinParticleManager.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinParticleManager.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinParticleManager.java rename to fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinParticleManager.java diff --git a/fabric-registry-sync/src/main/resources/fabric-registry-sync.mixins.json b/fabric-registry-sync/src/main/resources/fabric-registry-sync.mixins.json new file mode 100644 index 000000000..5b6b51b78 --- /dev/null +++ b/fabric-registry-sync/src/main/resources/fabric-registry-sync.mixins.json @@ -0,0 +1,22 @@ +{ + "required": true, + "package": "net.fabricmc.fabric.mixin.registry", + "compatibilityLevel": "JAVA_8", + "mixins": [ + "MixinBootstrap", + "MixinIdList", + "MixinIdRegistry", + "MixinPlayerManager", + "MixinWorldSaveHandler" + ], + "client": [ + "client.MixinBlockColorMap", + "client.MixinItemColorMap", + "client.MixinItemModelMap", + "client.MixinMinecraftClient", + "client.MixinParticleManager" + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/fabric-registry-sync/src/main/resources/fabric.mod.json b/fabric-registry-sync/src/main/resources/fabric.mod.json new file mode 100644 index 000000000..053192750 --- /dev/null +++ b/fabric-registry-sync/src/main/resources/fabric.mod.json @@ -0,0 +1,14 @@ +{ + "schemaVersion": 1, + "id": "fabric-registry-sync", + "version": "${version}", + "license": "Apache-2.0", + "mixins": [ + "fabric-registry-sync.mixins.json" + ], + "entrypoints": { + "client": [ + "net.fabricmc.fabric.impl.registry.FabricRegistryClientInit" + ] + } +} \ No newline at end of file diff --git a/fabric-resource-loader/build.gradle b/fabric-resource-loader/build.gradle new file mode 100644 index 000000000..487e53ebe --- /dev/null +++ b/fabric-resource-loader/build.gradle @@ -0,0 +1,2 @@ +archivesBaseName = "fabric-resource-loader" +version = "0.1.0" diff --git a/src/main/java/net/fabricmc/fabric/api/resource/IdentifiableResourceReloadListener.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/IdentifiableResourceReloadListener.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/resource/IdentifiableResourceReloadListener.java rename to fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/IdentifiableResourceReloadListener.java diff --git a/src/main/java/net/fabricmc/fabric/api/resource/ModResourcePack.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/ModResourcePack.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/resource/ModResourcePack.java rename to fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/ModResourcePack.java diff --git a/src/main/java/net/fabricmc/fabric/api/resource/ResourceManagerHelper.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/ResourceManagerHelper.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/resource/ResourceManagerHelper.java rename to fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/ResourceManagerHelper.java diff --git a/src/main/java/net/fabricmc/fabric/api/resource/ResourceReloadListenerKeys.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/ResourceReloadListenerKeys.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/resource/ResourceReloadListenerKeys.java rename to fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/ResourceReloadListenerKeys.java diff --git a/src/main/java/net/fabricmc/fabric/api/resource/SimpleResourceReloadListener.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/SimpleResourceReloadListener.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/resource/SimpleResourceReloadListener.java rename to fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/SimpleResourceReloadListener.java diff --git a/src/main/java/net/fabricmc/fabric/api/resource/SimpleSynchronousResourceReloadListener.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/SimpleSynchronousResourceReloadListener.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/resource/SimpleSynchronousResourceReloadListener.java rename to fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/SimpleSynchronousResourceReloadListener.java diff --git a/src/main/java/net/fabricmc/fabric/impl/resources/DeferredInputStream.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/DeferredInputStream.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/resources/DeferredInputStream.java rename to fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/DeferredInputStream.java diff --git a/src/main/java/net/fabricmc/fabric/impl/resources/DeferredNioExecutionHandler.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/DeferredNioExecutionHandler.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/resources/DeferredNioExecutionHandler.java rename to fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/DeferredNioExecutionHandler.java diff --git a/src/main/java/net/fabricmc/fabric/impl/resources/ModNioResourcePack.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/ModNioResourcePack.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/resources/ModNioResourcePack.java rename to fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/ModNioResourcePack.java diff --git a/src/main/java/net/fabricmc/fabric/impl/resources/ModResourcePackCreator.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/ModResourcePackCreator.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/resources/ModResourcePackCreator.java rename to fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/ModResourcePackCreator.java diff --git a/src/main/java/net/fabricmc/fabric/impl/resources/ModResourcePackUtil.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/ModResourcePackUtil.java similarity index 91% rename from src/main/java/net/fabricmc/fabric/impl/resources/ModResourcePackUtil.java rename to fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/ModResourcePackUtil.java index f177d6f78..02d89c6ab 100644 --- a/src/main/java/net/fabricmc/fabric/impl/resources/ModResourcePackUtil.java +++ b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/ModResourcePackUtil.java @@ -54,13 +54,11 @@ public final class ModResourcePackUtil { } public static boolean containsDefault(ModMetadata info, String filename) { - return "pack.mcmeta".equals(filename) || "pack.png".equals(filename); + return "pack.mcmeta".equals(filename); } public static InputStream openDefault(ModMetadata info, String filename) { switch (filename) { - case "pack.png": - return ModResourcePackUtil.class.getClassLoader().getResourceAsStream("assets/fabric/textures/misc/default_icon.png"); case "pack.mcmeta": String description = info.getName(); if (description == null) { diff --git a/src/main/java/net/fabricmc/fabric/impl/resources/ResourceManagerHelperImpl.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/ResourceManagerHelperImpl.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/resources/ResourceManagerHelperImpl.java rename to fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/ResourceManagerHelperImpl.java diff --git a/src/main/java/net/fabricmc/fabric/mixin/resources/MixinKeyedResourceReloadListener.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinKeyedResourceReloadListener.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/mixin/resources/MixinKeyedResourceReloadListener.java rename to fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinKeyedResourceReloadListener.java diff --git a/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftGame.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftGame.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftGame.java rename to fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftGame.java diff --git a/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftServer.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftServer.java similarity index 83% rename from src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftServer.java rename to fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftServer.java index 444b69f6c..83cec0f46 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftServer.java +++ b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftServer.java @@ -35,8 +35,8 @@ public class MixinMinecraftServer { @Shadow private ResourcePackContainerManager resourcePackContainerManager; - @Inject(method = "method_3800", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/ResourcePackContainerManager;addCreator(Lnet/minecraft/resource/ResourcePackCreator;)V", ordinal = 1)) - public void method_3800(File file, LevelProperties properties, CallbackInfo info) { + @Inject(method = "loadWorldDataPacks", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/ResourcePackContainerManager;addCreator(Lnet/minecraft/resource/ResourcePackCreator;)V", ordinal = 1)) + public void appendFabricDataPacks(File file, LevelProperties properties, CallbackInfo info) { resourcePackContainerManager.addCreator(new ModResourcePackCreator(ResourceType.DATA)); } } diff --git a/src/main/java/net/fabricmc/fabric/mixin/resources/MixinReloadableResourceManagerImpl.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinReloadableResourceManagerImpl.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/mixin/resources/MixinReloadableResourceManagerImpl.java rename to fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinReloadableResourceManagerImpl.java diff --git a/src/main/java/net/fabricmc/fabric/mixin/resources/MixinReloadableResourceManagerImplClient.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinReloadableResourceManagerImplClient.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/mixin/resources/MixinReloadableResourceManagerImplClient.java rename to fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinReloadableResourceManagerImplClient.java diff --git a/fabric-resource-loader/src/main/resources/fabric-resource-loader.mixins.json b/fabric-resource-loader/src/main/resources/fabric-resource-loader.mixins.json new file mode 100644 index 000000000..2b5010743 --- /dev/null +++ b/fabric-resource-loader/src/main/resources/fabric-resource-loader.mixins.json @@ -0,0 +1,17 @@ +{ + "required": true, + "package": "net.fabricmc.fabric.mixin.resources", + "compatibilityLevel": "JAVA_8", + "mixins": [ + "MixinKeyedResourceReloadListener$Server", + "MixinMinecraftServer", + "MixinReloadableResourceManagerImpl" + ], + "client": [ + "MixinKeyedResourceReloadListener$Client", + "MixinMinecraftGame" + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/fabric-resource-loader/src/main/resources/fabric.mod.json b/fabric-resource-loader/src/main/resources/fabric.mod.json new file mode 100644 index 000000000..f72c6b891 --- /dev/null +++ b/fabric-resource-loader/src/main/resources/fabric.mod.json @@ -0,0 +1,9 @@ +{ + "schemaVersion": 1, + "id": "fabric-resource-loader", + "version": "${version}", + "license": "Apache-2.0", + "mixins": [ + "fabric-resource-loader.mixins.json" + ] +} \ No newline at end of file diff --git a/fabric-tag-hooks/build.gradle b/fabric-tag-hooks/build.gradle new file mode 100644 index 000000000..1b15631a8 --- /dev/null +++ b/fabric-tag-hooks/build.gradle @@ -0,0 +1,7 @@ +archivesBaseName = "fabric-tag-hooks" +version = "0.1.0" + +dependencies { + compile project(path: ':fabric-lib', configuration: 'dev') + compile project(path: ':fabric-resource-loader', configuration: 'dev') +} diff --git a/fabric-tag-hooks/src/main/java/net/fabricmc/fabric/api/tag/TagRegistry.java b/fabric-tag-hooks/src/main/java/net/fabricmc/fabric/api/tag/TagRegistry.java new file mode 100644 index 000000000..69079d57e --- /dev/null +++ b/fabric-tag-hooks/src/main/java/net/fabricmc/fabric/api/tag/TagRegistry.java @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2016, 2017, 2018 FabricMC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.fabricmc.fabric.api.tag; + +import net.fabricmc.fabric.impl.tag.TagDelegate; +import net.minecraft.block.Block; +import net.minecraft.entity.EntityType; +import net.minecraft.fluid.Fluid; +import net.minecraft.item.Item; +import net.minecraft.tag.*; +import net.minecraft.util.Identifier; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.function.Supplier; + +/** + * Helper methods for registering Tags. + */ +public final class TagRegistry { + private TagRegistry() { + + } + + public static Tag create(Identifier id, Supplier> containerSupplier) { + return new TagDelegate(id, null) { + private TagContainer container; + + @Override + protected void onAccess() { + TagContainer currContainer = containerSupplier.get(); + if (container != currContainer) { + container = currContainer; + delegate = container.getOrCreate(this.getId()); + } + } + }; + } + + public static Tag block(Identifier id) { + return create(id, BlockTags::getContainer); + } + + public static Tag> entityType(Identifier id) { + return create(id, EntityTags::getContainer); + } + + public static Tag fluid(Identifier id) { + return create(id, TagRegistry::getFluidTagContainer); + } + + public static Tag item(Identifier id) { + return create(id, ItemTags::getContainer); + } + + private static Field fluidTagContainer; + + private static TagContainer getFluidTagContainer() { + if (fluidTagContainer == null) { + for (Field f : FluidTags.class.getDeclaredFields()) { + if ((f.getModifiers() & Modifier.STATIC) != 0 && f.getType() == TagContainer.class) { + f.setAccessible(true); + fluidTagContainer = f; + break; + } + } + + if (fluidTagContainer == null) { + throw new RuntimeException("Could not find FluidTags.container!"); + } + } + + try { + //noinspection unchecked + return (TagContainer) fluidTagContainer.get(null); + } catch (IllegalAccessException e) { + throw new RuntimeException("Could not access FluidTags.container (" + fluidTagContainer.getName() + ")!", e); + } + } +} diff --git a/src/main/java/net/fabricmc/fabric/api/tag/TagDelegate.java b/fabric-tag-hooks/src/main/java/net/fabricmc/fabric/impl/tag/TagDelegate.java similarity index 96% rename from src/main/java/net/fabricmc/fabric/api/tag/TagDelegate.java rename to fabric-tag-hooks/src/main/java/net/fabricmc/fabric/impl/tag/TagDelegate.java index 813f644b8..d8ff6c32d 100644 --- a/src/main/java/net/fabricmc/fabric/api/tag/TagDelegate.java +++ b/fabric-tag-hooks/src/main/java/net/fabricmc/fabric/impl/tag/TagDelegate.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.api.tag; +package net.fabricmc.fabric.impl.tag; import net.minecraft.tag.Tag; import net.minecraft.util.Identifier; diff --git a/fabric-tag-hooks/src/main/resources/fabric.mod.json b/fabric-tag-hooks/src/main/resources/fabric.mod.json new file mode 100644 index 000000000..47468a258 --- /dev/null +++ b/fabric-tag-hooks/src/main/resources/fabric.mod.json @@ -0,0 +1,6 @@ +{ + "schemaVersion": 1, + "id": "fabric-tag-hooks", + "version": "${version}", + "license": "Apache-2.0" +} \ No newline at end of file diff --git a/src/test/java/net/fabricmc/fabric/block/FireMod.java b/fabric-testmods/java/net/fabricmc/fabric/block/FireMod.java similarity index 100% rename from src/test/java/net/fabricmc/fabric/block/FireMod.java rename to fabric-testmods/java/net/fabricmc/fabric/block/FireMod.java diff --git a/src/test/java/net/fabricmc/fabric/colormapper/ColorProviderMod.java b/fabric-testmods/java/net/fabricmc/fabric/colormapper/ColorProviderMod.java similarity index 100% rename from src/test/java/net/fabricmc/fabric/colormapper/ColorProviderMod.java rename to fabric-testmods/java/net/fabricmc/fabric/colormapper/ColorProviderMod.java diff --git a/src/test/java/net/fabricmc/fabric/commands/CommandMod.java b/fabric-testmods/java/net/fabricmc/fabric/commands/CommandMod.java similarity index 100% rename from src/test/java/net/fabricmc/fabric/commands/CommandMod.java rename to fabric-testmods/java/net/fabricmc/fabric/commands/CommandMod.java diff --git a/src/test/java/net/fabricmc/fabric/containers/ContainerMod.java b/fabric-testmods/java/net/fabricmc/fabric/containers/ContainerMod.java similarity index 100% rename from src/test/java/net/fabricmc/fabric/containers/ContainerMod.java rename to fabric-testmods/java/net/fabricmc/fabric/containers/ContainerMod.java diff --git a/src/test/java/net/fabricmc/fabric/containers/ContainerModClient.java b/fabric-testmods/java/net/fabricmc/fabric/containers/ContainerModClient.java similarity index 100% rename from src/test/java/net/fabricmc/fabric/containers/ContainerModClient.java rename to fabric-testmods/java/net/fabricmc/fabric/containers/ContainerModClient.java diff --git a/src/test/java/net/fabricmc/fabric/events/PickBlockEventModClient.java b/fabric-testmods/java/net/fabricmc/fabric/events/PickBlockEventModClient.java similarity index 100% rename from src/test/java/net/fabricmc/fabric/events/PickBlockEventModClient.java rename to fabric-testmods/java/net/fabricmc/fabric/events/PickBlockEventModClient.java diff --git a/src/test/java/net/fabricmc/fabric/events/ServerEventMod.java b/fabric-testmods/java/net/fabricmc/fabric/events/ServerEventMod.java similarity index 100% rename from src/test/java/net/fabricmc/fabric/events/ServerEventMod.java rename to fabric-testmods/java/net/fabricmc/fabric/events/ServerEventMod.java diff --git a/src/test/java/net/fabricmc/fabric/item/FuelMod.java b/fabric-testmods/java/net/fabricmc/fabric/item/FuelMod.java similarity index 100% rename from src/test/java/net/fabricmc/fabric/item/FuelMod.java rename to fabric-testmods/java/net/fabricmc/fabric/item/FuelMod.java diff --git a/src/test/java/net/fabricmc/fabric/itemgroup/ItemGroupMod.java b/fabric-testmods/java/net/fabricmc/fabric/itemgroup/ItemGroupMod.java similarity index 100% rename from src/test/java/net/fabricmc/fabric/itemgroup/ItemGroupMod.java rename to fabric-testmods/java/net/fabricmc/fabric/itemgroup/ItemGroupMod.java diff --git a/src/test/java/net/fabricmc/fabric/keybinding/KeyBindingModClient.java b/fabric-testmods/java/net/fabricmc/fabric/keybinding/KeyBindingModClient.java similarity index 100% rename from src/test/java/net/fabricmc/fabric/keybinding/KeyBindingModClient.java rename to fabric-testmods/java/net/fabricmc/fabric/keybinding/KeyBindingModClient.java diff --git a/src/test/java/net/fabricmc/fabric/loot/LootEntryMod.java b/fabric-testmods/java/net/fabricmc/fabric/loot/LootEntryMod.java similarity index 100% rename from src/test/java/net/fabricmc/fabric/loot/LootEntryMod.java rename to fabric-testmods/java/net/fabricmc/fabric/loot/LootEntryMod.java diff --git a/src/test/java/net/fabricmc/fabric/model/ModelModClient.java b/fabric-testmods/java/net/fabricmc/fabric/model/ModelModClient.java similarity index 100% rename from src/test/java/net/fabricmc/fabric/model/ModelModClient.java rename to fabric-testmods/java/net/fabricmc/fabric/model/ModelModClient.java diff --git a/src/test/java/net/fabricmc/fabric/resources/ResourceReloadModClient.java b/fabric-testmods/java/net/fabricmc/fabric/resources/ResourceReloadModClient.java similarity index 100% rename from src/test/java/net/fabricmc/fabric/resources/ResourceReloadModClient.java rename to fabric-testmods/java/net/fabricmc/fabric/resources/ResourceReloadModClient.java diff --git a/src/test/resources/data/minecraft/loot_tables/blocks/stone.json b/fabric-testmods/resources/data/minecraft/loot_tables/blocks/stone.json similarity index 100% rename from src/test/resources/data/minecraft/loot_tables/blocks/stone.json rename to fabric-testmods/resources/data/minecraft/loot_tables/blocks/stone.json diff --git a/src/test/resources/mod.json b/fabric-testmods/resources/mod.json similarity index 100% rename from src/test/resources/mod.json rename to fabric-testmods/resources/mod.json diff --git a/fabric-textures/build.gradle b/fabric-textures/build.gradle new file mode 100644 index 000000000..9ca075eee --- /dev/null +++ b/fabric-textures/build.gradle @@ -0,0 +1,6 @@ +archivesBaseName = "fabric-textures" +version = "0.1.0" + +dependencies { + compile project(path: ':fabric-lib', configuration: 'dev') +} diff --git a/src/main/java/net/fabricmc/fabric/api/client/texture/CustomSpriteLoader.java b/fabric-textures/src/main/java/net/fabricmc/fabric/api/client/texture/CustomSpriteLoader.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/client/texture/CustomSpriteLoader.java rename to fabric-textures/src/main/java/net/fabricmc/fabric/api/client/texture/CustomSpriteLoader.java diff --git a/src/main/java/net/fabricmc/fabric/api/client/texture/DependentSprite.java b/fabric-textures/src/main/java/net/fabricmc/fabric/api/client/texture/DependentSprite.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/client/texture/DependentSprite.java rename to fabric-textures/src/main/java/net/fabricmc/fabric/api/client/texture/DependentSprite.java diff --git a/src/main/java/net/fabricmc/fabric/api/event/client/ClientSpriteRegistryCallback.java b/fabric-textures/src/main/java/net/fabricmc/fabric/api/event/client/ClientSpriteRegistryCallback.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/api/event/client/ClientSpriteRegistryCallback.java rename to fabric-textures/src/main/java/net/fabricmc/fabric/api/event/client/ClientSpriteRegistryCallback.java diff --git a/src/main/java/net/fabricmc/fabric/impl/client/texture/FabricSprite.java b/fabric-textures/src/main/java/net/fabricmc/fabric/impl/client/texture/FabricSprite.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/impl/client/texture/FabricSprite.java rename to fabric-textures/src/main/java/net/fabricmc/fabric/impl/client/texture/FabricSprite.java diff --git a/src/main/java/net/fabricmc/fabric/mixin/client/texture/MixinSpriteAtlasTexture.java b/fabric-textures/src/main/java/net/fabricmc/fabric/mixin/client/texture/MixinSpriteAtlasTexture.java similarity index 100% rename from src/main/java/net/fabricmc/fabric/mixin/client/texture/MixinSpriteAtlasTexture.java rename to fabric-textures/src/main/java/net/fabricmc/fabric/mixin/client/texture/MixinSpriteAtlasTexture.java diff --git a/fabric-textures/src/main/resources/fabric-textures.mixins.json b/fabric-textures/src/main/resources/fabric-textures.mixins.json new file mode 100644 index 000000000..e9dfaac01 --- /dev/null +++ b/fabric-textures/src/main/resources/fabric-textures.mixins.json @@ -0,0 +1,11 @@ +{ + "required": true, + "package": "net.fabricmc.fabric.mixin.client.texture", + "compatibilityLevel": "JAVA_8", + "client": [ + "MixinSpriteAtlasTexture" + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/fabric-textures/src/main/resources/fabric.mod.json b/fabric-textures/src/main/resources/fabric.mod.json new file mode 100644 index 000000000..719f5fda0 --- /dev/null +++ b/fabric-textures/src/main/resources/fabric.mod.json @@ -0,0 +1,10 @@ +{ + "schemaVersion": 1, + "id": "fabric-textures", + "version": "${version}", + "license": "Apache-2.0", + "environment": "client", + "mixins": [ + "fabric-textures.mixins.json" + ] +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 90bfa5781..1919f472a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1,2 @@ group = net.fabricmc +org.gradle.jvmargs=-Xmx2G diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 000000000..0f2a98622 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,30 @@ +pluginManagement { + repositories { + jcenter() + gradlePluginPortal() + maven { + name = 'Fabric' + url = 'https://maven.fabricmc.net/' + } + mavenLocal() + } +} + +include 'fabric-client-models' +include 'fabric-client-textures' +include 'fabric-containers' +include 'fabric-crash-report-info' +include 'fabric-creative-tabs' +include 'fabric-events-interaction' +include 'fabric-events-lifecycle' +include 'fabric-lib' +include 'fabric-mining-levels' +include 'fabric-networking' +include 'fabric-networking-blockentity' +include 'fabric-object-builders' +include 'fabric-registry-client' +include 'fabric-registry-commands' +include 'fabric-registry-extras' +include 'fabric-registry-sync' +include 'fabric-registry-tags' +include 'fabric-resource-loader' diff --git a/src/main/java/net/fabricmc/fabric/api/tag/FabricBlockTags.java b/src/main/java/net/fabricmc/fabric/api/tag/FabricBlockTags.java deleted file mode 100644 index a8be94fcf..000000000 --- a/src/main/java/net/fabricmc/fabric/api/tag/FabricBlockTags.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018 FabricMC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.fabricmc.fabric.api.tag; - -import net.minecraft.block.Block; -import net.minecraft.tag.Tag; -import net.minecraft.util.Identifier; - -/** - * Block tags provided by Fabric. - */ -public class FabricBlockTags { - private FabricBlockTags() { - - } - - private static Tag register(String id) { - return TagRegistry.block(new Identifier("fabric", id)); - } -} diff --git a/src/main/java/net/fabricmc/fabric/impl/FabricAPIClientInitializer.java b/src/main/java/net/fabricmc/fabric/impl/FabricAPIClientInitializer.java deleted file mode 100644 index eddca251f..000000000 --- a/src/main/java/net/fabricmc/fabric/impl/FabricAPIClientInitializer.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018 FabricMC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.fabricmc.fabric.impl; - -import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.fabric.api.block.BlockPickInteractionAware; -import net.fabricmc.fabric.api.entity.EntityPickInteractionAware; -import net.fabricmc.fabric.api.event.client.player.ClientPickBlockGatherCallback; -import net.fabricmc.fabric.api.network.ClientSidePacketRegistry; -import net.fabricmc.fabric.impl.client.gui.ScreenProviderRegistryImpl; -import net.fabricmc.fabric.impl.registry.RegistrySyncManager; -import net.minecraft.block.BlockState; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.network.ClientPlayerEntity; -import net.minecraft.entity.Entity; -import net.minecraft.item.ItemStack; -import net.minecraft.text.StringTextComponent; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.hit.EntityHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockView; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -public class FabricAPIClientInitializer implements ClientModInitializer { - private static final Logger LOGGER = LogManager.getLogger(); - - @Override - public void onInitializeClient() { - ClientSidePacketRegistry.INSTANCE.register(RegistrySyncManager.ID, (ctx, buf) -> { - // if not hosting server, apply packet - RegistrySyncManager.receivePacket(ctx, buf, !MinecraftClient.getInstance().isInSingleplayer(), (e) -> { - LOGGER.error("Registry remapping failed!", e); - MinecraftClient.getInstance().execute(() -> { - ((ClientPlayerEntity) ctx.getPlayer()).networkHandler.getClientConnection().disconnect( - new StringTextComponent("Registry remapping failed: " + e.getMessage()) - ); - }); - }); - }); - - ClientPickBlockGatherCallback.EVENT.register(((player, result) -> { - if (result instanceof BlockHitResult) { - BlockView view = player.getEntityWorld(); - BlockPos pos = ((BlockHitResult) result).getBlockPos(); - BlockState state = view.getBlockState(pos); - - if (state.getBlock() instanceof BlockPickInteractionAware) { - return (((BlockPickInteractionAware) state.getBlock()).getPickedStack(state, view, pos, player, result)); - } - } else if (result instanceof EntityHitResult) { - Entity entity = ((EntityHitResult) result).getEntity(); - - if (entity instanceof EntityPickInteractionAware) { - return ((EntityPickInteractionAware) entity).getPickedStack(player, result); - } - } - - return ItemStack.EMPTY; - })); - - ((ScreenProviderRegistryImpl) ScreenProviderRegistryImpl.INSTANCE).init(); - } -} diff --git a/src/main/java/net/fabricmc/fabric/impl/FabricAPIInitializer.java b/src/main/java/net/fabricmc/fabric/impl/FabricAPIInitializer.java deleted file mode 100644 index 648df5281..000000000 --- a/src/main/java/net/fabricmc/fabric/impl/FabricAPIInitializer.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018 FabricMC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.fabricmc.fabric.impl; - -import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.block.BlockAttackInteractionAware; -import net.fabricmc.fabric.api.event.player.AttackBlockCallback; -import net.minecraft.block.BlockState; -import net.minecraft.util.ActionResult; - -public class FabricAPIInitializer implements ModInitializer { - @Override - public void onInitialize() { - AttackBlockCallback.EVENT.register((player, world, hand, pos, direction) -> { - BlockState state = world.getBlockState(pos); - if (state instanceof BlockAttackInteractionAware) { - if (((BlockAttackInteractionAware) state).onAttackInteraction(state, world, pos, player, hand, direction)) { - return ActionResult.FAIL; - } - } else if (state.getBlock() instanceof BlockAttackInteractionAware) { - if (((BlockAttackInteractionAware) state.getBlock()).onAttackInteraction(state, world, pos, player, hand, direction)) { - return ActionResult.FAIL; - } - } - - return ActionResult.PASS; - }); - } -} diff --git a/src/main/java/net/fabricmc/fabric/mixin/bugfix/MixinBiomeColors.java b/src/main/java/net/fabricmc/fabric/mixin/bugfix/MixinBiomeColors.java deleted file mode 100644 index 3a2a07fd3..000000000 --- a/src/main/java/net/fabricmc/fabric/mixin/bugfix/MixinBiomeColors.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018 FabricMC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.fabricmc.fabric.mixin.bugfix; - -import net.minecraft.client.render.block.BiomeColors; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.ExtendedBlockView; -import net.minecraft.world.biome.Biome; -import net.minecraft.world.biome.Biomes; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Coerce; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.Redirect; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(BiomeColors.class) -public class MixinBiomeColors { - // Apparently, ExtendedBlockView.getBiome() is null sometimes. Huh? - @Redirect(method = "colorAt", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/ExtendedBlockView;getBiome(Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/world/biome/Biome;")) - private static Biome getBiome(ExtendedBlockView view, BlockPos pos) { - Biome biome = view.getBiome(pos); - if (biome == null) { - return Biomes.DEFAULT; - } else { - return biome; - } - } -} diff --git a/src/main/java/net/fabricmc/fabric/mixin/events/tick/MixinMinecraftServer.java b/src/main/java/net/fabricmc/fabric/mixin/events/tick/MixinMinecraftServer.java deleted file mode 100644 index f75cbe3d1..000000000 --- a/src/main/java/net/fabricmc/fabric/mixin/events/tick/MixinMinecraftServer.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018 FabricMC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.fabricmc.fabric.mixin.events.tick; - -import net.fabricmc.fabric.api.event.server.ServerTickCallback; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.profiler.DisableableProfiler; -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.CallbackInfo; - -import java.util.function.BooleanSupplier; - -@Mixin(MinecraftServer.class) -public class MixinMinecraftServer { - @Inject(at = @At("RETURN"), method = "tick") - protected void tick(BooleanSupplier var1, CallbackInfo info) { - ServerTickCallback.EVENT.invoker().tick((MinecraftServer) (Object) this); - } -} diff --git a/src/main/java/net/fabricmc/fabric/mixin/tools/MixinMiningToolItem.java b/src/main/java/net/fabricmc/fabric/mixin/tools/MixinMiningToolItem.java deleted file mode 100644 index f34603a65..000000000 --- a/src/main/java/net/fabricmc/fabric/mixin/tools/MixinMiningToolItem.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018 FabricMC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.fabricmc.fabric.mixin.tools; - -import net.fabricmc.fabric.impl.accessors.MiningToolItemAccessor; -import net.minecraft.item.MiningToolItem; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; - -@Mixin(MiningToolItem.class) -public class MixinMiningToolItem implements MiningToolItemAccessor { - @Shadow - private float blockBreakingSpeed; - - @Override - public float getBlockBreakingSpeed() { - return blockBreakingSpeed; - } -} diff --git a/src/main/resources/assets/fabric/icon.png b/src/main/resources/assets/fabric/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..7c97cba4be94d8568ae2af9d5e4db9dd31282090 GIT binary patch literal 229 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnF3?v&v(vJfv=>VS)S49Q}AhIygYN*PcHK}gh zvMGBu%{jJb>Fo&gR&>1g_QcF zi$*tkGx}o9k|k>zs(8CN76|JFME$B~ycK!p;O62FpV(9jHnmu@YYVStZcKR|u$!Cr XqpfvIVC{aO8yGxY{an^LB{Ts5?jTIF literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/fabric/textures/misc/default_icon.png b/src/main/resources/assets/fabric/textures/misc/default_icon.png deleted file mode 100644 index 6cd4386247657ecf9a2f42a6a5e4f9dc3a2db4a7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 247 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?I3?vN&YJLDI(Ey(iR}&MH>gwvrlP51!zFRoZDai zali4?Z|dK4Ck0Lgsm41Ez5Z+a1x_%@M9C{Q@Lh4g;>MxC{ITH}2V=+q{u5b>K}rqW zM+#kZ{_oFVDQLXM82Rz6v04M$jpM%E%JvHE_netl99VVr#NRcRK+!J~KF(lJ3Q+!R t$QYua6r?mkxFE$&t%0wmpMj--@fQ2(Q{^+=ih&Mg@O1TaS?83{1OPVSTbcj> diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index ea01a6162..5ff12ce6b 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,16 +1,15 @@ { + "schemaVersion": 1, "id": "fabric", "name": "Fabric API", "version": "${version}", - "side": "universal", "description": "Core API module providing key hooks and intercompatibility features.", "license": "Apache-2.0", - "initializers": [ - "net.fabricmc.fabric.impl.FabricAPIInitializer", - "net.fabricmc.fabric.impl.FabricAPIClientInitializer" - ], - "mixins": { - "client": "net.fabricmc.fabric.mixins.client.json", - "common": "net.fabricmc.fabric.mixins.common.json" + "icon": "assets/fabric/icon.png", + "contact": { + "homepage": "https://fabricmc.net", + "irc": "irc://irc.esper.net:6667/fabric", + "issues": "https://github.com/FabricMC/fabric/issues", + "sources": "https://github.com/FabricMC/fabric" } -} +} \ No newline at end of file diff --git a/src/main/resources/net.fabricmc.fabric.mixins.client.json b/src/main/resources/net.fabricmc.fabric.mixins.client.json deleted file mode 100644 index 472eb022e..000000000 --- a/src/main/resources/net.fabricmc.fabric.mixins.client.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "required": true, - "package": "net.fabricmc.fabric.mixin", - "compatibilityLevel": "JAVA_8", - "mixins": [ - "block.entity.MixinClientPlayNetworkHandler", - "bugfix.MixinBiomeColors", - "client.itemgroup.MixinItemGroup", - "client.itemgroup.MixinCreativePlayerInventoryGui", - "client.keybinding.MixinGameOptions", - "client.keybinding.MixinKeyBinding", - "client.model.MixinModelLoader", - "client.render.MixinBlockColorMap", - "client.render.MixinBlockEntityRenderManager", - "client.render.MixinEntityRenderManager", - "client.render.MixinItemColorMap", - "client.texture.MixinSpriteAtlasTexture", - "events.playerinteraction.MixinClientPlayerInteractionManager", - "events.playerinteraction.MixinMinecraftClient", - "events.tick.MixinMinecraftClient", - "networking.MixinClientPlayNetworkHandler", - "registry.client.MixinBlockColorMap", - "registry.client.MixinItemColorMap", - "registry.client.MixinItemModelMap", - "registry.client.MixinMinecraftClient", - "registry.client.MixinParticleManager", - "resources.MixinKeyedResourceReloadListener$Client", - "resources.MixinMinecraftGame" - ], - "injectors": { - "defaultRequire": 1 - } -} diff --git a/src/main/resources/net.fabricmc.fabric.mixins.common.json b/src/main/resources/net.fabricmc.fabric.mixins.common.json deleted file mode 100644 index 4116e3ddb..000000000 --- a/src/main/resources/net.fabricmc.fabric.mixins.common.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "required": true, - "package": "net.fabricmc.fabric.mixin", - "compatibilityLevel": "JAVA_8", - "mixins": [ - "block.MixinBlockBuilder", - "block.MixinFireBlock", - "block.entity.MixinBlockEntity", - "commands.MixinMinecraftDedicatedServer", - "commands.MixinServerCommandManager", - "container.MixinServerPlayerEntity", - "entity.MixinEntityTracker", - "entity.MixinThreadedAnvilChunkStorage", - "events.objectbuilder.MixinBlock", - "events.objectbuilder.MixinItem", - "events.playerinteraction.MixinServerPlayNetworkHandler", - "events.playerinteraction.MixinServerPlayerEntity", - "events.playerinteraction.MixinServerPlayerInteractionManager", - "events.server.MixinMinecraftServer", - "events.tick.MixinMinecraftServer", - "events.tick.MixinWorld", - "item.MixinAbstractFurnaceBlockEntity", - "itemgroup.MixinItemGroup", - "misc.MixinCrashReport", - "networking.MixinCustomPayloadC2SPacket", - "networking.MixinServerPlayNetworkHandler", - "registry.MixinBootstrap", - "registry.MixinIdList", - "registry.MixinIdRegistry", - "registry.MixinPlayerManager", - "registry.MixinWorldSaveHandler", - "resources.MixinKeyedResourceReloadListener$Server", - "resources.MixinMinecraftServer", - "resources.MixinReloadableResourceManagerImpl", - "tools.MixinItemStack", - "tools.MixinMiningToolItem" - ], - "injectors": { - "defaultRequire": 1 - } -} \ No newline at end of file