├── forge ├── gradle.properties └── src │ └── main │ ├── resources │ ├── icon.png │ ├── pack.mcmeta │ ├── architectury.mixins.json │ └── META-INF │ │ └── mods.toml │ └── java │ └── dev │ └── architectury │ ├── hooks │ ├── level │ │ ├── biome │ │ │ └── forge │ │ │ │ └── BiomeHooksImpl.java │ │ ├── forge │ │ │ └── ExplosionHooksImpl.java │ │ └── entity │ │ │ └── forge │ │ │ ├── PlayerHooksImpl.java │ │ │ └── ItemEntityHooksImpl.java │ ├── fluid │ │ └── forge │ │ │ ├── FluidBucketHooksImpl.java │ │ │ ├── LiquidBlockHooksImpl.java │ │ │ └── FluidStackHooksForge.java │ ├── forge │ │ ├── PackRepositoryHooksImpl.java │ │ └── DyeColorHooksImpl.java │ └── item │ │ ├── forge │ │ └── ItemStackHooksImpl.java │ │ └── food │ │ └── forge │ │ └── FoodPropertiesHooksImpl.java │ ├── utils │ └── forge │ │ └── GameInstanceImpl.java │ ├── event │ └── forge │ │ ├── EventHandlerImplServer.java │ │ └── LootTableModificationContextImpl.java │ ├── core │ ├── block │ │ └── forge │ │ │ └── imitator │ │ │ └── ArchitecturyLiquidBlock.java │ └── item │ │ └── forge │ │ └── imitator │ │ └── ArchitecturyMobBucketItem.java │ ├── registry │ ├── client │ │ └── rendering │ │ │ └── forge │ │ │ ├── BlockEntityRendererRegistryImpl.java │ │ │ └── RenderTypeRegistryImpl.java │ ├── forge │ │ └── CreativeTabRegistryImpl.java │ └── item │ │ └── forge │ │ └── ItemPropertiesRegistryImpl.java │ ├── forge │ └── ArchitecturyForge.java │ └── mixin │ └── forge │ ├── MixinEntitySpawnExtension.java │ ├── MixinLevelEvent.java │ └── MixinItemExtension.java ├── testmod-forge ├── gradle.properties ├── src │ └── main │ │ ├── resources │ │ ├── pack.mcmeta │ │ └── META-INF │ │ │ └── mods.toml │ │ └── java │ │ └── dev │ │ └── architectury │ │ └── test │ │ └── forge │ │ └── TestModForge.java └── build.gradle ├── .github └── FUNDING.yml ├── fabric └── src │ └── main │ ├── resources │ ├── icon.png │ └── fabric.mod.json │ └── java │ └── dev │ └── architectury │ ├── hooks │ ├── fabric │ │ ├── PersistentEntitySectionManagerHooks.java │ │ ├── DyeColorHooksImpl.java │ │ └── PackRepositoryHooksImpl.java │ ├── level │ │ ├── biome │ │ │ └── fabric │ │ │ │ └── BiomeHooksImpl.java │ │ ├── entity │ │ │ └── fabric │ │ │ │ ├── FakePlayers.java │ │ │ │ ├── ItemEntityHooksImpl.java │ │ │ │ └── PlayerHooksImpl.java │ │ └── fabric │ │ │ └── ExplosionHooksImpl.java │ ├── fluid │ │ └── fabric │ │ │ ├── FluidBucketHooksImpl.java │ │ │ └── LiquidBlockHooksImpl.java │ └── item │ │ ├── food │ │ └── fabric │ │ │ └── FoodPropertiesHooksImpl.java │ │ └── fabric │ │ └── ItemStackHooksImpl.java │ ├── init │ └── fabric │ │ ├── ArchitecturyServer.java │ │ └── ArchitecturyClient.java │ ├── mixin │ └── fabric │ │ ├── BiomeAccessor.java │ │ ├── BucketItemAccessor.java │ │ ├── LiquidBlockAccessor.java │ │ ├── MixinEntity.java │ │ ├── MixinDedicatedServer.java │ │ ├── MixinTamableAnimal.java │ │ └── client │ │ └── MixinIntegratedServer.java │ ├── registry │ ├── client │ │ ├── keymappings │ │ │ └── fabric │ │ │ │ └── KeyMappingRegistryImpl.java │ │ ├── level │ │ │ └── entity │ │ │ │ └── fabric │ │ │ │ ├── EntityModelLayerRegistryImpl.java │ │ │ │ └── EntityRendererRegistryImpl.java │ │ └── rendering │ │ │ └── fabric │ │ │ ├── BlockEntityRendererRegistryImpl.java │ │ │ └── RenderTypeRegistryImpl.java │ ├── fabric │ │ └── CreativeTabRegistryImpl.java │ ├── level │ │ └── entity │ │ │ ├── fabric │ │ │ ├── EntityAttributeRegistryImpl.java │ │ │ └── SpawnPlacementsRegistryImpl.java │ │ │ └── trade │ │ │ └── fabric │ │ │ └── TradeRegistryImpl.java │ ├── fuel │ │ └── fabric │ │ │ └── FuelRegistryImpl.java │ └── item │ │ └── fabric │ │ └── ItemPropertiesRegistryImpl.java │ ├── impl │ └── fabric │ │ └── ChatComponentImpl.java │ ├── event │ └── fabric │ │ ├── EventFactoryImpl.java │ │ └── LootTableModificationContextImpl.java │ └── compat │ └── fabric │ └── ModMenuCompatibility.java ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── testmod-common ├── src │ └── main │ │ ├── resources │ │ ├── assets │ │ │ └── architectury_test │ │ │ │ ├── models │ │ │ │ └── item │ │ │ │ │ ├── test_spawn_egg.json │ │ │ │ │ └── test_spawn_egg_2.json │ │ │ │ ├── particles │ │ │ │ └── test_particle.json │ │ │ │ ├── lang │ │ │ │ └── en_us.json │ │ │ │ └── textures │ │ │ │ └── particle │ │ │ │ └── test_particle.png │ │ └── data │ │ │ └── architectury_test │ │ │ └── tags │ │ │ └── blocks │ │ │ └── heart_particles2.json │ │ └── java │ │ └── dev │ │ └── architectury │ │ └── test │ │ ├── debug │ │ ├── MessageSink.java │ │ └── ConsoleMessageSink.java │ │ ├── tab │ │ └── TestCreativeTabs.java │ │ ├── loot │ │ └── TestLoot.java │ │ └── recipes │ │ └── TestRecipeSerializer.java └── build.gradle ├── .gitignore ├── testmod-fabric ├── src │ └── main │ │ └── resources │ │ └── fabric.mod.json └── build.gradle ├── gradle.properties ├── settings.gradle ├── common └── src │ └── main │ ├── resources │ ├── architectury-common.mixins.json │ └── architectury.common.json │ └── java │ └── dev │ └── architectury │ ├── impl │ ├── package-info.java │ └── TooltipAdditionalContextsImpl.java │ ├── registry │ ├── registries │ │ ├── options │ │ │ ├── RegistrarOption.java │ │ │ ├── DefaultIdRegistrarOption.java │ │ │ └── StandardRegistrarOption.java │ │ └── RegistrarBuilder.java │ ├── menu │ │ └── ExtendedMenuProvider.java │ ├── client │ │ ├── keymappings │ │ │ └── KeyMappingRegistry.java │ │ ├── level │ │ │ └── entity │ │ │ │ ├── EntityModelLayerRegistry.java │ │ │ │ └── EntityRendererRegistry.java │ │ └── rendering │ │ │ ├── BlockEntityRendererRegistry.java │ │ │ └── RenderTypeRegistry.java │ └── CreativeTabRegistry.java │ ├── event │ ├── EventActor.java │ ├── Event.java │ └── events │ │ └── client │ │ ├── ClientRecipeUpdateEvent.java │ │ └── ClientTickEvent.java │ ├── utils │ ├── value │ │ ├── FloatSupplier.java │ │ ├── Value.java │ │ ├── FloatValue.java │ │ ├── IntValue.java │ │ ├── LongValue.java │ │ ├── DoubleValue.java │ │ └── BooleanValue.java │ ├── Amount.java │ ├── GameInstance.java │ └── PlatformExpectedError.java │ ├── mixin │ └── inject │ │ ├── MixinItem.java │ │ ├── MixinBlock.java │ │ ├── MixinFluid.java │ │ ├── MixinBucketItem.java │ │ ├── MixinEntityType.java │ │ ├── MixinGameEvent.java │ │ ├── MixinLiquidBlock.java │ │ └── MixinFoodPropertiesBuilder.java │ ├── annotations │ ├── ForgeEvent.java │ └── ForgeEventCancellable.java │ ├── hooks │ ├── DyeColorHooks.java │ ├── level │ │ ├── entity │ │ │ ├── PlayerHooks.java │ │ │ ├── EntityHooks.java │ │ │ └── ItemEntityHooks.java │ │ ├── ExplosionHooks.java │ │ └── biome │ │ │ ├── BiomeProperties.java │ │ │ └── ClimateProperties.java │ ├── PackRepositoryHooks.java │ ├── item │ │ └── food │ │ │ └── FoodPropertiesHooks.java │ ├── fluid │ │ ├── FluidBucketHooks.java │ │ └── LiquidBlockHooks.java │ └── client │ │ └── screen │ │ └── ScreenAccess.java │ ├── extensions │ ├── injected │ │ ├── InjectedBucketItemExtension.java │ │ ├── InjectedGameEventExtension.java │ │ ├── InjectedLiquidBlockExtension.java │ │ ├── InjectedItemExtension.java │ │ ├── InjectedBlockExtension.java │ │ ├── InjectedFluidExtension.java │ │ ├── InjectedEntityTypeExtension.java │ │ ├── InjectedRegistryEntryExtension.java │ │ └── InjectedFoodPropertiesBuilderExtension.java │ └── network │ │ └── EntitySpawnExtension.java │ ├── core │ ├── block │ │ └── ArchitecturyLiquidBlock.java │ └── item │ │ ├── ArchitecturyBucketItem.java │ │ ├── ArchitecturyMobBucketItem.java │ │ └── ArchitecturyRecordItem.java │ └── networking │ ├── simple │ └── BaseC2SMessage.java │ └── transformers │ └── PacketCollector.java └── HEADER /forge/gradle.properties: -------------------------------------------------------------------------------- 1 | loom.platform=forge -------------------------------------------------------------------------------- /testmod-forge/gradle.properties: -------------------------------------------------------------------------------- 1 | loom.platform=forge -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | patreon: shedaniel 2 | github: MaxNeedsSnacks 3 | -------------------------------------------------------------------------------- /fabric/src/main/resources/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/architectury/architectury-api/HEAD/fabric/src/main/resources/icon.png -------------------------------------------------------------------------------- /forge/src/main/resources/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/architectury/architectury-api/HEAD/forge/src/main/resources/icon.png -------------------------------------------------------------------------------- /forge/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "Architectury", 4 | "pack_format": 6 5 | } 6 | } -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/architectury/architectury-api/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /testmod-forge/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "Architectury Test", 4 | "pack_format": 6 5 | } 6 | } -------------------------------------------------------------------------------- /testmod-common/src/main/resources/assets/architectury_test/models/item/test_spawn_egg.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "minecraft:item/template_spawn_egg" 3 | } -------------------------------------------------------------------------------- /testmod-common/src/main/resources/assets/architectury_test/models/item/test_spawn_egg_2.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "minecraft:item/template_spawn_egg" 3 | } -------------------------------------------------------------------------------- /testmod-common/src/main/resources/assets/architectury_test/particles/test_particle.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": [ 3 | "architectury_test:test_particle" 4 | ] 5 | } -------------------------------------------------------------------------------- /testmod-common/src/main/resources/data/architectury_test/tags/blocks/heart_particles2.json: -------------------------------------------------------------------------------- 1 | { 2 | "replace": false, 3 | "values": [ 4 | "minecraft:emerald_block" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /testmod-common/src/main/resources/assets/architectury_test/lang/en_us.json: -------------------------------------------------------------------------------- 1 | { 2 | "category.architectury_test": "Architectury Test", 3 | "key.architectury_test.test": "Test Keybind" 4 | } -------------------------------------------------------------------------------- /testmod-common/src/main/resources/assets/architectury_test/textures/particle/test_particle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/architectury/architectury-api/HEAD/testmod-common/src/main/resources/assets/architectury_test/textures/particle/test_particle.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | *.ipr 3 | run/ 4 | *.iws 5 | out/ 6 | *.iml 7 | .gradle/ 8 | output/ 9 | bin/ 10 | libs/ 11 | 12 | .classpath 13 | .project 14 | .settings/org.eclipse.core.resources.prefs 15 | .idea/ 16 | classes/ 17 | 18 | .vscode/ 19 | logs/ -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /testmod-forge/src/main/resources/META-INF/mods.toml: -------------------------------------------------------------------------------- 1 | modLoader = "javafml" 2 | loaderVersion = "[33,)" 3 | issueTrackerURL = "https://github.com/shedaniel/architectury/issues" 4 | license = "LGPL-3" 5 | 6 | [[mods]] 7 | modId = "architectury_test" 8 | version = "${file.jarVersion}" 9 | displayName = "Architectury Test" 10 | authors = "shedaniel" 11 | description = ''' 12 | A intermediary api aimed to ease developing multiplatform mods. 13 | ''' 14 | license = "LGPL-3" -------------------------------------------------------------------------------- /testmod-fabric/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "architectury-test", 4 | "version": "${version}", 5 | "name": "Architectury Test", 6 | "description": "A intermediary api aimed to ease developing multiplatform mods.", 7 | "authors": [ 8 | "shedaniel" 9 | ], 10 | "license": "LGPL-3", 11 | "environment": "*", 12 | "entrypoints": { 13 | "main": [ 14 | "dev.architectury.test.TestMod::initialize" 15 | ] 16 | } 17 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx6G 2 | org.gradle.daemon=false 3 | 4 | platforms=fabric,forge 5 | 6 | minecraft_version=1.19.2 7 | supported_version=1.19.2 8 | 9 | artifact_type=release 10 | 11 | archives_base_name=architectury 12 | archives_base_name_snapshot=architectury-snapshot 13 | base_version=6.6 14 | maven_group=dev.architectury 15 | 16 | fabric_loader_version=0.14.19 17 | fabric_api_version=0.66.0+1.19.2 18 | mod_menu_version=3.1.0 19 | 20 | forge_version=43.2.0 21 | 22 | curseforge_id=419699 23 | modrinth_id=lhGA9TYQ 24 | -------------------------------------------------------------------------------- /testmod-common/build.gradle: -------------------------------------------------------------------------------- 1 | loom { 2 | accessWidenerPath = project(':common').file("src/main/resources/architectury.accessWidener") 3 | } 4 | 5 | dependencies { 6 | // We depend on fabric loader here to use the fabric @Environment annotations 7 | // Do NOT use other classes from fabric loader 8 | modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" 9 | implementation project(path: ":common", configuration: "namedElements") 10 | } 11 | 12 | architectury { 13 | common(rootProject.platforms.split(",")) 14 | } 15 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | maven { url "https://maven.fabricmc.net/" } 4 | maven { url "https://maven.architectury.dev/" } 5 | maven { url "https://files.minecraftforge.net/maven/" } 6 | gradlePluginPortal() 7 | } 8 | } 9 | 10 | if (JavaVersion.current().ordinal() + 1 < 17) { 11 | throw new IllegalStateException("Please run gradle with Java 17+!") 12 | } 13 | 14 | include("common") 15 | include("fabric") 16 | include("forge") 17 | include("testmod-common") 18 | include("testmod-fabric") 19 | include("testmod-forge") 20 | 21 | rootProject.name = "architectury" 22 | -------------------------------------------------------------------------------- /common/src/main/resources/architectury-common.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "dev.architectury.mixin", 4 | "compatibilityLevel": "JAVA_16", 5 | "minVersion": "0.7.11", 6 | "client": [ 7 | ], 8 | "mixins": [ 9 | "inject.MixinBlock", 10 | "inject.MixinBucketItem", 11 | "inject.MixinEntityType", 12 | "inject.MixinFluid", 13 | "inject.MixinFoodPropertiesBuilder", 14 | "inject.MixinGameEvent", 15 | "inject.MixinItem", 16 | "inject.MixinLiquidBlock", 17 | "MixinLightningBolt" 18 | ], 19 | "injectors": { 20 | "maxShiftBy": 5, 21 | "defaultRequire": 1 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /forge/src/main/resources/architectury.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "dev.architectury.mixin.forge", 4 | "plugin": "dev.architectury.plugin.forge.ArchitecturyMixinPlugin", 5 | "compatibilityLevel": "JAVA_16", 6 | "minVersion": "0.8", 7 | "client": [ 8 | "client.MixinCommandSourceStack", 9 | "MixinClientLevel", 10 | "MixinMinecraft" 11 | ], 12 | "mixins": [ 13 | "MixinChunkSerializer", 14 | "MixinEntitySpawnExtension", 15 | "MixinFallingBlockEntity", 16 | "MixinItemExtension", 17 | "MixinLevelEvent" 18 | ], 19 | "injectors": { 20 | "defaultRequire": 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /forge/src/main/resources/META-INF/mods.toml: -------------------------------------------------------------------------------- 1 | modLoader = "javafml" 2 | loaderVersion = "[43,)" 3 | issueTrackerURL = "https://github.com/shedaniel/architectury/issues" 4 | license = "GNU LGPLv3" 5 | 6 | [[mods]] 7 | modId = "architectury" 8 | version = "${version}" 9 | displayName = "Architectury" 10 | authors = "shedaniel" 11 | description = ''' 12 | A intermediary api aimed to ease developing multiplatform mods. 13 | ''' 14 | logoFile = "icon.png" 15 | license = "LGPL-3" 16 | 17 | [[dependencies.architectury]] 18 | modId = "minecraft" 19 | mandatory = true 20 | versionRange = "[1.19.2,)" 21 | ordering = "NONE" 22 | side = "BOTH" 23 | 24 | [[dependencies.architectury]] 25 | modId = "forge" 26 | mandatory = true 27 | versionRange = "[43.2.0,)" 28 | ordering = "NONE" 29 | side = "BOTH" 30 | -------------------------------------------------------------------------------- /HEADER: -------------------------------------------------------------------------------- 1 | This file is part of architectury. 2 | Copyright (C) ${year} ${name} 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 3 of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with this program; if not, write to the Free Software Foundation, 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -------------------------------------------------------------------------------- /testmod-fabric/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "com.github.johnrengelman.shadow" version "7.0.0" 3 | id "com.matthewprenger.cursegradle" 4 | } 5 | 6 | loom { 7 | accessWidenerPath = project(":common").loom.accessWidenerPath 8 | 9 | mixin { useLegacyMixinAp = true } 10 | } 11 | 12 | architectury { 13 | platformSetupLoomIde() 14 | fabric() 15 | } 16 | 17 | configurations { 18 | common 19 | compileClasspath.extendsFrom common 20 | runtimeClasspath.extendsFrom common 21 | developmentFabric.extendsFrom common 22 | } 23 | 24 | dependencies { 25 | modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" 26 | modImplementation "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}" 27 | 28 | implementation project(path: ":fabric", configuration: "namedElements") 29 | common(project(path: ":common", configuration: "namedElements")) { transitive false } 30 | common(project(path: ":testmod-common", configuration: "namedElements")) { transitive false } 31 | } 32 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/impl/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | @ApiStatus.Internal 21 | package dev.architectury.impl; 22 | 23 | import org.jetbrains.annotations.ApiStatus; -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/registry/registries/options/RegistrarOption.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.registry.registries.options; 21 | 22 | public interface RegistrarOption { 23 | } 24 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/event/EventActor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.event; 21 | 22 | @FunctionalInterface 23 | public interface EventActor { 24 | EventResult act(T t); 25 | } 26 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/utils/value/FloatSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.utils.value; 21 | 22 | @FunctionalInterface 23 | public interface FloatSupplier { 24 | float getAsFloat(); 25 | } 26 | -------------------------------------------------------------------------------- /testmod-forge/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "com.github.johnrengelman.shadow" version "7.0.0" 3 | id "com.matthewprenger.cursegradle" 4 | } 5 | 6 | loom { 7 | accessWidenerPath = project(":common").loom.accessWidenerPath 8 | 9 | mods { 10 | forge { 11 | sourceSet project(":forge").sourceSets.main 12 | } 13 | } 14 | 15 | forge { 16 | mixinConfig "architectury.mixins.json" 17 | } 18 | } 19 | 20 | architectury { 21 | platformSetupLoomIde() 22 | forge() 23 | } 24 | 25 | configurations { 26 | common 27 | compileClasspath.extendsFrom common 28 | runtimeClasspath.extendsFrom common 29 | developmentForge.extendsFrom common 30 | } 31 | 32 | dependencies { 33 | forge "net.minecraftforge:forge:${gradle.rootProject.architectury.minecraft}-${rootProject.forge_version}" 34 | 35 | implementation project(path: ":forge", configuration: "namedElements") 36 | common(project(path: ":common", configuration: "namedElements")) { transitive false } 37 | common(project(path: ":testmod-common", configuration: "namedElements")) { transitive false } 38 | } 39 | -------------------------------------------------------------------------------- /common/src/main/resources/architectury.common.json: -------------------------------------------------------------------------------- 1 | { 2 | "accessWidener": "architectury.accessWidener", 3 | "injected_interfaces": { 4 | "net/minecraft/class_1792": [ 5 | "dev/architectury/extensions/injected/InjectedItemExtension" 6 | ], 7 | "net/minecraft/class_2248": [ 8 | "dev/architectury/extensions/injected/InjectedBlockExtension" 9 | ], 10 | "net/minecraft/class_3611": [ 11 | "dev/architectury/extensions/injected/InjectedFluidExtension" 12 | ], 13 | "net/minecraft/class_1299": [ 14 | "dev/architectury/extensions/injected/InjectedEntityTypeExtension" 15 | ], 16 | "net/minecraft/class_1755": [ 17 | "dev/architectury/extensions/injected/InjectedBucketItemExtension" 18 | ], 19 | "net/minecraft/class_5712": [ 20 | "dev/architectury/extensions/injected/InjectedGameEventExtension" 21 | ], 22 | "net/minecraft/class_4174$class_4175": [ 23 | "dev/architectury/extensions/injected/InjectedFoodPropertiesBuilderExtension" 24 | ], 25 | "net/minecraft/class_2404": [ 26 | "dev/architectury/extensions/injected/InjectedLiquidBlockExtension" 27 | ] 28 | } 29 | } -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/utils/value/Value.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.utils.value; 21 | 22 | import java.util.function.Consumer; 23 | import java.util.function.Supplier; 24 | 25 | public interface Value extends Supplier, Consumer { 26 | } 27 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/hooks/fabric/PersistentEntitySectionManagerHooks.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.fabric; 21 | 22 | import net.minecraft.server.level.ServerLevel; 23 | 24 | public interface PersistentEntitySectionManagerHooks { 25 | void architectury_attachLevel(ServerLevel level); 26 | } 27 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/registry/registries/options/DefaultIdRegistrarOption.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.registry.registries.options; 21 | 22 | import net.minecraft.resources.ResourceLocation; 23 | 24 | public record DefaultIdRegistrarOption(ResourceLocation defaultId) implements RegistrarOption { 25 | } 26 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/init/fabric/ArchitecturyServer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.init.fabric; 21 | 22 | import dev.architectury.event.events.common.LifecycleEvent; 23 | 24 | public class ArchitecturyServer { 25 | public static void init() { 26 | LifecycleEvent.SETUP.invoker().run(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /testmod-common/src/main/java/dev/architectury/test/debug/MessageSink.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.test.debug; 21 | 22 | public interface MessageSink { 23 | void accept(String message); 24 | 25 | default void accept(String message, Object... args) { 26 | accept(String.format(message, args)); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/event/Event.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.event; 21 | 22 | public interface Event { 23 | T invoker(); 24 | 25 | void register(T listener); 26 | 27 | void unregister(T listener); 28 | 29 | boolean isRegistered(T listener); 30 | 31 | void clearListeners(); 32 | } 33 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/registry/menu/ExtendedMenuProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.registry.menu; 21 | 22 | import net.minecraft.network.FriendlyByteBuf; 23 | import net.minecraft.world.MenuProvider; 24 | 25 | public interface ExtendedMenuProvider extends MenuProvider { 26 | void saveExtraData(FriendlyByteBuf buf); 27 | } 28 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/utils/value/FloatValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.utils.value; 21 | 22 | import it.unimi.dsi.fastutil.floats.FloatConsumer; 23 | 24 | public interface FloatValue extends Value, FloatSupplier, FloatConsumer { 25 | @Override 26 | default Float get() { 27 | return getAsFloat(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/mixin/inject/MixinItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.mixin.inject; 21 | 22 | import dev.architectury.extensions.injected.InjectedItemExtension; 23 | import net.minecraft.world.item.Item; 24 | import org.spongepowered.asm.mixin.Mixin; 25 | 26 | @Mixin(Item.class) 27 | public class MixinItem implements InjectedItemExtension { 28 | } 29 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/mixin/inject/MixinBlock.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.mixin.inject; 21 | 22 | import dev.architectury.extensions.injected.InjectedBlockExtension; 23 | import net.minecraft.world.level.block.Block; 24 | import org.spongepowered.asm.mixin.Mixin; 25 | 26 | @Mixin(Block.class) 27 | public class MixinBlock implements InjectedBlockExtension { 28 | } 29 | -------------------------------------------------------------------------------- /forge/src/main/java/dev/architectury/hooks/level/biome/forge/BiomeHooksImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.level.biome.forge; 21 | 22 | import net.minecraft.world.level.biome.Biome; 23 | 24 | public class BiomeHooksImpl { 25 | public static Biome.ClimateSettings extractClimateSettings(Biome biome) { 26 | return biome.getModifiedClimateSettings(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/mixin/inject/MixinFluid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.mixin.inject; 21 | 22 | import dev.architectury.extensions.injected.InjectedFluidExtension; 23 | import net.minecraft.world.level.material.Fluid; 24 | import org.spongepowered.asm.mixin.Mixin; 25 | 26 | @Mixin(Fluid.class) 27 | public class MixinFluid implements InjectedFluidExtension { 28 | } 29 | -------------------------------------------------------------------------------- /forge/src/main/java/dev/architectury/hooks/level/forge/ExplosionHooksImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.level.forge; 21 | 22 | import net.minecraft.world.level.Explosion; 23 | import net.minecraft.world.phys.Vec3; 24 | 25 | public class ExplosionHooksImpl { 26 | public static Vec3 getPosition(Explosion explosion) { 27 | return explosion.getPosition(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /forge/src/main/java/dev/architectury/hooks/fluid/forge/FluidBucketHooksImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.fluid.forge; 21 | 22 | import net.minecraft.world.item.BucketItem; 23 | import net.minecraft.world.level.material.Fluid; 24 | 25 | public class FluidBucketHooksImpl { 26 | public static Fluid getFluid(BucketItem item) { 27 | return item.getFluid(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/utils/value/IntValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.utils.value; 21 | 22 | import it.unimi.dsi.fastutil.ints.IntConsumer; 23 | 24 | import java.util.function.IntSupplier; 25 | 26 | public interface IntValue extends Value, IntSupplier, IntConsumer { 27 | @Override 28 | default Integer get() { 29 | return getAsInt(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/utils/value/LongValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.utils.value; 21 | 22 | import it.unimi.dsi.fastutil.longs.LongConsumer; 23 | 24 | import java.util.function.LongSupplier; 25 | 26 | public interface LongValue extends Value, LongSupplier, LongConsumer { 27 | @Override 28 | default Long get() { 29 | return getAsLong(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /forge/src/main/java/dev/architectury/utils/forge/GameInstanceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.utils.forge; 21 | 22 | import net.minecraft.server.MinecraftServer; 23 | import net.minecraftforge.server.ServerLifecycleHooks; 24 | 25 | public class GameInstanceImpl { 26 | public static MinecraftServer getServer() { 27 | return ServerLifecycleHooks.getCurrentServer(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/annotations/ForgeEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.annotations; 21 | 22 | import java.lang.annotation.ElementType; 23 | import java.lang.annotation.Retention; 24 | import java.lang.annotation.RetentionPolicy; 25 | import java.lang.annotation.Target; 26 | 27 | @Retention(RetentionPolicy.RUNTIME) 28 | @Target(ElementType.TYPE) 29 | public @interface ForgeEvent { 30 | } 31 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/mixin/inject/MixinBucketItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.mixin.inject; 21 | 22 | import dev.architectury.extensions.injected.InjectedBucketItemExtension; 23 | import net.minecraft.world.item.BucketItem; 24 | import org.spongepowered.asm.mixin.Mixin; 25 | 26 | @Mixin(BucketItem.class) 27 | public class MixinBucketItem implements InjectedBucketItemExtension { 28 | } 29 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/mixin/inject/MixinEntityType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.mixin.inject; 21 | 22 | import dev.architectury.extensions.injected.InjectedEntityTypeExtension; 23 | import net.minecraft.world.entity.EntityType; 24 | import org.spongepowered.asm.mixin.Mixin; 25 | 26 | @Mixin(EntityType.class) 27 | public class MixinEntityType implements InjectedEntityTypeExtension { 28 | } 29 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/mixin/inject/MixinGameEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.mixin.inject; 21 | 22 | import dev.architectury.extensions.injected.InjectedGameEventExtension; 23 | import net.minecraft.world.level.gameevent.GameEvent; 24 | import org.spongepowered.asm.mixin.Mixin; 25 | 26 | @Mixin(GameEvent.class) 27 | public class MixinGameEvent implements InjectedGameEventExtension { 28 | } 29 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/mixin/inject/MixinLiquidBlock.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.mixin.inject; 21 | 22 | import dev.architectury.extensions.injected.InjectedLiquidBlockExtension; 23 | import net.minecraft.world.level.block.LiquidBlock; 24 | import org.spongepowered.asm.mixin.Mixin; 25 | 26 | @Mixin(LiquidBlock.class) 27 | public class MixinLiquidBlock implements InjectedLiquidBlockExtension { 28 | } 29 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/utils/value/DoubleValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.utils.value; 21 | 22 | import it.unimi.dsi.fastutil.doubles.DoubleConsumer; 23 | 24 | import java.util.function.DoubleSupplier; 25 | 26 | public interface DoubleValue extends Value, DoubleSupplier, DoubleConsumer { 27 | @Override 28 | default Double get() { 29 | return getAsDouble(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /forge/src/main/java/dev/architectury/hooks/fluid/forge/LiquidBlockHooksImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.fluid.forge; 21 | 22 | import net.minecraft.world.level.block.LiquidBlock; 23 | import net.minecraft.world.level.material.FlowingFluid; 24 | 25 | public class LiquidBlockHooksImpl { 26 | public static FlowingFluid getFluid(LiquidBlock block) { 27 | return block.getFluid(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /forge/src/main/java/dev/architectury/hooks/level/entity/forge/PlayerHooksImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.level.entity.forge; 21 | 22 | import net.minecraft.world.entity.player.Player; 23 | import net.minecraftforge.common.util.FakePlayer; 24 | 25 | public class PlayerHooksImpl { 26 | public static boolean isFake(Player playerEntity) { 27 | return playerEntity instanceof FakePlayer; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/utils/value/BooleanValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.utils.value; 21 | 22 | import it.unimi.dsi.fastutil.booleans.BooleanConsumer; 23 | 24 | import java.util.function.BooleanSupplier; 25 | 26 | public interface BooleanValue extends Value, BooleanSupplier, BooleanConsumer { 27 | @Override 28 | default Boolean get() { 29 | return getAsBoolean(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/annotations/ForgeEventCancellable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.annotations; 21 | 22 | import java.lang.annotation.ElementType; 23 | import java.lang.annotation.Retention; 24 | import java.lang.annotation.RetentionPolicy; 25 | import java.lang.annotation.Target; 26 | 27 | @Retention(RetentionPolicy.RUNTIME) 28 | @Target(ElementType.TYPE) 29 | public @interface ForgeEventCancellable { 30 | } 31 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/mixin/fabric/BiomeAccessor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.mixin.fabric; 21 | 22 | import net.minecraft.world.level.biome.Biome; 23 | import org.spongepowered.asm.mixin.Mixin; 24 | import org.spongepowered.asm.mixin.gen.Accessor; 25 | 26 | @Mixin(Biome.class) 27 | public interface BiomeAccessor { 28 | @Accessor("climateSettings") 29 | Biome.ClimateSettings getClimateSettings(); 30 | } 31 | -------------------------------------------------------------------------------- /forge/src/main/java/dev/architectury/event/forge/EventHandlerImplServer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.event.forge; 21 | 22 | import net.minecraftforge.api.distmarker.Dist; 23 | import net.minecraftforge.api.distmarker.OnlyIn; 24 | 25 | @OnlyIn(Dist.DEDICATED_SERVER) 26 | public class EventHandlerImplServer { 27 | @OnlyIn(Dist.DEDICATED_SERVER) 28 | public static class ModBasedEventHandler { 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/hooks/DyeColorHooks.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks; 21 | 22 | import dev.architectury.injectables.annotations.ExpectPlatform; 23 | import net.minecraft.world.item.DyeColor; 24 | 25 | public class DyeColorHooks { 26 | private DyeColorHooks() { 27 | } 28 | 29 | @ExpectPlatform 30 | public static int getColorValue(DyeColor color) { 31 | throw new AssertionError(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/hooks/level/biome/fabric/BiomeHooksImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.level.biome.fabric; 21 | 22 | import dev.architectury.mixin.fabric.BiomeAccessor; 23 | import net.minecraft.world.level.biome.Biome; 24 | 25 | public class BiomeHooksImpl { 26 | public static Biome.ClimateSettings extractClimateSettings(Biome biome) { 27 | return ((BiomeAccessor) (Object) biome).getClimateSettings(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /forge/src/main/java/dev/architectury/hooks/forge/PackRepositoryHooksImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.forge; 21 | 22 | import net.minecraft.server.packs.repository.PackRepository; 23 | import net.minecraft.server.packs.repository.RepositorySource; 24 | 25 | public class PackRepositoryHooksImpl { 26 | public static void addSource(PackRepository repository, RepositorySource source) { 27 | repository.addPackFinder(source); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/mixin/inject/MixinFoodPropertiesBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.mixin.inject; 21 | 22 | import dev.architectury.extensions.injected.InjectedFoodPropertiesBuilderExtension; 23 | import net.minecraft.world.food.FoodProperties; 24 | import org.spongepowered.asm.mixin.Mixin; 25 | 26 | @Mixin(FoodProperties.Builder.class) 27 | public class MixinFoodPropertiesBuilder implements InjectedFoodPropertiesBuilderExtension { 28 | } 29 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/mixin/fabric/BucketItemAccessor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.mixin.fabric; 21 | 22 | import net.minecraft.world.item.BucketItem; 23 | import net.minecraft.world.level.material.Fluid; 24 | import org.spongepowered.asm.mixin.Mixin; 25 | import org.spongepowered.asm.mixin.gen.Accessor; 26 | 27 | @Mixin(BucketItem.class) 28 | public interface BucketItemAccessor { 29 | @Accessor("content") 30 | Fluid getContent(); 31 | } 32 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/registry/client/keymappings/fabric/KeyMappingRegistryImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.registry.client.keymappings.fabric; 21 | 22 | import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; 23 | import net.minecraft.client.KeyMapping; 24 | 25 | public class KeyMappingRegistryImpl { 26 | public static void register(KeyMapping mapping) { 27 | KeyBindingHelper.registerKeyBinding(mapping); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/hooks/level/entity/PlayerHooks.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.level.entity; 21 | 22 | import dev.architectury.injectables.annotations.ExpectPlatform; 23 | import net.minecraft.world.entity.player.Player; 24 | 25 | public final class PlayerHooks { 26 | private PlayerHooks() { 27 | } 28 | 29 | @ExpectPlatform 30 | public static boolean isFake(Player player) { 31 | throw new AssertionError(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/hooks/fluid/fabric/FluidBucketHooksImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.fluid.fabric; 21 | 22 | import dev.architectury.mixin.fabric.BucketItemAccessor; 23 | import net.minecraft.world.item.BucketItem; 24 | import net.minecraft.world.level.material.Fluid; 25 | 26 | public class FluidBucketHooksImpl { 27 | public static Fluid getFluid(BucketItem item) { 28 | return ((BucketItemAccessor) item).getContent(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/extensions/injected/InjectedBucketItemExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.extensions.injected; 21 | 22 | import dev.architectury.hooks.fluid.FluidBucketHooks; 23 | import net.minecraft.world.item.BucketItem; 24 | import net.minecraft.world.level.material.Fluid; 25 | 26 | public interface InjectedBucketItemExtension { 27 | default Fluid arch$getFluid() { 28 | return FluidBucketHooks.getFluid((BucketItem) this); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/mixin/fabric/LiquidBlockAccessor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.mixin.fabric; 21 | 22 | import net.minecraft.world.level.block.LiquidBlock; 23 | import net.minecraft.world.level.material.FlowingFluid; 24 | import org.spongepowered.asm.mixin.Mixin; 25 | import org.spongepowered.asm.mixin.gen.Accessor; 26 | 27 | @Mixin(LiquidBlock.class) 28 | public interface LiquidBlockAccessor { 29 | @Accessor("fluid") 30 | FlowingFluid getFluid(); 31 | } 32 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/extensions/injected/InjectedGameEventExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.extensions.injected; 21 | 22 | import net.minecraft.core.Holder; 23 | import net.minecraft.world.level.gameevent.GameEvent; 24 | 25 | public interface InjectedGameEventExtension extends InjectedRegistryEntryExtension { 26 | @Override 27 | default Holder arch$holder() { 28 | return ((GameEvent) this).builtInRegistryHolder(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/hooks/fabric/DyeColorHooksImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.fabric; 21 | 22 | import net.minecraft.world.item.DyeColor; 23 | 24 | public class DyeColorHooksImpl { 25 | public static int getColorValue(DyeColor color) { 26 | var colors = color.getTextureDiffuseColors(); 27 | return ((int) (colors[0] * 255.0F + 0.5D) & 255) << 16 | ((int) (colors[1] * 255.0F + 0.5D) & 255) << 8 | (int) (colors[2] * 255.0F + 0.5D); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /testmod-common/src/main/java/dev/architectury/test/debug/ConsoleMessageSink.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.test.debug; 21 | 22 | import org.apache.logging.log4j.LogManager; 23 | import org.apache.logging.log4j.Logger; 24 | 25 | public class ConsoleMessageSink implements MessageSink { 26 | protected final Logger logger = LogManager.getLogger("Architectury Test"); 27 | 28 | @Override 29 | public void accept(String message) { 30 | logger.info(message); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /forge/src/main/java/dev/architectury/hooks/forge/DyeColorHooksImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.forge; 21 | 22 | import net.minecraft.world.item.DyeColor; 23 | 24 | public class DyeColorHooksImpl { 25 | public static int getColorValue(DyeColor dyeColor) { 26 | var colors = dyeColor.getTextureDiffuseColors(); 27 | return ((int) (colors[0] * 255.0F + 0.5D) & 255) << 16 | ((int) (colors[1] * 255.0F + 0.5D) & 255) << 8 | (int) (colors[2] * 255.0F + 0.5D); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/registry/registries/options/StandardRegistrarOption.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.registry.registries.options; 21 | 22 | public enum StandardRegistrarOption implements RegistrarOption { 23 | /** 24 | * Denote that the registry should save to disc and persist. Defaulted false. 25 | */ 26 | SAVE_TO_DISC, 27 | /** 28 | * Denote that the registry should sync its contents to clients. Defaulted false. 29 | */ 30 | SYNC_TO_CLIENTS, 31 | } 32 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/hooks/fluid/fabric/LiquidBlockHooksImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.fluid.fabric; 21 | 22 | import dev.architectury.mixin.fabric.LiquidBlockAccessor; 23 | import net.minecraft.world.level.block.LiquidBlock; 24 | import net.minecraft.world.level.material.FlowingFluid; 25 | 26 | public class LiquidBlockHooksImpl { 27 | public static FlowingFluid getFluid(LiquidBlock block) { 28 | return ((LiquidBlockAccessor) block).getFluid(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/hooks/level/entity/fabric/FakePlayers.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.level.entity.fabric; 21 | 22 | import dev.architectury.event.Event; 23 | import dev.architectury.event.EventFactory; 24 | import dev.architectury.event.EventResult; 25 | import net.minecraft.world.entity.player.Player; 26 | 27 | public interface FakePlayers { 28 | Event EVENT = EventFactory.createEventResult(); 29 | 30 | EventResult isFakePlayer(Player player); 31 | } 32 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/extensions/injected/InjectedLiquidBlockExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.extensions.injected; 21 | 22 | import dev.architectury.hooks.fluid.LiquidBlockHooks; 23 | import net.minecraft.world.level.block.LiquidBlock; 24 | import net.minecraft.world.level.material.FlowingFluid; 25 | 26 | public interface InjectedLiquidBlockExtension { 27 | default FlowingFluid arch$getFluid() { 28 | return LiquidBlockHooks.getFluid((LiquidBlock) this); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /fabric/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "architectury", 4 | "version": "${version}", 5 | "name": "Architectury", 6 | "description": "A intermediary api aimed to ease developing multiplatform mods.", 7 | "authors": [ 8 | "shedaniel" 9 | ], 10 | "contact": { 11 | "issues": "https://github.com/architectury/architectury-api/issues", 12 | "sources": "https://github.com/architectury/architectury-api", 13 | "homepage": "https://architectury.github.io/architectury-documentations/" 14 | }, 15 | "license": "LGPL-3", 16 | "environment": "*", 17 | "mixins": [ 18 | "architectury-common.mixins.json", 19 | "architectury.mixins.json" 20 | ], 21 | "entrypoints": { 22 | "main": [ 23 | "dev.architectury.utils.fabric.GameInstanceImpl::init" 24 | ], 25 | "server": [ 26 | "dev.architectury.init.fabric.ArchitecturyServer::init" 27 | ], 28 | "client": [ 29 | "dev.architectury.init.fabric.ArchitecturyClient::init" 30 | ], 31 | "modmenu": [ 32 | "dev.architectury.compat.fabric.ModMenuCompatibility" 33 | ] 34 | }, 35 | "icon": "icon.png", 36 | "depends": { 37 | "minecraft": "~1.19.2", 38 | "fabricloader": ">=0.14.0", 39 | "fabric-api": ">=0.66.0" 40 | }, 41 | "breaks": { 42 | "optifabric": "<1.13.0" 43 | }, 44 | "custom": { 45 | "modmenu:api": true 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /forge/src/main/java/dev/architectury/hooks/item/forge/ItemStackHooksImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.item.forge; 21 | 22 | import net.minecraft.world.item.ItemStack; 23 | 24 | public class ItemStackHooksImpl { 25 | public static boolean hasCraftingRemainingItem(ItemStack stack) { 26 | return stack.hasCraftingRemainingItem(); 27 | } 28 | 29 | public static ItemStack getCraftingRemainingItem(ItemStack stack) { 30 | return stack.getCraftingRemainingItem(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/hooks/level/ExplosionHooks.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.level; 21 | 22 | import dev.architectury.injectables.annotations.ExpectPlatform; 23 | import net.minecraft.world.level.Explosion; 24 | import net.minecraft.world.phys.Vec3; 25 | 26 | public final class ExplosionHooks { 27 | private ExplosionHooks() { 28 | } 29 | 30 | @ExpectPlatform 31 | public static Vec3 getPosition(Explosion explosion) { 32 | throw new AssertionError(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /forge/src/main/java/dev/architectury/core/block/forge/imitator/ArchitecturyLiquidBlock.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.core.block.forge.imitator; 21 | 22 | import net.minecraft.world.level.block.LiquidBlock; 23 | import net.minecraft.world.level.material.FlowingFluid; 24 | 25 | import java.util.function.Supplier; 26 | 27 | public class ArchitecturyLiquidBlock extends LiquidBlock { 28 | public ArchitecturyLiquidBlock(Supplier fluid, Properties properties) { 29 | super(fluid, properties); 30 | } 31 | } -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/hooks/level/fabric/ExplosionHooksImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.level.fabric; 21 | 22 | import net.minecraft.world.level.Explosion; 23 | import net.minecraft.world.phys.Vec3; 24 | 25 | public class ExplosionHooksImpl { 26 | public static Vec3 getPosition(Explosion explosion) { 27 | return ((ExplosionExtensions) explosion).architectury_getPosition(); 28 | } 29 | 30 | public interface ExplosionExtensions { 31 | Vec3 architectury_getPosition(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/extensions/injected/InjectedItemExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.extensions.injected; 21 | 22 | import dev.architectury.registry.registries.Registries; 23 | import net.minecraft.core.Holder; 24 | import net.minecraft.core.Registry; 25 | import net.minecraft.world.item.Item; 26 | 27 | public interface InjectedItemExtension extends InjectedRegistryEntryExtension { 28 | @Override 29 | default Holder arch$holder() { 30 | return ((Item) this).builtInRegistryHolder(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/extensions/injected/InjectedBlockExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.extensions.injected; 21 | 22 | import dev.architectury.registry.registries.Registries; 23 | import net.minecraft.core.Holder; 24 | import net.minecraft.core.Registry; 25 | import net.minecraft.world.level.block.Block; 26 | 27 | public interface InjectedBlockExtension extends InjectedRegistryEntryExtension { 28 | @Override 29 | default Holder arch$holder() { 30 | return ((Block) this).builtInRegistryHolder(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/extensions/injected/InjectedFluidExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.extensions.injected; 21 | 22 | import dev.architectury.registry.registries.Registries; 23 | import net.minecraft.core.Holder; 24 | import net.minecraft.core.Registry; 25 | import net.minecraft.world.level.material.Fluid; 26 | 27 | public interface InjectedFluidExtension extends InjectedRegistryEntryExtension { 28 | @Override 29 | default Holder arch$holder() { 30 | return ((Fluid) this).builtInRegistryHolder(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/hooks/PackRepositoryHooks.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks; 21 | 22 | import dev.architectury.injectables.annotations.ExpectPlatform; 23 | import net.minecraft.server.packs.repository.PackRepository; 24 | import net.minecraft.server.packs.repository.RepositorySource; 25 | 26 | public class PackRepositoryHooks { 27 | private PackRepositoryHooks() { 28 | } 29 | 30 | @ExpectPlatform 31 | public static void addSource(PackRepository repository, RepositorySource source) { 32 | throw new AssertionError(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /testmod-forge/src/main/java/dev/architectury/test/forge/TestModForge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.test.forge; 21 | 22 | import dev.architectury.platform.forge.EventBuses; 23 | import dev.architectury.test.TestMod; 24 | import net.minecraftforge.fml.common.Mod; 25 | import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; 26 | 27 | @Mod(TestMod.MOD_ID) 28 | public class TestModForge { 29 | public TestModForge() { 30 | EventBuses.registerModEventBus(TestMod.MOD_ID, FMLJavaModLoadingContext.get().getModEventBus()); 31 | TestMod.initialize(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/extensions/injected/InjectedEntityTypeExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.extensions.injected; 21 | 22 | import dev.architectury.registry.registries.Registries; 23 | import net.minecraft.core.Holder; 24 | import net.minecraft.core.Registry; 25 | import net.minecraft.world.entity.EntityType; 26 | 27 | public interface InjectedEntityTypeExtension extends InjectedRegistryEntryExtension> { 28 | @Override 29 | default Holder> arch$holder() { 30 | return ((EntityType) this).builtInRegistryHolder(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/extensions/injected/InjectedRegistryEntryExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.extensions.injected; 21 | 22 | import net.minecraft.core.Holder; 23 | import net.minecraft.resources.ResourceKey; 24 | import net.minecraft.resources.ResourceLocation; 25 | import org.jetbrains.annotations.Nullable; 26 | 27 | public interface InjectedRegistryEntryExtension { 28 | Holder arch$holder(); 29 | 30 | @Nullable 31 | default ResourceLocation arch$registryName() { 32 | return arch$holder().unwrapKey().map(ResourceKey::location).orElse(null); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/utils/Amount.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.utils; 21 | 22 | public class Amount { 23 | /** 24 | * Converts a long to an int while dropping overflowed values. 25 | * 26 | * @param amount the long to convert 27 | * @return the int value 28 | */ 29 | public static int toInt(long amount) { 30 | if (amount >= Integer.MAX_VALUE) { 31 | return Integer.MAX_VALUE; 32 | } else if (amount <= Integer.MIN_VALUE) { 33 | return Integer.MIN_VALUE; 34 | } 35 | 36 | return (int) amount; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/registry/client/keymappings/KeyMappingRegistry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.registry.client.keymappings; 21 | 22 | import dev.architectury.injectables.annotations.ExpectPlatform; 23 | import net.fabricmc.api.EnvType; 24 | import net.fabricmc.api.Environment; 25 | import net.minecraft.client.KeyMapping; 26 | 27 | @Environment(EnvType.CLIENT) 28 | public final class KeyMappingRegistry { 29 | private KeyMappingRegistry() { 30 | } 31 | 32 | @ExpectPlatform 33 | public static void register(KeyMapping mapping) { 34 | throw new AssertionError(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/registry/fabric/CreativeTabRegistryImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.registry.fabric; 21 | 22 | import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder; 23 | import net.minecraft.resources.ResourceLocation; 24 | import net.minecraft.world.item.CreativeModeTab; 25 | import net.minecraft.world.item.ItemStack; 26 | 27 | import java.util.function.Supplier; 28 | 29 | public class CreativeTabRegistryImpl { 30 | public static CreativeModeTab create(ResourceLocation name, Supplier icon) { 31 | return FabricItemGroupBuilder.build(name, icon); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /forge/src/main/java/dev/architectury/hooks/item/food/forge/FoodPropertiesHooksImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.item.food.forge; 21 | 22 | import net.minecraft.world.effect.MobEffectInstance; 23 | import net.minecraft.world.food.FoodProperties; 24 | 25 | import java.util.function.Supplier; 26 | 27 | public class FoodPropertiesHooksImpl { 28 | @SuppressWarnings("unchecked") 29 | public static void effect(FoodProperties.Builder builder, 30 | Supplier effectSupplier, float chance) { 31 | builder.effect((Supplier) effectSupplier, chance); 32 | } 33 | } -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/hooks/level/entity/EntityHooks.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.level.entity; 21 | 22 | import net.minecraft.world.entity.Entity; 23 | import net.minecraft.world.phys.shapes.CollisionContext; 24 | import net.minecraft.world.phys.shapes.EntityCollisionContext; 25 | import org.jetbrains.annotations.Nullable; 26 | 27 | public final class EntityHooks { 28 | private EntityHooks() { 29 | } 30 | 31 | @Nullable 32 | public static Entity fromCollision(CollisionContext ctx) { 33 | return ctx instanceof EntityCollisionContext ? ((EntityCollisionContext) ctx).getEntity() : null; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/init/fabric/ArchitecturyClient.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.init.fabric; 21 | 22 | import dev.architectury.event.events.client.ClientLifecycleEvent; 23 | import dev.architectury.event.events.common.LifecycleEvent; 24 | import dev.architectury.networking.fabric.SpawnEntityPacket; 25 | import net.minecraft.client.Minecraft; 26 | 27 | public class ArchitecturyClient { 28 | public static void init() { 29 | LifecycleEvent.SETUP.invoker().run(); 30 | ClientLifecycleEvent.CLIENT_SETUP.invoker().stateChanged(Minecraft.getInstance()); 31 | 32 | SpawnEntityPacket.Client.register(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/hooks/fabric/PackRepositoryHooksImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.fabric; 21 | 22 | import net.minecraft.server.packs.repository.PackRepository; 23 | import net.minecraft.server.packs.repository.RepositorySource; 24 | 25 | import java.util.ArrayList; 26 | import java.util.HashSet; 27 | import java.util.List; 28 | 29 | public class PackRepositoryHooksImpl { 30 | public static void addSource(PackRepository repository, RepositorySource source) { 31 | List set = new ArrayList<>(repository.sources); 32 | set.add(source); 33 | repository.sources = new HashSet<>(set); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/hooks/level/entity/fabric/ItemEntityHooksImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.level.entity.fabric; 21 | 22 | import dev.architectury.utils.value.IntValue; 23 | import net.minecraft.world.entity.item.ItemEntity; 24 | 25 | public class ItemEntityHooksImpl { 26 | public static IntValue lifespan(ItemEntity entity) { 27 | return new IntValue() { 28 | @Override 29 | public void accept(int value) { 30 | 31 | } 32 | 33 | @Override 34 | public int getAsInt() { 35 | return 6000; 36 | } 37 | }; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /testmod-common/src/main/java/dev/architectury/test/tab/TestCreativeTabs.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.test.tab; 21 | 22 | import dev.architectury.registry.CreativeTabRegistry; 23 | import dev.architectury.test.TestMod; 24 | import dev.architectury.test.registry.TestRegistries; 25 | import net.minecraft.resources.ResourceLocation; 26 | import net.minecraft.world.item.CreativeModeTab; 27 | import net.minecraft.world.item.ItemStack; 28 | 29 | public class TestCreativeTabs { 30 | public static final CreativeModeTab TEST_TAB = CreativeTabRegistry.create(new ResourceLocation(TestMod.MOD_ID, "test_tab"), 31 | () -> new ItemStack(TestRegistries.TEST_ITEM.get())); 32 | } 33 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/extensions/network/EntitySpawnExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.extensions.network; 21 | 22 | import net.minecraft.network.FriendlyByteBuf; 23 | import net.minecraft.world.entity.Entity; 24 | 25 | /** 26 | * This interface can be implemented on {@linkplain Entity entities} to attach additional spawn data to packets sent to client. 27 | * This is used in conjunction with {@link dev.architectury.networking.NetworkManager#createAddEntityPacket(Entity)} 28 | */ 29 | public interface EntitySpawnExtension { 30 | void saveAdditionalSpawnData(FriendlyByteBuf buf); 31 | 32 | void loadAdditionalSpawnData(FriendlyByteBuf buf); 33 | } 34 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/registry/client/level/entity/fabric/EntityModelLayerRegistryImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.registry.client.level.entity.fabric; 21 | 22 | import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry; 23 | import net.minecraft.client.model.geom.ModelLayerLocation; 24 | import net.minecraft.client.model.geom.builders.LayerDefinition; 25 | 26 | import java.util.function.Supplier; 27 | 28 | public class EntityModelLayerRegistryImpl { 29 | public static void register(ModelLayerLocation location, Supplier definition) { 30 | EntityModelLayerRegistry.registerModelLayer(location, definition::get); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /forge/src/main/java/dev/architectury/event/forge/LootTableModificationContextImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.event.forge; 21 | 22 | import dev.architectury.event.events.common.LootEvent; 23 | import net.minecraft.world.level.storage.loot.LootPool; 24 | import net.minecraft.world.level.storage.loot.LootTable; 25 | 26 | final class LootTableModificationContextImpl implements LootEvent.LootTableModificationContext { 27 | private final LootTable table; 28 | 29 | LootTableModificationContextImpl(LootTable table) { 30 | this.table = table; 31 | } 32 | 33 | @Override 34 | public void addPool(LootPool pool) { 35 | table.addPool(pool); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/hooks/item/food/fabric/FoodPropertiesHooksImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.item.food.fabric; 21 | 22 | import net.minecraft.world.effect.MobEffectInstance; 23 | import net.minecraft.world.food.FoodProperties; 24 | 25 | import java.util.function.Supplier; 26 | 27 | public class FoodPropertiesHooksImpl { 28 | public static void effect(FoodProperties.Builder builder, 29 | Supplier effectSupplier, float chance) { 30 | // Fabric doesn't have deferred registration, so the mob effect should always be available anyway 31 | builder.effect(effectSupplier.get(), chance); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /forge/src/main/java/dev/architectury/hooks/level/entity/forge/ItemEntityHooksImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.level.entity.forge; 21 | 22 | import dev.architectury.utils.value.IntValue; 23 | import net.minecraft.world.entity.item.ItemEntity; 24 | 25 | public class ItemEntityHooksImpl { 26 | public static IntValue lifespan(ItemEntity entity) { 27 | return new IntValue() { 28 | @Override 29 | public void accept(int value) { 30 | entity.lifespan = value; 31 | } 32 | 33 | @Override 34 | public int getAsInt() { 35 | return entity.lifespan; 36 | } 37 | }; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/hooks/item/food/FoodPropertiesHooks.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.item.food; 21 | 22 | import dev.architectury.injectables.annotations.ExpectPlatform; 23 | import net.minecraft.world.effect.MobEffectInstance; 24 | import net.minecraft.world.food.FoodProperties; 25 | 26 | import java.util.function.Supplier; 27 | 28 | public final class FoodPropertiesHooks { 29 | private FoodPropertiesHooks() { 30 | } 31 | 32 | @ExpectPlatform 33 | public static void effect(FoodProperties.Builder builder, 34 | Supplier effectSupplier, float chance) { 35 | throw new AssertionError(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /forge/src/main/java/dev/architectury/core/item/forge/imitator/ArchitecturyMobBucketItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.core.item.forge.imitator; 21 | 22 | import net.minecraft.sounds.SoundEvent; 23 | import net.minecraft.world.entity.EntityType; 24 | import net.minecraft.world.item.MobBucketItem; 25 | import net.minecraft.world.level.material.Fluid; 26 | 27 | import java.util.function.Supplier; 28 | 29 | public class ArchitecturyMobBucketItem extends MobBucketItem { 30 | public ArchitecturyMobBucketItem(Supplier> entity, Supplier fluid, Supplier sound, Properties properties) { 31 | super(entity, fluid, sound, properties); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /forge/src/main/java/dev/architectury/hooks/fluid/forge/FluidStackHooksForge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.fluid.forge; 21 | 22 | import dev.architectury.fluid.FluidStack; 23 | import dev.architectury.fluid.forge.FluidStackImpl; 24 | 25 | public final class FluidStackHooksForge { 26 | private FluidStackHooksForge() { 27 | } 28 | 29 | public static FluidStack fromForge(net.minecraftforge.fluids.FluidStack stack) { 30 | return FluidStackImpl.fromValue.apply(stack); 31 | } 32 | 33 | public static net.minecraftforge.fluids.FluidStack toForge(FluidStack stack) { 34 | return (net.minecraftforge.fluids.FluidStack) FluidStackImpl.toValue.apply(stack); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/registry/registries/RegistrarBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.registry.registries; 21 | 22 | import dev.architectury.registry.registries.options.RegistrarOption; 23 | import dev.architectury.registry.registries.options.StandardRegistrarOption; 24 | 25 | public interface RegistrarBuilder { 26 | Registrar build(); 27 | 28 | RegistrarBuilder option(RegistrarOption option); 29 | 30 | default RegistrarBuilder saveToDisc() { 31 | return option(StandardRegistrarOption.SAVE_TO_DISC); 32 | } 33 | 34 | default RegistrarBuilder syncToClients() { 35 | return option(StandardRegistrarOption.SYNC_TO_CLIENTS); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/extensions/injected/InjectedFoodPropertiesBuilderExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.extensions.injected; 21 | 22 | import dev.architectury.hooks.item.food.FoodPropertiesHooks; 23 | import net.minecraft.world.effect.MobEffectInstance; 24 | import net.minecraft.world.food.FoodProperties; 25 | 26 | import java.util.function.Supplier; 27 | 28 | public interface InjectedFoodPropertiesBuilderExtension { 29 | default FoodProperties.Builder arch$effect(Supplier effectSupplier, float chance) { 30 | FoodPropertiesHooks.effect((FoodProperties.Builder) this, effectSupplier, chance); 31 | return (FoodProperties.Builder) this; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /forge/src/main/java/dev/architectury/registry/client/rendering/forge/BlockEntityRendererRegistryImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.registry.client.rendering.forge; 21 | 22 | import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; 23 | import net.minecraft.client.renderer.blockentity.BlockEntityRenderers; 24 | import net.minecraft.world.level.block.entity.BlockEntity; 25 | import net.minecraft.world.level.block.entity.BlockEntityType; 26 | 27 | public class BlockEntityRendererRegistryImpl { 28 | public static void register(BlockEntityType type, BlockEntityRendererProvider provider) { 29 | BlockEntityRenderers.register(type, provider); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/hooks/fluid/FluidBucketHooks.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.fluid; 21 | 22 | import dev.architectury.injectables.annotations.ExpectPlatform; 23 | import net.minecraft.world.item.BucketItem; 24 | import net.minecraft.world.level.material.Fluid; 25 | 26 | public final class FluidBucketHooks { 27 | /** 28 | * Returns the fluid contained in the bucket. 29 | * This requires special handling since forge defers the fiuid. 30 | * 31 | * @param item the bucket item 32 | * @return the fluid contained in the bucket 33 | */ 34 | @ExpectPlatform 35 | public static Fluid getFluid(BucketItem item) { 36 | throw new AssertionError(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/utils/GameInstance.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.utils; 21 | 22 | import dev.architectury.injectables.annotations.ExpectPlatform; 23 | import net.fabricmc.api.EnvType; 24 | import net.fabricmc.api.Environment; 25 | import net.minecraft.client.Minecraft; 26 | import net.minecraft.server.MinecraftServer; 27 | import org.jetbrains.annotations.Nullable; 28 | 29 | public final class GameInstance { 30 | @Environment(EnvType.CLIENT) 31 | public static Minecraft getClient() { 32 | return Minecraft.getInstance(); 33 | } 34 | 35 | @Nullable 36 | @ExpectPlatform 37 | public static MinecraftServer getServer() { 38 | throw new AssertionError(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/registry/client/level/entity/fabric/EntityRendererRegistryImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.registry.client.level.entity.fabric; 21 | 22 | import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry; 23 | import net.minecraft.client.renderer.entity.EntityRendererProvider; 24 | import net.minecraft.world.entity.Entity; 25 | import net.minecraft.world.entity.EntityType; 26 | 27 | import java.util.function.Supplier; 28 | 29 | public class EntityRendererRegistryImpl { 30 | public static void register(Supplier> type, EntityRendererProvider provider) { 31 | EntityRendererRegistry.register(type.get(), provider); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/registry/client/rendering/fabric/BlockEntityRendererRegistryImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.registry.client.rendering.fabric; 21 | 22 | import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry; 23 | import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; 24 | import net.minecraft.world.level.block.entity.BlockEntity; 25 | import net.minecraft.world.level.block.entity.BlockEntityType; 26 | 27 | public class BlockEntityRendererRegistryImpl { 28 | public static void register(BlockEntityType type, BlockEntityRendererProvider provider) { 29 | BlockEntityRendererRegistry.register(type, provider); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/registry/client/level/entity/EntityModelLayerRegistry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.registry.client.level.entity; 21 | 22 | import dev.architectury.injectables.annotations.ExpectPlatform; 23 | import net.fabricmc.api.EnvType; 24 | import net.fabricmc.api.Environment; 25 | import net.minecraft.client.model.geom.ModelLayerLocation; 26 | import net.minecraft.client.model.geom.builders.LayerDefinition; 27 | 28 | import java.util.function.Supplier; 29 | 30 | @Environment(EnvType.CLIENT) 31 | public class EntityModelLayerRegistry { 32 | @ExpectPlatform 33 | public static void register(ModelLayerLocation location, Supplier definition) { 34 | throw new AssertionError(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/registry/client/rendering/fabric/RenderTypeRegistryImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.registry.client.rendering.fabric; 21 | 22 | import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; 23 | import net.minecraft.client.renderer.RenderType; 24 | import net.minecraft.world.level.block.Block; 25 | import net.minecraft.world.level.material.Fluid; 26 | 27 | public class RenderTypeRegistryImpl { 28 | public static void register(RenderType type, Block... blocks) { 29 | BlockRenderLayerMap.INSTANCE.putBlocks(type, blocks); 30 | } 31 | 32 | public static void register(RenderType type, Fluid... fluids) { 33 | BlockRenderLayerMap.INSTANCE.putFluids(type, fluids); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/hooks/fluid/LiquidBlockHooks.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.fluid; 21 | 22 | import dev.architectury.injectables.annotations.ExpectPlatform; 23 | import net.minecraft.world.level.block.LiquidBlock; 24 | import net.minecraft.world.level.material.FlowingFluid; 25 | 26 | public final class LiquidBlockHooks { 27 | /** 28 | * Returns the fluid contained in the liquid block. 29 | * This requires special handling since forge defers the fiuid. 30 | * 31 | * @param block the liquid block 32 | * @return the fluid contained in the liquid block 33 | */ 34 | @ExpectPlatform 35 | public static FlowingFluid getFluid(LiquidBlock block) { 36 | throw new AssertionError(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/registry/level/entity/fabric/EntityAttributeRegistryImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.registry.level.entity.fabric; 21 | 22 | import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry; 23 | import net.minecraft.world.entity.EntityType; 24 | import net.minecraft.world.entity.LivingEntity; 25 | import net.minecraft.world.entity.ai.attributes.AttributeSupplier; 26 | 27 | import java.util.function.Supplier; 28 | 29 | public class EntityAttributeRegistryImpl { 30 | public static void register(Supplier> type, Supplier attribute) { 31 | FabricDefaultAttributeRegistry.register(type.get(), attribute.get()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/hooks/level/entity/ItemEntityHooks.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.level.entity; 21 | 22 | import dev.architectury.injectables.annotations.ExpectPlatform; 23 | import dev.architectury.utils.value.IntValue; 24 | import net.minecraft.world.entity.item.ItemEntity; 25 | 26 | public final class ItemEntityHooks { 27 | private ItemEntityHooks() { 28 | } 29 | 30 | /** 31 | * The lifespan of an {@link ItemEntity}. 32 | * Fabric: Since it doesn't have this, the value will be a readable-only value of 6000. 33 | * Forge: Value of lifespan of the forge hook. 34 | */ 35 | @ExpectPlatform 36 | public static IntValue lifespan(ItemEntity entity) { 37 | throw new AssertionError(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/registry/CreativeTabRegistry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.registry; 21 | 22 | import dev.architectury.injectables.annotations.ExpectPlatform; 23 | import net.minecraft.resources.ResourceLocation; 24 | import net.minecraft.world.item.CreativeModeTab; 25 | import net.minecraft.world.item.ItemStack; 26 | 27 | import java.util.function.Supplier; 28 | 29 | public final class CreativeTabRegistry { 30 | private CreativeTabRegistry() { 31 | } 32 | 33 | // I am sorry, fabric wants a resource location instead of the translation key for whatever reason 34 | @ExpectPlatform 35 | public static CreativeModeTab create(ResourceLocation name, Supplier icon) { 36 | throw new AssertionError(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/utils/PlatformExpectedError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.utils; 21 | 22 | public class PlatformExpectedError extends Error { 23 | public PlatformExpectedError() { 24 | } 25 | 26 | public PlatformExpectedError(String message) { 27 | super(message); 28 | } 29 | 30 | public PlatformExpectedError(String message, Throwable cause) { 31 | super(message, cause); 32 | } 33 | 34 | public PlatformExpectedError(Throwable cause) { 35 | super(cause); 36 | } 37 | 38 | public PlatformExpectedError(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 39 | super(message, cause, enableSuppression, writableStackTrace); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/registry/level/entity/fabric/SpawnPlacementsRegistryImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.registry.level.entity.fabric; 21 | 22 | import net.minecraft.world.entity.EntityType; 23 | import net.minecraft.world.entity.Mob; 24 | import net.minecraft.world.entity.SpawnPlacements; 25 | import net.minecraft.world.level.levelgen.Heightmap; 26 | 27 | import java.util.function.Supplier; 28 | 29 | public class SpawnPlacementsRegistryImpl { 30 | public static void register(Supplier> type, SpawnPlacements.Type spawnPlacement, Heightmap.Types heightmapType, SpawnPlacements.SpawnPredicate spawnPredicate) { 31 | SpawnPlacements.register(type.get(), spawnPlacement, heightmapType, spawnPredicate); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/impl/fabric/ChatComponentImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.impl.fabric; 21 | 22 | import dev.architectury.event.events.common.ChatEvent; 23 | import net.minecraft.network.chat.Component; 24 | import org.jetbrains.annotations.ApiStatus; 25 | import org.jetbrains.annotations.Nullable; 26 | 27 | @ApiStatus.Internal 28 | public class ChatComponentImpl implements ChatEvent.ChatComponent { 29 | private Component component; 30 | 31 | public ChatComponentImpl(Component component) { 32 | this.component = component; 33 | } 34 | 35 | @Override 36 | public Component get() { 37 | return component; 38 | } 39 | 40 | public void set(Component component) { 41 | this.component = component; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/hooks/item/fabric/ItemStackHooksImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.item.fabric; 21 | 22 | import net.minecraft.world.item.Item; 23 | import net.minecraft.world.item.ItemStack; 24 | import net.minecraft.world.item.Items; 25 | 26 | public class ItemStackHooksImpl { 27 | public static boolean hasCraftingRemainingItem(ItemStack stack) { 28 | return stack.getItem().hasCraftingRemainingItem(); 29 | } 30 | 31 | public static ItemStack getCraftingRemainingItem(ItemStack stack) { 32 | if (!hasCraftingRemainingItem(stack)) return ItemStack.EMPTY; 33 | Item item = stack.getItem().getCraftingRemainingItem(); 34 | return item == null || item == Items.AIR ? ItemStack.EMPTY : item.getDefaultInstance(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /forge/src/main/java/dev/architectury/forge/ArchitecturyForge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.forge; 21 | 22 | import dev.architectury.platform.forge.EventBuses; 23 | import dev.architectury.event.EventHandler; 24 | import dev.architectury.registry.level.biome.forge.BiomeModificationsImpl; 25 | import net.minecraftforge.fml.common.Mod; 26 | import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; 27 | 28 | @Mod(ArchitecturyForge.MOD_ID) 29 | public class ArchitecturyForge { 30 | public static final String MOD_ID = "architectury"; 31 | 32 | public ArchitecturyForge() { 33 | EventBuses.registerModEventBus(ArchitecturyForge.MOD_ID, FMLJavaModLoadingContext.get().getModEventBus()); 34 | EventHandler.init(); 35 | BiomeModificationsImpl.init(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/hooks/level/entity/fabric/PlayerHooksImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.level.entity.fabric; 21 | 22 | import net.minecraft.server.level.ServerPlayer; 23 | import net.minecraft.world.entity.player.Player; 24 | 25 | public class PlayerHooksImpl { 26 | public static boolean isFake(Player player) { 27 | var result = FakePlayers.EVENT.invoker().isFakePlayer(player); 28 | if (result.isPresent()) { 29 | return result.isTrue(); 30 | } 31 | // If no result has been returned, assume that player classes extending ServerPlayer 32 | // (apart from ServerPlayer itself) are fake players, as a "reasonable default" 33 | return player instanceof ServerPlayer && player.getClass() != ServerPlayer.class; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /forge/src/main/java/dev/architectury/mixin/forge/MixinEntitySpawnExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.mixin.forge; 21 | 22 | import dev.architectury.extensions.network.EntitySpawnExtension; 23 | import net.minecraft.network.FriendlyByteBuf; 24 | import net.minecraftforge.entity.IEntityAdditionalSpawnData; 25 | import org.spongepowered.asm.mixin.Mixin; 26 | 27 | @Mixin(EntitySpawnExtension.class) 28 | public interface MixinEntitySpawnExtension extends IEntityAdditionalSpawnData { 29 | @Override 30 | default void writeSpawnData(FriendlyByteBuf buf) { 31 | ((EntitySpawnExtension) this).saveAdditionalSpawnData(buf); 32 | } 33 | 34 | @Override 35 | default void readSpawnData(FriendlyByteBuf buf) { 36 | ((EntitySpawnExtension) this).loadAdditionalSpawnData(buf); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/core/block/ArchitecturyLiquidBlock.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.core.block; 21 | 22 | import dev.architectury.platform.Platform; 23 | import net.minecraft.world.level.block.LiquidBlock; 24 | import net.minecraft.world.level.material.FlowingFluid; 25 | 26 | import java.util.function.Supplier; 27 | 28 | public class ArchitecturyLiquidBlock extends LiquidBlock { 29 | public ArchitecturyLiquidBlock(Supplier fluid, Properties properties) { 30 | super(checkPlatform(fluid).get(), properties); 31 | } 32 | 33 | private static T checkPlatform(T obj) { 34 | if (Platform.isForge()) { 35 | throw new IllegalStateException("This class should've been replaced on Forge!"); 36 | } 37 | 38 | return obj; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/event/fabric/EventFactoryImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.event.fabric; 21 | 22 | import dev.architectury.event.Event; 23 | import dev.architectury.event.EventActor; 24 | import org.jetbrains.annotations.ApiStatus; 25 | 26 | import java.util.function.Consumer; 27 | 28 | public class EventFactoryImpl { 29 | public static Event> attachToForge(Event> event) { 30 | return event; 31 | } 32 | 33 | @ApiStatus.Internal 34 | public static Event> attachToForgeEventActor(Event> event) { 35 | return event; 36 | } 37 | 38 | @ApiStatus.Internal 39 | public static Event> attachToForgeEventActorCancellable(Event> event) { 40 | return event; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/registry/fuel/fabric/FuelRegistryImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.registry.fuel.fabric; 21 | 22 | import net.fabricmc.fabric.api.registry.FuelRegistry; 23 | import net.minecraft.world.item.ItemStack; 24 | import net.minecraft.world.level.ItemLike; 25 | 26 | public class FuelRegistryImpl { 27 | public static void register(int time, ItemLike... items) { 28 | for (var item : items) { 29 | if (time >= 0) { 30 | FuelRegistry.INSTANCE.add(item, time); 31 | } else { 32 | FuelRegistry.INSTANCE.remove(item); 33 | } 34 | } 35 | } 36 | 37 | public static int get(ItemStack stack) { 38 | var time = FuelRegistry.INSTANCE.get(stack.getItem()); 39 | return time == null ? 0 : time; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/mixin/fabric/MixinEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.mixin.fabric; 21 | 22 | import dev.architectury.hooks.level.entity.fabric.EntityHooksImpl; 23 | import net.minecraft.world.entity.Entity; 24 | import net.minecraft.world.level.entity.EntityInLevelCallback; 25 | import org.spongepowered.asm.mixin.Mixin; 26 | import org.spongepowered.asm.mixin.injection.At; 27 | import org.spongepowered.asm.mixin.injection.ModifyVariable; 28 | 29 | @Mixin(Entity.class) 30 | public class MixinEntity { 31 | @ModifyVariable(method = "setLevelCallback", argsOnly = true, ordinal = 0, at = @At("HEAD")) 32 | public EntityInLevelCallback modifyLevelCallback_setLevelCallback(EntityInLevelCallback callback) { 33 | return EntityHooksImpl.wrapEntityInLevelCallback((Entity) (Object) this, callback); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /forge/src/main/java/dev/architectury/registry/client/rendering/forge/RenderTypeRegistryImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.registry.client.rendering.forge; 21 | 22 | import net.minecraft.client.renderer.ItemBlockRenderTypes; 23 | import net.minecraft.client.renderer.RenderType; 24 | import net.minecraft.world.level.block.Block; 25 | import net.minecraft.world.level.material.Fluid; 26 | 27 | public class RenderTypeRegistryImpl { 28 | public static void register(RenderType type, Block... blocks) { 29 | for (Block block : blocks) { 30 | ItemBlockRenderTypes.setRenderLayer(block, type); 31 | } 32 | } 33 | 34 | public static void register(RenderType type, Fluid... fluids) { 35 | for (Fluid fluid : fluids) { 36 | ItemBlockRenderTypes.setRenderLayer(fluid, type); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /forge/src/main/java/dev/architectury/registry/forge/CreativeTabRegistryImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.registry.forge; 21 | 22 | import net.minecraft.resources.ResourceLocation; 23 | import net.minecraft.world.item.CreativeModeTab; 24 | import net.minecraft.world.item.ItemStack; 25 | import org.jetbrains.annotations.NotNull; 26 | 27 | import java.util.function.Supplier; 28 | 29 | public class CreativeTabRegistryImpl { 30 | public static CreativeModeTab create(ResourceLocation resourceLocation, Supplier supplier) { 31 | return new CreativeModeTab(String.format("%s.%s", resourceLocation.getNamespace(), resourceLocation.getPath())) { 32 | @Override 33 | @NotNull 34 | public ItemStack makeIcon() { 35 | return supplier.get(); 36 | } 37 | }; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/hooks/level/biome/BiomeProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.level.biome; 21 | 22 | public interface BiomeProperties { 23 | ClimateProperties getClimateProperties(); 24 | 25 | EffectsProperties getEffectsProperties(); 26 | 27 | GenerationProperties getGenerationProperties(); 28 | 29 | SpawnProperties getSpawnProperties(); 30 | 31 | interface Mutable extends BiomeProperties { 32 | @Override 33 | ClimateProperties.Mutable getClimateProperties(); 34 | 35 | @Override 36 | EffectsProperties.Mutable getEffectsProperties(); 37 | 38 | @Override 39 | GenerationProperties.Mutable getGenerationProperties(); 40 | 41 | @Override 42 | SpawnProperties.Mutable getSpawnProperties(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/networking/simple/BaseC2SMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.networking.simple; 21 | 22 | import net.fabricmc.api.EnvType; 23 | import net.fabricmc.api.Environment; 24 | import net.minecraft.client.Minecraft; 25 | 26 | /** 27 | * The base class for client -> server messages managed by a {@link SimpleNetworkManager}. 28 | */ 29 | public abstract class BaseC2SMessage extends Message { 30 | /** 31 | * Sends this message to the server. 32 | */ 33 | @Environment(EnvType.CLIENT) 34 | public final void sendToServer() { 35 | if (Minecraft.getInstance().getConnection() != null) { 36 | Minecraft.getInstance().getConnection().send(toPacket()); 37 | } else { 38 | throw new IllegalStateException("Unable to send packet to the server while not in game!"); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/hooks/level/biome/ClimateProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.level.biome; 21 | 22 | import net.minecraft.world.level.biome.Biome.Precipitation; 23 | import net.minecraft.world.level.biome.Biome.TemperatureModifier; 24 | 25 | public interface ClimateProperties { 26 | Precipitation getPrecipitation(); 27 | 28 | float getTemperature(); 29 | 30 | TemperatureModifier getTemperatureModifier(); 31 | 32 | float getDownfall(); 33 | 34 | interface Mutable extends ClimateProperties { 35 | Mutable setPrecipitation(Precipitation precipitation); 36 | 37 | Mutable setTemperature(float temperature); 38 | 39 | Mutable setTemperatureModifier(TemperatureModifier temperatureModifier); 40 | 41 | Mutable setDownfall(float downfall); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/event/fabric/LootTableModificationContextImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.event.fabric; 21 | 22 | import dev.architectury.event.events.common.LootEvent; 23 | import net.minecraft.world.level.storage.loot.LootPool; 24 | import net.minecraft.world.level.storage.loot.LootTable; 25 | 26 | final class LootTableModificationContextImpl implements LootEvent.LootTableModificationContext { 27 | private final LootTable.Builder tableBuilder; 28 | 29 | LootTableModificationContextImpl(LootTable.Builder tableBuilder) { 30 | this.tableBuilder = tableBuilder; 31 | } 32 | 33 | @Override 34 | public void addPool(LootPool pool) { 35 | tableBuilder.pool(pool); 36 | } 37 | 38 | @Override 39 | public void addPool(LootPool.Builder pool) { 40 | tableBuilder.withPool(pool); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/registry/client/level/entity/EntityRendererRegistry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.registry.client.level.entity; 21 | 22 | import dev.architectury.injectables.annotations.ExpectPlatform; 23 | import net.fabricmc.api.EnvType; 24 | import net.fabricmc.api.Environment; 25 | import net.minecraft.client.renderer.entity.EntityRendererProvider; 26 | import net.minecraft.world.entity.Entity; 27 | import net.minecraft.world.entity.EntityType; 28 | 29 | import java.util.function.Supplier; 30 | 31 | @Environment(EnvType.CLIENT) 32 | public final class EntityRendererRegistry { 33 | private EntityRendererRegistry() { 34 | } 35 | 36 | @ExpectPlatform 37 | public static void register(Supplier> type, EntityRendererProvider provider) { 38 | throw new AssertionError(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/registry/client/rendering/BlockEntityRendererRegistry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.registry.client.rendering; 21 | 22 | import dev.architectury.injectables.annotations.ExpectPlatform; 23 | import net.fabricmc.api.EnvType; 24 | import net.fabricmc.api.Environment; 25 | import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; 26 | import net.minecraft.world.level.block.entity.BlockEntity; 27 | import net.minecraft.world.level.block.entity.BlockEntityType; 28 | 29 | @Environment(EnvType.CLIENT) 30 | public final class BlockEntityRendererRegistry { 31 | private BlockEntityRendererRegistry() { 32 | } 33 | 34 | @ExpectPlatform 35 | public static void register(BlockEntityType type, BlockEntityRendererProvider provider) { 36 | throw new AssertionError(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/registry/client/rendering/RenderTypeRegistry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.registry.client.rendering; 21 | 22 | import dev.architectury.injectables.annotations.ExpectPlatform; 23 | import net.fabricmc.api.EnvType; 24 | import net.fabricmc.api.Environment; 25 | import net.minecraft.client.renderer.RenderType; 26 | import net.minecraft.world.level.block.Block; 27 | import net.minecraft.world.level.material.Fluid; 28 | 29 | @Environment(EnvType.CLIENT) 30 | public final class RenderTypeRegistry { 31 | private RenderTypeRegistry() { 32 | } 33 | 34 | @ExpectPlatform 35 | public static void register(RenderType type, Block... blocks) { 36 | throw new AssertionError(); 37 | } 38 | 39 | @ExpectPlatform 40 | public static void register(RenderType type, Fluid... fluids) { 41 | throw new AssertionError(); 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/hooks/client/screen/ScreenAccess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.hooks.client.screen; 21 | 22 | import net.minecraft.client.gui.components.AbstractWidget; 23 | import net.minecraft.client.gui.components.Widget; 24 | import net.minecraft.client.gui.components.events.GuiEventListener; 25 | import net.minecraft.client.gui.narration.NarratableEntry; 26 | import net.minecraft.client.gui.screens.Screen; 27 | 28 | import java.util.List; 29 | 30 | public interface ScreenAccess { 31 | Screen getScreen(); 32 | 33 | List getNarratables(); 34 | 35 | List getRenderables(); 36 | 37 | T addRenderableWidget(T widget); 38 | 39 | T addRenderableOnly(T listener); 40 | 41 | T addWidget(T listener); 42 | } 43 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/event/events/client/ClientRecipeUpdateEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.event.events.client; 21 | 22 | import dev.architectury.event.Event; 23 | import dev.architectury.event.EventFactory; 24 | import net.fabricmc.api.EnvType; 25 | import net.fabricmc.api.Environment; 26 | import net.minecraft.world.item.crafting.RecipeManager; 27 | 28 | @Environment(EnvType.CLIENT) 29 | public interface ClientRecipeUpdateEvent { 30 | /** 31 | * @see ClientRecipeUpdateEvent#update(RecipeManager) 32 | */ 33 | Event EVENT = EventFactory.createLoop(); 34 | 35 | /** 36 | * Invoked when the client has received an updated list of recipes from the server. 37 | * Equivalent to Forge's {@code RecipesUpdatedEvent} event. 38 | * 39 | * @param recipeManager The recipe manager. 40 | */ 41 | void update(RecipeManager recipeManager); 42 | } 43 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/mixin/fabric/MixinDedicatedServer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.mixin.fabric; 21 | 22 | import dev.architectury.event.events.common.LifecycleEvent; 23 | import net.minecraft.server.MinecraftServer; 24 | import net.minecraft.server.dedicated.DedicatedServer; 25 | import org.spongepowered.asm.mixin.Mixin; 26 | import org.spongepowered.asm.mixin.injection.At; 27 | import org.spongepowered.asm.mixin.injection.Inject; 28 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 29 | 30 | @Mixin(DedicatedServer.class) 31 | public class MixinDedicatedServer { 32 | @Inject(method = "initServer", at = @At("RETURN"), cancellable = true) 33 | private void initServer(CallbackInfoReturnable cir) { 34 | if (cir.getReturnValueZ()) { 35 | LifecycleEvent.SERVER_STARTING.invoker().stateChanged((MinecraftServer) (Object) this); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /forge/src/main/java/dev/architectury/mixin/forge/MixinLevelEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.mixin.forge; 21 | 22 | import dev.architectury.event.forge.EventHandlerImplCommon; 23 | import net.minecraft.world.level.LevelAccessor; 24 | import net.minecraftforge.event.level.LevelEvent; 25 | import org.spongepowered.asm.mixin.Mixin; 26 | import org.spongepowered.asm.mixin.Unique; 27 | 28 | import java.lang.ref.WeakReference; 29 | 30 | @Mixin(LevelEvent.class) 31 | public class MixinLevelEvent implements EventHandlerImplCommon.LevelEventAttachment { 32 | @Unique 33 | private WeakReference level; 34 | 35 | @Override 36 | public LevelAccessor architectury$getAttachedLevel() { 37 | return level == null ? null : level.get(); 38 | } 39 | 40 | @Override 41 | public void architectury$attachLevel(LevelAccessor level) { 42 | this.level = new WeakReference<>(level); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /forge/src/main/java/dev/architectury/registry/item/forge/ItemPropertiesRegistryImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.registry.item.forge; 21 | 22 | import net.minecraft.client.renderer.item.ClampedItemPropertyFunction; 23 | import net.minecraft.client.renderer.item.ItemProperties; 24 | import net.minecraft.resources.ResourceLocation; 25 | import net.minecraft.world.level.ItemLike; 26 | 27 | public class ItemPropertiesRegistryImpl { 28 | public static ClampedItemPropertyFunction registerGeneric(ResourceLocation propertyId, ClampedItemPropertyFunction function) { 29 | ItemProperties.registerGeneric(propertyId, function); 30 | return function; 31 | } 32 | 33 | public static ClampedItemPropertyFunction register(ItemLike item, ResourceLocation propertyId, ClampedItemPropertyFunction function) { 34 | ItemProperties.register(item.asItem(), propertyId, function); 35 | return function; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/mixin/fabric/MixinTamableAnimal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.mixin.fabric; 21 | 22 | import dev.architectury.event.events.common.EntityEvent; 23 | import net.minecraft.world.entity.TamableAnimal; 24 | import net.minecraft.world.entity.animal.Animal; 25 | import net.minecraft.world.entity.player.Player; 26 | import org.spongepowered.asm.mixin.Mixin; 27 | import org.spongepowered.asm.mixin.injection.At; 28 | import org.spongepowered.asm.mixin.injection.Inject; 29 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 30 | 31 | @Mixin(TamableAnimal.class) 32 | public class MixinTamableAnimal { 33 | @Inject(method = "tame", at = @At(value = "HEAD"), cancellable = true) 34 | private void tame(Player player, CallbackInfo ci) { 35 | if (EntityEvent.ANIMAL_TAME.invoker().tame((Animal) (Object) this, player).isFalse()) { 36 | ci.cancel(); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/mixin/fabric/client/MixinIntegratedServer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.mixin.fabric.client; 21 | 22 | import dev.architectury.event.events.common.LifecycleEvent; 23 | import net.minecraft.client.server.IntegratedServer; 24 | import net.minecraft.server.MinecraftServer; 25 | import org.spongepowered.asm.mixin.Mixin; 26 | import org.spongepowered.asm.mixin.injection.At; 27 | import org.spongepowered.asm.mixin.injection.Inject; 28 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 29 | 30 | @Mixin(IntegratedServer.class) 31 | public class MixinIntegratedServer { 32 | @Inject(method = "initServer", at = @At("RETURN"), cancellable = true) 33 | private void initServer(CallbackInfoReturnable cir) { 34 | if (cir.getReturnValueZ()) { 35 | LifecycleEvent.SERVER_STARTING.invoker().stateChanged((MinecraftServer) (Object) this); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/impl/TooltipAdditionalContextsImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.impl; 21 | 22 | import dev.architectury.event.events.client.ClientTooltipEvent; 23 | import net.minecraft.world.item.ItemStack; 24 | import org.jetbrains.annotations.Nullable; 25 | 26 | public class TooltipAdditionalContextsImpl implements ClientTooltipEvent.AdditionalContexts { 27 | private static final ThreadLocal INSTANCE_LOCAL = ThreadLocal.withInitial(TooltipAdditionalContextsImpl::new); 28 | 29 | public static ClientTooltipEvent.AdditionalContexts get() { 30 | return INSTANCE_LOCAL.get(); 31 | } 32 | 33 | @Nullable 34 | private ItemStack item; 35 | 36 | @Override 37 | @Nullable 38 | public ItemStack getItem() { 39 | return item; 40 | } 41 | 42 | @Override 43 | public void setItem(@Nullable ItemStack item) { 44 | this.item = item; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /testmod-common/src/main/java/dev/architectury/test/loot/TestLoot.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.test.loot; 21 | 22 | import dev.architectury.event.events.common.LootEvent; 23 | import net.minecraft.world.item.Items; 24 | import net.minecraft.world.level.block.Blocks; 25 | import net.minecraft.world.level.storage.loot.LootPool; 26 | import net.minecraft.world.level.storage.loot.entries.LootItem; 27 | 28 | public class TestLoot { 29 | public static void init() { 30 | LootEvent.MODIFY_LOOT_TABLE.register((lootTables, id, context, builtin) -> { 31 | // Check that the loot table is dirt and built-in 32 | if (builtin && Blocks.DIRT.getLootTable().equals(id)) { 33 | // Create a loot pool with a single item entry of Items.DIAMOND 34 | LootPool.Builder pool = LootPool.lootPool().add(LootItem.lootTableItem(Items.DIAMOND)); 35 | context.addPool(pool); 36 | } 37 | }); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/registry/level/entity/trade/fabric/TradeRegistryImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.registry.level.entity.trade.fabric; 21 | 22 | import net.fabricmc.fabric.api.object.builder.v1.trade.TradeOfferHelper; 23 | import net.minecraft.world.entity.npc.VillagerProfession; 24 | import net.minecraft.world.entity.npc.VillagerTrades; 25 | 26 | import java.util.Collections; 27 | 28 | public class TradeRegistryImpl { 29 | public static void registerVillagerTrade0(VillagerProfession profession, int level, VillagerTrades.ItemListing... trades) { 30 | TradeOfferHelper.registerVillagerOffers(profession, level, allTradesList -> Collections.addAll(allTradesList, trades)); 31 | } 32 | 33 | public static void registerTradeForWanderingTrader(boolean rare, VillagerTrades.ItemListing... trades) { 34 | TradeOfferHelper.registerWanderingTraderOffers(rare ? 2 : 1, allTradesList -> Collections.addAll(allTradesList, trades)); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/core/item/ArchitecturyBucketItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.core.item; 21 | 22 | import dev.architectury.hooks.fluid.FluidBucketHooks; 23 | import dev.architectury.platform.Platform; 24 | import net.minecraft.world.item.BucketItem; 25 | import net.minecraft.world.level.material.Fluid; 26 | 27 | import java.util.function.Supplier; 28 | 29 | public class ArchitecturyBucketItem extends BucketItem { 30 | public ArchitecturyBucketItem(Supplier fluid, Properties properties) { 31 | super(checkPlatform(fluid).get(), properties); 32 | } 33 | 34 | private static T checkPlatform(T obj) { 35 | if (Platform.isForge()) { 36 | throw new IllegalStateException("This class should've been replaced on Forge!"); 37 | } 38 | 39 | return obj; 40 | } 41 | 42 | public final Fluid getContainedFluid() { 43 | return FluidBucketHooks.getFluid(this); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/networking/transformers/PacketCollector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.networking.transformers; 21 | 22 | import net.minecraft.network.protocol.Packet; 23 | import org.jetbrains.annotations.Nullable; 24 | 25 | import java.util.ArrayList; 26 | import java.util.List; 27 | import java.util.function.Consumer; 28 | 29 | public class PacketCollector implements PacketSink { 30 | @Nullable 31 | private final Consumer> consumer; 32 | private final List> packets = new ArrayList<>(); 33 | 34 | public PacketCollector(@Nullable Consumer> consumer) { 35 | this.consumer = consumer; 36 | } 37 | 38 | @Override 39 | public void accept(Packet packet) { 40 | packets.add(packet); 41 | if (this.consumer != null) { 42 | this.consumer.accept(packet); 43 | } 44 | } 45 | 46 | public List> collect() { 47 | return packets; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /forge/src/main/java/dev/architectury/mixin/forge/MixinItemExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.mixin.forge; 21 | 22 | import dev.architectury.extensions.ItemExtension; 23 | import net.minecraft.world.entity.EquipmentSlot; 24 | import net.minecraft.world.entity.player.Player; 25 | import net.minecraft.world.item.ItemStack; 26 | import net.minecraft.world.level.Level; 27 | import net.minecraftforge.common.extensions.IForgeItem; 28 | import org.jetbrains.annotations.Nullable; 29 | import org.spongepowered.asm.mixin.Mixin; 30 | 31 | @Mixin(ItemExtension.class) 32 | public interface MixinItemExtension extends IForgeItem { 33 | @Override 34 | default void onArmorTick(ItemStack stack, Level world, Player player) { 35 | ((ItemExtension) this).tickArmor(stack, player); 36 | } 37 | 38 | @Nullable 39 | @Override 40 | default EquipmentSlot getEquipmentSlot(ItemStack stack) { 41 | return ((ItemExtension) this).getCustomEquipmentSlot(stack); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /testmod-common/src/main/java/dev/architectury/test/recipes/TestRecipeSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.test.recipes; 21 | 22 | import com.google.gson.JsonObject; 23 | import net.minecraft.network.FriendlyByteBuf; 24 | import net.minecraft.resources.ResourceLocation; 25 | import net.minecraft.world.item.crafting.CustomRecipe; 26 | import net.minecraft.world.item.crafting.FireworkRocketRecipe; 27 | import net.minecraft.world.item.crafting.RecipeSerializer; 28 | 29 | public class TestRecipeSerializer implements RecipeSerializer { 30 | @Override 31 | public CustomRecipe fromJson(ResourceLocation id, JsonObject json) { 32 | return new FireworkRocketRecipe(id); 33 | } 34 | 35 | @Override 36 | public CustomRecipe fromNetwork(ResourceLocation id, FriendlyByteBuf buf) { 37 | return new FireworkRocketRecipe(id); 38 | } 39 | 40 | @Override 41 | public void toNetwork(FriendlyByteBuf buf, CustomRecipe recipe) { 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/core/item/ArchitecturyMobBucketItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.core.item; 21 | 22 | import dev.architectury.platform.Platform; 23 | import net.minecraft.sounds.SoundEvent; 24 | import net.minecraft.world.entity.EntityType; 25 | import net.minecraft.world.item.MobBucketItem; 26 | import net.minecraft.world.level.material.Fluid; 27 | 28 | import java.util.function.Supplier; 29 | 30 | public class ArchitecturyMobBucketItem extends MobBucketItem { 31 | public ArchitecturyMobBucketItem(Supplier> entity, Supplier fluid, Supplier sound, Properties properties) { 32 | super(checkPlatform(entity).get(), fluid.get(), sound.get(), properties); 33 | } 34 | 35 | private static T checkPlatform(T obj) { 36 | if (Platform.isForge()) { 37 | throw new IllegalStateException("This class should've been replaced on Forge!"); 38 | } 39 | 40 | return obj; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/event/events/client/ClientTickEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.event.events.client; 21 | 22 | import dev.architectury.event.Event; 23 | import dev.architectury.event.EventFactory; 24 | import net.fabricmc.api.EnvType; 25 | import net.fabricmc.api.Environment; 26 | import net.minecraft.client.Minecraft; 27 | 28 | @Environment(EnvType.CLIENT) 29 | public interface ClientTickEvent { 30 | Event CLIENT_PRE = EventFactory.createLoop(); 31 | Event CLIENT_POST = EventFactory.createLoop(); 32 | Event CLIENT_LEVEL_PRE = EventFactory.createLoop(); 33 | Event CLIENT_LEVEL_POST = EventFactory.createLoop(); 34 | 35 | void tick(T instance); 36 | 37 | @Environment(EnvType.CLIENT) 38 | interface Client extends ClientTickEvent { 39 | } 40 | 41 | @Environment(EnvType.CLIENT) 42 | interface ClientLevel extends ClientTickEvent { 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/registry/item/fabric/ItemPropertiesRegistryImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.registry.item.fabric; 21 | 22 | import net.fabricmc.fabric.api.object.builder.v1.client.model.FabricModelPredicateProviderRegistry; 23 | import net.minecraft.client.renderer.item.ClampedItemPropertyFunction; 24 | import net.minecraft.resources.ResourceLocation; 25 | import net.minecraft.world.level.ItemLike; 26 | 27 | public class ItemPropertiesRegistryImpl { 28 | public static ClampedItemPropertyFunction registerGeneric(ResourceLocation propertyId, ClampedItemPropertyFunction function) { 29 | FabricModelPredicateProviderRegistry.register(propertyId, function); 30 | return function; 31 | } 32 | 33 | public static ClampedItemPropertyFunction register(ItemLike item, ResourceLocation propertyId, ClampedItemPropertyFunction function) { 34 | FabricModelPredicateProviderRegistry.register(item.asItem(), propertyId, function); 35 | return function; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /fabric/src/main/java/dev/architectury/compat/fabric/ModMenuCompatibility.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.compat.fabric; 21 | 22 | import com.google.common.collect.Maps; 23 | import com.terraformersmc.modmenu.api.ConfigScreenFactory; 24 | import com.terraformersmc.modmenu.api.ModMenuApi; 25 | import dev.architectury.platform.fabric.PlatformImpl; 26 | 27 | import java.util.Map; 28 | 29 | public class ModMenuCompatibility implements ModMenuApi { 30 | private static final Map> FACTORIES = Maps.newHashMap(); 31 | 32 | @Override 33 | public Map> getProvidedConfigScreenFactories() { 34 | validateMap(); 35 | return FACTORIES; 36 | } 37 | 38 | private void validateMap() { 39 | for (var entry : PlatformImpl.CONFIG_SCREENS.entrySet()) { 40 | if (!FACTORIES.containsKey(entry.getKey())) { 41 | FACTORIES.put(entry.getKey(), entry.getValue()::provide); 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /common/src/main/java/dev/architectury/core/item/ArchitecturyRecordItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of architectury. 3 | * Copyright (C) 2020, 2021, 2022 architectury 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | package dev.architectury.core.item; 21 | 22 | import dev.architectury.registry.registries.RegistrySupplier; 23 | import net.minecraft.sounds.SoundEvent; 24 | import net.minecraft.world.item.RecordItem; 25 | 26 | public class ArchitecturyRecordItem extends RecordItem { 27 | private final RegistrySupplier sound; 28 | 29 | public ArchitecturyRecordItem(int analogOutput, RegistrySupplier sound, Properties properties, int lengthInSeconds) { 30 | super(analogOutput, sound.orElse(null), properties, lengthInSeconds); 31 | this.sound = sound; 32 | 33 | if (!sound.isPresent()) { 34 | RecordItem.BY_NAME.remove(null); 35 | 36 | sound.listen(soundEvent -> { 37 | RecordItem.BY_NAME.put(soundEvent, this); 38 | }); 39 | } 40 | } 41 | 42 | @Override 43 | public SoundEvent getSound() { 44 | return sound.get(); 45 | } 46 | } 47 | --------------------------------------------------------------------------------