├── .github └── workflows │ └── build.yml ├── .gitignore ├── LICENSE ├── README.md ├── build.gradle ├── config ├── checkstyle │ └── checkstyle.xml └── java.header ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── legacy-api-base ├── build.gradle └── src │ └── main │ ├── java │ ├── io │ │ └── github │ │ │ └── minecraftcursedlegacy │ │ │ ├── accessor │ │ │ └── AccessorMinecraft.java │ │ │ ├── api │ │ │ ├── event │ │ │ │ └── ActionResult.java │ │ │ ├── registry │ │ │ │ └── Id.java │ │ │ └── server │ │ │ │ └── VanillaChecker.java │ │ │ ├── impl │ │ │ └── base │ │ │ │ └── VanillaCheckerImpl.java │ │ │ └── mixin │ │ │ ├── MixinLoginRequestPacketClient.java │ │ │ ├── MixinOverlay.java │ │ │ ├── MixinResourceDownloadThread.java │ │ │ ├── MixinServerLoginPacketHandler.java │ │ │ ├── MixinServerPlayerPacketHandler.java │ │ │ └── MixinTitleScreen.java │ └── net │ │ └── fabricmc │ │ └── fabric │ │ ├── api │ │ └── event │ │ │ ├── Event.java │ │ │ └── EventFactory.java │ │ └── impl │ │ └── base │ │ └── event │ │ ├── ArrayBackedEvent.java │ │ └── EventFactoryImpl.java │ └── resources │ ├── fabric.mod.json │ ├── legacy-api-base.accessors.json │ └── legacy-api-base.mixins.json ├── legacy-attached-data-v1 ├── build.gradle └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── minecraftcursedlegacy │ │ │ ├── api │ │ │ ├── attacheddata │ │ │ │ └── v1 │ │ │ │ │ ├── AttachedData.java │ │ │ │ │ ├── DataManager.java │ │ │ │ │ ├── DataStorage.java │ │ │ │ │ └── SimpleDataStorage.java │ │ │ └── data │ │ │ │ ├── AttachedData.java │ │ │ │ └── DataManager.java │ │ │ └── mixin │ │ │ └── attacheddata │ │ │ ├── MixinItemInstance.java │ │ │ ├── MixinLevelProperties.java │ │ │ └── MixinPlayerInventory.java │ └── resources │ │ ├── fabric.mod.json │ │ └── legacy-attached-data.mixins.json │ └── test │ ├── java │ └── io │ │ └── github │ │ └── minecraftcursedlegacy │ │ └── test │ │ ├── ItemDataTest.java │ │ └── LevelPropertiesDataTest.java │ └── resources │ └── fabric.mod.json ├── legacy-commands-v1 ├── build.gradle └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── minecraftcursedlegacy │ │ │ ├── accessor │ │ │ └── command │ │ │ │ ├── AccessorMinecraft.java │ │ │ │ └── AccessorServerPlayPacketHandler.java │ │ │ ├── api │ │ │ └── command │ │ │ │ ├── ChatEvent.java │ │ │ │ ├── CommandDispatchEvent.java │ │ │ │ ├── Sender.java │ │ │ │ ├── ServerCommandUtils.java │ │ │ │ └── dispatcher │ │ │ │ ├── CommandDispatcher.java │ │ │ │ ├── DefaultCommandDispatcher.java │ │ │ │ └── DispatcherRegistry.java │ │ │ ├── impl │ │ │ └── command │ │ │ │ ├── CommandsImpl.java │ │ │ │ ├── DefaultCommandDispatcherImpl.java │ │ │ │ ├── PlayerSender.java │ │ │ │ └── ServerCommandSender.java │ │ │ └── mixin │ │ │ └── command │ │ │ ├── MixinCommandManager.java │ │ │ ├── MixinMinecraft.java │ │ │ └── MixinServerPlayPacketHandler.java │ └── resources │ │ ├── fabric.mod.json │ │ ├── legacy-commands.accessors.json │ │ └── legacy-commands.mixins.json │ └── test │ ├── java │ └── io │ │ └── github │ │ └── minecraftcursedlegacy │ │ └── test │ │ └── CommandsTest.java │ └── resources │ └── fabric.mod.json ├── legacy-config-v0 ├── build.gradle └── src │ └── main │ ├── java │ └── io │ │ └── github │ │ └── minecraftcursedlegacy │ │ └── api │ │ └── config │ │ └── Configs.java │ └── resources │ └── fabric.mod.json ├── legacy-interaction-events-v0 ├── build.gradle └── src │ └── main │ ├── java │ └── io │ │ └── github │ │ └── minecraftcursedlegacy │ │ ├── api │ │ └── event │ │ │ └── TileInteractionCallback.java │ │ ├── impl │ │ └── events │ │ │ └── interaction │ │ │ └── TileInteractionImpl.java │ │ └── mixin │ │ └── events │ │ └── interaction │ │ ├── MixinClientInteractionManager.java │ │ └── MixinServerInteractionManager.java │ └── resources │ ├── fabric.mod.json │ └── legacy-interaction-events.mixins.json ├── legacy-lifecycle-events-v1 ├── build.gradle └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── minecraftcursedlegacy │ │ │ ├── api │ │ │ └── event │ │ │ │ └── lifecycle │ │ │ │ ├── ClientLifecycleEvents.java │ │ │ │ ├── ClientTickCallback.java │ │ │ │ ├── CommonLifecycleEvents.java │ │ │ │ ├── DedicatedServerTickCallback.java │ │ │ │ └── ServerLifecycleEvents.java │ │ │ └── mixin │ │ │ └── event │ │ │ └── lifecycle │ │ │ ├── MixinMinecraft.java │ │ │ ├── MixinMinecraftServer.java │ │ │ └── MixinPlayerManager.java │ └── resources │ │ ├── fabric.mod.json │ │ └── legacy-lifecycle-events.mixins.json │ └── test │ ├── java │ └── io │ │ └── github │ │ └── minecraftcursedlegacy │ │ └── test │ │ ├── LifecycleEventsTest.java │ │ └── LifecycleEventsTestServer.java │ └── resources │ └── fabric.mod.json ├── legacy-networking-v0 ├── build.gradle └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── minecraftcursedlegacy │ │ │ ├── accessor │ │ │ └── networking │ │ │ │ └── AccessorAbstractPacket.java │ │ │ ├── api │ │ │ └── networking │ │ │ │ ├── PluginChannel.java │ │ │ │ └── PluginChannelRegistry.java │ │ │ └── impl │ │ │ └── networking │ │ │ ├── NetworkingImpl.java │ │ │ ├── PluginChannelRegistryImpl.java │ │ │ └── PluginMessagePacket.java │ └── resources │ │ ├── fabric.mod.json │ │ └── legacy-networking.accessors.json │ └── test │ ├── java │ └── io │ │ └── github │ │ └── minecraftcursedlegacy │ │ └── test │ │ ├── NetworkingTest.java │ │ ├── NetworkingTestServer.java │ │ └── TestPluginChannel.java │ └── resources │ └── fabric.mod.json ├── legacy-recipes-v0 ├── build.gradle └── src │ └── main │ ├── java │ └── io │ │ └── github │ │ └── minecraftcursedlegacy │ │ ├── accessor │ │ └── recipe │ │ │ └── AccessorRecipeRegistry.java │ │ └── api │ │ └── recipe │ │ └── Recipes.java │ └── resources │ ├── fabric.mod.json │ └── legacy-recipes.accessors.json ├── legacy-registries-v1 ├── .gitignore ├── build.gradle ├── idsetgenerator.py └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── minecraftcursedlegacy │ │ │ ├── accessor │ │ │ └── registry │ │ │ │ ├── AccessorCompoundTag.java │ │ │ │ ├── AccessorDimensionFile.java │ │ │ │ ├── AccessorEntityRegistry.java │ │ │ │ ├── AccessorPlaceableTileItem.java │ │ │ │ ├── AccessorRecipeRegistry.java │ │ │ │ ├── AccessorShapedRecipe.java │ │ │ │ ├── AccessorShapelessRecipe.java │ │ │ │ └── AccessorTileItem.java │ │ │ ├── api │ │ │ └── registry │ │ │ │ ├── EntityTypes.java │ │ │ │ ├── Registries.java │ │ │ │ ├── Registry.java │ │ │ │ ├── RegistryDiff.java │ │ │ │ ├── RegistryEntryAddedCallback.java │ │ │ │ ├── RegistryRemappedCallback.java │ │ │ │ └── TileItems.java │ │ │ ├── impl │ │ │ └── registry │ │ │ │ ├── EntityType.java │ │ │ │ ├── EntityTypeRegistry.java │ │ │ │ ├── HasParentId.java │ │ │ │ ├── IdSetter.java │ │ │ │ ├── ItemTypeRegistry.java │ │ │ │ ├── RegistryImpl.java │ │ │ │ ├── SmeltingRecipeSetter.java │ │ │ │ ├── TileRegistry.java │ │ │ │ ├── VanillaIds.java │ │ │ │ └── sync │ │ │ │ ├── RegistryDiffImpl.java │ │ │ │ ├── RegistryRemapper.java │ │ │ │ └── RegistrySyncChannelS2C.java │ │ │ └── mixin │ │ │ └── registry │ │ │ ├── MixinItemType.java │ │ │ ├── MixinMcRegionLevelStorage.java │ │ │ ├── MixinMinecraftServer.java │ │ │ ├── MixinOldLevelStorage.java │ │ │ ├── MixinPlaceableTileItem.java │ │ │ ├── MixinServerLoginPacketHandler.java │ │ │ ├── MixinShapedRecipe.java │ │ │ ├── MixinSmeltingRecipeRegistry.java │ │ │ ├── MixinTile.java │ │ │ └── MixinTileItem.java │ └── resources │ │ ├── fabric.mod.json │ │ ├── legacy-registries.accessors.json │ │ └── legacy-registries.mixins.json │ └── test │ ├── java │ └── io │ │ └── github │ │ └── minecraftcursedlegacy │ │ └── test │ │ ├── BasicItem.java │ │ ├── BasicTile.java │ │ └── RegistryTest.java │ └── resources │ └── fabric.mod.json ├── legacy-terrain-v1 ├── build.gradle └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── minecraftcursedlegacy │ │ │ ├── api │ │ │ ├── levelgen │ │ │ │ ├── BiomePlacementCallback.java │ │ │ │ ├── ChunkDecorateCallback.java │ │ │ │ ├── ChunkShapeCallback.java │ │ │ │ └── ExtendedBiome.java │ │ │ └── terrain │ │ │ │ ├── BiomeEvents.java │ │ │ │ ├── ChunkGenEvents.java │ │ │ │ ├── ChunkGenerator.java │ │ │ │ ├── ExtendedBiome.java │ │ │ │ └── feature │ │ │ │ ├── CountPlacement.java │ │ │ │ ├── Placement.java │ │ │ │ ├── PositionedFeature.java │ │ │ │ ├── PositionedFeatures.java │ │ │ │ ├── ScatteredHeightmapPlacement.java │ │ │ │ └── ScatteredYRangePlacement.java │ │ │ ├── impl │ │ │ └── terrain │ │ │ │ ├── BiomeRecomputer.java │ │ │ │ ├── InternalLevelSourceAccess.java │ │ │ │ └── LevelGenImpl.java │ │ │ └── mixin │ │ │ └── terrain │ │ │ ├── MixinBiome.java │ │ │ ├── MixinDimension.java │ │ │ ├── MixinLevel.java │ │ │ ├── MixinNetherLevelSource.java │ │ │ └── MixinOverworldLevelSource.java │ └── resources │ │ ├── fabric.mod.json │ │ └── legacy-terrain.mixins.json │ └── test │ ├── java │ └── io │ │ └── github │ │ └── minecraftcursedlegacy │ │ └── test │ │ ├── LevelGenTest.java │ │ ├── OreRock.java │ │ └── TestBiome.java │ └── resources │ └── fabric.mod.json ├── legacy-textures-v1 ├── build.gradle └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── minecraftcursedlegacy │ │ │ ├── api │ │ │ └── client │ │ │ │ └── AtlasMap.java │ │ │ ├── impl │ │ │ └── texture │ │ │ │ ├── Atlas.java │ │ │ │ ├── AtlasMapper.java │ │ │ │ ├── CrossModel.java │ │ │ │ ├── GeneratedAtlas.java │ │ │ │ ├── ModelDiscoverer.java │ │ │ │ └── resource │ │ │ │ ├── ModelJson.java │ │ │ │ ├── ModelSetup.java │ │ │ │ ├── ModelType.java │ │ │ │ └── ResourceLoader.java │ │ │ └── mixin │ │ │ └── texture │ │ │ ├── MixinHandItemRenderer.java │ │ │ └── MixinItemRenderer.java │ └── resources │ │ ├── fabric.mod.json │ │ └── legacy-textures.mixins.json │ └── test │ ├── java │ └── io │ │ └── github │ │ └── minecraftcursedlegacy │ │ └── test │ │ └── TexturesTest.java │ └── resources │ ├── TEXTURES_LICENCE.txt │ ├── assets │ └── legacy-textures-test │ │ ├── bc │ │ ├── diamond_gear.png │ │ ├── golden_gear.png │ │ ├── item_textures.png │ │ ├── stone_gear.png │ │ └── wooden_gear.png │ │ ├── icon.png │ │ ├── models │ │ ├── item │ │ │ └── malachite_grass.json │ │ └── tile │ │ │ ├── iron_grass.json │ │ │ ├── malachite_grass.json │ │ │ └── red_grass.json │ │ └── textures │ │ ├── item │ │ └── item_texture_too.png │ │ └── tile │ │ ├── cursed_legacy_block.png │ │ ├── dirt.png │ │ ├── iron_grass.png │ │ ├── malachite_grass.png │ │ ├── red_grass_side.png │ │ └── red_grass_top.png │ └── fabric.mod.json ├── legacy-tile-entities-v1 ├── build.gradle └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── minecraftcursedlegacy │ │ │ ├── accessor │ │ │ └── tileentities │ │ │ │ └── AccessorTileEntity.java │ │ │ └── api │ │ │ └── tileentities │ │ │ └── TileEntities.java │ └── resources │ │ ├── fabric.mod.json │ │ └── legacy-tile-entities.accessors.json │ └── test │ ├── java │ └── io │ │ └── github │ │ └── minecraftcursedlegacy │ │ └── test │ │ └── TileEntityTest.java │ └── resources │ └── fabric.mod.json ├── legacy-translations-v0 ├── build.gradle └── src │ └── main │ ├── java │ └── io │ │ └── github │ │ └── minecraftcursedlegacy │ │ ├── accessor │ │ └── translations │ │ │ └── AccessorTranslationStorage.java │ │ └── api │ │ └── registry │ │ └── Translations.java │ └── resources │ ├── fabric.mod.json │ └── legacy-translations.accessors.json ├── legacy-worldtypes-v1 ├── build.gradle └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── minecraftcursedlegacy │ │ │ ├── api │ │ │ └── worldtype │ │ │ │ └── WorldType.java │ │ │ ├── impl │ │ │ └── worldtype │ │ │ │ ├── WorldTypeData.java │ │ │ │ └── WorldTypeImpl.java │ │ │ └── mixin │ │ │ └── worldtype │ │ │ ├── MixinCreateLevelScreen.java │ │ │ ├── MixinDimension.java │ │ │ └── MixinMinecraftServer.java │ └── resources │ │ ├── fabric.mod.json │ │ └── legacy-worldtypes.mixins.json │ └── test │ ├── java │ └── io │ │ └── github │ │ └── minecraftcursedlegacy │ │ └── test │ │ ├── LowFlatChunkGenerator.java │ │ ├── LowFlatWorldType.java │ │ ├── RandomChunkGenerator.java │ │ ├── RandomWorldType.java │ │ └── WorldTypeTest.java │ └── resources │ └── fabric.mod.json ├── settings.gradle └── src └── main └── resources ├── api.mixins.json ├── assets └── api │ └── icon.png └── fabric.mod.json /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Java CI 2 | 3 | on: 4 | push: 5 | pull_request: 6 | 7 | jobs: 8 | checkstyle: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v1 12 | - uses: actions/setup-java@v1 13 | with: 14 | java-version: 8 15 | - uses: eskatos/gradle-command-action@v1 16 | with: 17 | arguments: checkstyleMain --stacktrace 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled nonsense that does not belong in *source* control 2 | build 3 | bin 4 | .gradle 5 | out 6 | run 7 | classes 8 | 9 | # IDE nonsense that could go in source control but really shouldn't 10 | .classpath 11 | .project 12 | .metadata 13 | .settings 14 | *.launch 15 | *.iml 16 | .idea 17 | *.ipr 18 | *.iws 19 | 20 | # Sekrit files 21 | private.properties 22 | private.gradle 23 | 24 | # Files from bad operating systems :^) 25 | Thumbs.db 26 | .DS_Store 27 | local.properties 28 | .directory 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020 The Cursed Legacy Team. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Minecraft Cursed Legacy API 2 | 3 | The (unofficial) [Fabric](https://fabricmc.net/) home for 1.2.5 and Beta 1.7.3 - if you want the newer versions see [here](https://github.com/FabricMC/fabric). 4 | 5 | ## Setup 6 | Run the following command (if you are not using eclipse, replace “eclipse” with your relevant ide) 7 | 8 | ``` 9 | ./gradlew eclipse 10 | ``` 11 | 12 | NOTE: if you want sources (recommended), instead run this. You only need to run this the first time you need to generate sources. 13 | 14 | ``` 15 | ./gradlew :rebuildLVT :genSources eclipse 16 | ``` 17 | 18 | To be able to run the API as a whole in an API dev environment, ensure the root project has been set up in your ide. This should be automatic, but it pays to make sure. 19 | 20 | If you wish to build a copy of API, you can run: 21 | 22 | ``` 23 | ./gradlew build -x checkstyleTest 24 | ``` 25 | 26 | ## Contributing 27 | 28 | Make sure to follow the code style guidelines, which can be seen in use in existing files. 29 | 30 | A General Summary of the code style: 31 | - Use tabs for indentation 32 | - Use same-line braces 33 | - Put a new line between “regular code lines” and if/for/while etc. statements. 34 | 35 | ## License 36 | This API is available under the MIT license. Feel free to learn from it and incorporate it in your own projects. 37 | 38 | ## Running Tests 39 | If your ide runs using gradle change settings to make your ide compile it itself so you can run the test modules. 40 | If your ide doesn't have this feature get a better ide not a glorified text editor please kthx 41 | 42 | ## Subproject Versions 43 | The convention I use for subproject versions is setting it to the last api version I updated them. 44 | If this is stupid, please ping Valoeghese on discord to rant about it. 45 | 46 | -------------------------------------------------------------------------------- /config/checkstyle/checkstyle.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /config/java.header: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Done to increase the memory available to gradle. 2 | org.gradle.jvmargs=-Xmx1G 3 | 4 | # Fabric Properties 5 | minecraft_version=b1.7.3 6 | loader_version=1.0.0 7 | plasma_build=18 8 | 9 | # Mod Properties 10 | mod_version = 1.1.0 11 | maven_group = io.github.minecraftcursedlegacy 12 | archives_base_name = cursed-legacy-api 13 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-cursed-legacy/Cursed-Legacy-API/1ff36aef55a67f9f4764a7bf874aa355d8de9c61/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Aug 22 17:36:22 EDT 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip 7 | -------------------------------------------------------------------------------- /legacy-api-base/build.gradle: -------------------------------------------------------------------------------- 1 | archivesBaseName = 'legacy-api-base' 2 | version = getSubprojectVersion(project, '1.0.0') 3 | 4 | dependencies { 5 | } 6 | -------------------------------------------------------------------------------- /legacy-api-base/src/main/java/io/github/minecraftcursedlegacy/accessor/AccessorMinecraft.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.accessor; 25 | 26 | import org.spongepowered.asm.mixin.Mixin; 27 | import org.spongepowered.asm.mixin.gen.Accessor; 28 | 29 | import net.minecraft.client.Minecraft; 30 | import net.minecraft.client.MinecraftApplet; 31 | 32 | @Mixin(Minecraft.class) 33 | public interface AccessorMinecraft { 34 | @Accessor("field_2765") 35 | MinecraftApplet getApplet(); 36 | } -------------------------------------------------------------------------------- /legacy-api-base/src/main/java/io/github/minecraftcursedlegacy/api/event/ActionResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.api.event; 25 | 26 | /** 27 | * Represents the result of an event. Specific implementation is per event. 28 | */ 29 | public enum ActionResult { 30 | FAIL, 31 | PASS, 32 | SUCCESS; 33 | } 34 | -------------------------------------------------------------------------------- /legacy-api-base/src/main/java/io/github/minecraftcursedlegacy/api/server/VanillaChecker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.api.server; 25 | 26 | import io.github.minecraftcursedlegacy.impl.base.VanillaCheckerImpl; 27 | import net.minecraft.entity.player.Player; 28 | 29 | public final class VanillaChecker { 30 | private VanillaChecker() { 31 | } 32 | 33 | /** 34 | * Checks if a player is using a Vanilla Client. 35 | */ 36 | public static boolean isVanilla(Player player) { 37 | return VanillaCheckerImpl.playermap.get(player.name); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /legacy-api-base/src/main/java/io/github/minecraftcursedlegacy/impl/base/VanillaCheckerImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.impl.base; 25 | 26 | import java.util.HashMap; 27 | 28 | public final class VanillaCheckerImpl { 29 | private VanillaCheckerImpl() { 30 | } 31 | 32 | public static HashMap playermap = new HashMap(); 33 | 34 | public static final long FABRIC_IDENTIFIER_CONSTANT = -9223372036854775808l; 35 | } -------------------------------------------------------------------------------- /legacy-api-base/src/main/java/io/github/minecraftcursedlegacy/mixin/MixinOverlay.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.mixin; 25 | 26 | import org.spongepowered.asm.mixin.Mixin; 27 | import org.spongepowered.asm.mixin.injection.Constant; 28 | import org.spongepowered.asm.mixin.injection.ModifyConstant; 29 | 30 | import net.minecraft.client.gui.Overlay; 31 | 32 | @Mixin(Overlay.class) 33 | public class MixinOverlay { 34 | @ModifyConstant(method = "method_1946", constant = @Constant(stringValue="Minecraft Beta 1.7.3 (")) 35 | private String render(String original) { 36 | return "Minecraft Beta 1.7.3 / Fabric ("; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /legacy-api-base/src/main/java/io/github/minecraftcursedlegacy/mixin/MixinServerLoginPacketHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.mixin; 25 | 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 | import io.github.minecraftcursedlegacy.impl.base.VanillaCheckerImpl; 32 | import net.minecraft.packet.login.LoginRequestPacket; 33 | import net.minecraft.server.network.ServerLoginPacketHandler; 34 | 35 | @Mixin(ServerLoginPacketHandler.class) 36 | public class MixinServerLoginPacketHandler { 37 | @Inject(at = @At("HEAD"), method = "handleLoginRequest") 38 | public void handleHandshake(LoginRequestPacket arg, CallbackInfo bruh) { 39 | if (arg.worldSeed == VanillaCheckerImpl.FABRIC_IDENTIFIER_CONSTANT) { 40 | System.out.println("Fabric Client Connecting"); 41 | VanillaCheckerImpl.playermap.put(arg.username, false); 42 | } else { 43 | System.out.println("Vanilla Client Connecting"); 44 | VanillaCheckerImpl.playermap.put(arg.username, true); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /legacy-api-base/src/main/java/io/github/minecraftcursedlegacy/mixin/MixinServerPlayerPacketHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.mixin; 25 | 26 | import org.spongepowered.asm.mixin.Mixin; 27 | import org.spongepowered.asm.mixin.Shadow; 28 | import org.spongepowered.asm.mixin.injection.At; 29 | import org.spongepowered.asm.mixin.injection.Inject; 30 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 31 | 32 | import io.github.minecraftcursedlegacy.impl.base.VanillaCheckerImpl; 33 | import net.minecraft.server.network.ServerPlayPacketHandler; 34 | import net.minecraft.server.player.ServerPlayer; 35 | 36 | @Mixin(ServerPlayPacketHandler.class) 37 | public class MixinServerPlayerPacketHandler { 38 | @Shadow 39 | private ServerPlayer player; 40 | 41 | @Inject(at= @At("HEAD"), method = "onSocketClosed") 42 | public void method_1473(String string, Object[] objects, CallbackInfo bruh) { 43 | VanillaCheckerImpl.playermap.remove(player.name); 44 | } 45 | } -------------------------------------------------------------------------------- /legacy-api-base/src/main/java/io/github/minecraftcursedlegacy/mixin/MixinTitleScreen.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.mixin; 25 | 26 | import org.spongepowered.asm.mixin.Mixin; 27 | import org.spongepowered.asm.mixin.injection.Constant; 28 | import org.spongepowered.asm.mixin.injection.ModifyConstant; 29 | 30 | import net.minecraft.client.gui.screen.TitleScreen; 31 | 32 | @Mixin(TitleScreen.class) 33 | public class MixinTitleScreen { 34 | @ModifyConstant(method = "render", constant = @Constant(stringValue="Minecraft Beta 1.7.3")) 35 | private String render(String original) { 36 | return "Minecraft Beta 1.7.3 / Fabric"; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /legacy-api-base/src/main/java/net/fabricmc/fabric/api/event/Event.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2017, 2018, 2019 FabricMC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package net.fabricmc.fabric.api.event; 18 | 19 | /** 20 | * Base class for Event implementations. 21 | * 22 | * @param The listener type. 23 | * @see EventFactory 24 | */ 25 | public abstract class Event { 26 | /** 27 | * The invoker field. This should be updated by the implementation to 28 | * always refer to an instance containing all code that should be 29 | * executed upon event emission. 30 | */ 31 | protected T invoker; 32 | 33 | /** 34 | * Returns the invoker instance. 35 | * 36 | *

An "invoker" is an object which hides multiple registered 37 | * listeners of type T under one instance of type T, executing 38 | * them and leaving early as necessary. 39 | * 40 | * @return The invoker instance. 41 | */ 42 | public final T invoker() { 43 | return invoker; 44 | } 45 | 46 | /** 47 | * Register a listener to the event. 48 | * 49 | * @param listener The desired listener. 50 | */ 51 | public abstract void register(T listener); 52 | } -------------------------------------------------------------------------------- /legacy-api-base/src/main/java/net/fabricmc/fabric/impl/base/event/ArrayBackedEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2017, 2018, 2019 FabricMC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package net.fabricmc.fabric.impl.base.event; 18 | 19 | import java.lang.reflect.Array; 20 | import java.util.Arrays; 21 | import java.util.function.Function; 22 | 23 | import net.fabricmc.fabric.api.event.Event; 24 | 25 | class ArrayBackedEvent extends Event { 26 | private final Class type; 27 | private final Function invokerFactory; 28 | private final T dummyInvoker; 29 | private T[] handlers; 30 | 31 | ArrayBackedEvent(Class type, T dummyInvoker, Function invokerFactory) { 32 | this.type = type; 33 | this.dummyInvoker = dummyInvoker; 34 | this.invokerFactory = invokerFactory; 35 | update(); 36 | } 37 | 38 | @SuppressWarnings("unchecked") 39 | void update() { 40 | if (handlers == null) { 41 | if (dummyInvoker != null) { 42 | invoker = dummyInvoker; 43 | } else { 44 | //noinspection unchecked 45 | invoker = invokerFactory.apply((T[]) Array.newInstance(type, 0)); 46 | } 47 | } else if (handlers.length == 1) { 48 | invoker = handlers[0]; 49 | } else { 50 | invoker = invokerFactory.apply(handlers); 51 | } 52 | } 53 | 54 | @Override @SuppressWarnings("unchecked") 55 | public void register(T listener) { 56 | if (listener == null) { 57 | throw new NullPointerException("Tried to register a null listener!"); 58 | } 59 | 60 | if (handlers == null) { 61 | //noinspection unchecked 62 | handlers = (T[]) Array.newInstance(type, 1); 63 | handlers[0] = listener; 64 | } else { 65 | handlers = Arrays.copyOf(handlers, handlers.length + 1); 66 | handlers[handlers.length - 1] = listener; 67 | } 68 | 69 | update(); 70 | } 71 | } -------------------------------------------------------------------------------- /legacy-api-base/src/main/java/net/fabricmc/fabric/impl/base/event/EventFactoryImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2017, 2018, 2019 FabricMC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package net.fabricmc.fabric.impl.base.event; 18 | 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | import java.util.function.Function; 22 | 23 | import net.fabricmc.fabric.api.event.Event; 24 | 25 | public final class EventFactoryImpl { 26 | private static final List> ARRAY_BACKED_EVENTS = new ArrayList<>(); 27 | 28 | private EventFactoryImpl() { } 29 | 30 | public static void invalidate() { 31 | ARRAY_BACKED_EVENTS.forEach(ArrayBackedEvent::update); 32 | } 33 | 34 | public static Event createArrayBacked(Class type, Function invokerFactory) { 35 | return createArrayBacked(type, null, invokerFactory); 36 | } 37 | 38 | public static Event createArrayBacked(Class type, T emptyInvoker, Function invokerFactory) { 39 | ArrayBackedEvent event = new ArrayBackedEvent<>(type, emptyInvoker, invokerFactory); 40 | ARRAY_BACKED_EVENTS.add(event); 41 | return event; 42 | } 43 | } -------------------------------------------------------------------------------- /legacy-api-base/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "legacy-api-base", 4 | "version": "${version}", 5 | 6 | "name": "Minecraft Cursed Legacy API Base", 7 | "description": "A set of useful hooks and features to be used by modders.", 8 | "authors": [ 9 | "The Cursed Legacy Team" 10 | ], 11 | "contact": { 12 | "issues": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API/issues", 13 | "sources": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API" 14 | }, 15 | 16 | "license": "MIT", 17 | "icon": "assets/api/icon.png", 18 | 19 | "mixins": [ 20 | "legacy-api-base.accessors.json", 21 | "legacy-api-base.mixins.json" 22 | ], 23 | 24 | "depends": { 25 | "fabricloader": "*", 26 | "minecraft": "1.0.0-beta.7.3" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /legacy-api-base/src/main/resources/legacy-api-base.accessors.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "io.github.minecraftcursedlegacy.accessor", 4 | "compatibilityLevel": "JAVA_8", 5 | "client": [ 6 | "AccessorMinecraft" 7 | ], 8 | "injectors": { 9 | "defaultRequire": 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /legacy-api-base/src/main/resources/legacy-api-base.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "io.github.minecraftcursedlegacy.mixin", 4 | "compatibilityLevel": "JAVA_8", 5 | "client": [ 6 | "MixinLoginRequestPacketClient", 7 | "MixinOverlay", 8 | "MixinTitleScreen", 9 | "MixinResourceDownloadThread" 10 | ], 11 | "server": [ 12 | "MixinServerLoginPacketHandler", 13 | "MixinServerPlayerPacketHandler" 14 | ], 15 | "injectors": { 16 | "defaultRequire": 1 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /legacy-attached-data-v1/build.gradle: -------------------------------------------------------------------------------- 1 | archivesBaseName = 'legacy-attached-data-v1' 2 | version = getSubprojectVersion(project, '1.0.0') 3 | 4 | moduleDependencies(project, 'legacy-api-base') 5 | dependencies { 6 | testImplementation project(path: ':legacy-interaction-events-v0') 7 | testImplementation project(path: ':legacy-registries-v1') 8 | } 9 | -------------------------------------------------------------------------------- /legacy-attached-data-v1/src/main/java/io/github/minecraftcursedlegacy/api/attacheddata/v1/AttachedData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.api.attacheddata.v1; 25 | 26 | import io.github.minecraftcursedlegacy.api.registry.Id; 27 | import net.minecraft.util.io.CompoundTag; 28 | 29 | /** 30 | * Data which can be attached to various vanilla objects, such as items and levels. 31 | * @see {@link DataManager}. 32 | * @since 1.0.0 33 | */ 34 | public interface AttachedData { 35 | /** 36 | * @return the id of this modded data. 37 | */ 38 | Id getId(); 39 | /** 40 | * @return a tag representation of this data. 41 | */ 42 | CompoundTag toTag(CompoundTag tag); 43 | /** 44 | * @param tag the tag from which to load data. 45 | */ 46 | void fromTag(CompoundTag tag); 47 | /** 48 | * Creates a deep copy of this {@link AttachedData}, similar to the recommendations for {@link Object#clone}. 49 | */ 50 | AttachedData copy(); 51 | } 52 | -------------------------------------------------------------------------------- /legacy-attached-data-v1/src/main/java/io/github/minecraftcursedlegacy/api/data/AttachedData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.api.data; 25 | 26 | import io.github.minecraftcursedlegacy.api.registry.Id; 27 | import net.minecraft.util.io.CompoundTag; 28 | 29 | /** 30 | * Data which can be attached to various vanilla objects, such as items and blocks. 31 | * @see {@link DataManager}. 32 | * @deprecated since 1.0.0. Use {@linkplain io.github.minecraftcursedlegacy.api.attacheddata.v1.AttachedData this equivalent} from api v1 instead. 33 | */ 34 | @Deprecated 35 | public interface AttachedData extends io.github.minecraftcursedlegacy.api.attacheddata.v1.AttachedData { 36 | /** 37 | * @return the id of this modded data. 38 | */ 39 | Id getId(); 40 | /** 41 | * @return a tag representation of this data. 42 | */ 43 | CompoundTag toTag(CompoundTag tag); 44 | /** 45 | * @param tag the tag from which to load data. 46 | */ 47 | void fromTag(CompoundTag tag); 48 | /** 49 | * Creates a deep copy of this {@link AttachedData}, similar to the recommendations for {@link Object#clone}. 50 | */ 51 | AttachedData copy(); 52 | } -------------------------------------------------------------------------------- /legacy-attached-data-v1/src/main/java/io/github/minecraftcursedlegacy/mixin/attacheddata/MixinPlayerInventory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.mixin.attacheddata; 25 | 26 | import org.spongepowered.asm.mixin.Mixin; 27 | import org.spongepowered.asm.mixin.injection.At; 28 | import org.spongepowered.asm.mixin.injection.Redirect; 29 | 30 | import io.github.minecraftcursedlegacy.api.attacheddata.v1.DataManager; 31 | import net.minecraft.entity.player.PlayerInventory; 32 | import net.minecraft.item.ItemInstance; 33 | 34 | @Mixin(PlayerInventory.class) 35 | public class MixinPlayerInventory { 36 | @Redirect(method = "method_685", at = @At(value = "NEW", target = "net/minecraft/item/ItemInstance")) 37 | private ItemInstance api_injectForItemPickup(int id, int count, int damage, ItemInstance param) { 38 | ItemInstance result = new ItemInstance(id, count, damage); 39 | DataManager.ITEM_INSTANCE.copyData(param, result); 40 | return result; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /legacy-attached-data-v1/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "legacy-attached-data", 4 | "version": "${version}", 5 | 6 | "name": "Minecraft Cursed Legacy API Attached Data", 7 | "description": "A set of useful hooks and features to be used by modders.", 8 | "authors": [ 9 | "The Cursed Legacy Team" 10 | ], 11 | "contact": { 12 | "issues": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API/issues", 13 | "sources": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API" 14 | }, 15 | 16 | "license": "MIT", 17 | "icon": "assets/api/icon.png", 18 | 19 | "mixins": [ 20 | "legacy-attached-data.mixins.json" 21 | ], 22 | "depends": { 23 | "fabricloader": "*", 24 | "minecraft": "1.0.0-beta.7.3", 25 | "legacy-api-base": "*" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /legacy-attached-data-v1/src/main/resources/legacy-attached-data.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "io.github.minecraftcursedlegacy.mixin.attacheddata", 4 | "compatibilityLevel": "JAVA_8", 5 | "mixins": [ 6 | "MixinItemInstance", 7 | "MixinLevelProperties", 8 | "MixinPlayerInventory" 9 | ], 10 | "injectors": { 11 | "defaultRequire": 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /legacy-attached-data-v1/src/test/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "legacy-attached-data-test", 4 | "version": "${version}", 5 | 6 | "name": "Attached Data Test Mod", 7 | "description": "Tests for the attached data module of Cursed Legacy API.", 8 | "authors": [ 9 | "The Cursed Legacy Team" 10 | ], 11 | "contact": { 12 | "issues": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API/issues", 13 | "sources": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API" 14 | }, 15 | 16 | "license": "MIT", 17 | "icon": "assets/modid/icon.png", 18 | 19 | "environment": "*", 20 | "entrypoints": { 21 | "init": [ 22 | "io.github.minecraftcursedlegacy.test.ItemDataTest", 23 | "io.github.minecraftcursedlegacy.test.LevelPropertiesDataTest" 24 | ] 25 | }, 26 | 27 | "depends": { 28 | "fabricloader": "*", 29 | "legacy-api-base": "*", 30 | "legacy-attached-data": "*", 31 | "minecraft": "1.0.0-beta.7.3" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /legacy-commands-v1/build.gradle: -------------------------------------------------------------------------------- 1 | archivesBaseName = 'legacy-commands-v1' 2 | version = getSubprojectVersion(project, '1.1.0') 3 | 4 | moduleDependencies(project, 'legacy-api-base') 5 | 6 | dependencies { 7 | } 8 | -------------------------------------------------------------------------------- /legacy-commands-v1/src/main/java/io/github/minecraftcursedlegacy/accessor/command/AccessorMinecraft.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.accessor.command; 25 | 26 | import net.minecraft.client.Minecraft; 27 | import org.spongepowered.asm.mixin.Mixin; 28 | import org.spongepowered.asm.mixin.gen.Accessor; 29 | 30 | @Mixin(Minecraft.class) 31 | public interface AccessorMinecraft { 32 | @Accessor 33 | public static Minecraft getInstance() { 34 | throw new UnsupportedOperationException("mixin"); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /legacy-commands-v1/src/main/java/io/github/minecraftcursedlegacy/accessor/command/AccessorServerPlayPacketHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.accessor.command; 25 | 26 | import net.minecraft.server.network.ServerPlayPacketHandler; 27 | import net.minecraft.server.player.ServerPlayer; 28 | import org.spongepowered.asm.mixin.Mixin; 29 | import org.spongepowered.asm.mixin.gen.Accessor; 30 | 31 | @Mixin(ServerPlayPacketHandler.class) 32 | public interface AccessorServerPlayPacketHandler { 33 | @Accessor 34 | public abstract ServerPlayer getPlayer(); 35 | } 36 | -------------------------------------------------------------------------------- /legacy-commands-v1/src/main/java/io/github/minecraftcursedlegacy/api/command/CommandDispatchEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.api.command; 25 | 26 | import net.fabricmc.fabric.api.event.Event; 27 | import net.fabricmc.fabric.api.event.EventFactory; 28 | 29 | /** 30 | * Event for when a command is issued on the server. Used by the command implementation for multiplayer commands. 31 | * @since 1.1.0 32 | */ 33 | public interface CommandDispatchEvent { 34 | Event INSTANCE = EventFactory.createArrayBacked(CommandDispatchEvent.class, listeners -> (sender, command) -> { 35 | for (CommandDispatchEvent listener : listeners) { 36 | if (listener.onDispatch (sender, command)) { 37 | return true; 38 | } 39 | } 40 | 41 | return false; 42 | }); 43 | 44 | /** 45 | * Called when a command is issued by a source. 46 | * @param sender the source who has issued the command. 47 | * @param command the command string, excluding the "/" (slash) at the beginning if executed from chat. 48 | * 49 | * @return whether the command was handled. 50 | */ 51 | boolean onDispatch(Sender sender, String command); 52 | } 53 | -------------------------------------------------------------------------------- /legacy-commands-v1/src/main/java/io/github/minecraftcursedlegacy/api/command/Sender.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.api.command; 25 | 26 | import javax.annotation.Nullable; 27 | 28 | import io.github.minecraftcursedlegacy.impl.command.PlayerSender; 29 | import net.minecraft.entity.player.Player; 30 | 31 | /** 32 | * Information about and utility methods for handling incoming commands and chat messages. 33 | * @since 1.1.0 34 | */ 35 | public interface Sender { 36 | /** 37 | * @return the player executing the command. Will be null if it is the console. 38 | */ 39 | @Nullable Player getPlayer(); 40 | /** 41 | * Sends a chat message to the command source as feedback. 42 | * @param message the message to send. 43 | */ 44 | void sendCommandFeedback(String message); 45 | /** 46 | * Sends an error chat message to the command source as feedback. 47 | * @param message the message to send. 48 | */ 49 | default void sendError(String message) { 50 | this.sendCommandFeedback("§4"+message); 51 | } 52 | 53 | /** 54 | * Creates a new sender from the given player. 55 | * @param player the player who is responsible for sending. 56 | * @return the new sender instance. 57 | */ 58 | static Sender fromPlayer(Player player) { 59 | return new PlayerSender(player); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /legacy-commands-v1/src/main/java/io/github/minecraftcursedlegacy/api/command/ServerCommandUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.api.command; 25 | 26 | import io.github.minecraftcursedlegacy.impl.command.ServerCommandSender; 27 | import net.fabricmc.api.EnvType; 28 | import net.fabricmc.api.Environment; 29 | import net.minecraft.server.command.CommandSource; 30 | 31 | /** 32 | * Utilities for server commands. Do not reference this class client side! 33 | * @since 1.1.0 34 | */ 35 | @Environment(EnvType.SERVER) 36 | public class ServerCommandUtils { 37 | /** 38 | * Create a {@linkplain Sender sender} from a command source. 39 | * @param source the command source. 40 | * @return the sender instance that references the given command source. 41 | */ 42 | public static Sender createSender(CommandSource source) { 43 | return new ServerCommandSender(source); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /legacy-commands-v1/src/main/java/io/github/minecraftcursedlegacy/impl/command/PlayerSender.java: -------------------------------------------------------------------------------- 1 | package io.github.minecraftcursedlegacy.impl.command; 2 | 3 | import io.github.minecraftcursedlegacy.accessor.command.AccessorMinecraft; 4 | import io.github.minecraftcursedlegacy.api.command.Sender; 5 | import net.minecraft.entity.player.Player; 6 | 7 | public class PlayerSender implements Sender { 8 | private final Player player; 9 | 10 | public PlayerSender(Player player) { 11 | this.player = player; 12 | } 13 | 14 | public Player getPlayer() { 15 | return this.player; 16 | } 17 | 18 | public String getName() { 19 | return this.player.name; 20 | } 21 | 22 | public void sendCommandFeedback(String message) { 23 | AccessorMinecraft.getInstance().overlay.addChatMessage(message); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /legacy-commands-v1/src/main/java/io/github/minecraftcursedlegacy/impl/command/ServerCommandSender.java: -------------------------------------------------------------------------------- 1 | package io.github.minecraftcursedlegacy.impl.command; 2 | 3 | import io.github.minecraftcursedlegacy.accessor.command.AccessorServerPlayPacketHandler; 4 | import io.github.minecraftcursedlegacy.api.command.Sender; 5 | import net.fabricmc.api.EnvType; 6 | import net.fabricmc.api.Environment; 7 | import net.minecraft.entity.player.Player; 8 | import net.minecraft.server.command.CommandSource; 9 | 10 | @Environment(EnvType.SERVER) 11 | public class ServerCommandSender implements Sender { 12 | private final CommandSource source; 13 | 14 | public ServerCommandSender(CommandSource source) { 15 | this.source = source; 16 | } 17 | 18 | public Player getPlayer() { 19 | if (source instanceof AccessorServerPlayPacketHandler) { 20 | return ((AccessorServerPlayPacketHandler) source).getPlayer(); 21 | } 22 | return null; 23 | } 24 | 25 | public String getName() { 26 | return this.source.getName(); 27 | } 28 | 29 | public void sendCommandFeedback(String message) { 30 | this.source.sendFeedback(message); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /legacy-commands-v1/src/main/java/io/github/minecraftcursedlegacy/mixin/command/MixinCommandManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.mixin.command; 25 | 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 | import io.github.minecraftcursedlegacy.api.command.CommandDispatchEvent; 32 | import io.github.minecraftcursedlegacy.api.command.ServerCommandUtils; 33 | import net.minecraft.server.command.Command; 34 | import net.minecraft.server.command.CommandManager; 35 | 36 | @Mixin(CommandManager.class) 37 | public abstract class MixinCommandManager { 38 | @Inject(method = "processCommand", at = @At(value = "HEAD"), cancellable = true) 39 | private void handleCommand(Command command, CallbackInfo ci) { 40 | if (CommandDispatchEvent.INSTANCE.invoker().onDispatch(ServerCommandUtils.createSender(command.source), command.commandString)) { 41 | ci.cancel(); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /legacy-commands-v1/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "legacy-commands", 4 | "version": "${version}", 5 | 6 | "name": "Minecraft Cursed Legacy Commands", 7 | "description": "A set of useful hooks and features to be used by modders.", 8 | "authors": [ 9 | "The Cursed Legacy Team" 10 | ], 11 | "contact": { 12 | "issues": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API/issues", 13 | "sources": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API" 14 | }, 15 | 16 | "license": "MIT", 17 | "icon": "assets/api/icon.png", 18 | 19 | "entrypoints": { 20 | "init": [ 21 | "io.github.minecraftcursedlegacy.impl.command.CommandsImpl" 22 | ] 23 | }, 24 | 25 | "mixins": [ 26 | "legacy-commands.mixins.json", 27 | "legacy-commands.accessors.json" 28 | ], 29 | 30 | "depends": { 31 | "fabricloader": "*", 32 | "legacy-api-base": "*", 33 | "minecraft": "1.0.0-beta.7.3" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /legacy-commands-v1/src/main/resources/legacy-commands.accessors.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "io.github.minecraftcursedlegacy.accessor.command", 4 | "compatibilityLevel": "JAVA_8", 5 | "client": [ 6 | "AccessorMinecraft" 7 | ], 8 | "server": [ 9 | "AccessorServerPlayPacketHandler" 10 | ], 11 | "injectors": { 12 | "defaultRequire": 1 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /legacy-commands-v1/src/main/resources/legacy-commands.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "io.github.minecraftcursedlegacy.mixin.command", 4 | "compatibilityLevel": "JAVA_8", 5 | "client": [ 6 | "MixinMinecraft" 7 | ], 8 | "server": [ 9 | "MixinCommandManager", 10 | "MixinServerPlayPacketHandler" 11 | ], 12 | "injectors": { 13 | "defaultRequire": 1 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /legacy-commands-v1/src/test/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "legacy-commands-test", 4 | "version": "${version}", 5 | 6 | "name": "Commands Test Mod", 7 | "description": "Tests for the commands module of Cursed Legacy API.", 8 | "authors": [ 9 | "The Cursed Legacy Team" 10 | ], 11 | "contact": { 12 | "issues": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API/issues", 13 | "sources": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API" 14 | }, 15 | 16 | "license": "MIT", 17 | "icon": "assets/modid/icon.png", 18 | 19 | "environment": "*", 20 | "entrypoints": { 21 | "init": [ 22 | "io.github.minecraftcursedlegacy.test.CommandsTest" 23 | ] 24 | }, 25 | 26 | "depends": { 27 | "fabricloader": "*", 28 | "legacy-api-base": "*", 29 | "legacy-commands": "*", 30 | "minecraft": "1.0.0-beta.7.3" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /legacy-config-v0/build.gradle: -------------------------------------------------------------------------------- 1 | archivesBaseName = 'legacy-config-v0' 2 | version = getSubprojectVersion(project, '0.6.3') 3 | 4 | apply plugin: 'java-library' 5 | 6 | moduleDependencies(project, 'legacy-api-base') 7 | dependencies { 8 | include api('valoeghese:ZoesteriaConfig:1.3.6') 9 | } 10 | 11 | minecraft { 12 | addIncludeTweaker {dependency, json -> 13 | if ('ZoesteriaConfig' == dependency.name) { 14 | json.addProperty('description', 'Config format and library designed for Zoesteria 2, but also useable by other projects') 15 | json.addProperty('license', 'MIT') 16 | 17 | def authors = new com.google.gson.JsonArray() 18 | authors.add('Valoeghese') 19 | json.add('authors', authors) 20 | 21 | def contact = new com.google.gson.JsonObject() 22 | contact.addProperty('sources', 'https://github.com/valoeghese/ZoesteriaConfig') 23 | contact.addProperty('issues', 'https://github.com/valoeghese/ZoesteriaConfig/issues') 24 | json.add('contact', contact) 25 | } 26 | } 27 | } 28 | 29 | publishing { 30 | publications { 31 | mavenJava(MavenPublication) { 32 | pom.withXml { 33 | //Workaround from java.components including everything (including the game) 34 | addDependency(it, 'compile', project.configurations.api.dependencies) 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /legacy-config-v0/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "legacy-config", 4 | "version": "${version}", 5 | 6 | "name": "Minecraft Cursed Legacy API Config", 7 | "description": "A set of useful hooks and features to be used by modders.", 8 | "authors": [ 9 | "The Cursed Legacy Team" 10 | ], 11 | "contact": { 12 | "issues": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API/issues", 13 | "sources": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API" 14 | }, 15 | 16 | "license": "MIT", 17 | "icon": "assets/api/icon.png", 18 | 19 | "depends": { 20 | "fabricloader": "*", 21 | "minecraft": "1.0.0-beta.7.3", 22 | "legacy-api-base": "*" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /legacy-interaction-events-v0/build.gradle: -------------------------------------------------------------------------------- 1 | archivesBaseName = 'legacy-interaction-events-v0' 2 | version = getSubprojectVersion(project, '0.6.3') 3 | 4 | moduleDependencies(project, 'legacy-api-base') 5 | dependencies { 6 | } 7 | -------------------------------------------------------------------------------- /legacy-interaction-events-v0/src/main/java/io/github/minecraftcursedlegacy/impl/events/interaction/TileInteractionImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.impl.events.interaction; 25 | 26 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 27 | 28 | import io.github.minecraftcursedlegacy.api.event.ActionResult; 29 | import io.github.minecraftcursedlegacy.api.event.TileInteractionCallback; 30 | import net.minecraft.entity.player.Player; 31 | import net.minecraft.item.ItemInstance; 32 | import net.minecraft.level.Level; 33 | import net.minecraft.tile.Tile; 34 | 35 | public class TileInteractionImpl { 36 | public static void onTileInteract(Player player, Level level, ItemInstance item, int x, int y, int z, int i1, CallbackInfoReturnable info) { 37 | int tile = level.getTileId(x, y, z); 38 | ActionResult result = TileInteractionCallback.EVENT.invoker().onTileInteract(player, level, item, Tile.BY_ID[tile], x, y, z, i1); 39 | 40 | if (result != ActionResult.PASS) { 41 | info.setReturnValue(result == ActionResult.SUCCESS); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /legacy-interaction-events-v0/src/main/java/io/github/minecraftcursedlegacy/mixin/events/interaction/MixinClientInteractionManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.mixin.events.interaction; 25 | 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.CallbackInfoReturnable; 30 | 31 | import io.github.minecraftcursedlegacy.impl.events.interaction.TileInteractionImpl; 32 | import net.minecraft.client.ClientInteractionManager; 33 | import net.minecraft.entity.player.Player; 34 | import net.minecraft.item.ItemInstance; 35 | import net.minecraft.level.Level; 36 | 37 | @Mixin(ClientInteractionManager.class) 38 | public class MixinClientInteractionManager { 39 | @Inject(at = @At("HEAD"), method = "useItemOnTile", cancellable = true) 40 | private void api_onTileInteract(Player player, Level level, ItemInstance item, int x, int y, int z, int i1, CallbackInfoReturnable info) { 41 | TileInteractionImpl.onTileInteract(player, level, item, x, y, z, i1, info); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /legacy-interaction-events-v0/src/main/java/io/github/minecraftcursedlegacy/mixin/events/interaction/MixinServerInteractionManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.mixin.events.interaction; 25 | 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.CallbackInfoReturnable; 30 | 31 | import io.github.minecraftcursedlegacy.impl.events.interaction.TileInteractionImpl; 32 | import net.minecraft.entity.player.Player; 33 | import net.minecraft.item.ItemInstance; 34 | import net.minecraft.level.Level; 35 | import net.minecraft.server.player.ServerInteractionManager; 36 | 37 | @Mixin(ServerInteractionManager.class) 38 | public class MixinServerInteractionManager { 39 | @Inject(at = @At("HEAD"), method = "activateTile", cancellable = true) 40 | private void api_onTileInteract(Player player, Level level, ItemInstance item, int x, int y, int z, int i1, CallbackInfoReturnable info) { 41 | TileInteractionImpl.onTileInteract(player, level, item, x, y, z, i1, info); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /legacy-interaction-events-v0/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "legacy-interaction-events", 4 | "version": "${version}", 5 | 6 | "name": "Minecraft Cursed Legacy API Interaction Events", 7 | "description": "A set of useful hooks and features to be used by modders.", 8 | "authors": [ 9 | "The Cursed Legacy Team" 10 | ], 11 | "contact": { 12 | "issues": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API/issues", 13 | "sources": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API" 14 | }, 15 | 16 | "license": "MIT", 17 | "icon": "assets/api/icon.png", 18 | 19 | "mixins": [ 20 | "legacy-interaction-events.mixins.json" 21 | ], 22 | "depends": { 23 | "fabricloader": "*", 24 | "minecraft": "1.0.0-beta.7.3", 25 | "legacy-api-base": "*" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /legacy-interaction-events-v0/src/main/resources/legacy-interaction-events.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "io.github.minecraftcursedlegacy.mixin.events.interaction", 4 | "compatibilityLevel": "JAVA_8", 5 | "client": [ 6 | "MixinClientInteractionManager" 7 | ], 8 | "server": [ 9 | "MixinServerInteractionManager" 10 | ], 11 | "injectors": { 12 | "defaultRequire": 1 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /legacy-lifecycle-events-v1/build.gradle: -------------------------------------------------------------------------------- 1 | archivesBaseName = 'legacy-lifecycle-events-v1' 2 | version = getSubprojectVersion(project, '1.0.0') 3 | 4 | moduleDependencies(project, 'legacy-api-base') 5 | dependencies { 6 | } 7 | -------------------------------------------------------------------------------- /legacy-lifecycle-events-v1/src/main/java/io/github/minecraftcursedlegacy/api/event/lifecycle/ClientTickCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.api.event.lifecycle; 25 | 26 | import net.fabricmc.fabric.api.event.Event; 27 | import net.minecraft.client.Minecraft; 28 | 29 | /** 30 | * Callback for ticks on the client. 31 | * @deprecated use {@linkplain ClientLifecycleEvents#END_TICK} instead. 32 | */ 33 | @FunctionalInterface 34 | @Deprecated 35 | public interface ClientTickCallback extends ClientLifecycleEvents.Tick { 36 | Event EVENT = ClientLifecycleEvents.END_TICK; 37 | 38 | /** 39 | * Called when the client ticks. 40 | * @param client the minecraft client instance. 41 | */ 42 | void onClientTick(Minecraft client); 43 | } 44 | -------------------------------------------------------------------------------- /legacy-lifecycle-events-v1/src/main/java/io/github/minecraftcursedlegacy/api/event/lifecycle/CommonLifecycleEvents.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.api.event.lifecycle; 25 | 26 | import net.fabricmc.fabric.api.event.Event; 27 | import net.fabricmc.fabric.api.event.EventFactory; 28 | import net.minecraft.entity.player.Player; 29 | 30 | /** 31 | * Collection of common events that pertain to the game lifecycle. 32 | * @since 1.1.0 33 | */ 34 | public class CommonLifecycleEvents { 35 | /** 36 | * Event for the player respawning. 37 | */ 38 | public static final Event PLAYER_RESPAWN = EventFactory.createArrayBacked(PlayerRespawn.class, 39 | listeners -> player -> { 40 | for (PlayerRespawn listener : listeners) { 41 | listener.onRespawn(player); 42 | } 43 | }); 44 | 45 | @FunctionalInterface 46 | public interface PlayerRespawn { 47 | /** 48 | * Called after the player respawns. 49 | * @param player the player that has respawned. 50 | */ 51 | void onRespawn(Player player); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /legacy-lifecycle-events-v1/src/main/java/io/github/minecraftcursedlegacy/api/event/lifecycle/DedicatedServerTickCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.api.event.lifecycle; 25 | 26 | import net.fabricmc.fabric.api.event.Event; 27 | import net.minecraft.server.MinecraftServer; 28 | 29 | /** 30 | * Callback for ticks on the dedicated server. Does *not* run in singleplayer! 31 | * @deprecated use {@linkplain ServerLifecycleEvents#END_TICK} instead. 32 | */ 33 | @FunctionalInterface 34 | @Deprecated 35 | public interface DedicatedServerTickCallback extends ServerLifecycleEvents.Tick { 36 | Event EVENT = ServerLifecycleEvents.END_TICK; 37 | 38 | /** 39 | * Called when the dedicated server ticks. 40 | * @param server the dedicated server instance. 41 | */ 42 | void onServerTick(MinecraftServer server); 43 | } 44 | -------------------------------------------------------------------------------- /legacy-lifecycle-events-v1/src/main/java/io/github/minecraftcursedlegacy/mixin/event/lifecycle/MixinMinecraftServer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.mixin.event.lifecycle; 25 | 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 | import io.github.minecraftcursedlegacy.api.event.lifecycle.ServerLifecycleEvents; 32 | import net.minecraft.server.MinecraftServer; 33 | 34 | @Mixin(MinecraftServer.class) 35 | public class MixinMinecraftServer { 36 | @Inject(at = @At("HEAD"), method = "tick") 37 | private void onStartTick(CallbackInfo info) { 38 | ServerLifecycleEvents.START_TICK.invoker().onServerTick((MinecraftServer) (Object) this); 39 | } 40 | 41 | @Inject(at = @At("RETURN"), method = "tick") 42 | private void onEndTick(CallbackInfo info) { 43 | ServerLifecycleEvents.END_TICK.invoker().onServerTick((MinecraftServer) (Object) this); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /legacy-lifecycle-events-v1/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "legacy-lifecycle-events", 4 | "version": "${version}", 5 | 6 | "name": "Minecraft Cursed Legacy Lifecycle Events", 7 | "description": "A set of useful hooks and features to be used by modders.", 8 | "authors": [ 9 | "The Cursed Legacy Team" 10 | ], 11 | "contact": { 12 | "issues": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API/issues", 13 | "sources": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API" 14 | }, 15 | 16 | "license": "MIT", 17 | "icon": "assets/api/icon.png", 18 | 19 | "mixins": [ 20 | "legacy-lifecycle-events.mixins.json" 21 | ], 22 | 23 | "depends": { 24 | "fabricloader": "*", 25 | "legacy-api-base": "*", 26 | "minecraft": "1.0.0-beta.7.3" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /legacy-lifecycle-events-v1/src/main/resources/legacy-lifecycle-events.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "io.github.minecraftcursedlegacy.mixin.event.lifecycle", 4 | "compatibilityLevel": "JAVA_8", 5 | "client": [ 6 | "MixinMinecraft" 7 | ], 8 | "server": [ 9 | "MixinMinecraftServer", 10 | "MixinPlayerManager" 11 | ], 12 | "injectors": { 13 | "defaultRequire": 1 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /legacy-lifecycle-events-v1/src/test/java/io/github/minecraftcursedlegacy/test/LifecycleEventsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.test; 25 | 26 | import io.github.minecraftcursedlegacy.api.event.lifecycle.CommonLifecycleEvents; 27 | import net.fabricmc.api.ModInitializer; 28 | 29 | public class LifecycleEventsTest implements ModInitializer { 30 | @Override 31 | public void onInitialize() { 32 | CommonLifecycleEvents.PLAYER_RESPAWN.register(player -> { 33 | System.out.println("Player has respawned: " + player.name); 34 | }); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /legacy-lifecycle-events-v1/src/test/java/io/github/minecraftcursedlegacy/test/LifecycleEventsTestServer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.test; 25 | 26 | import io.github.minecraftcursedlegacy.api.event.lifecycle.ServerLifecycleEvents; 27 | import net.fabricmc.api.DedicatedServerModInitializer; 28 | 29 | public class LifecycleEventsTestServer implements DedicatedServerModInitializer { 30 | @Override 31 | public void onInitializeServer() { 32 | ServerLifecycleEvents.PLAYER_LOGIN.register((player, packetHandler) -> { 33 | System.out.println("Player has joined: " + player.name); 34 | //packetHandler.drop("U R Bad"); Uncomment this line to test login packet dropping 35 | }); 36 | 37 | ServerLifecycleEvents.PLAYER_DISCONNECT.register(player -> { 38 | System.out.println("Player has left the game: " + player.name); 39 | }); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /legacy-lifecycle-events-v1/src/test/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "legacy-lifecycle-events-test", 4 | "version": "${version}", 5 | 6 | "name": "Lifecycle Events Test Mod", 7 | "description": "Test mod for the lifecycle events api", 8 | "authors": [ 9 | "The Cursed Legacy Team" 10 | ], 11 | "contact": { 12 | "issues": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API/issues", 13 | "sources": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API" 14 | }, 15 | 16 | "license": "MIT", 17 | "icon": "assets/modid/icon.png", 18 | 19 | "environment": "*", 20 | "entrypoints": { 21 | "init": [ 22 | "io.github.minecraftcursedlegacy.test.LifecycleEventsTest" 23 | ], 24 | "server": [ 25 | "io.github.minecraftcursedlegacy.test.LifecycleEventsTestServer" 26 | ] 27 | }, 28 | 29 | "depends": { 30 | "fabricloader": "*", 31 | "legacy-api-base": "*", 32 | "legacy-lifecycle-events": "*", 33 | "minecraft": "1.0.0-beta.7.3" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /legacy-networking-v0/build.gradle: -------------------------------------------------------------------------------- 1 | archivesBaseName = 'legacy-networking-v0' 2 | version = getSubprojectVersion(project, '0.6.3') 3 | 4 | moduleDependencies(project, 'legacy-api-base') 5 | dependencies { 6 | testImplementation project(path: ':legacy-interaction-events-v0') 7 | } 8 | -------------------------------------------------------------------------------- /legacy-networking-v0/src/main/java/io/github/minecraftcursedlegacy/accessor/networking/AccessorAbstractPacket.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.accessor.networking; 25 | 26 | import org.spongepowered.asm.mixin.Mixin; 27 | import org.spongepowered.asm.mixin.gen.Invoker; 28 | 29 | import net.minecraft.packet.AbstractPacket; 30 | 31 | @Mixin(AbstractPacket.class) 32 | @SuppressWarnings("rawtypes") 33 | public interface AccessorAbstractPacket { 34 | @Invoker("register") 35 | static void register(int var0, boolean flag, boolean flag1, Class arg) { 36 | } 37 | } -------------------------------------------------------------------------------- /legacy-networking-v0/src/main/java/io/github/minecraftcursedlegacy/api/networking/PluginChannelRegistry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.api.networking; 25 | 26 | import io.github.minecraftcursedlegacy.impl.networking.PluginChannelRegistryImpl; 27 | 28 | public class PluginChannelRegistry { 29 | private PluginChannelRegistry() { 30 | } 31 | 32 | public static void registerPluginChannel(PluginChannel channel) { 33 | PluginChannelRegistryImpl.registerPluginChannel(channel); 34 | } 35 | } -------------------------------------------------------------------------------- /legacy-networking-v0/src/main/java/io/github/minecraftcursedlegacy/impl/networking/NetworkingImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.impl.networking; 25 | 26 | import io.github.minecraftcursedlegacy.accessor.networking.AccessorAbstractPacket; 27 | import net.fabricmc.api.ModInitializer; 28 | 29 | public class NetworkingImpl implements ModInitializer { 30 | @Override 31 | public void onInitialize() { 32 | AccessorAbstractPacket.register(250, true, true, PluginMessagePacket.class); 33 | } 34 | } -------------------------------------------------------------------------------- /legacy-networking-v0/src/main/java/io/github/minecraftcursedlegacy/impl/networking/PluginChannelRegistryImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.impl.networking; 25 | 26 | import java.util.HashMap; 27 | 28 | import io.github.minecraftcursedlegacy.api.networking.PluginChannel; 29 | import net.minecraft.network.PacketHandler; 30 | 31 | public class PluginChannelRegistryImpl { 32 | private PluginChannelRegistryImpl() { 33 | } 34 | 35 | private static HashMap channelMap = new HashMap<>(); 36 | 37 | public static void registerPluginChannel(PluginChannel channel) { 38 | channelMap.put(channel.getChannelIdentifier().toString(), channel); 39 | } 40 | 41 | protected static void handlePacket(PacketHandler arg, PluginMessagePacket packet) { 42 | channelMap.get(packet.channel).onReceive(arg, packet.data); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /legacy-networking-v0/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "legacy-networking", 4 | "version": "${version}", 5 | 6 | "name": "Minecraft Cursed Legacy Networking", 7 | "description": "A set of useful hooks and features to be used by modders.", 8 | "authors": [ 9 | "The Cursed Legacy Team" 10 | ], 11 | "contact": { 12 | "issues": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API/issues", 13 | "sources": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API" 14 | }, 15 | 16 | "license": "MIT", 17 | "icon": "assets/api/icon.png", 18 | 19 | "entrypoints": { 20 | "init": [ 21 | "io.github.minecraftcursedlegacy.impl.networking.NetworkingImpl" 22 | ] 23 | }, 24 | 25 | "mixins": [ 26 | "legacy-networking.accessors.json" 27 | ], 28 | 29 | "depends": { 30 | "fabricloader": "*", 31 | "legacy-api-base": "*", 32 | "minecraft": "1.0.0-beta.7.3" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /legacy-networking-v0/src/main/resources/legacy-networking.accessors.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "io.github.minecraftcursedlegacy.accessor.networking", 4 | "compatibilityLevel": "JAVA_8", 5 | "mixins": [ 6 | "AccessorAbstractPacket" 7 | ], 8 | "injectors": { 9 | "defaultRequire": 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /legacy-networking-v0/src/test/java/io/github/minecraftcursedlegacy/test/NetworkingTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.test; 25 | 26 | import io.github.minecraftcursedlegacy.api.networking.PluginChannel; 27 | import io.github.minecraftcursedlegacy.api.networking.PluginChannelRegistry; 28 | import net.fabricmc.api.ModInitializer; 29 | 30 | public class NetworkingTest implements ModInitializer { 31 | @Override 32 | public void onInitialize() { 33 | System.out.println("Hello, Fabric Networking World!"); 34 | 35 | PluginChannelRegistry.registerPluginChannel(testPluginChannel = new TestPluginChannel()); 36 | } 37 | 38 | static PluginChannel testPluginChannel; 39 | } 40 | -------------------------------------------------------------------------------- /legacy-networking-v0/src/test/java/io/github/minecraftcursedlegacy/test/NetworkingTestServer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.test; 25 | 26 | import io.github.minecraftcursedlegacy.api.event.ActionResult; 27 | import io.github.minecraftcursedlegacy.api.event.TileInteractionCallback; 28 | import net.fabricmc.api.DedicatedServerModInitializer; 29 | import net.minecraft.server.level.ServerLevel; 30 | import net.minecraft.server.player.ServerPlayer; 31 | 32 | public class NetworkingTestServer implements DedicatedServerModInitializer { 33 | @Override 34 | public void onInitializeServer() { 35 | TileInteractionCallback.EVENT.register((player, level, item, tile, x, y, z, face) -> { 36 | // This may not trigger every time due to load order. 37 | // That is ok. 38 | if (face == 0 && level instanceof ServerLevel && player instanceof ServerPlayer) { 39 | NetworkingTest.testPluginChannel.send(new byte[] {(byte) tile.id}, (ServerPlayer) player); 40 | } 41 | 42 | return ActionResult.PASS; 43 | }); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /legacy-networking-v0/src/test/java/io/github/minecraftcursedlegacy/test/TestPluginChannel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.test; 25 | 26 | import io.github.minecraftcursedlegacy.api.networking.PluginChannel; 27 | import io.github.minecraftcursedlegacy.api.registry.Id; 28 | import net.minecraft.network.PacketHandler; 29 | import net.minecraft.packet.play.ChatMessagePacket; 30 | 31 | /** 32 | * The test plugin channel. 33 | */ 34 | public class TestPluginChannel extends PluginChannel { 35 | @Override 36 | public Id getChannelIdentifier() { 37 | return ID; 38 | } 39 | 40 | @Override 41 | public void onReceive(PacketHandler arg, byte[] data) { 42 | arg.handleChatMessage(new ChatMessagePacket("Wassup bro! Tile: " + data[0])); 43 | } 44 | 45 | public static final Id ID = new Id("legacy-networking-test", "test"); 46 | } 47 | -------------------------------------------------------------------------------- /legacy-networking-v0/src/test/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "legacy-networking-test", 4 | "version": "${version}", 5 | 6 | "name": "Networking Test Mod", 7 | "description": "Tests for the networking module of Cursed Legacy API.", 8 | "authors": [ 9 | "The Cursed Legacy Team" 10 | ], 11 | "contact": { 12 | "issues": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API/issues", 13 | "sources": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API" 14 | }, 15 | 16 | "license": "MIT", 17 | "icon": "assets/modid/icon.png", 18 | 19 | "environment": "*", 20 | "entrypoints": { 21 | "init": [ 22 | "io.github.minecraftcursedlegacy.test.NetworkingTest" 23 | ], 24 | "server": [ 25 | "io.github.minecraftcursedlegacy.test.NetworkingTestServer" 26 | ] 27 | }, 28 | 29 | "depends": { 30 | "fabricloader": "*", 31 | "legacy-api-base": "*", 32 | "legacy-networking": "*", 33 | "minecraft": "1.0.0-beta.7.3" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /legacy-recipes-v0/build.gradle: -------------------------------------------------------------------------------- 1 | archivesBaseName = 'legacy-recipes-v0' 2 | version = getSubprojectVersion(project, '0.6.3') 3 | 4 | moduleDependencies(project, 'legacy-api-base') 5 | dependencies { 6 | } 7 | -------------------------------------------------------------------------------- /legacy-recipes-v0/src/main/java/io/github/minecraftcursedlegacy/accessor/recipe/AccessorRecipeRegistry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.accessor.recipe; 25 | 26 | import org.spongepowered.asm.mixin.Mixin; 27 | import org.spongepowered.asm.mixin.gen.Invoker; 28 | 29 | import net.minecraft.item.ItemInstance; 30 | import net.minecraft.recipe.RecipeRegistry; 31 | 32 | @Mixin(RecipeRegistry.class) 33 | public interface AccessorRecipeRegistry { 34 | @Invoker("addShapedRecipe") 35 | void invokeAddShapedRecipe(ItemInstance arg, Object... objects); 36 | 37 | @Invoker("addShapelessRecipe") 38 | void invokeAddShapelessRecipe(ItemInstance arg, Object... objects); 39 | } 40 | -------------------------------------------------------------------------------- /legacy-recipes-v0/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "legacy-recipes", 4 | "version": "${version}", 5 | 6 | "name": "Minecraft Cursed Legacy API Recipes", 7 | "description": "A set of useful hooks and features to be used by modders.", 8 | "authors": [ 9 | "The Cursed Legacy Team" 10 | ], 11 | "contact": { 12 | "issues": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API/issues", 13 | "sources": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API" 14 | }, 15 | 16 | "license": "MIT", 17 | "icon": "assets/api/icon.png", 18 | 19 | "mixins": [ 20 | "legacy-recipes.accessors.json" 21 | ], 22 | "depends": { 23 | "fabricloader": "*", 24 | "minecraft": "1.0.0-beta.7.3", 25 | "legacy-api-base": "*" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /legacy-recipes-v0/src/main/resources/legacy-recipes.accessors.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "io.github.minecraftcursedlegacy.accessor.recipe", 4 | "compatibilityLevel": "JAVA_8", 5 | "mixins": [ 6 | "AccessorRecipeRegistry" 7 | ], 8 | "injectors": { 9 | "defaultRequire": 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /legacy-registries-v1/.gitignore: -------------------------------------------------------------------------------- 1 | input.txt -------------------------------------------------------------------------------- /legacy-registries-v1/build.gradle: -------------------------------------------------------------------------------- 1 | archivesBaseName = 'legacy-registries-v1' 2 | version = getSubprojectVersion(project, '1.1.0') 3 | 4 | moduleDependencies(project, 'legacy-api-base', 'legacy-networking-v0') 5 | 6 | dependencies { 7 | testImplementation project(path: ':legacy-recipes-v0') 8 | testImplementation project(path: ':legacy-translations-v0') 9 | } 10 | -------------------------------------------------------------------------------- /legacy-registries-v1/idsetgenerator.py: -------------------------------------------------------------------------------- 1 | # leaving this here in case someone finds it useful 2 | # paste all the public static final stuff and it will giv u the setter code 3 | # imagine choosing each id manually am I right 4 | # take that mine diver 5 | 6 | import re 7 | 8 | def load(filename): 9 | with open(filename) as file: 10 | return file.read() 11 | 12 | data = load("input.txt").split("\n") 13 | 14 | test = data[0].strip().split(" ") 15 | mode = 3 # non final naming conventions 16 | if test[2] == "final": 17 | mode = 4 # final naming conventions 18 | 19 | cameltosnake = re.compile(r'(? getRecipes(); 38 | } 39 | -------------------------------------------------------------------------------- /legacy-registries-v1/src/main/java/io/github/minecraftcursedlegacy/accessor/registry/AccessorShapedRecipe.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.accessor.registry; 25 | 26 | import org.spongepowered.asm.mixin.Mixin; 27 | import org.spongepowered.asm.mixin.gen.Accessor; 28 | 29 | import net.minecraft.item.ItemInstance; 30 | import net.minecraft.recipe.ShapedRecipe; 31 | 32 | @Mixin(ShapedRecipe.class) 33 | public interface AccessorShapedRecipe { 34 | @Accessor("ingredients") 35 | ItemInstance[] getIngredients(); 36 | @Accessor("output") 37 | ItemInstance getOutput(); 38 | } 39 | -------------------------------------------------------------------------------- /legacy-registries-v1/src/main/java/io/github/minecraftcursedlegacy/accessor/registry/AccessorShapelessRecipe.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.accessor.registry; 25 | 26 | import java.util.List; 27 | 28 | import org.spongepowered.asm.mixin.Mixin; 29 | import org.spongepowered.asm.mixin.gen.Accessor; 30 | 31 | import net.minecraft.item.ItemInstance; 32 | import net.minecraft.recipe.ShapelessRecipe; 33 | 34 | @Mixin(ShapelessRecipe.class) 35 | public interface AccessorShapelessRecipe { 36 | @Accessor("output") 37 | ItemInstance getOutput(); 38 | @Accessor("input") 39 | List getInput(); 40 | } 41 | -------------------------------------------------------------------------------- /legacy-registries-v1/src/main/java/io/github/minecraftcursedlegacy/accessor/registry/AccessorTileItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.accessor.registry; 25 | 26 | import org.spongepowered.asm.mixin.Mixin; 27 | import org.spongepowered.asm.mixin.gen.Accessor; 28 | 29 | import net.minecraft.item.TileItem; 30 | 31 | @Mixin(TileItem.class) 32 | public interface AccessorTileItem { 33 | @Accessor("tileId") 34 | int getTileId(); 35 | } 36 | -------------------------------------------------------------------------------- /legacy-registries-v1/src/main/java/io/github/minecraftcursedlegacy/api/registry/EntityTypes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.api.registry; 25 | 26 | import io.github.minecraftcursedlegacy.impl.registry.EntityType; 27 | import net.minecraft.entity.Entity; 28 | 29 | public class EntityTypes { 30 | /** 31 | * Use this to create EntityTypes for your own entities. 32 | * @param clazz the entity class. 33 | * @param id the identifier used in the EntityType registry. 34 | */ 35 | public static EntityType createEntityType(Class clazz, Id id) { 36 | return new EntityType(clazz, id); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /legacy-registries-v1/src/main/java/io/github/minecraftcursedlegacy/api/registry/Registries.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.api.registry; 25 | 26 | import io.github.minecraftcursedlegacy.impl.registry.EntityType; 27 | import io.github.minecraftcursedlegacy.impl.registry.RegistryImpl; 28 | import net.minecraft.item.ItemType; 29 | import net.minecraft.tile.Tile; 30 | 31 | /** 32 | * Class containing the {@link Registry registries} that are part of the api. 33 | */ 34 | public final class Registries { 35 | /** 36 | * Registry for Item Types. 37 | */ 38 | public static final Registry ITEM_TYPE = RegistryImpl.ITEM_TYPE; 39 | /** 40 | * Registry for Tiles. 41 | */ 42 | public static final Registry TILE = RegistryImpl.TILE; 43 | 44 | /** 45 | * Registry for Entity types. 46 | */ 47 | public static final Registry ENTITY_TYPE = RegistryImpl.ENTITY_TYPE; 48 | } 49 | -------------------------------------------------------------------------------- /legacy-registries-v1/src/main/java/io/github/minecraftcursedlegacy/api/registry/RegistryDiff.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.api.registry; 25 | 26 | import javax.annotation.Nullable; 27 | 28 | /** 29 | * Interface look at the difference between a registry before and after remapping. 30 | * @since 1.1.0 31 | */ 32 | public interface RegistryDiff { 33 | /** 34 | * Retrieves the new serialised id by the old one. 35 | * @param old the old serialised id. 36 | * @return the new serialised id, if present 37 | */ 38 | @Nullable 39 | Integer getNewSerialisedId(int old); 40 | /** 41 | * Retrieves the object associated with an old serialised id. 42 | * @param old the old serialised id. 43 | * @return the object that was associated with it. 44 | */ 45 | @Nullable 46 | T getByOldSerialisedId(int old); 47 | /** 48 | * Retrieves the old serialised id that was associated with an object. 49 | * @param value the object to retrieve the id for. 50 | * @return the old serialised id that was associated with an object. 51 | */ 52 | int getOldSerialisedId(T value); 53 | } 54 | -------------------------------------------------------------------------------- /legacy-registries-v1/src/main/java/io/github/minecraftcursedlegacy/api/registry/RegistryEntryAddedCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.api.registry; 25 | 26 | /** 27 | * Modeled after the modern fabric callback. 28 | * Runs after registry entries are added to allow for mods to dynamically handle registry objects.
29 | * Get the event for this callback from a given registry using {@linkplain Registry#getEvent}. 30 | */ 31 | @FunctionalInterface 32 | public interface RegistryEntryAddedCallback { 33 | /** 34 | * Called when a new registry entry is added. 35 | * @param value the object being registered. 36 | * @param id the id of the object being registered. 37 | * @param serialisedId the integer raw id of the registered object for serialisation. 38 | */ 39 | void onEntryAdded(T value, Id id, int serialisedId); 40 | } 41 | -------------------------------------------------------------------------------- /legacy-registries-v1/src/main/java/io/github/minecraftcursedlegacy/api/registry/RegistryRemappedCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.api.registry; 25 | 26 | /** 27 | * Runs after registry entries are remapped to allow for mods to dynamically handle registry objects.
28 | * Get the event for this callback from a given registry using {@linkplain Registry#getRemapEvent}. 29 | * @since 1.1.0 30 | */ 31 | @FunctionalInterface 32 | public interface RegistryRemappedCallback { 33 | /** 34 | * Called when the registry is remapped. 35 | * @param registry the registry which has been remapped. 36 | * @param diff an interface look into the difference between the old and new registry raw ids. 37 | */ 38 | void onRemap(Registry registry, RegistryDiff diff); 39 | } 40 | -------------------------------------------------------------------------------- /legacy-registries-v1/src/main/java/io/github/minecraftcursedlegacy/impl/registry/EntityType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.impl.registry; 25 | 26 | import io.github.minecraftcursedlegacy.api.registry.Id; 27 | import net.minecraft.entity.Entity; 28 | 29 | public class EntityType { 30 | private final Class clazz; 31 | private final String vanillaRegistryStringId; 32 | 33 | /** 34 | * Protected constructor used only for vanilla entities. 35 | * @param clazz the entity class. 36 | * @param vanillaRegistryStringId the vanilla name of the entity. 37 | */ 38 | protected EntityType(Class clazz, String vanillaRegistryStringId) { 39 | this.clazz = clazz; 40 | this.vanillaRegistryStringId = vanillaRegistryStringId; 41 | } 42 | 43 | public EntityType(Class clazz, Id id) { 44 | this.clazz = clazz; 45 | this.vanillaRegistryStringId = id.toString(); 46 | } 47 | 48 | public Class getClazz() { 49 | return clazz; 50 | } 51 | 52 | public String getVanillaRegistryStringId() { 53 | return vanillaRegistryStringId; 54 | } 55 | 56 | public Id getId() { 57 | return new Id(vanillaRegistryStringId); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /legacy-registries-v1/src/main/java/io/github/minecraftcursedlegacy/impl/registry/HasParentId.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.impl.registry; 25 | 26 | public interface HasParentId { 27 | void setParentId(int id); 28 | int getParentId(); 29 | } 30 | -------------------------------------------------------------------------------- /legacy-registries-v1/src/main/java/io/github/minecraftcursedlegacy/impl/registry/IdSetter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.impl.registry; 25 | 26 | public interface IdSetter { 27 | void setId(int id); 28 | } 29 | -------------------------------------------------------------------------------- /legacy-registries-v1/src/main/java/io/github/minecraftcursedlegacy/impl/registry/SmeltingRecipeSetter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.impl.registry; 25 | 26 | import java.util.Map; 27 | 28 | @SuppressWarnings("rawtypes") 29 | public interface SmeltingRecipeSetter { 30 | void setRecipes(Map recipes); 31 | } 32 | -------------------------------------------------------------------------------- /legacy-registries-v1/src/main/java/io/github/minecraftcursedlegacy/impl/registry/sync/RegistrySyncChannelS2C.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.impl.registry.sync; 25 | 26 | import java.io.ByteArrayInputStream; 27 | import java.io.DataInputStream; 28 | 29 | import io.github.minecraftcursedlegacy.api.networking.PluginChannel; 30 | import io.github.minecraftcursedlegacy.api.registry.Id; 31 | import net.minecraft.network.PacketHandler; 32 | import net.minecraft.util.io.NBTIO; 33 | 34 | public class RegistrySyncChannelS2C extends PluginChannel { 35 | @Override 36 | public Id getChannelIdentifier() { 37 | return ID; 38 | } 39 | 40 | @Override 41 | public void onReceive(PacketHandler arg, byte[] buf) { 42 | // Client side stuff 43 | DataInputStream data = new DataInputStream(new ByteArrayInputStream(buf)); 44 | RegistryRemapper.remap(NBTIO.readGzipped(data), null); 45 | } 46 | 47 | public static final Id ID = new Id("legacy-registries", "sync"); 48 | } 49 | -------------------------------------------------------------------------------- /legacy-registries-v1/src/main/java/io/github/minecraftcursedlegacy/mixin/registry/MixinItemType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.mixin.registry; 25 | 26 | import org.spongepowered.asm.mixin.Final; 27 | import org.spongepowered.asm.mixin.Mixin; 28 | import org.spongepowered.asm.mixin.Mutable; 29 | import org.spongepowered.asm.mixin.Shadow; 30 | 31 | import io.github.minecraftcursedlegacy.impl.registry.IdSetter; 32 | import net.minecraft.item.ItemType; 33 | 34 | @Mixin(ItemType.class) 35 | public class MixinItemType implements IdSetter { 36 | @Shadow 37 | @Final 38 | @Mutable 39 | private int id; 40 | 41 | @Override 42 | public void setId(int id) { 43 | this.id = id; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /legacy-registries-v1/src/main/java/io/github/minecraftcursedlegacy/mixin/registry/MixinPlaceableTileItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.mixin.registry; 25 | 26 | import org.spongepowered.asm.mixin.Mixin; 27 | import org.spongepowered.asm.mixin.Shadow; 28 | 29 | import io.github.minecraftcursedlegacy.impl.registry.HasParentId; 30 | import net.minecraft.item.PlaceableTileItem; 31 | 32 | @Mixin(PlaceableTileItem.class) 33 | public class MixinPlaceableTileItem implements HasParentId { 34 | @Shadow 35 | private int tileId; 36 | 37 | @Override 38 | public void setParentId(int id) { 39 | this.tileId = id; 40 | } 41 | 42 | @Override 43 | public int getParentId() { 44 | return this.tileId; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /legacy-registries-v1/src/main/java/io/github/minecraftcursedlegacy/mixin/registry/MixinShapedRecipe.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.mixin.registry; 25 | 26 | import org.spongepowered.asm.mixin.Final; 27 | import org.spongepowered.asm.mixin.Mixin; 28 | import org.spongepowered.asm.mixin.Mutable; 29 | import org.spongepowered.asm.mixin.Shadow; 30 | 31 | import io.github.minecraftcursedlegacy.impl.registry.IdSetter; 32 | import net.minecraft.recipe.ShapedRecipe; 33 | 34 | @Mixin(ShapedRecipe.class) 35 | public class MixinShapedRecipe implements IdSetter { 36 | @Shadow 37 | @Final 38 | @Mutable 39 | private int outputId; 40 | 41 | @Override 42 | public void setId(int id) { 43 | this.outputId = id; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /legacy-registries-v1/src/main/java/io/github/minecraftcursedlegacy/mixin/registry/MixinSmeltingRecipeRegistry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.mixin.registry; 25 | 26 | import java.util.Map; 27 | 28 | import org.spongepowered.asm.mixin.Mixin; 29 | import org.spongepowered.asm.mixin.Shadow; 30 | 31 | import io.github.minecraftcursedlegacy.impl.registry.SmeltingRecipeSetter; 32 | import net.minecraft.recipe.SmeltingRecipeRegistry; 33 | 34 | @Mixin(SmeltingRecipeRegistry.class) 35 | @SuppressWarnings("rawtypes") 36 | public abstract class MixinSmeltingRecipeRegistry implements SmeltingRecipeSetter { 37 | @Shadow 38 | private Map recipes; 39 | 40 | @Override 41 | public void setRecipes(Map recipes) { 42 | this.recipes = recipes; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /legacy-registries-v1/src/main/java/io/github/minecraftcursedlegacy/mixin/registry/MixinTile.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.mixin.registry; 25 | 26 | import org.spongepowered.asm.mixin.Final; 27 | import org.spongepowered.asm.mixin.Mixin; 28 | import org.spongepowered.asm.mixin.Mutable; 29 | import org.spongepowered.asm.mixin.Shadow; 30 | 31 | import io.github.minecraftcursedlegacy.impl.registry.IdSetter; 32 | import net.minecraft.tile.Tile; 33 | 34 | @Mixin(Tile.class) 35 | public class MixinTile implements IdSetter { 36 | @Shadow 37 | @Final 38 | @Mutable 39 | private int id; 40 | 41 | @Override 42 | public void setId(int id) { 43 | this.id = id; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /legacy-registries-v1/src/main/java/io/github/minecraftcursedlegacy/mixin/registry/MixinTileItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.mixin.registry; 25 | 26 | import org.spongepowered.asm.mixin.Mixin; 27 | import org.spongepowered.asm.mixin.Shadow; 28 | 29 | import io.github.minecraftcursedlegacy.impl.registry.HasParentId; 30 | import net.minecraft.item.TileItem; 31 | 32 | @Mixin(TileItem.class) 33 | public class MixinTileItem implements HasParentId { 34 | @Shadow 35 | private int tileId; 36 | 37 | @Override 38 | public void setParentId(int id) { 39 | this.tileId = id; 40 | } 41 | 42 | @Override 43 | public int getParentId() { 44 | return this.tileId; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /legacy-registries-v1/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "legacy-registries", 4 | "version": "${version}", 5 | 6 | "name": "Minecraft Cursed Legacy Registries", 7 | "description": "A set of useful hooks and features to be used by modders.", 8 | "authors": [ 9 | "The Cursed Legacy Team" 10 | ], 11 | "contact": { 12 | "issues": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API/issues", 13 | "sources": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API" 14 | }, 15 | 16 | "license": "MIT", 17 | "icon": "assets/api/icon.png", 18 | 19 | "entrypoints": { 20 | "init": [ 21 | "io.github.minecraftcursedlegacy.impl.registry.RegistryImpl" 22 | ] 23 | }, 24 | 25 | "mixins": [ 26 | "legacy-registries.accessors.json", 27 | "legacy-registries.mixins.json" 28 | ], 29 | 30 | "depends": { 31 | "fabricloader": "*", 32 | "legacy-api-base": "*", 33 | "minecraft": "1.0.0-beta.7.3" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /legacy-registries-v1/src/main/resources/legacy-registries.accessors.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "io.github.minecraftcursedlegacy.accessor.registry", 4 | "compatibilityLevel": "JAVA_8", 5 | "mixins": [ 6 | "AccessorCompoundTag", 7 | "AccessorDimensionFile", 8 | "AccessorEntityRegistry", 9 | "AccessorPlaceableTileItem", 10 | "AccessorRecipeRegistry", 11 | "AccessorShapedRecipe", 12 | "AccessorShapelessRecipe", 13 | "AccessorTileItem" 14 | ], 15 | "injectors": { 16 | "defaultRequire": 1 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /legacy-registries-v1/src/main/resources/legacy-registries.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "io.github.minecraftcursedlegacy.mixin.registry", 4 | "compatibilityLevel": "JAVA_8", 5 | "mixins": [ 6 | "MixinItemType", 7 | "MixinMcRegionLevelStorage", 8 | "MixinOldLevelStorage", 9 | "MixinPlaceableTileItem", 10 | "MixinShapedRecipe", 11 | "MixinSmeltingRecipeRegistry", 12 | "MixinTile", 13 | "MixinTileItem" 14 | ], 15 | "server": [ 16 | "MixinMinecraftServer", 17 | "MixinServerLoginPacketHandler" 18 | ], 19 | "injectors": { 20 | "defaultRequire": 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /legacy-registries-v1/src/test/java/io/github/minecraftcursedlegacy/test/BasicItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.test; 25 | 26 | import net.minecraft.item.ItemType; 27 | 28 | public class BasicItem extends ItemType { 29 | public BasicItem(int i) { 30 | super(i); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /legacy-registries-v1/src/test/java/io/github/minecraftcursedlegacy/test/BasicTile.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.test; 25 | 26 | import net.minecraft.tile.Tile; 27 | import net.minecraft.tile.material.Material; 28 | 29 | public class BasicTile extends Tile { 30 | protected BasicTile(int i, boolean fullOpaque) { 31 | super(i, 69, Material.DIRT); 32 | this.fop = fullOpaque; 33 | } 34 | 35 | private final boolean fop; 36 | 37 | public boolean isFullOpaque() { 38 | return this.fop; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /legacy-registries-v1/src/test/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "legacy-registries-test", 4 | "version": "${version}", 5 | 6 | "name": "Registries Test Mod", 7 | "description": "Tests for the registry module of Cursed Legacy API.", 8 | "authors": [ 9 | "The Cursed Legacy Team" 10 | ], 11 | "contact": { 12 | "issues": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API/issues", 13 | "sources": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API" 14 | }, 15 | 16 | "license": "MIT", 17 | "icon": "assets/modid/icon.png", 18 | 19 | "environment": "*", 20 | "entrypoints": { 21 | "init": [ 22 | "io.github.minecraftcursedlegacy.test.RegistryTest" 23 | ] 24 | }, 25 | 26 | "depends": { 27 | "fabricloader": "*", 28 | "legacy-api-base": "*", 29 | "legacy-registries": "*", 30 | "minecraft": "1.0.0-beta.7.3" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /legacy-terrain-v1/build.gradle: -------------------------------------------------------------------------------- 1 | archivesBaseName = 'legacy-terrain-v1' 2 | version = getSubprojectVersion(project, '1.0.6') 3 | 4 | moduleDependencies(project, 'legacy-api-base') 5 | dependencies { 6 | } 7 | -------------------------------------------------------------------------------- /legacy-terrain-v1/src/main/java/io/github/minecraftcursedlegacy/api/levelgen/ChunkDecorateCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.api.levelgen; 25 | 26 | import io.github.minecraftcursedlegacy.api.terrain.ChunkGenEvents; 27 | 28 | /** 29 | * Callback for chunk decoration. 30 | * @deprecated use {@linkplain ChunkGenEvents.Decorate} instead. 31 | */ 32 | @FunctionalInterface 33 | @Deprecated 34 | public interface ChunkDecorateCallback extends ChunkGenEvents.Decorate { 35 | } 36 | -------------------------------------------------------------------------------- /legacy-terrain-v1/src/main/java/io/github/minecraftcursedlegacy/api/levelgen/ChunkShapeCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.api.levelgen; 25 | 26 | import io.github.minecraftcursedlegacy.api.terrain.ChunkGenEvents; 27 | 28 | /** 29 | * Callback for chunk shaping. 30 | */ 31 | @FunctionalInterface 32 | @Deprecated 33 | public interface ChunkShapeCallback extends ChunkGenEvents.Shape { 34 | } 35 | -------------------------------------------------------------------------------- /legacy-terrain-v1/src/main/java/io/github/minecraftcursedlegacy/api/levelgen/ExtendedBiome.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.api.levelgen; 25 | 26 | import net.minecraft.level.biome.Biome; 27 | 28 | /** 29 | * Interface which can be implemented on your custom {@link Biome biomes} to add additional functionality. 30 | * @deprecated moved to {@linkplain io.github.minecraftcursedlegacy.api.terrain.ExtendedBiome}. 31 | */ 32 | @Deprecated 33 | public interface ExtendedBiome extends io.github.minecraftcursedlegacy.api.terrain.ExtendedBiome { 34 | } 35 | -------------------------------------------------------------------------------- /legacy-terrain-v1/src/main/java/io/github/minecraftcursedlegacy/api/terrain/BiomeEvents.java: -------------------------------------------------------------------------------- 1 | package io.github.minecraftcursedlegacy.api.terrain; 2 | 3 | import java.util.function.Consumer; 4 | 5 | import io.github.minecraftcursedlegacy.api.event.ActionResult; 6 | import net.fabricmc.fabric.api.event.Event; 7 | import net.fabricmc.fabric.api.event.EventFactory; 8 | import net.minecraft.level.biome.Biome; 9 | 10 | /** 11 | * Class of events pertaining to biome placement and biomes. 12 | * @since 1.0.0 13 | */ 14 | public final class BiomeEvents { 15 | private BiomeEvents() { 16 | } 17 | 18 | /** 19 | * Callback for biome placement based on climate. Add a hook for this in the {@link net.fabricmc.api.ModInitializer init} stage, as the biomes are calculated in postinit. 20 | * 21 | *

Upon return: 22 | *

    23 | *
  • SUCCESS succeeds in altering the biome, and sets the latest biome set via the biome setter. If no biome has been set, then the behaviour defaults to FAIL 24 | *
  • PASS falls back to further event processing. If all events PASS, then the behaviour defaults to SUCCESS. 25 | *
  • FAIL falls back to vanilla biome placement. 26 | *
27 | */ 28 | @FunctionalInterface 29 | public interface BiomePlacementCallback { 30 | Event EVENT = EventFactory.createArrayBacked(BiomePlacementCallback.class, 31 | (listeners) -> (temperature, rainfall, biomeSetter) -> { 32 | for (BiomePlacementCallback listener : listeners) { 33 | ActionResult result = listener.onClimaticBiomePlace(temperature, rainfall, biomeSetter); 34 | 35 | if (result != ActionResult.PASS) { 36 | return result; 37 | } 38 | } 39 | 40 | return ActionResult.SUCCESS; 41 | }); 42 | 43 | ActionResult onClimaticBiomePlace(float temperature, float humidity, Consumer biomeSetter); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /legacy-terrain-v1/src/main/java/io/github/minecraftcursedlegacy/api/terrain/ExtendedBiome.java: -------------------------------------------------------------------------------- 1 | package io.github.minecraftcursedlegacy.api.terrain; 2 | 3 | import net.minecraft.level.biome.Biome; 4 | 5 | /** 6 | * Interface which can be implemented on your custom {@link Biome biomes} to add additional functionality. 7 | */ 8 | public interface ExtendedBiome { 9 | default int getTreesPerChunk() { 10 | return 0; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /legacy-terrain-v1/src/main/java/io/github/minecraftcursedlegacy/api/terrain/feature/ScatteredHeightmapPlacement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.api.terrain.feature; 25 | 26 | import java.util.Arrays; 27 | import java.util.Random; 28 | 29 | import net.minecraft.level.Level; 30 | import net.minecraft.util.maths.TilePos; 31 | 32 | /** 33 | * {@linkplain Placement} that scatters along the x and z of the given region, and sets the height based on the heightmap. 34 | * Similar to how vanilla places trees. 35 | */ 36 | public class ScatteredHeightmapPlacement extends Placement { 37 | ScatteredHeightmapPlacement() { 38 | } 39 | 40 | @Override 41 | public Iterable getPositions(Level level, Random rand, int startX, int startY, int startZ) { 42 | int xToGen = startX + rand.nextInt(16) + 8; 43 | int zToGen = startZ + rand.nextInt(16) + 8; 44 | return Arrays.asList(new TilePos(xToGen, level.getHeight(xToGen, zToGen), zToGen)); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /legacy-terrain-v1/src/main/java/io/github/minecraftcursedlegacy/impl/terrain/BiomeRecomputer.java: -------------------------------------------------------------------------------- 1 | package io.github.minecraftcursedlegacy.impl.terrain; 2 | 3 | import io.github.minecraftcursedlegacy.api.ModPostInitializer; 4 | import net.minecraft.level.biome.Biome; 5 | 6 | /** 7 | * ReComputes the biome array after biome placement registration in ModInitializers run, in order to allow modded biomes to generate. 8 | */ 9 | public class BiomeRecomputer implements ModPostInitializer { 10 | @Override 11 | public void onPostInitialize() { 12 | Biome.createBiomeArray(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /legacy-terrain-v1/src/main/java/io/github/minecraftcursedlegacy/impl/terrain/InternalLevelSourceAccess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.impl.terrain; 25 | 26 | import net.minecraft.level.source.LevelSource; 27 | 28 | /** 29 | * Duck interface. 30 | * Because a certain way they implemented cancellable head injects is very annoying. 31 | * And messing with priorities didn't fix it. 32 | */ 33 | public interface InternalLevelSourceAccess { 34 | /** 35 | * Sets the internal api level source field on the class implementing this (i.e. Dimension). 36 | * @param source the level source. 37 | * @return the given source. 38 | */ 39 | LevelSource setInternalLevelSource(LevelSource source); 40 | 41 | /** 42 | * Much much much more "impl" than the above method. 43 | * @return the internal api level source. 44 | */ 45 | LevelSource getInternalLevelSource(); 46 | } 47 | -------------------------------------------------------------------------------- /legacy-terrain-v1/src/main/java/io/github/minecraftcursedlegacy/impl/terrain/LevelGenImpl.java: -------------------------------------------------------------------------------- 1 | package io.github.minecraftcursedlegacy.impl.terrain; 2 | 3 | import io.github.minecraftcursedlegacy.api.terrain.ChunkGenEvents; 4 | import io.github.minecraftcursedlegacy.api.terrain.ExtendedBiome; 5 | import net.fabricmc.api.ModInitializer; 6 | import net.minecraft.level.structure.Feature; 7 | 8 | public class LevelGenImpl implements ModInitializer { 9 | @Override 10 | public void onInitialize() { 11 | // Extended Biome 12 | ChunkGenEvents.Decorate decoration = (level, biome, rand, x, z) -> { 13 | if (biome instanceof ExtendedBiome) { 14 | ExtendedBiome eBiome = (ExtendedBiome) biome; 15 | 16 | for(int i = 0; i < eBiome.getTreesPerChunk(); ++i) { 17 | int xToGen = x + rand.nextInt(16) + 8; 18 | int zToGen = z + rand.nextInt(16) + 8; 19 | Feature feature = biome.getTree(rand); 20 | feature.setupTreeGeneration(1.0D, 1.0D, 1.0D); 21 | feature.generate(level, rand, xToGen, level.getHeight(xToGen, zToGen), zToGen); 22 | } 23 | } 24 | }; 25 | 26 | ChunkGenEvents.Decorate.OVERWORLD.register(decoration); 27 | ChunkGenEvents.Decorate.NETHER.register(decoration); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /legacy-terrain-v1/src/main/java/io/github/minecraftcursedlegacy/mixin/terrain/MixinBiome.java: -------------------------------------------------------------------------------- 1 | package io.github.minecraftcursedlegacy.mixin.terrain; 2 | 3 | import java.util.concurrent.atomic.AtomicReference; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 9 | 10 | import io.github.minecraftcursedlegacy.api.event.ActionResult; 11 | import io.github.minecraftcursedlegacy.api.terrain.BiomeEvents.BiomePlacementCallback; 12 | import net.minecraft.level.biome.Biome; 13 | 14 | @Mixin(Biome.class) 15 | public class MixinBiome { 16 | @Inject(at = @At("HEAD"), method = "getClimateBiome", cancellable = true) 17 | private static void addModdedBiomeGen(float temperature, float humidity, CallbackInfoReturnable info) { 18 | AtomicReference biomeResultWrapper = new AtomicReference<>(); 19 | ActionResult result = BiomePlacementCallback.EVENT.invoker().onClimaticBiomePlace(temperature, humidity, biomeResultWrapper::set); 20 | 21 | if (result == ActionResult.SUCCESS) { 22 | Biome biomeResult = biomeResultWrapper.get(); 23 | 24 | if (biomeResult != null) { 25 | info.setReturnValue(biomeResult); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /legacy-terrain-v1/src/main/java/io/github/minecraftcursedlegacy/mixin/terrain/MixinNetherLevelSource.java: -------------------------------------------------------------------------------- 1 | package io.github.minecraftcursedlegacy.mixin.terrain; 2 | 3 | import java.util.Random; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Shadow; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Inject; 9 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 10 | 11 | import io.github.minecraftcursedlegacy.api.terrain.ChunkGenEvents; 12 | import net.minecraft.level.Level; 13 | import net.minecraft.level.source.LevelSource; 14 | import net.minecraft.level.source.NetherLevelSource; 15 | import net.minecraft.tile.SandTile; 16 | 17 | @Mixin(NetherLevelSource.class) 18 | public class MixinNetherLevelSource { 19 | @Shadow 20 | private Random rand; 21 | @Shadow 22 | private Level level; 23 | 24 | @Inject(at = @At("RETURN"), method = "decorate") 25 | private void onDecorate(LevelSource levelSource, int x, int z, CallbackInfo info) { 26 | SandTile.fallInstantly = true; 27 | x *= 16; 28 | z *= 16; 29 | 30 | ChunkGenEvents.Decorate.NETHER.invoker().onDecorate( 31 | this.level, 32 | this.level.getBiomeSource().getBiome(x + 16, z + 16), 33 | this.rand, 34 | x, 35 | z); 36 | 37 | SandTile.fallInstantly = false; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /legacy-terrain-v1/src/main/java/io/github/minecraftcursedlegacy/mixin/terrain/MixinOverworldLevelSource.java: -------------------------------------------------------------------------------- 1 | package io.github.minecraftcursedlegacy.mixin.terrain; 2 | 3 | import java.util.Random; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Shadow; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Inject; 9 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 10 | 11 | import io.github.minecraftcursedlegacy.api.terrain.ChunkGenEvents; 12 | import net.minecraft.level.Level; 13 | import net.minecraft.level.biome.Biome; 14 | import net.minecraft.level.source.LevelSource; 15 | import net.minecraft.level.source.OverworldLevelSource; 16 | 17 | @Mixin(OverworldLevelSource.class) 18 | public class MixinOverworldLevelSource { 19 | @Shadow 20 | private Random rand; 21 | @Shadow 22 | private Level level; 23 | 24 | @Inject(at = @At(value = "INVOKE", target = "net/minecraft/level/Level.getBiomeSource()Lnet/minecraft/level/gen/BiomeSource;", ordinal = 1), method = "decorate") 25 | private void onDecorate(LevelSource levelSource, int x, int z, CallbackInfo info) { 26 | // the parameter variables x and z are multiplied by 16 in the code early on and stored in a local variable 27 | // So we replicate it here for ease of mods using this, as block x/z is more applicable for decoration 28 | x *= 16; 29 | z *= 16; 30 | ChunkGenEvents.Decorate.OVERWORLD.invoker().onDecorate( 31 | this.level, 32 | this.level.getBiomeSource().getBiome(x + 16, z + 16), // yes, vanilla does +16 in getBiome calls for features. 33 | this.rand, 34 | x, 35 | z); 36 | } 37 | 38 | @Inject(at = @At("RETURN"), method = "shapeChunk") 39 | private void shapeChunk(int chunkX, int chunkZ, byte[] tiles, Biome[] biomes, double[] temperatures, CallbackInfo info) { 40 | ChunkGenEvents.Shape.OVERWORLD.invoker().onShape(chunkX, chunkZ, tiles, biomes, temperatures); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /legacy-terrain-v1/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "legacy-terrain", 4 | "version": "${version}", 5 | 6 | "name": "Minecraft Cursed Legacy Terrain", 7 | "description": "A set of useful hooks and features to be used by modders.", 8 | "authors": [ 9 | "The Cursed Legacy Team" 10 | ], 11 | "contact": { 12 | "issues": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API/issues", 13 | "sources": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API" 14 | }, 15 | 16 | "license": "MIT", 17 | "icon": "assets/api/icon.png", 18 | 19 | "entrypoints": { 20 | "init": [ 21 | "io.github.minecraftcursedlegacy.impl.terrain.LevelGenImpl" 22 | ], 23 | "postInit": [ 24 | "io.github.minecraftcursedlegacy.impl.terrain.BiomeRecomputer" 25 | ] 26 | }, 27 | 28 | "mixins": [ 29 | "legacy-terrain.mixins.json" 30 | ], 31 | 32 | "depends": { 33 | "fabricloader": "*", 34 | "legacy-api-base": "*", 35 | "minecraft": "1.0.0-beta.7.3" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /legacy-terrain-v1/src/main/resources/legacy-terrain.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "io.github.minecraftcursedlegacy.mixin.terrain", 4 | "compatibilityLevel": "JAVA_8", 5 | "mixins": [ 6 | "MixinBiome", 7 | "MixinDimension", 8 | "MixinLevel", 9 | "MixinNetherLevelSource", 10 | "MixinOverworldLevelSource" 11 | ], 12 | "injectors": { 13 | "defaultRequire": 1 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /legacy-terrain-v1/src/test/java/io/github/minecraftcursedlegacy/test/OreRock.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.test; 25 | 26 | import java.util.Random; 27 | 28 | import net.minecraft.level.Level; 29 | import net.minecraft.level.structure.Feature; 30 | import net.minecraft.tile.Tile; 31 | 32 | public class OreRock extends Feature { 33 | 34 | @Override 35 | public boolean generate(Level level, Random rand, int x, int y, int z) { 36 | if (level.getTileId(x, y - 1, z) == Tile.GRASS.id) { 37 | if (rand.nextInt(4) == 0) { // big boi 38 | for (int xo = -1; xo <= 1; ++xo) { 39 | for (int zo = -1; zo <= 1; ++zo) { 40 | for (int yo = 0; yo < 3; ++yo) { 41 | if (yo == 2 && Math.abs(xo) == 1 && 1 == Math.abs(zo)) { 42 | continue; 43 | } 44 | 45 | level.setTile(x + xo, y + yo, z + zo, rand.nextInt(3) == 0 ? Tile.IRON_ORE.id : Tile.STONE.id); 46 | } 47 | } 48 | } 49 | } else { // smol boi 50 | for (int xo = 0; xo < 2; ++xo) { 51 | for (int zo = 0; zo < 2; ++zo) { 52 | for (int yo = 0; yo < 2; ++yo) { 53 | level.setTile(x + xo, y + yo, z + zo, rand.nextInt(3) == 0 ? Tile.IRON_ORE.id : Tile.STONE.id); 54 | } 55 | } 56 | } 57 | } 58 | 59 | return true; 60 | } 61 | 62 | return false; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /legacy-terrain-v1/src/test/java/io/github/minecraftcursedlegacy/test/TestBiome.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.test; 25 | 26 | import java.util.Random; 27 | 28 | import io.github.minecraftcursedlegacy.api.terrain.ExtendedBiome; 29 | import net.minecraft.level.biome.Biome; 30 | import net.minecraft.level.structure.Feature; 31 | import net.minecraft.level.structure.SpruceTree; 32 | 33 | public class TestBiome extends Biome implements ExtendedBiome { 34 | public TestBiome(String name) { 35 | this.setGrassColour(14278691); 36 | this.setName(name); 37 | } 38 | 39 | @Override 40 | public Feature getTree(Random random) { 41 | return new SpruceTree(); 42 | } 43 | 44 | @Override 45 | public int getTreesPerChunk() { 46 | return 1; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /legacy-terrain-v1/src/test/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "legacy-terrain-test", 4 | "version": "${version}", 5 | 6 | "name": "Terrain Test Mod", 7 | "description": "Tests for the terrain module of Cursed Legacy API.", 8 | "authors": [ 9 | "The Cursed Legacy Team" 10 | ], 11 | "contact": { 12 | "issues": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API/issues", 13 | "sources": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API" 14 | }, 15 | 16 | "license": "MIT", 17 | "icon": "assets/modid/icon.png", 18 | 19 | "environment": "*", 20 | "entrypoints": { 21 | "init": [ 22 | "io.github.minecraftcursedlegacy.test.LevelGenTest" 23 | ] 24 | }, 25 | 26 | "depends": { 27 | "fabricloader": "*", 28 | "legacy-api-base": "*", 29 | "legacy-terrain": "*", 30 | "minecraft": "1.0.0-beta.7.3" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /legacy-textures-v1/build.gradle: -------------------------------------------------------------------------------- 1 | archivesBaseName = 'legacy-textures-v1' 2 | version = getSubprojectVersion(project, '1.1.0') 3 | 4 | // networking is required by registries 5 | // including it here cuz I don't think moduleDependencies is recursive 6 | moduleDependencies(project, 'legacy-api-base', 'legacy-networking-v0', 'legacy-registries-v1') 7 | 8 | dependencies { 9 | testImplementation project(path: ':legacy-recipes-v0') 10 | testImplementation project(path: ':legacy-translations-v0') 11 | 12 | // CoreLib for Tile Models 13 | include modApi('com.github.paulevsGitch:B.1.7.3-CoreLib:v.1.3.0') { 14 | exclude(group: 'tk.valoeghese') //ZoesteriaConfig has disppeared from here 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /legacy-textures-v1/src/main/java/io/github/minecraftcursedlegacy/impl/texture/CrossModel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.impl.texture; 25 | 26 | import paulevs.corelib.model.Model; 27 | import paulevs.corelib.model.shape.Shape; 28 | import paulevs.corelib.model.shape.ShapeCross; 29 | import paulevs.corelib.texture.UVPair; 30 | 31 | public class CrossModel extends Model { 32 | public CrossModel(String texture) { 33 | this.addTexture("texture", texture); 34 | } 35 | 36 | @Override 37 | public void renderBlock() { 38 | render(); 39 | } 40 | 41 | @Override 42 | public void renderItem() { 43 | render(); 44 | } 45 | 46 | private void render() { 47 | Shape.setUV(getBlockUV()); 48 | CROSS.render(); 49 | } 50 | 51 | @Override 52 | public boolean hasItem() { 53 | return true; 54 | } 55 | 56 | @Override 57 | public UVPair particleUV() { 58 | return getBlockUV(); 59 | } 60 | 61 | private UVPair getBlockUV() { 62 | return this.getUV("texture"); 63 | } 64 | 65 | private static final Shape CROSS = new ShapeCross(); 66 | } 67 | -------------------------------------------------------------------------------- /legacy-textures-v1/src/main/java/io/github/minecraftcursedlegacy/impl/texture/resource/ModelJson.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.impl.texture.resource; 25 | 26 | import java.util.Map; 27 | 28 | /** 29 | * A model file. Everyone's favourite 1.16 feature /s. 30 | */ 31 | public class ModelJson { 32 | public String parent; 33 | public Map textures; 34 | public transient ModelSetup root; 35 | } 36 | -------------------------------------------------------------------------------- /legacy-textures-v1/src/main/java/io/github/minecraftcursedlegacy/impl/texture/resource/ModelSetup.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.impl.texture.resource; 25 | 26 | import io.github.minecraftcursedlegacy.api.registry.Id; 27 | 28 | @FunctionalInterface 29 | public interface ModelSetup { 30 | void setupModel(Id id, Object object, ModelJson parameters); 31 | } 32 | -------------------------------------------------------------------------------- /legacy-textures-v1/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "legacy-textures", 4 | "version": "${version}", 5 | 6 | "name": "Minecraft Cursed Legacy Textures", 7 | "description": "A set of useful hooks and features to be used by modders.", 8 | "authors": [ 9 | "The Cursed Legacy Team" 10 | ], 11 | "contact": { 12 | "issues": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API/issues", 13 | "sources": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API" 14 | }, 15 | 16 | "license": "MIT", 17 | "icon": "assets/api/icon.png", 18 | 19 | "entrypoints": { 20 | "client": [ 21 | "io.github.minecraftcursedlegacy.impl.texture.AtlasMapper", 22 | "io.github.minecraftcursedlegacy.impl.texture.ModelDiscoverer" 23 | ] 24 | }, 25 | 26 | "mixins": [ 27 | "legacy-textures.mixins.json" 28 | ], 29 | 30 | "depends": { 31 | "fabricloader": "*", 32 | "legacy-api-base": "*", 33 | "legacy-registries": "*", 34 | "minecraft": "1.0.0-beta.7.3" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /legacy-textures-v1/src/main/resources/legacy-textures.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "io.github.minecraftcursedlegacy.mixin.texture", 4 | "compatibilityLevel": "JAVA_8", 5 | "client": [ 6 | "MixinHandItemRenderer", 7 | "MixinItemRenderer" 8 | ], 9 | "injectors": { 10 | "defaultRequire": 1 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /legacy-textures-v1/src/test/resources/assets/legacy-textures-test/bc/diamond_gear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-cursed-legacy/Cursed-Legacy-API/1ff36aef55a67f9f4764a7bf874aa355d8de9c61/legacy-textures-v1/src/test/resources/assets/legacy-textures-test/bc/diamond_gear.png -------------------------------------------------------------------------------- /legacy-textures-v1/src/test/resources/assets/legacy-textures-test/bc/golden_gear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-cursed-legacy/Cursed-Legacy-API/1ff36aef55a67f9f4764a7bf874aa355d8de9c61/legacy-textures-v1/src/test/resources/assets/legacy-textures-test/bc/golden_gear.png -------------------------------------------------------------------------------- /legacy-textures-v1/src/test/resources/assets/legacy-textures-test/bc/item_textures.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-cursed-legacy/Cursed-Legacy-API/1ff36aef55a67f9f4764a7bf874aa355d8de9c61/legacy-textures-v1/src/test/resources/assets/legacy-textures-test/bc/item_textures.png -------------------------------------------------------------------------------- /legacy-textures-v1/src/test/resources/assets/legacy-textures-test/bc/stone_gear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-cursed-legacy/Cursed-Legacy-API/1ff36aef55a67f9f4764a7bf874aa355d8de9c61/legacy-textures-v1/src/test/resources/assets/legacy-textures-test/bc/stone_gear.png -------------------------------------------------------------------------------- /legacy-textures-v1/src/test/resources/assets/legacy-textures-test/bc/wooden_gear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-cursed-legacy/Cursed-Legacy-API/1ff36aef55a67f9f4764a7bf874aa355d8de9c61/legacy-textures-v1/src/test/resources/assets/legacy-textures-test/bc/wooden_gear.png -------------------------------------------------------------------------------- /legacy-textures-v1/src/test/resources/assets/legacy-textures-test/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-cursed-legacy/Cursed-Legacy-API/1ff36aef55a67f9f4764a7bf874aa355d8de9c61/legacy-textures-v1/src/test/resources/assets/legacy-textures-test/icon.png -------------------------------------------------------------------------------- /legacy-textures-v1/src/test/resources/assets/legacy-textures-test/models/item/malachite_grass.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "item/generated", 3 | "textures": { 4 | "": "legacy-textures-test:tile/malachite_grass" 5 | } 6 | } -------------------------------------------------------------------------------- /legacy-textures-v1/src/test/resources/assets/legacy-textures-test/models/tile/iron_grass.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "tile/cross", 3 | "textures": { 4 | "cross": "legacy-textures-test:tile/iron_grass" 5 | } 6 | } -------------------------------------------------------------------------------- /legacy-textures-v1/src/test/resources/assets/legacy-textures-test/models/tile/malachite_grass.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "tile/cross", 3 | "textures": { 4 | "cross": "legacy-textures-test:tile/malachite_grass" 5 | } 6 | } -------------------------------------------------------------------------------- /legacy-textures-v1/src/test/resources/assets/legacy-textures-test/models/tile/red_grass.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "tile/cube_bottom_top", 3 | "textures": { 4 | "top": "legacy-textures-test:tile/red_grass_top", 5 | "side": "legacy-textures-test:tile/red_grass_side", 6 | "bottom": "legacy-textures-test:tile/dirt" 7 | } 8 | } -------------------------------------------------------------------------------- /legacy-textures-v1/src/test/resources/assets/legacy-textures-test/textures/item/item_texture_too.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-cursed-legacy/Cursed-Legacy-API/1ff36aef55a67f9f4764a7bf874aa355d8de9c61/legacy-textures-v1/src/test/resources/assets/legacy-textures-test/textures/item/item_texture_too.png -------------------------------------------------------------------------------- /legacy-textures-v1/src/test/resources/assets/legacy-textures-test/textures/tile/cursed_legacy_block.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-cursed-legacy/Cursed-Legacy-API/1ff36aef55a67f9f4764a7bf874aa355d8de9c61/legacy-textures-v1/src/test/resources/assets/legacy-textures-test/textures/tile/cursed_legacy_block.png -------------------------------------------------------------------------------- /legacy-textures-v1/src/test/resources/assets/legacy-textures-test/textures/tile/dirt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-cursed-legacy/Cursed-Legacy-API/1ff36aef55a67f9f4764a7bf874aa355d8de9c61/legacy-textures-v1/src/test/resources/assets/legacy-textures-test/textures/tile/dirt.png -------------------------------------------------------------------------------- /legacy-textures-v1/src/test/resources/assets/legacy-textures-test/textures/tile/iron_grass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-cursed-legacy/Cursed-Legacy-API/1ff36aef55a67f9f4764a7bf874aa355d8de9c61/legacy-textures-v1/src/test/resources/assets/legacy-textures-test/textures/tile/iron_grass.png -------------------------------------------------------------------------------- /legacy-textures-v1/src/test/resources/assets/legacy-textures-test/textures/tile/malachite_grass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-cursed-legacy/Cursed-Legacy-API/1ff36aef55a67f9f4764a7bf874aa355d8de9c61/legacy-textures-v1/src/test/resources/assets/legacy-textures-test/textures/tile/malachite_grass.png -------------------------------------------------------------------------------- /legacy-textures-v1/src/test/resources/assets/legacy-textures-test/textures/tile/red_grass_side.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-cursed-legacy/Cursed-Legacy-API/1ff36aef55a67f9f4764a7bf874aa355d8de9c61/legacy-textures-v1/src/test/resources/assets/legacy-textures-test/textures/tile/red_grass_side.png -------------------------------------------------------------------------------- /legacy-textures-v1/src/test/resources/assets/legacy-textures-test/textures/tile/red_grass_top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-cursed-legacy/Cursed-Legacy-API/1ff36aef55a67f9f4764a7bf874aa355d8de9c61/legacy-textures-v1/src/test/resources/assets/legacy-textures-test/textures/tile/red_grass_top.png -------------------------------------------------------------------------------- /legacy-textures-v1/src/test/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "legacy-textures-test", 4 | "version": "${version}", 5 | 6 | "name": "Texture Test Mod", 7 | "description": "This is an example description! Tell everyone what your mod is about!", 8 | "authors": [ 9 | "The Cursed Legacy Team" 10 | ], 11 | "contact": { 12 | "issues": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API/issues", 13 | "sources": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API" 14 | }, 15 | 16 | "license": "MIT", 17 | "icon": "assets/modid/icon.png", 18 | 19 | "environment": "*", 20 | "entrypoints": { 21 | "init": [ 22 | "io.github.minecraftcursedlegacy.test.TexturesTest" 23 | ] 24 | }, 25 | 26 | "depends": { 27 | "fabricloader": "*", 28 | "legacy-textures": "*", 29 | "legacy-registries": "*", 30 | "minecraft": "1.0.0-beta.7.3" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /legacy-tile-entities-v1/build.gradle: -------------------------------------------------------------------------------- 1 | archivesBaseName = 'legacy-tile-entities-v1' 2 | version = getSubprojectVersion(project, '1.0.0') 3 | 4 | moduleDependencies(project, 'legacy-api-base') 5 | dependencies { 6 | testImplementation project(path: ':legacy-registries-v1') 7 | } 8 | -------------------------------------------------------------------------------- /legacy-tile-entities-v1/src/main/java/io/github/minecraftcursedlegacy/accessor/tileentities/AccessorTileEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.accessor.tileentities; 25 | 26 | import net.minecraft.tile.entity.TileEntity; 27 | import org.spongepowered.asm.mixin.Mixin; 28 | import org.spongepowered.asm.mixin.gen.Accessor; 29 | import org.spongepowered.asm.mixin.gen.Invoker; 30 | 31 | import java.util.Map; 32 | 33 | @Mixin(TileEntity.class) 34 | public interface AccessorTileEntity { 35 | @Invoker("register") 36 | static void register(Class clazz, String id) {} 37 | 38 | @Accessor("ID_TO_CLASS") 39 | static Map> getIdToClassMap() { throw new UnsupportedOperationException("mixin"); } 40 | 41 | @Accessor("CLASS_TO_ID") 42 | static Map, String> getClassToIdMap() { throw new UnsupportedOperationException("mixin"); } 43 | } 44 | -------------------------------------------------------------------------------- /legacy-tile-entities-v1/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "legacy-tile-entities", 4 | "version": "${version}", 5 | 6 | "name": "Minecraft Cursed Legacy Tile Entities", 7 | "description": "A set of useful hooks and features to be used by modders.", 8 | "authors": [ 9 | "The Cursed Legacy Team" 10 | ], 11 | "contact": { 12 | "issues": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API/issues", 13 | "sources": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API" 14 | }, 15 | 16 | "license": "MIT", 17 | "icon": "assets/api/icon.png", 18 | 19 | "mixins": [ 20 | "legacy-tile-entities.accessors.json" 21 | ], 22 | 23 | "depends": { 24 | "fabricloader": "*", 25 | "legacy-api-base": "*", 26 | "minecraft": "1.0.0-beta.7.3" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /legacy-tile-entities-v1/src/main/resources/legacy-tile-entities.accessors.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "io.github.minecraftcursedlegacy.accessor.tileentities", 4 | "compatibilityLevel": "JAVA_8", 5 | "mixins": [ 6 | "AccessorTileEntity" 7 | ], 8 | "injectors": { 9 | "defaultRequire": 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /legacy-tile-entities-v1/src/test/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "legacy-tile-entities-test", 4 | "version": "${version}", 5 | 6 | "name": "Tile Entities Test Mod", 7 | "description": "Tests for the tile entities module of Cursed Legacy API.", 8 | "authors": [ 9 | "The Cursed Legacy Team" 10 | ], 11 | "contact": { 12 | "issues": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API/issues", 13 | "sources": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API" 14 | }, 15 | 16 | "license": "MIT", 17 | "icon": "assets/modid/icon.png", 18 | 19 | "environment": "*", 20 | "entrypoints": { 21 | "init": [ 22 | "io.github.minecraftcursedlegacy.test.TileEntityTest" 23 | ] 24 | }, 25 | 26 | "depends": { 27 | "fabricloader": "*", 28 | "legacy-api-base": "*", 29 | "legacy-registries": "*", 30 | "legacy-tile-entities": "*", 31 | "minecraft": "1.0.0-beta.7.3" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /legacy-translations-v0/build.gradle: -------------------------------------------------------------------------------- 1 | archivesBaseName = 'legacy-translations-v0' 2 | version = getSubprojectVersion(project, '0.6.3') 3 | 4 | moduleDependencies(project, 'legacy-api-base') 5 | dependencies { 6 | } 7 | -------------------------------------------------------------------------------- /legacy-translations-v0/src/main/java/io/github/minecraftcursedlegacy/accessor/translations/AccessorTranslationStorage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.accessor.translations; 25 | 26 | import java.util.Properties; 27 | 28 | import org.spongepowered.asm.mixin.Mixin; 29 | import org.spongepowered.asm.mixin.gen.Accessor; 30 | 31 | import net.minecraft.client.resource.language.TranslationStorage; 32 | 33 | @Mixin(TranslationStorage.class) 34 | public interface AccessorTranslationStorage { 35 | @Accessor 36 | Properties getTranslations(); 37 | } -------------------------------------------------------------------------------- /legacy-translations-v0/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "legacy-translations", 4 | "version": "${version}", 5 | 6 | "name": "Minecraft Cursed Legacy Translations", 7 | "description": "A set of useful hooks and features to be used by modders.", 8 | "authors": [ 9 | "The Cursed Legacy Team" 10 | ], 11 | "contact": { 12 | "issues": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API/issues", 13 | "sources": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API" 14 | }, 15 | 16 | "license": "MIT", 17 | "icon": "assets/api/icon.png", 18 | 19 | "mixins": [ 20 | "legacy-translations.accessors.json" 21 | ], 22 | 23 | "depends": { 24 | "fabricloader": "*", 25 | "legacy-api-base": "*", 26 | "minecraft": "1.0.0-beta.7.3" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /legacy-translations-v0/src/main/resources/legacy-translations.accessors.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "io.github.minecraftcursedlegacy.accessor.translations", 4 | "compatibilityLevel": "JAVA_8", 5 | "mixins": [ 6 | "AccessorTranslationStorage" 7 | ], 8 | "injectors": { 9 | "defaultRequire": 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /legacy-worldtypes-v1/build.gradle: -------------------------------------------------------------------------------- 1 | archivesBaseName = 'legacy-worldtypes-v1' 2 | version = getSubprojectVersion(project, '1.0.5') 3 | 4 | moduleDependencies(project, 'legacy-api-base', 'legacy-attached-data-v1', 'legacy-terrain-v1', 'legacy-translations-v0') 5 | dependencies { 6 | } 7 | -------------------------------------------------------------------------------- /legacy-worldtypes-v1/src/main/java/io/github/minecraftcursedlegacy/mixin/worldtype/MixinMinecraftServer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Cursed Legacy Team. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package io.github.minecraftcursedlegacy.mixin.worldtype; 25 | 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 | import io.github.minecraftcursedlegacy.api.registry.Id; 32 | import io.github.minecraftcursedlegacy.api.worldtype.WorldType; 33 | import io.github.minecraftcursedlegacy.impl.worldtype.WorldTypeImpl; 34 | import net.minecraft.level.storage.LevelStorage; 35 | import net.minecraft.server.MinecraftServer; 36 | 37 | @Mixin(MinecraftServer.class) 38 | public class MixinMinecraftServer { 39 | @Inject(at = @At("HEAD"), method = "loadLevels") 40 | private void method_2159(LevelStorage storage, String string, long seedOrToken, CallbackInfo info) { 41 | String val = ((MinecraftServer) (Object) this).serverProperties.getString("world-type", "minecraft:default"); 42 | WorldTypeImpl.setSelected(WorldType.getById(new Id(val))); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /legacy-worldtypes-v1/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "legacy-worldtypes", 4 | "version": "${version}", 5 | 6 | "name": "Minecraft Cursed Legacy World Types", 7 | "description": "A set of useful hooks and features to be used by modders.", 8 | "authors": [ 9 | "The Cursed Legacy Team" 10 | ], 11 | "contact": { 12 | "issues": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API/issues", 13 | "sources": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API" 14 | }, 15 | 16 | "license": "MIT", 17 | "icon": "assets/api/icon.png", 18 | 19 | "entrypoints": { 20 | "init": [ 21 | "io.github.minecraftcursedlegacy.impl.worldtype.WorldTypeImpl" 22 | ] 23 | }, 24 | 25 | "mixins": [ 26 | "legacy-worldtypes.mixins.json" 27 | ], 28 | 29 | "depends": { 30 | "fabricloader": "*", 31 | "legacy-api-base": "*", 32 | "legacy-attached-data": "*", 33 | "legacy-terrain": "*", 34 | "legacy-translations": "*", 35 | "minecraft": "1.0.0-beta.7.3" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /legacy-worldtypes-v1/src/main/resources/legacy-worldtypes.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "io.github.minecraftcursedlegacy.mixin.worldtype", 4 | "compatibilityLevel": "JAVA_8", 5 | "mixins": [ 6 | "MixinDimension" 7 | ], 8 | "client": [ 9 | "MixinCreateLevelScreen" 10 | ], 11 | "server": [ 12 | "MixinMinecraftServer" 13 | ], 14 | "injectors": { 15 | "defaultRequire": 1 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /legacy-worldtypes-v1/src/test/java/io/github/minecraftcursedlegacy/test/LowFlatChunkGenerator.java: -------------------------------------------------------------------------------- 1 | package io.github.minecraftcursedlegacy.test; 2 | 3 | import io.github.minecraftcursedlegacy.api.terrain.ChunkGenerator; 4 | import net.minecraft.level.Level; 5 | import net.minecraft.level.biome.Biome; 6 | import net.minecraft.level.source.LevelSource; 7 | import net.minecraft.level.source.OverworldLevelSource; 8 | import net.minecraft.tile.Tile; 9 | 10 | public class LowFlatChunkGenerator extends ChunkGenerator { 11 | public LowFlatChunkGenerator(Level level, long seed) { 12 | super(level, seed); 13 | this.surface = new OverworldLevelSource(level, seed); 14 | } 15 | 16 | private final OverworldLevelSource surface; 17 | 18 | @Override 19 | public void decorate(LevelSource levelSource, int chunkX, int chunkZ) { 20 | this.surface.decorate(levelSource, chunkX, chunkZ); 21 | } 22 | 23 | @Override 24 | protected void shapeChunk(int chunkX, int chunkZ, byte[] tiles, Biome[] biomes) { 25 | for (int localX = 0; localX < 16; ++localX) { 26 | for (int localZ = 0; localZ < 16; ++localZ) { 27 | int height = 10; 28 | 29 | for (int y = height; y >= 0; --y) { 30 | tiles[getIndex(localX, y, localZ)] = (byte) Tile.STONE.id; 31 | } 32 | } 33 | } 34 | } 35 | 36 | @Override 37 | protected void buildSurface(int chunkX, int chunkZ, byte[] tiles, Biome[] biomes) { 38 | this.surface.buildSurface(chunkX, chunkZ, tiles, biomes); 39 | } 40 | 41 | @Override 42 | public int getMinSpawnY() { 43 | return 9; 44 | } 45 | 46 | @Override 47 | public boolean isValidSpawnPos(int x, int z) { 48 | int surfaceTile = this.level.getTileAtSurface(x, z); 49 | return surfaceTile == Tile.GRASS.id; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /legacy-worldtypes-v1/src/test/java/io/github/minecraftcursedlegacy/test/LowFlatWorldType.java: -------------------------------------------------------------------------------- 1 | package io.github.minecraftcursedlegacy.test; 2 | 3 | import io.github.minecraftcursedlegacy.api.registry.Id; 4 | import io.github.minecraftcursedlegacy.api.registry.Translations; 5 | import io.github.minecraftcursedlegacy.api.worldtype.WorldType; 6 | import net.minecraft.level.Level; 7 | import net.minecraft.level.source.LevelSource; 8 | import net.minecraft.util.io.CompoundTag; 9 | 10 | public class LowFlatWorldType extends WorldType { 11 | public LowFlatWorldType() { 12 | super(new Id("modid", "lowflat")); 13 | Translations.addTranslation(this.toString(), "Low Flat"); 14 | } 15 | 16 | @Override 17 | public LevelSource createChunkGenerator(Level level, CompoundTag additionalData) { 18 | return new LowFlatChunkGenerator(level, level.getSeed()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /legacy-worldtypes-v1/src/test/java/io/github/minecraftcursedlegacy/test/RandomChunkGenerator.java: -------------------------------------------------------------------------------- 1 | package io.github.minecraftcursedlegacy.test; 2 | 3 | import io.github.minecraftcursedlegacy.api.terrain.ChunkGenerator; 4 | import net.minecraft.level.Level; 5 | import net.minecraft.level.biome.Biome; 6 | import net.minecraft.level.source.LevelSource; 7 | import net.minecraft.level.source.OverworldLevelSource; 8 | import net.minecraft.tile.Tile; 9 | 10 | public class RandomChunkGenerator extends ChunkGenerator { 11 | public RandomChunkGenerator(Level level, long seed) { 12 | super(level, seed); 13 | this.surface = new OverworldLevelSource(level, seed); 14 | } 15 | 16 | private final OverworldLevelSource surface; 17 | 18 | @Override 19 | public void decorate(LevelSource levelSource, int chunkX, int chunkZ) { 20 | } 21 | 22 | @Override 23 | protected void shapeChunk(int chunkX, int chunkZ, byte[] tiles, Biome[] biomes) { 24 | for (int localX = 0; localX < 16; ++localX) { 25 | for (int localZ = 0; localZ < 16; ++localZ) { 26 | int height = 61 + this.rand.nextInt(6) + this.rand.nextInt(3) + ((chunkX + chunkZ) & 0b11); 27 | 28 | if (height < 63) { 29 | for (int y = 63; y > height; --y) { 30 | tiles[getIndex(localX, y, localZ)] = (byte) Tile.STILL_WATER.id; 31 | } 32 | } 33 | 34 | for (int y = height; y >= 0; --y) { 35 | tiles[getIndex(localX, y, localZ)] = (byte) Tile.STONE.id; 36 | } 37 | } 38 | } 39 | } 40 | 41 | @Override 42 | protected void buildSurface(int chunkX, int chunkZ, byte[] tiles, Biome[] biomes) { 43 | this.surface.buildSurface(chunkX, chunkZ, tiles, biomes); 44 | } 45 | 46 | @Override 47 | public int getMinSpawnY() { 48 | return 67; 49 | } 50 | 51 | @Override 52 | public boolean isValidSpawnPos(int x, int z) { 53 | int surfaceTile = this.level.getTileAtSurface(x, z); 54 | return surfaceTile == Tile.GRASS.id; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /legacy-worldtypes-v1/src/test/java/io/github/minecraftcursedlegacy/test/RandomWorldType.java: -------------------------------------------------------------------------------- 1 | package io.github.minecraftcursedlegacy.test; 2 | 3 | import io.github.minecraftcursedlegacy.api.registry.Id; 4 | import io.github.minecraftcursedlegacy.api.registry.Translations; 5 | import io.github.minecraftcursedlegacy.api.worldtype.WorldType; 6 | import net.minecraft.level.Level; 7 | import net.minecraft.level.source.LevelSource; 8 | import net.minecraft.util.io.CompoundTag; 9 | 10 | public class RandomWorldType extends WorldType { 11 | public RandomWorldType() { 12 | super(new Id("modid", "random")); 13 | Translations.addTranslation(this.toString(), "Test"); 14 | } 15 | 16 | @Override 17 | public LevelSource createChunkGenerator(Level level, CompoundTag additionalData) { 18 | return new RandomChunkGenerator(level, level.getSeed()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /legacy-worldtypes-v1/src/test/java/io/github/minecraftcursedlegacy/test/WorldTypeTest.java: -------------------------------------------------------------------------------- 1 | package io.github.minecraftcursedlegacy.test; 2 | 3 | import net.fabricmc.api.ModInitializer; 4 | 5 | public class WorldTypeTest implements ModInitializer { 6 | @Override 7 | public void onInitialize() { 8 | new RandomWorldType(); 9 | new LowFlatWorldType(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /legacy-worldtypes-v1/src/test/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "legacy-worldtype-test", 4 | "version": "${version}", 5 | 6 | "name": "World Type Test Mod", 7 | "description": "Tests for the world type module of Cursed Legacy API.", 8 | "authors": [ 9 | "The Cursed Legacy Team" 10 | ], 11 | "contact": { 12 | "issues": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API/issues", 13 | "sources": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API" 14 | }, 15 | 16 | "license": "MIT", 17 | "icon": "assets/modid/icon.png", 18 | 19 | "environment": "*", 20 | "entrypoints": { 21 | "init": [ 22 | "io.github.minecraftcursedlegacy.test.WorldTypeTest" 23 | ] 24 | }, 25 | 26 | "depends": { 27 | "fabricloader": "*", 28 | "legacy-api-base": "*", 29 | "legacy-attached-data": "*", 30 | "legacy-terrain": "*", 31 | "legacy-translations": "*", 32 | "legacy-worldtypes": "*", 33 | "minecraft": "1.0.0-beta.7.3" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | jcenter() 4 | maven { 5 | name = 'Fabric' 6 | url = 'https://maven.fabricmc.net/' 7 | } 8 | gradlePluginPortal() 9 | mavenLocal() 10 | } 11 | } 12 | 13 | rootProject.name = "cursed-legacy-api" 14 | 15 | include 'legacy-api-base' 16 | 17 | include 'legacy-attached-data-v1' 18 | include 'legacy-commands-v1' 19 | include 'legacy-config-v0' 20 | include 'legacy-interaction-events-v0' 21 | include 'legacy-lifecycle-events-v1' 22 | include 'legacy-networking-v0' 23 | include 'legacy-recipes-v0' 24 | include 'legacy-registries-v1' 25 | include 'legacy-terrain-v1' 26 | include 'legacy-textures-v1' 27 | include 'legacy-tile-entities-v1' 28 | include 'legacy-translations-v0' 29 | include 'legacy-worldtypes-v1' 30 | -------------------------------------------------------------------------------- /src/main/resources/api.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "io.github.minecraftcursedlegacy.mixin", 4 | "compatibilityLevel": "JAVA_8", 5 | "injectors": { 6 | "defaultRequire": 1 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/main/resources/assets/api/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-cursed-legacy/Cursed-Legacy-API/1ff36aef55a67f9f4764a7bf874aa355d8de9c61/src/main/resources/assets/api/icon.png -------------------------------------------------------------------------------- /src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "api", 4 | "version": "${version}", 5 | 6 | "name": "Minecraft Cursed Legacy API", 7 | "description": "A set of useful hooks and features to be used by modders.", 8 | "authors": [ 9 | "The Cursed Legacy Team" 10 | ], 11 | "contact": { 12 | "issues": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API/issues", 13 | "sources": "https://github.com/minecraft-cursed-legacy/Cursed-Legacy-API" 14 | }, 15 | 16 | "license": "MIT", 17 | "icon": "assets/api/icon.png", 18 | 19 | "environment": "*", 20 | 21 | "mixins": [ 22 | "api.mixins.json" 23 | ], 24 | 25 | "depends": { 26 | "fabricloader": "*", 27 | "minecraft": "1.0.0-beta.7.3", 28 | "legacy-api-base": "*", 29 | "legacy-attached-data": "*", 30 | "legacy-commands": "*", 31 | "legacy-config": "*", 32 | "legacy-interaction-events": "*", 33 | "legacy-lifecycle-events": "*", 34 | "legacy-networking": "*", 35 | "legacy-recipes": "*", 36 | "legacy-registries": "*", 37 | "legacy-terrain": "*", 38 | "legacy-translations": "*" 39 | } 40 | } 41 | --------------------------------------------------------------------------------