diff --git a/.gitignore b/.gitignore index 6336686..0c8ea22 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ bin .metadata .classpath .project +eclipse # idea out @@ -26,11 +27,12 @@ classes .gradle # other -eclipse run +.fabric +.forge # macos *.DS_Store -# Files from Forge MDK -forge*changelog.txt +# api keys +api-keys.properties \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ab1ae1f..1129372 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,79 +5,5 @@ All notable changes to the "just-vertical-slabs" Minecraft mod will be documente The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Forge Semantic Versioning](https://mcforge.readthedocs.io/en/latest/gettingstarted/versioning/#versioning). -## [Unreleased] -- Nothing new. - -## [1.18.2-3.2.0.3] - 2022/07/28 -- Updated repository structure and server/client compatibility. - -## [1.18.2-3.2.0.2] - 2022/07/19 -- Fixed a bug that would cause game crashes with Mekanism. -- Fixed Transparent Vertical Slabs for Mekanism. -- Fixed a bug that would make the in-game mod manager show this mod needed always to be updated. - -## [1.18.2-3.2.0.1] - 2022/07/18 -- Fixed a rare bug that could cause game crash. -- Updated in game mod image. - -## [1.18.2-3.2.0.0] - 2022/07/11 -- Fixed [1.18.2-3.2.0.0-beta1] double vertical slabs bugs. -- Changed project structure to prepare a Fabric port. -- Improved translucent vertical slabs rendering. -- Added images to documentation. -- Fixed tinted glass light down propagation. -- Fixed a combining bug that would prevent vertical slabs facing north from creating certain angles when side by side with double vertical slabs. -- Fixed tint of grass vertical slabs particles. -- Improved double vertical slabs. - -## [1.18.2-3.2.0.0-beta1] - 2022/06/04 -- Added double vertical slabs. -- BUG: Double Vertical Slabs that only have a referredSlabState (so no referredBlockState) don't render correctly. -- BUG: Double Vertical Slabs that should emit light don't emit it. -- BUG: (from previous versions) honey and slime vertical slabs don't render correctly. - -## [1.18.2-3.1.0.1] - 2022/05/23 -- Fixed client-server interactions and small bug fix. - -## [1.18.2-3.1.0.0] - 2022/05/22 -- Fixed crash when this mod is put only on server. -- Fixed client-server compatibility. -- Improved light for translucent vertical slabs. - -## [1.18.2-3.0.0.0] - 2022/05/16 -- Fixed dynamic colors, like for grass and foliage. -- Fixed overlayed textures. -- Improved drops. -- Added support for blocks that are not full height, like Dirt Path. -- Fixed not full height vertical slabs occluding other blocks when they shouldn't. -- Improved Inner Vertical Slab ("big corner") model. -- Added support for transparent (translucent) vertical slabs. -- Improved dynamic models. -- Now, when possible, most properties refer to the block rather than the slab to improve coherence. -- Fixed broken textures when using external shaders. - -## [1.18.2-2.0.0.0] - 2022/05/10 -- Refractored code to base Vertical Slabs on Slabs rather than Blocks. -- Improved dynamic model code. -- Updated readme. -- Removed requirement for crafting recipe of a Slab to be considered a valid Slab. Now it's sufficient to have the *minecraft:slabs* tag. - -## [1.18.2-1.0.0.0] - 2022/05/09 -- Added vertical slab variants for any block having a slab variant, vanilla or not. -- Added "stair combining logic" to vertical slabs. -- Added crafting recipes involving vertical slabs. -- Added stonecutter recipes involving vertical slabs. -- Added in-world waxing recipes for vertical slabs that can be waxed. -- Added creative tab with all vertical slabs. - -[Unreleased]: https://github.com/Nyphet/just-vertical-slabs -[1.18.2-3.2.0.3]: https://github.com/Nyphet/just-vertical-slabs/releases/tag/v1.18.2-3.2.0.3 -[1.18.2-3.2.0.2]: https://github.com/Nyphet/just-vertical-slabs/releases/tag/v1.18.2-3.2.0.2 -[1.18.2-3.2.0.1]: https://github.com/Nyphet/just-vertical-slabs/releases/tag/v1.18.2-3.2.0.1 -[1.18.2-3.2.0.0]: https://github.com/Nyphet/just-vertical-slabs/releases/tag/v1.18.2-3.2.0.0 -[1.18.2-3.2.0.0-beta1]: https://github.com/Nyphet/just-vertical-slabs/releases/tag/v1.18.2-3.2.0.0-beta1 -[1.18.2-3.1.0.1]: https://github.com/Nyphet/just-vertical-slabs/releases/tag/v1.18.2-3.1.0.1 -[1.18.2-3.1.0.0]: https://github.com/Nyphet/just-vertical-slabs/releases/tag/v1.18.2-3.1.0.0 -[1.18.2-3.0.0.0]: https://github.com/Nyphet/just-vertical-slabs/releases/tag/v1.18.2-3.0.0.0 -[1.18.2-2.0.0.0]: https://github.com/Nyphet/just-vertical-slabs/releases/tag/v1.18.2-2.0.0.0 -[1.18.2-1.0.0.0]: https://github.com/Nyphet/just-vertical-slabs/releases/tag/v1.18.2-1.0.0.0 +## **Migration** +This Changelog has been migrated to the newest [Changelog](https://github.com/Nyphet/just-vertical-slabs/blob/master/CHANGELOG.md), refer to that one. diff --git a/README.md b/README.md index ad8e113..cb31da8 100644 --- a/README.md +++ b/README.md @@ -1,53 +1,66 @@ -# Just Vertical Slabs -### Finally build with Vertical Slabs in Vanilla or with any mod you've installed! +![Just Vertical Slabs banner](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/just-vertical-slabs/banner.gif) -## Features -- **Works out of the box with any mod!** -- Vertical Slab variants for any block with slab variants, Vanilla or not! -- Vertical Slabs combine like stairs do! -- Vertical Slabs craftings! See next section for more details. -- Creative Tab with all available Vertical Slabs! +--- +![Minecraft](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/minecraft/minecraft.svg)[![1.19.2](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/minecraft/1-19-2.svg)](https://www.curseforge.com/minecraft/mc-mods/just-vertical-slabs/files/all?filter-status=1&filter-game-version=2020709689%3A9366)![Separator](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/separator.svg)[![1.18.2](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/minecraft/1-18-2.svg)](https://www.curseforge.com/minecraft/mc-mods/just-vertical-slabs/files/all?filter-status=1&filter-game-version=2020709689%3A9008) + +![Loader](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/loader/loader.svg)[![Forge](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/loader/forge.svg)](https://www.curseforge.com/minecraft/mc-mods/just-vertical-slabs/files/all?filter-status=1&filter-game-version=2020709689%3A7498) + +![Overlay](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/side/client-server.svg) + +![Issues](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/github/issues.svg)[![GitHub](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/github/github.svg)](https://github.com/Nyphet/just-vertical-slabs/issues) + +--- +## **Description** +Minecraft has always been lacking something important: vertical slabs. +Because of this most mods adding new slabs do not include vertical slabs and you'd have to download addon mods to add them, in the rare case they even exist. +This mod aims to fix all of the above, adding vertical slabs dynamically for Vanilla and each mod installed! See some screenshots [here](https://www.curseforge.com/minecraft/mc-mods/just-vertical-slabs/screenshots)! ***Important note:*** -*All and only blocks that already have slab variants will also get vertical slab variants, this to keep a Vanilla-like game style that nicely adapts to any eventual mod. -If you want more vertical slabs it's sufficient to add more slabs. Then, automatically, vertical slabs will be added to the game.* - -## Craftings -- 3 of the same block in a column to craft a vertical slab. -- 2 of the same vertical slab in a row to craft a full block. -- 2 of the same slab in a column to craft a full block. -- Vertical slabs can be crafted into slabs and vice versa just by putting them alone in the crafting. -- Waxing works as usual, both in-world and in-crafting. -- Stonecutter recipes are available. - It must be noted that, due to some implementation restrictions, a block can be stonecut only in its main vertical slab. To obtain the other vertical slab variants of that block the crafting recipes above must be used. +*All and only blocks that already have slab variants will also get vertical slab variants, this to keep a Vanilla-like game style that nicely adapts to any eventual mod.* +*If you want more vertical slabs it's sufficient to add more slabs. Then, automatically, vertical slabs will be added to the game.* -## Downloads -This is the FORGE version, a port to FABRIC is planned but won't happen any time soon. -Downloads are available [here](https://www.curseforge.com/minecraft/mc-mods/just-vertical-slabs/files). +## **Features** +- **Works out of the box with any mod!** +- Vertical Slab variants for any block with slab variants, Vanilla or not! +![Variants](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/just-vertical-slabs/variants.png) +- Vertical Slabs combine like stairs do! +![Combining](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/just-vertical-slabs/combining.png) +- Vertical Slabs craftings! See next section for more details. +- Creative Tab with all available Vertical Slabs! +![Creative tab](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/just-vertical-slabs/creative-tab.png) -## Issues -To open a new issue or search an existing one visit the [issues tab](https://github.com/Nyphet/just-vertical-slabs/issues). -Before opening a new issue please verify that no other issue about the same topic already exists, either open or closed. -If you find a mod that breaks with this mod or that does not get vertical slabs as it should, please open an issue. -If you find a weird or incorrect behavior of any vertical slab, please open an issue. +## **Craftings** +- 3 of the same block in a column to craft a vertical slab. +![Full to vertical](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/just-vertical-slabs/full-to-vertical.png) +- 2 of the same vertical slab in a row to craft a full block. +![Vertical to full](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/just-vertical-slabs/vertical-to-full.png) +- 2 of the same slab in a column to craft a full block. +![Horizontal to full](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/just-vertical-slabs/horizontal-to-full.png) +- Vertical slabs can be crafted into slabs and vice versa just by putting them alone in the crafting. +![Vertical to horizontal](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/just-vertical-slabs/vertical-to-horizontal.png)![Horizontal to vertical](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/just-vertical-slabs/horizontal-to-vertical.png) +- Waxing works as usual, both in-world and in-crafting. +![Waxing](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/just-vertical-slabs/waxing.png)![Waxing](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/just-vertical-slabs/waxing.gif) +- Stonecutter recipes are available. +![Stonecutter](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/just-vertical-slabs/stonecutter.png) +It must be noted that, due to some implementation restrictions, a block can be stonecut only in its main vertical slab. To obtain the other vertical slab variants of that block the crafting recipes above must be used. -## Credits +## **Credits** A very big thank you goes to the Forge team that allowed anyone to mod Minecraft for free and their support in the Forge Forums. -In particular I want to thank diesieben07 that followed me throughout most of the development, without him none of this would have been possible. +In particular I want to thank *diesieben07* that followed me throughout most of the initial development. -## Technical details -This mod is required on both server and client to work. +## **License and right of use** +Feel free to use this mod for any modpack or video, just be sure to give credit and possibly link [here](https://github.com/Nyphet/just-vertical-slabs#readme). +This project is published under the [GNU General Public License v3.0](https://github.com/Nyphet/just-vertical-slabs/blob/master/LICENSE). + +## **For developers** For slab items to be recognized as slabs they must have the *minecraft:slabs* tag, as they should. If they don't, there's no way to understand whether they are slabs or not, so they are assumed to be not. If another mod adds slabs that are not recognized by this mod, it's most probably for this reason, so check it and ask the other mod author to fix that. -## Mod Improvement -**Help wanted!** -There are a few points this mod is lacking in and I'd like to improve it, however I don't have nearly enough time nor energy to do so. -For this reason I'm looking for someone that would be available to help improve this project (for free of course). -If you think you are interested in becoming a co-author, help improve this mod and expand its ecosystem, please contact me with a message on [CurseForge](https://www.curseforge.com/private-messages/send?recipient=crystal_spider_). - -## License and right of use -Feel free to use this mod for any modpack or video, just be sure to give credit and possibly link [here](https://github.com/Nyphet/just-vertical-slabs#readme). -This project is published under the [GNU General Public License v3.0](https://github.com/Nyphet/just-vertical-slabs/blob/master/LICENSE). +## **Support me** +[![Twitch](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/twitch/twitch64.png "Twitch")](https://www.twitch.tv/crystal_spider_) +[![Patreon](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/patreon/patreon64.png "Patreon")](https://www.patreon.com/crystalspider) +[![Ko-fi](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/kofi/kofi64.png "Ko-fi")](https://ko-fi.com/crystalspider) +[![GitHub](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/github/github64.png "My other projects")](https://github.com/Nyphet) +[![My other projects](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/curseforge/curseforge64.png "My other projects")](https://www.curseforge.com/members/crystal_spider_/projects) diff --git a/forge/build.gradle b/forge/build.gradle index 71d74f9..e04c0ba 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -10,20 +10,20 @@ buildscript { } // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. plugins { - id 'eclipse' - id 'maven-publish' + id 'com.matthewprenger.cursegradle' version "${cursegradle_version}" + id "com.github.breadmoirai.github-release" version "${github_release_version}" } apply plugin: 'net.minecraftforge.gradle' -version = "${mcVersion}-${modVersion}-forge" -group = "crystalspider.${modid}" -archivesBaseName = "${modid}" +archivesBaseName = project.modid +version = "${minecraft_version}-${mod_version}-${loader.toLowerCase()}" +group = project.group // Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. java.toolchain.languageVersion = JavaLanguageVersion.of(17) minecraft { - mappings channel: 'official', version: "${mcVersion}" + mappings channel: 'official', version: "${minecraft_version}" // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default. runs { client { @@ -82,17 +82,21 @@ sourceSets.main.resources { srcDir 'src/generated/resources' } repositories {} dependencies { - minecraft "net.minecraftforge:forge:${mcVersion}-${forgeVersion}" + minecraft "net.minecraftforge:forge:${minecraft_version}-${loader_version}${forge_subversion}" } def resourceTarget = 'META-INF/mods.toml' -def intoTargets = ["$rootDir/out/production/resources/", "$rootDir/out/production/${project.name}.main/", "$rootDir/bin/main/"] +def intoTargets = ["$rootDir/bin/main/"] def replaceProperties = [ - modTitle: modTitle, - mcVersion: mcVersion, - modVersion: modVersion, - forgeVersion: forgeVersion, - author: author + modid: modid, + modid_kebab: modid_kebab, + mod_title: mod_title, + minecraft_version: minecraft_version, + mod_version: mod_version, + loader_version: loader_version, + forge_subversion: forge_subversion, + author: author, + github_user: github_user ] processResources { @@ -112,7 +116,6 @@ processResources { } into target } - file("${target}/${resourceTarget}").text = file("${target}/${resourceTarget}").text.replaceAll('modid', project.modid) } } } @@ -120,19 +123,68 @@ processResources { jar { manifest { attributes([ - "Specification-Title" : project.modTitle, + "Specification-Title" : project.mod_title, + "Specification-Version" : project.mod_version, "Specification-Vendor" : project.author, - "Specification-Version" : "1", - "Implementation-Title" : project.modTitle, - "Implementation-Version" : project.modVersion, + "Implementation-Title" : project.mod_title, + "Implementation-Version" : project.mod_version, "Implementation-Vendor" : project.author, + "Implementation-Vendor-Id": project.group, + "Implementation-URL" : "https://github.com/${github_user}/${modid_kebab}/tree/${minecraft_version}", "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") ]) } } -jar.finalizedBy('reobfJar') - tasks.withType(JavaCompile).configureEach { - options.encoding = 'UTF-8' + it.options.encoding = 'UTF-8' + it.options.release = 17 +} + +def changelog = "See [Changelog](https://github.com/${github_user}/${modid_kebab}/blob/master/CHANGELOG.md#${minecraft_version.replaceAll('\\.', '')}-${mod_version.replaceAll('\\.', '')}---${new Date().format("yyyyMMdd")})." + +file("../api-keys.properties").withReader { + Properties props = new Properties() + props.load(it) + project.api_keys = props +} + +curseforge { + apiKey = "${api_keys.curseforge}" + project { + id = "${curseforge_id}" + changelogType = 'markdown' + changelog = changelog + releaseType = 'release' + addGameVersion "${loader}" + addGameVersion "${minecraft_version}" + mainArtifact(jar) { + displayName = "[${loader} - ${minecraft_version}] ${mod_title} v${mod_version}" + // relations {} + } + } + options { + forgeGradleIntegration = false + } } + +githubRelease { + token "${api_keys.github}" + owner "${github_user}" + repo "${modid_kebab}" + tagName "v${minecraft_version}-${mod_version}" + targetCommitish "${minecraft_version}" + releaseName "v${minecraft_version}-${mod_version}" + generateReleaseNotes false + body changelog + draft true + prerelease false + releaseAssets jar + // Setting this to true will allow this plugin to upload artifacts to a release if it found an existing one. If overwrite is set to true, this option is ignored. + allowUploadToExisting true + // By default false; if set to true, will delete an existing release with the same tag and name + // overwrite true + // by default false; you can use this to see what actions would be taken without making a release + // dryRun false +} + diff --git a/forge/gradle.properties b/forge/gradle.properties index 4445993..7feafb4 100644 --- a/forge/gradle.properties +++ b/forge/gradle.properties @@ -1,11 +1,27 @@ # Sets default memory used for gradle commands. Can be overridden by user or command line properties. # This is required to provide enough memory for the Minecraft decompilation process. -org.gradle.jvmargs=-Xmx3G -org.gradle.daemon=false - -modid=justverticalslabs -modTitle=Just Vertical Slabs -mcVersion=1.18.2 -modVersion=3.2.0.3 -forgeVersion=40.1.0 -author=Crystal Spider +org.gradle.jvmargs = -Xmx3G +org.gradle.daemon = false + +# Forge Properties + minecraft_version = 1.18.2 + loader_version = 40 + loader = Forge + +# Mod Properties + mod_title = Just Vertical Slabs + mod_version = 4.0.0.0 + author = Crystal Spider + group = crystalspider + modid = justverticalslabs + modid_kebab = just-vertical-slabs + +# Dependencies + forge_subversion = .1.0 + cursegradle_version = 1.4.0 + github_release_version = 2.4.1 + +# Miscellaneous + github_user = Nyphet + curseforge_id = 605439 + api_keys = {} \ No newline at end of file diff --git a/forge/src/main/java/crystalspider/justverticalslabs/blocks/VerticalSlabBlock.java b/forge/src/main/java/crystalspider/justverticalslabs/blocks/VerticalSlabBlock.java index 1e09751..4f1bc90 100644 --- a/forge/src/main/java/crystalspider/justverticalslabs/blocks/VerticalSlabBlock.java +++ b/forge/src/main/java/crystalspider/justverticalslabs/blocks/VerticalSlabBlock.java @@ -472,7 +472,8 @@ public boolean canPlaceLiquid(BlockGetter getter, BlockPos pos, BlockState state @Override public boolean canBeReplaced(BlockState state, BlockPlaceContext context) { - if (!state.getValue(DOUBLE) && state.getValue(SHAPE) == StairsShape.STRAIGHT && VerticalSlabUtils.getReferredSlabState(context.getItemInHand()) == VerticalSlabUtils.getReferredSlabState(context.getLevel(), context.getClickedPos())) { + BlockState blockState = VerticalSlabUtils.getReferredSlabState(context.getItemInHand()); + if (!state.getValue(DOUBLE) && state.getValue(SHAPE) == StairsShape.STRAIGHT && blockState != null && blockState == VerticalSlabUtils.getReferredSlabState(context.getLevel(), context.getClickedPos())) { if (context.replacingClickedOnBlock()) { return context.getClickedFace() == state.getValue(FACING).getOpposite(); } diff --git a/forge/src/main/java/crystalspider/justverticalslabs/blocks/VerticalSlabBlockEntity.java b/forge/src/main/java/crystalspider/justverticalslabs/blocks/VerticalSlabBlockEntity.java index c4a8d39..f9d3d35 100644 --- a/forge/src/main/java/crystalspider/justverticalslabs/blocks/VerticalSlabBlockEntity.java +++ b/forge/src/main/java/crystalspider/justverticalslabs/blocks/VerticalSlabBlockEntity.java @@ -1,5 +1,6 @@ package crystalspider.justverticalslabs.blocks; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import crystalspider.justverticalslabs.JustVerticalSlabsLoader; @@ -50,6 +51,7 @@ public Packet getUpdatePacket() { return ClientboundBlockEntityDataPacket.create(this); } + @Nonnull @Override public IModelData getModelData() { return VerticalSlabUtils.buildModelData(referredSlabState); diff --git a/forge/src/main/java/crystalspider/justverticalslabs/handlers/ColorHandlerEventHandler.java b/forge/src/main/java/crystalspider/justverticalslabs/handlers/ColorHandlerEventHandler.java index d6a8e36..4e84680 100644 --- a/forge/src/main/java/crystalspider/justverticalslabs/handlers/ColorHandlerEventHandler.java +++ b/forge/src/main/java/crystalspider/justverticalslabs/handlers/ColorHandlerEventHandler.java @@ -23,6 +23,7 @@ /** * {@link ColorHandlerEvent} handler. */ +@SuppressWarnings("null") @EventBusSubscriber(value = Dist.CLIENT, bus = Bus.MOD) public class ColorHandlerEventHandler { /** diff --git a/forge/src/main/java/crystalspider/justverticalslabs/handlers/RightClickBlockHandler.java b/forge/src/main/java/crystalspider/justverticalslabs/handlers/RightClickBlockHandler.java index 1c84a5a..04bf37e 100644 --- a/forge/src/main/java/crystalspider/justverticalslabs/handlers/RightClickBlockHandler.java +++ b/forge/src/main/java/crystalspider/justverticalslabs/handlers/RightClickBlockHandler.java @@ -46,6 +46,7 @@ public void onRightClickBlock(RightClickBlock event) { * @param itemStack - {@link ItemStack} held in the interaction hand. * @return {@link InteractionResult}. */ + @SuppressWarnings("null") private InteractionResult wax(Level level, BlockPos blockPos, Player player, ItemStack itemStack) { BlockState slabState = VerticalSlabUtils.getReferredSlabState(level, blockPos); if (slabState != null && itemStack.is(Items.HONEYCOMB)) { diff --git a/forge/src/main/java/crystalspider/justverticalslabs/items/CutoutVerticalSlabBlockItem.java b/forge/src/main/java/crystalspider/justverticalslabs/items/CutoutVerticalSlabBlockItem.java index 22608c9..8e159ee 100644 --- a/forge/src/main/java/crystalspider/justverticalslabs/items/CutoutVerticalSlabBlockItem.java +++ b/forge/src/main/java/crystalspider/justverticalslabs/items/CutoutVerticalSlabBlockItem.java @@ -17,6 +17,7 @@ public CutoutVerticalSlabBlockItem() { } @Override + @SuppressWarnings("null") public void fillItemCategory(CreativeModeTab creativeModeTab, NonNullList itemStacks) { if (this.allowdedIn(creativeModeTab) && MapsManager.slabStateMap != null) { for(BlockState referredSlabState : MapsManager.slabStateMap.values()) { diff --git a/forge/src/main/java/crystalspider/justverticalslabs/items/TranslucentVerticalSlabBlockItem.java b/forge/src/main/java/crystalspider/justverticalslabs/items/TranslucentVerticalSlabBlockItem.java index e224c84..2d93534 100644 --- a/forge/src/main/java/crystalspider/justverticalslabs/items/TranslucentVerticalSlabBlockItem.java +++ b/forge/src/main/java/crystalspider/justverticalslabs/items/TranslucentVerticalSlabBlockItem.java @@ -17,6 +17,7 @@ public TranslucentVerticalSlabBlockItem() { } @Override + @SuppressWarnings("null") public void fillItemCategory(CreativeModeTab creativeModeTab, NonNullList itemStacks) { if (this.allowdedIn(creativeModeTab) && MapsManager.translucentMap != null) { for(BlockState referredSlabState : MapsManager.translucentMap.values()) { diff --git a/forge/src/main/java/crystalspider/justverticalslabs/items/VerticalSlabBlockItem.java b/forge/src/main/java/crystalspider/justverticalslabs/items/VerticalSlabBlockItem.java index c39de8b..35ca062 100644 --- a/forge/src/main/java/crystalspider/justverticalslabs/items/VerticalSlabBlockItem.java +++ b/forge/src/main/java/crystalspider/justverticalslabs/items/VerticalSlabBlockItem.java @@ -50,6 +50,7 @@ public ItemStack getDefaultInstance() { * Returns the correct burn time for the given Vertical Slab {@link ItemStack}. */ @Override + @SuppressWarnings("null") public int getBurnTime(ItemStack itemStack, @Nullable RecipeType recipeType) { BlockState referredSlabState = VerticalSlabUtils.getReferredSlabState(itemStack); if (referredSlabState != null) { diff --git a/forge/src/main/java/crystalspider/justverticalslabs/loot/VerticalSlabLootModifier.java b/forge/src/main/java/crystalspider/justverticalslabs/loot/VerticalSlabLootModifier.java index cfe2202..4ccae61 100644 --- a/forge/src/main/java/crystalspider/justverticalslabs/loot/VerticalSlabLootModifier.java +++ b/forge/src/main/java/crystalspider/justverticalslabs/loot/VerticalSlabLootModifier.java @@ -33,6 +33,7 @@ public VerticalSlabLootModifier(LootItemCondition[] conditionsIn) { @Nonnull @Override + @SuppressWarnings("null") public List doApply(List generatedLoot, LootContext context) { if (context.getParamOrNull(LootContextParams.BLOCK_ENTITY) instanceof VerticalSlabBlockEntity) { List loot = new ArrayList(); diff --git a/forge/src/main/java/crystalspider/justverticalslabs/model/VerticalSlabBakedModel.java b/forge/src/main/java/crystalspider/justverticalslabs/model/VerticalSlabBakedModel.java index f21a575..6db92e1 100644 --- a/forge/src/main/java/crystalspider/justverticalslabs/model/VerticalSlabBakedModel.java +++ b/forge/src/main/java/crystalspider/justverticalslabs/model/VerticalSlabBakedModel.java @@ -148,7 +148,7 @@ public TextureAtlasSprite getParticleIcon() { * @return {@link TextureAtlasSprite particle icon} based on the given {@link IModelData data}. */ @Override - public TextureAtlasSprite getParticleIcon(IModelData extraData) { + public TextureAtlasSprite getParticleIcon(@Nonnull IModelData extraData) { BlockState referredSlabState = extraData.getData(VerticalSlabUtils.REFERRED_SLAB_STATE); if (referredSlabState != null) { return ModelUtils.getReferredBakedModel(referredSlabState).getParticleIcon(ModelUtils.getReferredModelData(referredSlabState, extraData)); @@ -169,7 +169,9 @@ public TextureAtlasSprite getParticleIcon(IModelData extraData) { * @param modelData - {@link IModelData} to use to render. * @return {@link List} of {@link BakedQuad} based on parameters. */ + @Nonnull @Override + @SuppressWarnings("null") public List getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData modelData) { BlockState referredSlabState = modelData.getData(VerticalSlabUtils.REFERRED_SLAB_STATE); if (referredSlabState != null) { diff --git a/forge/src/main/java/crystalspider/justverticalslabs/model/item/VerticalSlabItemBakedModel.java b/forge/src/main/java/crystalspider/justverticalslabs/model/item/VerticalSlabItemBakedModel.java index d55c2c6..98e9c4d 100644 --- a/forge/src/main/java/crystalspider/justverticalslabs/model/item/VerticalSlabItemBakedModel.java +++ b/forge/src/main/java/crystalspider/justverticalslabs/model/item/VerticalSlabItemBakedModel.java @@ -3,6 +3,9 @@ import java.util.List; import java.util.Random; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import com.mojang.blaze3d.vertex.PoseStack; import crystalspider.justverticalslabs.model.VerticalSlabBakedModel; @@ -28,9 +31,9 @@ public class VerticalSlabItemBakedModel implements IDynamicBakedModel { /** * Proper {@link IModelData}. */ - private final IModelData data; + private final @Nonnull IModelData data; - public VerticalSlabItemBakedModel(VerticalSlabBakedModel verticalSlabBakedModel, IModelData data) { + public VerticalSlabItemBakedModel(VerticalSlabBakedModel verticalSlabBakedModel, @Nonnull IModelData data) { this.verticalSlabBakedModel = verticalSlabBakedModel; this.data = data; } @@ -114,7 +117,7 @@ public TextureAtlasSprite getParticleIcon() { * @return {@link VerticalSlabBakedModel#getParticleIcon(IModelData)}. */ @Override - public TextureAtlasSprite getParticleIcon(IModelData extraData) { + public TextureAtlasSprite getParticleIcon(@Nonnull IModelData extraData) { return verticalSlabBakedModel.getParticleIcon(data); } @@ -130,8 +133,9 @@ public TextureAtlasSprite getParticleIcon(IModelData extraData) { * @param modelData - {@link IModelData}. * @return {@link VerticalSlabBakedModel#getQuads(BlockState, Direction, Random, IModelData)}. */ + @Nonnull @Override - public List getQuads(BlockState state, Direction side, Random rand, IModelData extraData) { + public List getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData) { return verticalSlabBakedModel.getQuads(state, side, rand, data); } } diff --git a/forge/src/main/java/crystalspider/justverticalslabs/model/utils/BakedQuadUtils.java b/forge/src/main/java/crystalspider/justverticalslabs/model/utils/BakedQuadUtils.java index 2134dae..847aa64 100644 --- a/forge/src/main/java/crystalspider/justverticalslabs/model/utils/BakedQuadUtils.java +++ b/forge/src/main/java/crystalspider/justverticalslabs/model/utils/BakedQuadUtils.java @@ -4,6 +4,8 @@ import java.util.List; import java.util.Random; +import javax.annotation.Nonnull; + import crystalspider.justverticalslabs.JustVerticalSlabsLoader; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.resources.model.BakedModel; @@ -24,7 +26,7 @@ public class BakedQuadUtils { * @param modelData - {@link IModelData model data} of the block being rendered. * @return {@link List} of all referred {@link BakedQuad BakedQuads} for the given {@link Direction}. */ - public static final List getReferredBakedQuads(BlockState referredState, Direction side, Random rand, IModelData modelData) { + public static final List getReferredBakedQuads(BlockState referredState, Direction side, @Nonnull Random rand, @Nonnull IModelData modelData) { BakedModel referredBakedModel = ModelUtils.getReferredBakedModel(referredState); IModelData referredModelData = ModelUtils.getReferredModelData(referredState, modelData); List referredBakedQuads = new ArrayList(referredBakedModel.getQuads(referredState, side, rand, referredModelData)); diff --git a/forge/src/main/java/crystalspider/justverticalslabs/model/utils/ModelUtils.java b/forge/src/main/java/crystalspider/justverticalslabs/model/utils/ModelUtils.java index 30fb413..ce918af 100644 --- a/forge/src/main/java/crystalspider/justverticalslabs/model/utils/ModelUtils.java +++ b/forge/src/main/java/crystalspider/justverticalslabs/model/utils/ModelUtils.java @@ -1,5 +1,8 @@ package crystalspider.justverticalslabs.model.utils; +import javax.annotation.Nonnull; + +import crystalspider.justverticalslabs.JustVerticalSlabsLoader; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.model.BakedModel; import net.minecraft.core.BlockPos; @@ -28,7 +31,16 @@ public static final BakedModel getReferredBakedModel(BlockState referredState) { * @param defaultData - {@link IModelData default model data} to return if no model data can be retrieved from the given {@link BlockState}. * @return {@link IModelData model data} of the given {@link BlockState} or the {@link IModelData default model data}. */ - public static final IModelData getReferredModelData(BlockState blockState, IModelData defaultData) { - return blockState.hasBlockEntity() ? ((EntityBlock) blockState.getBlock()).newBlockEntity(new BlockPos(0, 0, 0), blockState).getModelData() : defaultData; + @SuppressWarnings("null") + public static final @Nonnull IModelData getReferredModelData(BlockState blockState, @Nonnull IModelData defaultData) { + if (blockState.hasBlockEntity()) { + try { + return ((EntityBlock) blockState.getBlock()).newBlockEntity(new BlockPos(0, 0, 0), blockState).getModelData(); + } catch (Exception e) { + JustVerticalSlabsLoader.LOGGER.warn("Referred block + {" + blockState + "} needs a BlockEntity but returned null when trying to create one, default ModelData will be used."); + return defaultData; + } + } + return defaultData; } } diff --git a/forge/src/main/java/crystalspider/justverticalslabs/recipes/VerticalSlabRecipe.java b/forge/src/main/java/crystalspider/justverticalslabs/recipes/VerticalSlabRecipe.java index fd300b5..011eeb3 100644 --- a/forge/src/main/java/crystalspider/justverticalslabs/recipes/VerticalSlabRecipe.java +++ b/forge/src/main/java/crystalspider/justverticalslabs/recipes/VerticalSlabRecipe.java @@ -52,6 +52,7 @@ default boolean isSpecial() { * @param itemStack * @return whether the {@link ItemStack} is a Vertical Slab. */ + @SuppressWarnings("null") default boolean isVerticalSlab(ItemStack itemStack) { BlockState referredSlabState = VerticalSlabUtils.getReferredSlabState(itemStack); return !itemStack.isEmpty() && referredSlabState != null && MapsManager.slabStateMap.containsKey(referredSlabState.getBlock().asItem()); diff --git a/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/VerticalSlabCraftingRecipe.java b/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/VerticalSlabCraftingRecipe.java index 09ca6c7..e44016c 100644 --- a/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/VerticalSlabCraftingRecipe.java +++ b/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/VerticalSlabCraftingRecipe.java @@ -52,6 +52,7 @@ public boolean canCraftInDimensions(int width, int height) { * Returns the {@link ItemStack} with the result of this recipe from the given {@link CraftingContainer}. */ @Override + @SuppressWarnings("null") public final ItemStack assemble(CraftingContainer craftingContainer) { return assemble(craftingContainer.getItem(getMatchIndex(craftingContainer))); } diff --git a/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/recipes/BlockToVerticalSlabCraftingRecipe.java b/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/recipes/BlockToVerticalSlabCraftingRecipe.java index a9ed8ff..eb54efb 100644 --- a/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/recipes/BlockToVerticalSlabCraftingRecipe.java +++ b/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/recipes/BlockToVerticalSlabCraftingRecipe.java @@ -1,5 +1,7 @@ package crystalspider.justverticalslabs.recipes.crafting.recipes; +import javax.annotation.Nonnull; + import crystalspider.justverticalslabs.JustVerticalSlabsLoader; import crystalspider.justverticalslabs.recipes.crafting.VerticalSlabCraftingRecipe; import crystalspider.justverticalslabs.utils.VerticalSlabUtils; @@ -26,8 +28,10 @@ public BlockToVerticalSlabCraftingRecipe() { super(1, 3); } + @Nonnull @Override - public ItemStack assemble(ItemStack matchedItem) { + @SuppressWarnings("null") + public ItemStack assemble(@Nonnull ItemStack matchedItem) { Item slab = MapsManager.blockMap.get(matchedItem.getItem()); ItemStack verticalSlab = VerticalSlabUtils.getVerticalSlabItem(MapsManager.slabStateMap.get(slab), VerticalSlabUtils.isTranslucent(slab)); verticalSlab.setCount(6); @@ -48,6 +52,7 @@ public Serializer getSerializer() { } @Override + @SuppressWarnings("null") protected Integer getMatchIndex(CraftingContainer craftingContainer) { boolean correctPattern = true; Integer matchIndex = null, containerWidth = craftingContainer.getWidth(); diff --git a/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/recipes/SlabToBlockCraftingRecipe.java b/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/recipes/SlabToBlockCraftingRecipe.java index c1754a1..d7ca4f5 100644 --- a/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/recipes/SlabToBlockCraftingRecipe.java +++ b/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/recipes/SlabToBlockCraftingRecipe.java @@ -1,5 +1,7 @@ package crystalspider.justverticalslabs.recipes.crafting.recipes; +import javax.annotation.Nonnull; + import crystalspider.justverticalslabs.JustVerticalSlabsLoader; import crystalspider.justverticalslabs.recipes.crafting.VerticalSlabCraftingRecipe; import crystalspider.justverticalslabs.utils.VerticalSlabUtils; @@ -26,8 +28,10 @@ public SlabToBlockCraftingRecipe() { super(1, 2); } + @Nonnull @Override - public ItemStack assemble(ItemStack matchedItem) { + @SuppressWarnings("null") + public ItemStack assemble(@Nonnull ItemStack matchedItem) { return MapsManager.slabMap.get(matchedItem.getItem()).getDefaultInstance(); } @@ -44,7 +48,8 @@ public Serializer getSerializer() { return JustVerticalSlabsLoader.SLAB_TO_BLOCK_CRAFTING_RECIPE_SERIALIZER.get(); } - @Override + @Override + @SuppressWarnings("null") protected Integer getMatchIndex(CraftingContainer craftingContainer) { boolean correctPattern = true; Integer matchIndex = null, containerWidth = craftingContainer.getWidth(); diff --git a/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/recipes/SlabToVerticalSlabCraftingRecipe.java b/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/recipes/SlabToVerticalSlabCraftingRecipe.java index ed46fdf..fd69e3c 100644 --- a/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/recipes/SlabToVerticalSlabCraftingRecipe.java +++ b/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/recipes/SlabToVerticalSlabCraftingRecipe.java @@ -1,5 +1,7 @@ package crystalspider.justverticalslabs.recipes.crafting.recipes; +import javax.annotation.Nonnull; + import crystalspider.justverticalslabs.JustVerticalSlabsLoader; import crystalspider.justverticalslabs.recipes.crafting.VerticalSlabCraftingRecipe; import crystalspider.justverticalslabs.utils.VerticalSlabUtils; @@ -25,8 +27,10 @@ public SlabToVerticalSlabCraftingRecipe() { super(1, 1); } + @Nonnull @Override - public ItemStack assemble(ItemStack matchedItem) { + @SuppressWarnings("null") + public ItemStack assemble(@Nonnull ItemStack matchedItem) { return VerticalSlabUtils.getVerticalSlabItem(MapsManager.slabStateMap.get(matchedItem.getItem()), VerticalSlabUtils.isTranslucent(matchedItem.getItem())); } @@ -44,6 +48,7 @@ public Serializer getSerializer() { } @Override + @SuppressWarnings("null") protected Integer getMatchIndex(CraftingContainer craftingContainer) { boolean correctPattern = true; Integer matchIndex = null; diff --git a/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/recipes/VerticalSlabToBlockCraftingRecipe.java b/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/recipes/VerticalSlabToBlockCraftingRecipe.java index 8767ae7..997b7d5 100644 --- a/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/recipes/VerticalSlabToBlockCraftingRecipe.java +++ b/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/recipes/VerticalSlabToBlockCraftingRecipe.java @@ -1,5 +1,7 @@ package crystalspider.justverticalslabs.recipes.crafting.recipes; +import javax.annotation.Nonnull; + import crystalspider.justverticalslabs.JustVerticalSlabsLoader; import crystalspider.justverticalslabs.recipes.crafting.VerticalSlabCraftingRecipe; import crystalspider.justverticalslabs.utils.VerticalSlabUtils; @@ -25,8 +27,10 @@ public VerticalSlabToBlockCraftingRecipe() { super(2, 1); } + @Nonnull @Override - public ItemStack assemble(ItemStack matchedItem) { + @SuppressWarnings("null") + public ItemStack assemble(@Nonnull ItemStack matchedItem) { return MapsManager.slabMap.get(VerticalSlabUtils.getReferredSlabState(matchedItem).getBlock().asItem()).getDefaultInstance(); } @@ -82,6 +86,7 @@ protected Integer getMatchIndex(CraftingContainer craftingContainer) { * @param itemStack2 * @return whether both {@link ItemStack ItemStacks} represent the same kind of Vertical Slab. */ + @SuppressWarnings("null") protected boolean verticalSlabsMatch(ItemStack itemStack1, ItemStack itemStack2) { return VerticalSlabUtils.getReferredSlabState(itemStack1) == VerticalSlabUtils.getReferredSlabState(itemStack2) && MapsManager.slabMap.containsKey(VerticalSlabUtils.getReferredSlabState(itemStack1).getBlock().asItem()); } diff --git a/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/recipes/VerticalSlabToSlabCraftingRecipe.java b/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/recipes/VerticalSlabToSlabCraftingRecipe.java index 4f35ae7..8407592 100644 --- a/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/recipes/VerticalSlabToSlabCraftingRecipe.java +++ b/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/recipes/VerticalSlabToSlabCraftingRecipe.java @@ -1,5 +1,7 @@ package crystalspider.justverticalslabs.recipes.crafting.recipes; +import javax.annotation.Nonnull; + import crystalspider.justverticalslabs.JustVerticalSlabsLoader; import crystalspider.justverticalslabs.recipes.crafting.VerticalSlabCraftingRecipe; import crystalspider.justverticalslabs.utils.VerticalSlabUtils; @@ -24,8 +26,10 @@ public VerticalSlabToSlabCraftingRecipe() { super(1, 1); } + @Nonnull @Override - public ItemStack assemble(ItemStack matchedItem) { + @SuppressWarnings("null") + public ItemStack assemble(@Nonnull ItemStack matchedItem) { return VerticalSlabUtils.getReferredSlabState(matchedItem).getBlock().asItem().getDefaultInstance(); } diff --git a/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/recipes/WaxedVerticalSlabCraftingRecipe.java b/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/recipes/WaxedVerticalSlabCraftingRecipe.java index f31911f..2109953 100644 --- a/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/recipes/WaxedVerticalSlabCraftingRecipe.java +++ b/forge/src/main/java/crystalspider/justverticalslabs/recipes/crafting/recipes/WaxedVerticalSlabCraftingRecipe.java @@ -1,5 +1,7 @@ package crystalspider.justverticalslabs.recipes.crafting.recipes; +import javax.annotation.Nonnull; + import crystalspider.justverticalslabs.JustVerticalSlabsLoader; import crystalspider.justverticalslabs.recipes.crafting.VerticalSlabCraftingRecipe; import crystalspider.justverticalslabs.utils.VerticalSlabUtils; @@ -24,8 +26,10 @@ public WaxedVerticalSlabCraftingRecipe() { super(1, 1); } + @Nonnull @Override - public ItemStack assemble(ItemStack matchedItem) { + @SuppressWarnings("null") + public ItemStack assemble(@Nonnull ItemStack matchedItem) { Item slab = MapsManager.waxingMap.get(VerticalSlabUtils.getReferredSlabState(matchedItem).getBlock().asItem()); return VerticalSlabUtils.getVerticalSlabItem(MapsManager.slabStateMap.get(slab), VerticalSlabUtils.isTranslucent(slab)); } @@ -49,6 +53,7 @@ public boolean canCraftInDimensions(int width, int height) { } @Override + @SuppressWarnings("null") protected Integer getMatchIndex(CraftingContainer craftingContainer) { boolean correctPattern = true, hasHoneycomb = false; Integer matchIndex = null; diff --git a/forge/src/main/java/crystalspider/justverticalslabs/recipes/stonecutter/recipes/BlockToVerticalSlabStonecutterRecipe.java b/forge/src/main/java/crystalspider/justverticalslabs/recipes/stonecutter/recipes/BlockToVerticalSlabStonecutterRecipe.java index 947c2c0..870ddcd 100644 --- a/forge/src/main/java/crystalspider/justverticalslabs/recipes/stonecutter/recipes/BlockToVerticalSlabStonecutterRecipe.java +++ b/forge/src/main/java/crystalspider/justverticalslabs/recipes/stonecutter/recipes/BlockToVerticalSlabStonecutterRecipe.java @@ -44,11 +44,13 @@ public ItemStack getResultItem() { } @Override + @SuppressWarnings("null") public boolean matches(Container container, Level level) { return MapsManager.stonecuttingMap.containsKey(container.getItem(0).getItem()); } @Override + @SuppressWarnings("null") public ItemStack assemble(Container container) { Item slab = MapsManager.stonecuttingMap.get(container.getItem(0).getItem()); ItemStack verticalSlab = VerticalSlabUtils.getVerticalSlabItem(MapsManager.slabStateMap.get(slab), VerticalSlabUtils.isTranslucent(slab)); diff --git a/forge/src/main/java/crystalspider/justverticalslabs/utils/VerticalSlabUtils.java b/forge/src/main/java/crystalspider/justverticalslabs/utils/VerticalSlabUtils.java index 4109bf9..0d5abc1 100644 --- a/forge/src/main/java/crystalspider/justverticalslabs/utils/VerticalSlabUtils.java +++ b/forge/src/main/java/crystalspider/justverticalslabs/utils/VerticalSlabUtils.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.Map; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import com.google.common.collect.ImmutableMap; @@ -65,6 +66,8 @@ public class VerticalSlabUtils { * @param referredSlabState * @return Vertical Slab {@link IModelData}. */ + @Nonnull + @SuppressWarnings("null") public static final IModelData buildModelData(BlockState referredSlabState) { return new ModelDataMap.Builder().withInitial(REFERRED_SLAB_STATE, referredSlabState).build(); } @@ -95,6 +98,7 @@ public static final boolean isTranslucent(BlockState referredSlabState) { * @param slab * @return check value. */ + @SuppressWarnings("null") public static final boolean isTranslucent(Item slab) { return MapsManager.translucentMap.containsKey(slab); } @@ -258,6 +262,7 @@ public static final BlockState getReferredBlockState(BlockGetter getter, BlockPo * @return {@link BlockState referredBlockState} or {@code null}. */ @Nullable + @SuppressWarnings("null") public static final BlockState getReferredBlockState(BlockState referredSlabState) { if (referredSlabState != null && MapsManager.slabMap.containsKey(referredSlabState.getBlock().asItem())) { return Block.byItem(MapsManager.slabMap.get(referredSlabState.getBlock().asItem())).defaultBlockState(); @@ -323,6 +328,7 @@ public static final void setFallbackRecipeManager(RecipeManager recipeManager) { /** * Adds all Vertical Vlabs to the search tree if not already present. */ + @SuppressWarnings("null") public static final void addToSearchTree() { int intialSize = inSearchTree.size(); MutableSearchTree creativeSearchTree = Minecraft.getInstance().getSearchTree(SearchRegistry.CREATIVE_NAMES); diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index d2dbb6a..1ddf55d 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -1,15 +1,15 @@ modLoader="javafml" -loaderVersion="[40,)" +loaderVersion="[${loader_version},)" license="GNU AGPLv3" -issueTrackerURL="https://github.com/Nyphet/just-vertical-slabs/issues" #optional +issueTrackerURL="https://github.com/${github_user}/${modid_kebab}/issues" #optional [[mods]] -modId="modid" -version="${modVersion}" -displayName="${modTitle}" -updateJSONURL="https://raw.githubusercontent.com/Nyphet/just-vertical-slabs/master/forge/updates.json" #optional -displayURL="https://github.com/Nyphet/just-vertical-slabs/tree/${mcVersion}" #optional -logoFile="just-vertical-slabs.gif" #optional -credits="A very big thank you goes to the Forge team that allowed anyone to mod Minecraft for free and their support in the Forge Forums.\nIn particular I want to thank diesieben07 that followed me throughtout most of the development, without him none of this would have been possible." #optional +modId="${modid}" +version="${mod_version}" +displayName="${mod_title}" +updateJSONURL="https://raw.githubusercontent.com/${github_user}/${modid_kebab}/master/forge/updates.json" #optional +displayURL="https://github.com/${github_user}/${modid_kebab}/tree/${minecraft_version}" #optional +logoFile="${modid_kebab}.gif" #optional +# credits="Thank who deserves it." #optional authors="${author}" #optional # Display Test controls the display for your mod in the server connection screen # MATCH_VERSION means that your mod will cause a red X if the versions on client and server differ. This is the default behaviour and should be what you choose if you have server and client elements to your mod. @@ -18,17 +18,16 @@ authors="${author}" #optional # NONE means that no display test is set on your mod. You need to do this yourself, see IExtensionPoint.DisplayTest for more information. You can define any scheme you wish with this value. # IMPORTANT NOTE: this is NOT an instruction as to which environments (CLIENT or DEDICATED SERVER) your mod loads on. Your mod should load (and maybe do nothing!) whereever it finds itself. #displayTest="MATCH_VERSION" # MATCH_VERSION is the default if nothing is specified #optional -description="Finally build with Vertical Slabs in Vanilla or with any mod you've installed!" -[[dependencies.modid]] +description="Let Soul Fire burn!" +[[dependencies.${modid}]] modId="forge" mandatory=true - versionRange="[${forgeVersion},)" + versionRange="[${loader_version}${forge_subversion},)" ordering="NONE" side="BOTH" -[[dependencies.modid]] +[[dependencies.${modid}]] modId="minecraft" mandatory=true - versionRange="[${mcVersion},)" + versionRange="[${minecraft_version},)" ordering="NONE" side="BOTH" -#optional diff --git a/forge/src/main/resources/pack.mcmeta b/forge/src/main/resources/pack.mcmeta index 1e21c31..dfa08d2 100644 --- a/forge/src/main/resources/pack.mcmeta +++ b/forge/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { - "description": "justverticalslabs resources", + "description": "${modid} resources", "pack_format": 9 } } diff --git a/forge/updates.json b/forge/updates.json deleted file mode 100644 index 6b70887..0000000 --- a/forge/updates.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "homepage": "https://www.curseforge.com/minecraft/mc-mods/just-vertical-slabs/files", - "1.18.2": { - "3.2.0.3": "https://www.curseforge.com/minecraft/mc-mods/just-vertical-slabs/files/3903948", - "3.2.0.2": "https://www.curseforge.com/minecraft/mc-mods/just-vertical-slabs/files/3884066", - "3.2.0.1": "https://www.curseforge.com/minecraft/mc-mods/just-vertical-slabs/files/3881946", - "3.2.0.0": "https://www.curseforge.com/minecraft/mc-mods/just-vertical-slabs/files/3871060", - "3.2.0.0-beta1": "https://www.curseforge.com/minecraft/mc-mods/just-vertical-slabs/files/3817189", - "3.1.0.1": "https://www.curseforge.com/minecraft/mc-mods/just-vertical-slabs/files/3802450", - "3.1.0.0": "https://www.curseforge.com/minecraft/mc-mods/just-vertical-slabs/files/3801259", - "3.0.0.0": "https://www.curseforge.com/minecraft/mc-mods/just-vertical-slabs/files/3793049", - "2.0.0.0": "https://www.curseforge.com/minecraft/mc-mods/just-vertical-slabs/files/3786215", - "1.0.0.0": "https://www.curseforge.com/minecraft/mc-mods/just-vertical-slabs/files/3785696" - }, - "promos": { - "1.18.2-latest": "3.2.0.3", - "1.18.2-recommended": "3.2.0.3" - } -} \ No newline at end of file diff --git a/publish.cmd b/publish.cmd new file mode 100644 index 0000000..bf6bf26 --- /dev/null +++ b/publish.cmd @@ -0,0 +1,7 @@ +@REM cd ./fabric +@REM powershell -Command "./gradlew githubRelease"; +@REM powershell -Command "./gradlew curseforge"; +@REM cd ../forge +cd ./forge +powershell -Command "./gradlew githubRelease"; +powershell -Command "./gradlew curseforge"; \ No newline at end of file