diff --git a/build.gradle b/build.gradle index eb3851a..c531424 100755 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,11 @@ plugins { - id 'fabric-loom' version '1.1-SNAPSHOT' + id 'fabric-loom' version '1.6-SNAPSHOT' id 'maven-publish' + id "me.shedaniel.unified-publishing" version "0.1.+" } -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 +sourceCompatibility = JavaVersion.VERSION_21 +targetCompatibility = JavaVersion.VERSION_21 archivesBaseName = project.archives_base_name version = project.mod_version @@ -64,8 +65,7 @@ tasks.withType(JavaCompile).configureEach { // If Javadoc is generated, this must be specified in that task too. it.options.encoding = "UTF-8" - // Minecraft 1.17 (21w19a) upwards uses Java 16. - it.options.release = 17 + it.options.release = 21 } sourceSets { main { @@ -112,3 +112,55 @@ publishing { // retrieving dependencies. } } + +ext { + releaseChangelog = { + def changes = new StringBuilder() + changes << "## This Rocks v$project.version for $project.minecraft_version\n[View the changelog](https://www.github.com/TeamMidnightDust/ThisRocks/commits/)" + def proc = "git log --max-count=1 --pretty=format:%s".execute() + proc.in.eachLine { line -> + def processedLine = line.toString() + if (!processedLine.contains("New translations") && !processedLine.contains("Merge") && !processedLine.contains("branch")) { + changes << "\n- ${processedLine.capitalize()}" + } + } + proc.waitFor() + return changes.toString() + } +} + +unifiedPublishing { + project { + displayName = "This Rocks! v$project.version - Fabric $project.minecraft_version" + releaseType = "$project.release_type" + changelog = releaseChangelog() + gameVersions = [] + gameLoaders = ["fabric","quilt"] + mainPublication remapJar + relations { + includes { + curseforge = "midnightlib" + modrinth = "midnightlib" + } + } + + var CURSEFORGE_TOKEN = project.findProperty("CURSEFORGE_TOKEN") ?: System.getenv("CURSEFORGE_TOKEN") + if (CURSEFORGE_TOKEN != null) { + curseforge { + token = CURSEFORGE_TOKEN + id = rootProject.curseforge_id + gameVersions.addAll "Java 21", project.minecraft_version + } + } + + var MODRINTH_TOKEN = project.findProperty("MODRINTH_TOKEN") ?: System.getenv("MODRINTH_TOKEN") + if (MODRINTH_TOKEN != null) { + modrinth { + token = MODRINTH_TOKEN + id = rootProject.modrinth_id + version = "$project.version" + gameVersions.addAll project.minecraft_version + } + } + } +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 99e0534..566a1f6 100755 --- a/gradle.properties +++ b/gradle.properties @@ -3,16 +3,19 @@ org.gradle.jvmargs=-Xmx2G # Fabric Properties # check these on https://fabricmc.net/use - minecraft_version=1.19.4 - yarn_mappings=1.19.4+build.2 - loader_version=0.14.19 + minecraft_version=1.21 + yarn_mappings=1.21+build.2 + loader_version=0.15.11 # Mod Properties - mod_version = 1.7.0 + mod_version = 1.8.0 maven_group = eu.midnightdust.motschen archives_base_name = rocks + release_type=release + curseforge_id=416283 + modrinth_id=Sb5ypgDP # Dependencies # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api - fabric_version=0.78.0+1.19.4 - midnightlib_version=1.3.0-fabric + fabric_version=0.100.1+1.21 + midnightlib_version=1.5.7-fabric diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180..e644113 100755 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e750102..a441313 100755 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c787..b740cf1 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +80,11 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +131,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ @@ -205,6 +214,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 107acd3..7101f8e 100755 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,89 +1,92 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle b/settings.gradle index 5b60df3..99f54aa 100755 --- a/settings.gradle +++ b/settings.gradle @@ -1,10 +1,10 @@ pluginManagement { repositories { - jcenter() maven { name = 'Fabric' url = 'https://maven.fabricmc.net/' } + maven { url "https://maven.architectury.dev/" } gradlePluginPortal() } } diff --git a/src/main/java/eu/midnightdust/motschen/rocks/RocksClient.java b/src/main/java/eu/midnightdust/motschen/rocks/RocksClient.java index aa527c1..d4f78de 100755 --- a/src/main/java/eu/midnightdust/motschen/rocks/RocksClient.java +++ b/src/main/java/eu/midnightdust/motschen/rocks/RocksClient.java @@ -1,14 +1,26 @@ package eu.midnightdust.motschen.rocks; +import eu.midnightdust.motschen.rocks.blockstates.StarfishVariation; import net.fabricmc.api.ClientModInitializer; import net.minecraft.client.item.ModelPredicateProviderRegistry; +import net.minecraft.component.DataComponentTypes; +import net.minecraft.item.ItemStack; import net.minecraft.util.Identifier; +import java.util.Objects; + +import static eu.midnightdust.motschen.rocks.RocksMain.STARFISH_VARIATION; + public class RocksClient implements ClientModInitializer { @Override public void onInitializeClient() { - ModelPredicateProviderRegistry.register(RocksMain.Starfish.asItem(), new Identifier("red"), (stack, world, entity, seed) -> (stack.getNbt() != null && stack.getNbt().getString("variation").equals("red")) ? 1 : 0); - ModelPredicateProviderRegistry.register(RocksMain.Starfish.asItem(), new Identifier("pink"), (stack, world, entity, seed) -> (stack.getNbt() != null && stack.getNbt().getString("variation").equals("pink")) ? 1 : 0); - ModelPredicateProviderRegistry.register(RocksMain.Starfish.asItem(), new Identifier("orange"), (stack, world, entity, seed) -> (stack.getNbt() != null && stack.getNbt().getString("variation").equals("orange")) ? 1 : 0); + ModelPredicateProviderRegistry.register(RocksMain.Starfish.asItem(), Identifier.of("red"), (stack, world, entity, seed) -> matchesVariation(stack, StarfishVariation.RED)); + ModelPredicateProviderRegistry.register(RocksMain.Starfish.asItem(), Identifier.of("pink"), (stack, world, entity, seed) -> matchesVariation(stack, StarfishVariation.PINK)); + ModelPredicateProviderRegistry.register(RocksMain.Starfish.asItem(), Identifier.of("orange"), (stack, world, entity, seed) -> matchesVariation(stack, StarfishVariation.ORANGE)); + } + private static Integer matchesVariation(ItemStack stack, StarfishVariation variation) { + var blockStateData = stack.getComponents().get(DataComponentTypes.BLOCK_STATE); + if (blockStateData == null || blockStateData.isEmpty() || blockStateData.getValue(STARFISH_VARIATION) == null) return 0; + return Objects.equals(blockStateData.getValue(STARFISH_VARIATION), variation) ? 1 : 0; } } diff --git a/src/main/java/eu/midnightdust/motschen/rocks/RocksMain.java b/src/main/java/eu/midnightdust/motschen/rocks/RocksMain.java index 8104267..cb3adbd 100755 --- a/src/main/java/eu/midnightdust/motschen/rocks/RocksMain.java +++ b/src/main/java/eu/midnightdust/motschen/rocks/RocksMain.java @@ -1,6 +1,5 @@ package eu.midnightdust.motschen.rocks; -import com.google.common.collect.Lists; import eu.midnightdust.motschen.rocks.block.*; import eu.midnightdust.motschen.rocks.block.blockentity.BlockEntityInit; import eu.midnightdust.motschen.rocks.blockstates.RockVariation; @@ -11,14 +10,18 @@ import eu.midnightdust.motschen.rocks.config.RocksConfig; import eu.midnightdust.motschen.rocks.world.*; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; +import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; import net.minecraft.block.Block; import net.minecraft.item.*; -import net.minecraft.resource.featuretoggle.FeatureFlags; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; import net.minecraft.state.property.EnumProperty; +import net.minecraft.text.Text; import net.minecraft.util.Identifier; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import static eu.midnightdust.motschen.rocks.RocksRegistryUtils.registerBlockWithItem; @@ -71,58 +74,58 @@ public class RocksMain implements ModInitializer { public static Item NetherrackSplitter = new Item(new Item.Settings()); public static Item SoulSoilSplitter = new Item(new Item.Settings()); public static List groupItems = new ArrayList<>(); - public static ItemStack cherryStack; public static ItemGroup RocksGroup; + public static final RegistryKey ROCKS_GROUP = RegistryKey.of(RegistryKeys.ITEM_GROUP, Identifier.of(MOD_ID, "rocks")); @Override public void onInitialize() { RocksConfig.init("rocks", RocksConfig.class); - registerBlockWithItem(new Identifier(MOD_ID,"rock"), Rock); - registerBlockWithItem(new Identifier(MOD_ID,"granite_rock"), GraniteRock); - registerBlockWithItem(new Identifier(MOD_ID,"diorite_rock"), DioriteRock); - registerBlockWithItem(new Identifier(MOD_ID,"andesite_rock"), AndesiteRock); - registerBlockWithItem(new Identifier(MOD_ID,"sand_rock"), SandRock); - registerBlockWithItem(new Identifier(MOD_ID,"red_sand_rock"), RedSandRock); - registerBlockWithItem(new Identifier(MOD_ID,"gravel_rock"), GravelRock); - registerBlockWithItem(new Identifier(MOD_ID,"end_stone_rock"), EndstoneRock); - registerBlockWithItem(new Identifier(MOD_ID,"netherrack_rock"), NetherrackRock); - registerBlockWithItem(new Identifier(MOD_ID,"soul_soil_rock"), SoulSoilRock); + registerBlockWithItem(Identifier.of(MOD_ID,"rock"), Rock); + registerBlockWithItem(Identifier.of(MOD_ID,"granite_rock"), GraniteRock); + registerBlockWithItem(Identifier.of(MOD_ID,"diorite_rock"), DioriteRock); + registerBlockWithItem(Identifier.of(MOD_ID,"andesite_rock"), AndesiteRock); + registerBlockWithItem(Identifier.of(MOD_ID,"sand_rock"), SandRock); + registerBlockWithItem(Identifier.of(MOD_ID,"red_sand_rock"), RedSandRock); + registerBlockWithItem(Identifier.of(MOD_ID,"gravel_rock"), GravelRock); + registerBlockWithItem(Identifier.of(MOD_ID,"end_stone_rock"), EndstoneRock); + registerBlockWithItem(Identifier.of(MOD_ID,"netherrack_rock"), NetherrackRock); + registerBlockWithItem(Identifier.of(MOD_ID,"soul_soil_rock"), SoulSoilRock); - registerBlockWithItem(new Identifier(MOD_ID,"oak_stick"), OakStick); - registerBlockWithItem(new Identifier(MOD_ID,"spruce_stick"), SpruceStick); - registerBlockWithItem(new Identifier(MOD_ID,"birch_stick"), BirchStick); - registerBlockWithItem(new Identifier(MOD_ID,"acacia_stick"), AcaciaStick); - registerBlockWithItem(new Identifier(MOD_ID,"jungle_stick"), JungleStick); - registerBlockWithItem(new Identifier(MOD_ID,"dark_oak_stick"), DarkOakStick); - registerBlockWithItem(new Identifier(MOD_ID,"mangrove_stick"), MangroveStick); - registerBlockWithItem(new Identifier(MOD_ID,"cherry_stick"), CherryStick); - registerBlockWithItem(new Identifier(MOD_ID,"bamboo_stick"), BambooStick); - registerBlockWithItem(new Identifier(MOD_ID,"crimson_stick"), CrimsonStick); - registerBlockWithItem(new Identifier(MOD_ID,"warped_stick"), WarpedStick); + registerBlockWithItem(Identifier.of(MOD_ID,"oak_stick"), OakStick); + registerBlockWithItem(Identifier.of(MOD_ID,"spruce_stick"), SpruceStick); + registerBlockWithItem(Identifier.of(MOD_ID,"birch_stick"), BirchStick); + registerBlockWithItem(Identifier.of(MOD_ID,"acacia_stick"), AcaciaStick); + registerBlockWithItem(Identifier.of(MOD_ID,"jungle_stick"), JungleStick); + registerBlockWithItem(Identifier.of(MOD_ID,"dark_oak_stick"), DarkOakStick); + registerBlockWithItem(Identifier.of(MOD_ID,"mangrove_stick"), MangroveStick); + registerBlockWithItem(Identifier.of(MOD_ID,"cherry_stick"), CherryStick); + registerBlockWithItem(Identifier.of(MOD_ID,"bamboo_stick"), BambooStick); + registerBlockWithItem(Identifier.of(MOD_ID,"crimson_stick"), CrimsonStick); + registerBlockWithItem(Identifier.of(MOD_ID,"warped_stick"), WarpedStick); - registerBlockWithItem(new Identifier(MOD_ID,"geyser"), Geyser); - registerBlockWithItem(new Identifier(MOD_ID,"nether_geyser"), NetherGeyser); + registerBlockWithItem(Identifier.of(MOD_ID,"geyser"), Geyser); + registerBlockWithItem(Identifier.of(MOD_ID,"nether_geyser"), NetherGeyser); - registerBlockWithItem(new Identifier(MOD_ID,"pinecone"), Pinecone); - registerBlockWithItem(new Identifier(MOD_ID,"seashell"), Seashell); - registerBlockWithItem(new Identifier(MOD_ID,"starfish"), Starfish); + registerBlockWithItem(Identifier.of(MOD_ID,"pinecone"), Pinecone); + registerBlockWithItem(Identifier.of(MOD_ID,"seashell"), Seashell); + registerBlockWithItem(Identifier.of(MOD_ID,"starfish"), Starfish); - registerItem(new Identifier(MOD_ID,"cobblestone_splitter"), CobblestoneSplitter); - registerItem(new Identifier(MOD_ID,"granite_splitter"), GraniteSplitter); - registerItem(new Identifier(MOD_ID,"diorite_splitter"), DioriteSplitter); - registerItem(new Identifier(MOD_ID,"andesite_splitter"), AndesiteSplitter); - registerItem(new Identifier(MOD_ID,"sandstone_splitter"), SandStoneSplitter); - registerItem(new Identifier(MOD_ID,"red_sandstone_splitter"), RedSandStoneSplitter); - registerItem(new Identifier(MOD_ID,"end_stone_splitter"), EndStoneSplitter); - registerItem(new Identifier(MOD_ID,"netherrack_splitter"), NetherrackSplitter); - registerItem(new Identifier(MOD_ID,"soul_soil_splitter"), SoulSoilSplitter); + registerItem(Identifier.of(MOD_ID,"cobblestone_splitter"), CobblestoneSplitter); + registerItem(Identifier.of(MOD_ID,"granite_splitter"), GraniteSplitter); + registerItem(Identifier.of(MOD_ID,"diorite_splitter"), DioriteSplitter); + registerItem(Identifier.of(MOD_ID,"andesite_splitter"), AndesiteSplitter); + registerItem(Identifier.of(MOD_ID,"sandstone_splitter"), SandStoneSplitter); + registerItem(Identifier.of(MOD_ID,"red_sandstone_splitter"), RedSandStoneSplitter); + registerItem(Identifier.of(MOD_ID,"end_stone_splitter"), EndStoneSplitter); + registerItem(Identifier.of(MOD_ID,"netherrack_splitter"), NetherrackSplitter); + registerItem(Identifier.of(MOD_ID,"soul_soil_splitter"), SoulSoilSplitter); - RocksGroup = FabricItemGroup.builder(new Identifier(MOD_ID, "rocks")).icon(() -> new ItemStack(RocksMain.Rock)).entries(((displayContext, entries) -> { + RocksGroup = FabricItemGroup.builder().displayName(Text.translatable("itemGroup.rocks.rocks")).icon(() -> new ItemStack(RocksMain.Rock)).entries(((displayContext, entries) -> { List visibleGroupItems = new ArrayList<>(groupItems); - if (!displayContext.enabledFeatures().contains(FeatureFlags.UPDATE_1_20)) visibleGroupItems.remove(cherryStack); entries.addAll(visibleGroupItems); })).build(); + Registry.register(Registries.ITEM_GROUP, ROCKS_GROUP, RocksGroup); new FeatureRegistry<>(); FeatureInjector.init(); BlockEntityInit.init(); diff --git a/src/main/java/eu/midnightdust/motschen/rocks/RocksRegistryUtils.java b/src/main/java/eu/midnightdust/motschen/rocks/RocksRegistryUtils.java index c120904..bd0c275 100644 --- a/src/main/java/eu/midnightdust/motschen/rocks/RocksRegistryUtils.java +++ b/src/main/java/eu/midnightdust/motschen/rocks/RocksRegistryUtils.java @@ -1,6 +1,10 @@ package eu.midnightdust.motschen.rocks; +import eu.midnightdust.motschen.rocks.blockstates.StarfishVariation; import net.minecraft.block.Block; +import net.minecraft.component.ComponentMap; +import net.minecraft.component.DataComponentTypes; +import net.minecraft.component.type.BlockStateComponent; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -9,6 +13,8 @@ import net.minecraft.util.Identifier; import net.minecraft.world.gen.feature.ConfiguredFeature; import net.minecraft.world.gen.feature.PlacedFeature; +import static eu.midnightdust.motschen.rocks.RocksMain.STARFISH_VARIATION; + public class RocksRegistryUtils { public static void registerBlockWithItem(Identifier id, Block block) { Registry.register(Registries.BLOCK, id, block); @@ -16,28 +22,27 @@ public class RocksRegistryUtils { } public static void registerItem(Identifier id, Item item) { Registry.register(Registries.ITEM, id, item); - if (id.equals(new Identifier(RocksMain.MOD_ID, "starfish"))) putStarfishItems(item); + if (id.equals(Identifier.of(RocksMain.MOD_ID, "starfish"))) putStarfishItems(item); else { ItemStack itemStack = new ItemStack(item); RocksMain.groupItems.add(itemStack); - if (id.equals(new Identifier(RocksMain.MOD_ID, "cherry_stick"))) RocksMain.cherryStack = itemStack; } } private static void putStarfishItems(Item starfish) { ItemStack redStarfish = new ItemStack(starfish); - redStarfish.getOrCreateNbt().putString("variation", "red"); + redStarfish.applyComponentsFrom(ComponentMap.builder().add(DataComponentTypes.BLOCK_STATE, BlockStateComponent.DEFAULT.with(STARFISH_VARIATION, StarfishVariation.RED)).build()); RocksMain.groupItems.add(redStarfish); ItemStack orangeStarfish = new ItemStack(starfish); - orangeStarfish.getOrCreateNbt().putString("variation", "orange"); + orangeStarfish.applyComponentsFrom(ComponentMap.builder().add(DataComponentTypes.BLOCK_STATE, BlockStateComponent.DEFAULT.with(STARFISH_VARIATION, StarfishVariation.ORANGE)).build()); RocksMain.groupItems.add(orangeStarfish); ItemStack pinkStarfish = new ItemStack(starfish); - pinkStarfish.getOrCreateNbt().putString("variation", "pink"); + pinkStarfish.applyComponentsFrom(ComponentMap.builder().add(DataComponentTypes.BLOCK_STATE, BlockStateComponent.DEFAULT.with(STARFISH_VARIATION, StarfishVariation.PINK)).build()); RocksMain.groupItems.add(pinkStarfish); } public static void register(Registerable> context, String name, ConfiguredFeature feature) { - context.register(RegistryKey.of(RegistryKeys.CONFIGURED_FEATURE, new Identifier(RocksMain.MOD_ID, name)), feature); + context.register(RegistryKey.of(RegistryKeys.CONFIGURED_FEATURE, Identifier.of(RocksMain.MOD_ID, name)), feature); } public static void register(Registerable context, String name, PlacedFeature feature) { - context.register(RegistryKey.of(RegistryKeys.PLACED_FEATURE, new Identifier(RocksMain.MOD_ID, name)), feature); + context.register(RegistryKey.of(RegistryKeys.PLACED_FEATURE, Identifier.of(RocksMain.MOD_ID, name)), feature); } } diff --git a/src/main/java/eu/midnightdust/motschen/rocks/block/NetherGeyser.java b/src/main/java/eu/midnightdust/motschen/rocks/block/NetherGeyser.java index 68d12eb..89ae128 100755 --- a/src/main/java/eu/midnightdust/motschen/rocks/block/NetherGeyser.java +++ b/src/main/java/eu/midnightdust/motschen/rocks/block/NetherGeyser.java @@ -1,5 +1,6 @@ package eu.midnightdust.motschen.rocks.block; +import com.mojang.serialization.MapCodec; import eu.midnightdust.motschen.rocks.block.blockentity.BlockEntityInit; import eu.midnightdust.motschen.rocks.block.blockentity.NetherGeyserBlockEntity; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; @@ -27,9 +28,15 @@ public class NetherGeyser extends BlockWithEntity implements BlockEntityProvider public static final BooleanProperty ACTIVE = BooleanProperty.of("active"); public NetherGeyser() { - super(FabricBlockSettings.copy(Blocks.STONE).strength(10).noCollision().nonOpaque().sounds(BlockSoundGroup.STONE)); + super(AbstractBlock.Settings.copy(Blocks.STONE).strength(10).noCollision().nonOpaque().sounds(BlockSoundGroup.STONE)); this.setDefaultState(this.stateManager.getDefaultState().with(ACTIVE, false)); } + + @Override + protected MapCodec getCodec() { + return null; + } + @Override public BlockRenderType getRenderType(BlockState state) { return BlockRenderType.MODEL; @@ -40,7 +47,7 @@ public class NetherGeyser extends BlockWithEntity implements BlockEntityProvider } @Nullable public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { - return checkType(type, BlockEntityInit.NETHER_GEYSER_BE, NetherGeyserBlockEntity::tick); + return validateTicker(type, BlockEntityInit.NETHER_GEYSER_BE, NetherGeyserBlockEntity::tick); } @Override public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) { diff --git a/src/main/java/eu/midnightdust/motschen/rocks/block/OverworldGeyser.java b/src/main/java/eu/midnightdust/motschen/rocks/block/OverworldGeyser.java index 418273e..e001c91 100755 --- a/src/main/java/eu/midnightdust/motschen/rocks/block/OverworldGeyser.java +++ b/src/main/java/eu/midnightdust/motschen/rocks/block/OverworldGeyser.java @@ -1,5 +1,6 @@ package eu.midnightdust.motschen.rocks.block; +import com.mojang.serialization.MapCodec; import eu.midnightdust.motschen.rocks.block.blockentity.BlockEntityInit; import eu.midnightdust.motschen.rocks.block.blockentity.OverworldGeyserBlockEntity; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; @@ -31,9 +32,15 @@ public class OverworldGeyser extends BlockWithEntity implements BlockEntityProvi public static final BooleanProperty SNOWY = Properties.SNOWY; public OverworldGeyser() { - super(FabricBlockSettings.copy(Blocks.STONE).strength(10).noCollision().nonOpaque().sounds(BlockSoundGroup.STONE)); + super(AbstractBlock.Settings.copy(Blocks.STONE).strength(10).noCollision().nonOpaque().sounds(BlockSoundGroup.STONE)); this.setDefaultState(this.stateManager.getDefaultState().with(ACTIVE, false).with(SNOWY, false)); } + + @Override + protected MapCodec getCodec() { + return null; + } + @Override public BlockRenderType getRenderType(BlockState state) { return BlockRenderType.MODEL; @@ -44,7 +51,7 @@ public class OverworldGeyser extends BlockWithEntity implements BlockEntityProvi } @Nullable public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { - return checkType(type, BlockEntityInit.OVERWORLD_GEYSER_BE, OverworldGeyserBlockEntity::tick); + return validateTicker(type, BlockEntityInit.OVERWORLD_GEYSER_BE, OverworldGeyserBlockEntity::tick); } @Override public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) { diff --git a/src/main/java/eu/midnightdust/motschen/rocks/block/Pinecone.java b/src/main/java/eu/midnightdust/motschen/rocks/block/Pinecone.java index ea8c489..7212ace 100755 --- a/src/main/java/eu/midnightdust/motschen/rocks/block/Pinecone.java +++ b/src/main/java/eu/midnightdust/motschen/rocks/block/Pinecone.java @@ -2,6 +2,7 @@ package eu.midnightdust.motschen.rocks.block; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.block.*; +import net.minecraft.item.ItemPlacementContext; import net.minecraft.sound.BlockSoundGroup; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -15,7 +16,7 @@ public class Pinecone extends Block { private static final VoxelShape SHAPE; public Pinecone() { - super(FabricBlockSettings.copy(Blocks.POPPY).nonOpaque().sounds(BlockSoundGroup.WOOD)); + super(AbstractBlock.Settings.copy(Blocks.POPPY).nonOpaque().sounds(BlockSoundGroup.WOOD)); this.setDefaultState(this.stateManager.getDefaultState()); } @@ -33,4 +34,6 @@ public class Pinecone extends Block { public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) { return !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, direction, newState, world, pos, posFrom); } + protected boolean isTransparent(BlockState state, BlockView world, BlockPos pos) {return true;} + protected boolean canReplace(BlockState state, ItemPlacementContext context) {return true;} } diff --git a/src/main/java/eu/midnightdust/motschen/rocks/block/Rock.java b/src/main/java/eu/midnightdust/motschen/rocks/block/Rock.java index 323c428..1a08b40 100755 --- a/src/main/java/eu/midnightdust/motschen/rocks/block/Rock.java +++ b/src/main/java/eu/midnightdust/motschen/rocks/block/Rock.java @@ -2,7 +2,6 @@ package eu.midnightdust.motschen.rocks.block; import eu.midnightdust.motschen.rocks.RocksMain; import eu.midnightdust.motschen.rocks.blockstates.RockVariation; -import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.block.*; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemPlacementContext; @@ -25,10 +24,11 @@ import java.util.Objects; public class Rock extends Block { private static final VoxelShape SHAPE; + private static final VoxelShape SHAPE_LARGE; private static final EnumProperty ROCK_VARIATION = RocksMain.ROCK_VARIATION; public Rock() { - super(FabricBlockSettings.copy(Blocks.POPPY).nonOpaque().sounds(BlockSoundGroup.STONE)); + super(AbstractBlock.Settings.copy(Blocks.POPPY).nonOpaque().sounds(BlockSoundGroup.STONE)); this.setDefaultState(this.stateManager.getDefaultState().with(ROCK_VARIATION, RockVariation.TINY)); } @@ -37,7 +37,8 @@ public class Rock extends Block { return Objects.requireNonNull(super.getPlacementState(itemPlacementContext)) .with(ROCK_VARIATION, RockVariation.TINY); } - public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { + @Override + public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { if (player.isCreative()) { if (state.get(ROCK_VARIATION) == RockVariation.TINY) { world.setBlockState(pos, state.with(ROCK_VARIATION, RockVariation.SMALL)); @@ -62,10 +63,11 @@ public class Rock extends Block { } @Override public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) { - return SHAPE; + return state.get(ROCK_VARIATION).equals(RockVariation.LARGE) ? SHAPE_LARGE : SHAPE; } static { - SHAPE = createCuboidShape(0, 0, 0, 16, 3, 16); + SHAPE = createCuboidShape(0, 0, 0, 16, 2, 16); + SHAPE_LARGE = createCuboidShape(0, 0, 0, 16, 3, 16); } public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { @@ -74,4 +76,6 @@ public class Rock extends Block { public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) { return !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, direction, newState, world, pos, posFrom); } + protected boolean isTransparent(BlockState state, BlockView world, BlockPos pos) {return true;} + protected boolean canReplace(BlockState state, ItemPlacementContext context) {return true;} } diff --git a/src/main/java/eu/midnightdust/motschen/rocks/block/Seashell.java b/src/main/java/eu/midnightdust/motschen/rocks/block/Seashell.java index a0d1b53..f059769 100755 --- a/src/main/java/eu/midnightdust/motschen/rocks/block/Seashell.java +++ b/src/main/java/eu/midnightdust/motschen/rocks/block/Seashell.java @@ -33,7 +33,7 @@ public class Seashell extends Block implements Waterloggable { public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; public Seashell() { - super(FabricBlockSettings.copy(Blocks.POPPY).nonOpaque().sounds(BlockSoundGroup.STONE)); + super(AbstractBlock.Settings.copy(Blocks.POPPY).nonOpaque().sounds(BlockSoundGroup.STONE)); this.setDefaultState(this.stateManager.getDefaultState().with(SEASHELL_VARIATION, SeashellVariation.PINK).with(WATERLOGGED, false)); } @@ -49,7 +49,8 @@ public class Seashell extends Block implements Waterloggable { .with(SEASHELL_VARIATION, SeashellVariation.PINK).with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); } - public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { + @Override + public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { if (player.isCreative()) { if (state.get(SEASHELL_VARIATION) == SeashellVariation.YELLOW) { world.setBlockState(pos, state.with(SEASHELL_VARIATION, SeashellVariation.WHITE)); @@ -83,4 +84,5 @@ public class Seashell extends Block implements Waterloggable { public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) { return !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, direction, newState, world, pos, posFrom); } + protected boolean canReplace(BlockState state, ItemPlacementContext context) {return true;} } diff --git a/src/main/java/eu/midnightdust/motschen/rocks/block/Starfish.java b/src/main/java/eu/midnightdust/motschen/rocks/block/Starfish.java index cbf81c8..4dc301a 100755 --- a/src/main/java/eu/midnightdust/motschen/rocks/block/Starfish.java +++ b/src/main/java/eu/midnightdust/motschen/rocks/block/Starfish.java @@ -4,6 +4,9 @@ import eu.midnightdust.motschen.rocks.RocksMain; import eu.midnightdust.motschen.rocks.blockstates.StarfishVariation; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.block.*; +import net.minecraft.component.ComponentMap; +import net.minecraft.component.DataComponentTypes; +import net.minecraft.component.type.BlockStateComponent; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.FluidState; import net.minecraft.fluid.Fluids; @@ -27,6 +30,8 @@ import net.minecraft.world.WorldView; import java.util.Objects; +import static eu.midnightdust.motschen.rocks.RocksMain.STARFISH_VARIATION; + public class Starfish extends Block implements Waterloggable { private static final VoxelShape SHAPE; @@ -34,7 +39,7 @@ public class Starfish extends Block implements Waterloggable { public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; public Starfish() { - super(FabricBlockSettings.copy(Blocks.POPPY).nonOpaque().sounds(BlockSoundGroup.CORAL)); + super(AbstractBlock.Settings.copy(Blocks.POPPY).nonOpaque().sounds(BlockSoundGroup.CORAL)); this.setDefaultState(this.stateManager.getDefaultState().with(STARFISH_VARIATION, StarfishVariation.RED).with(WATERLOGGED, false)); } @@ -45,24 +50,18 @@ public class Starfish extends Block implements Waterloggable { @Override public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) { - ItemStack stack = itemPlacementContext.getStack(); - StarfishVariation variation = StarfishVariation.RED; - if (stack.getNbt() != null) { - var optionalVariation = STARFISH_VARIATION.parse(stack.getNbt().getString("variation")); - if (optionalVariation.isPresent()) variation = optionalVariation.get(); - } FluidState fluidState = itemPlacementContext.getWorld().getFluidState(itemPlacementContext.getBlockPos()); return Objects.requireNonNull(super.getPlacementState(itemPlacementContext)) - .with(STARFISH_VARIATION, variation).with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); + .with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); } @Override - public ItemStack getPickStack(BlockView world, BlockPos pos, BlockState state) { + public ItemStack getPickStack(WorldView world, BlockPos pos, BlockState state) { ItemStack stack = new ItemStack(this); - stack.getOrCreateNbt().putString("variation", state.get(STARFISH_VARIATION).asString()); + stack.applyComponentsFrom(ComponentMap.builder().add(DataComponentTypes.BLOCK_STATE, BlockStateComponent.DEFAULT.with(STARFISH_VARIATION, state.get(STARFISH_VARIATION))).build()); return stack; } - public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { + public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { if (player.isCreative()) { if (state.get(STARFISH_VARIATION) == StarfishVariation.RED) { world.setBlockState(pos, state.with(STARFISH_VARIATION, StarfishVariation.PINK)); @@ -96,4 +95,5 @@ public class Starfish extends Block implements Waterloggable { public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) { return !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, direction, newState, world, pos, posFrom); } + protected boolean canReplace(BlockState state, ItemPlacementContext context) {return true;} } diff --git a/src/main/java/eu/midnightdust/motschen/rocks/block/Stick.java b/src/main/java/eu/midnightdust/motschen/rocks/block/Stick.java index 1c798c6..fcf95a2 100755 --- a/src/main/java/eu/midnightdust/motschen/rocks/block/Stick.java +++ b/src/main/java/eu/midnightdust/motschen/rocks/block/Stick.java @@ -31,7 +31,7 @@ public class Stick extends Block { public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; public Stick() { - super(FabricBlockSettings.copy(Blocks.POPPY).nonOpaque().sounds(BlockSoundGroup.WOOD)); + super(AbstractBlock.Settings.copy(Blocks.POPPY).nonOpaque().sounds(BlockSoundGroup.WOOD)); this.setDefaultState(this.stateManager.getDefaultState().with(STICK_VARIATION, StickVariation.SMALL).with(WATERLOGGED, false)); } @@ -40,7 +40,7 @@ public class Stick extends Block { return Objects.requireNonNull(super.getPlacementState(itemPlacementContext)) .with(STICK_VARIATION, StickVariation.SMALL).with(WATERLOGGED, false); } - public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { + public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { if (player.isCreative()) { if (state.get(STICK_VARIATION) == StickVariation.SMALL) { world.setBlockState(pos, state.with(STICK_VARIATION, StickVariation.MEDIUM)); @@ -74,4 +74,6 @@ public class Stick extends Block { public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) { return !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, direction, newState, world, pos, posFrom); } + protected boolean isTransparent(BlockState state, BlockView world, BlockPos pos) {return true;} + protected boolean canReplace(BlockState state, ItemPlacementContext context) {return true;} } diff --git a/src/main/java/eu/midnightdust/motschen/rocks/block/blockentity/BlockEntityInit.java b/src/main/java/eu/midnightdust/motschen/rocks/block/blockentity/BlockEntityInit.java index a7d33ff..4a6da42 100755 --- a/src/main/java/eu/midnightdust/motschen/rocks/block/blockentity/BlockEntityInit.java +++ b/src/main/java/eu/midnightdust/motschen/rocks/block/blockentity/BlockEntityInit.java @@ -12,7 +12,7 @@ public class BlockEntityInit { public static BlockEntityType NETHER_GEYSER_BE; public static void init() { - OVERWORLD_GEYSER_BE = Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier(RocksMain.MOD_ID,"overworld_geyser_blockentity"), FabricBlockEntityTypeBuilder.create(OverworldGeyserBlockEntity::new, RocksMain.Geyser).build(null)); - NETHER_GEYSER_BE = Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier(RocksMain.MOD_ID,"nether_geyser_blockentity"), FabricBlockEntityTypeBuilder.create(NetherGeyserBlockEntity::new, RocksMain.NetherGeyser).build(null)); + OVERWORLD_GEYSER_BE = Registry.register(Registries.BLOCK_ENTITY_TYPE, Identifier.of(RocksMain.MOD_ID,"overworld_geyser_blockentity"), FabricBlockEntityTypeBuilder.create(OverworldGeyserBlockEntity::new, RocksMain.Geyser).build(null)); + NETHER_GEYSER_BE = Registry.register(Registries.BLOCK_ENTITY_TYPE, Identifier.of(RocksMain.MOD_ID,"nether_geyser_blockentity"), FabricBlockEntityTypeBuilder.create(NetherGeyserBlockEntity::new, RocksMain.NetherGeyser).build(null)); } } diff --git a/src/main/java/eu/midnightdust/motschen/rocks/blockstates/StarfishVariation.java b/src/main/java/eu/midnightdust/motschen/rocks/blockstates/StarfishVariation.java index 45a263c..9b4bfbd 100755 --- a/src/main/java/eu/midnightdust/motschen/rocks/blockstates/StarfishVariation.java +++ b/src/main/java/eu/midnightdust/motschen/rocks/blockstates/StarfishVariation.java @@ -7,7 +7,7 @@ public enum StarfishVariation implements StringIdentifiable { PINK("pink"), ORANGE("orange"); - private final String name; + public final String name; StarfishVariation(String name) { this.name = name; diff --git a/src/main/java/eu/midnightdust/motschen/rocks/world/FeatureInjector.java b/src/main/java/eu/midnightdust/motschen/rocks/world/FeatureInjector.java index 78d6535..e402d0b 100755 --- a/src/main/java/eu/midnightdust/motschen/rocks/world/FeatureInjector.java +++ b/src/main/java/eu/midnightdust/motschen/rocks/world/FeatureInjector.java @@ -94,6 +94,6 @@ public class FeatureInjector { if (RocksConfig.geyser) BiomeModifications.addFeature(ctx -> ctx.hasTag(BiomeTags.IGLOO_HAS_STRUCTURE) || ctx.getBiomeKey().toString().contains("snowy"), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("snowy_geyser")); } public static RegistryKey getKey(String name) { - return RegistryKey.of(RegistryKeys.PLACED_FEATURE, new Identifier(RocksMain.MOD_ID, name)); + return RegistryKey.of(RegistryKeys.PLACED_FEATURE, Identifier.of(RocksMain.MOD_ID, name)); } } \ No newline at end of file diff --git a/src/main/resources/data/rocks/loot_tables/blocks/acacia_stick.json b/src/main/resources/data/rocks/loot_table/blocks/acacia_stick.json similarity index 50% rename from src/main/resources/data/rocks/loot_tables/blocks/acacia_stick.json rename to src/main/resources/data/rocks/loot_table/blocks/acacia_stick.json index 4577f1f..d61f4a2 100755 --- a/src/main/resources/data/rocks/loot_tables/blocks/acacia_stick.json +++ b/src/main/resources/data/rocks/loot_table/blocks/acacia_stick.json @@ -4,40 +4,46 @@ { "rolls": 1, "entries": [ - { - "type": "minecraft:alternatives", + { + "type": "minecraft:alternatives", "children": [ { "type": "minecraft:item", + "name": "rocks:acacia_stick", + "functions": [ + { + "function": "minecraft:copy_state", + "block": "rocks:acacia_stick", + "properties": [ + "variation" + ] + } + ], "conditions": [ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } + "components": { + "minecraft:enchantments": { + "minecraft:silk_touch": 1 } - ] + } } } - ], - "name": "rocks:acacia_stick" + ] }, { "type": "minecraft:item", "name": "minecraft:stick" } - ], - "conditions": [ + ] + } + ], + "conditions": [ { "condition": "minecraft:survives_explosion" } ] } - ] - } - ] + ] } diff --git a/src/main/resources/data/rocks/loot_tables/blocks/andesite_rock.json b/src/main/resources/data/rocks/loot_table/blocks/andesite_rock.json similarity index 50% rename from src/main/resources/data/rocks/loot_tables/blocks/andesite_rock.json rename to src/main/resources/data/rocks/loot_table/blocks/andesite_rock.json index 9530ff6..ff26778 100755 --- a/src/main/resources/data/rocks/loot_tables/blocks/andesite_rock.json +++ b/src/main/resources/data/rocks/loot_table/blocks/andesite_rock.json @@ -4,40 +4,46 @@ { "rolls": 1, "entries": [ - { - "type": "minecraft:alternatives", + { + "type": "minecraft:alternatives", "children": [ { "type": "minecraft:item", + "name": "rocks:andesite_rock", + "functions": [ + { + "function": "minecraft:copy_state", + "block": "rocks:andesite_rock", + "properties": [ + "variation" + ] + } + ], "conditions": [ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } + "components": { + "minecraft:enchantments": { + "minecraft:silk_touch": 1 } - ] + } } } - ], - "name": "rocks:andesite_rock" + ] }, { "type": "minecraft:item", "name": "rocks:andesite_splitter" } - ], - "conditions": [ + ] + } + ], + "conditions": [ { "condition": "minecraft:survives_explosion" } ] } - ] - } - ] + ] } diff --git a/src/main/resources/data/rocks/loot_tables/blocks/bamboo_stick.json b/src/main/resources/data/rocks/loot_table/blocks/bamboo_stick.json similarity index 50% rename from src/main/resources/data/rocks/loot_tables/blocks/bamboo_stick.json rename to src/main/resources/data/rocks/loot_table/blocks/bamboo_stick.json index b866d34..0de08f5 100755 --- a/src/main/resources/data/rocks/loot_tables/blocks/bamboo_stick.json +++ b/src/main/resources/data/rocks/loot_table/blocks/bamboo_stick.json @@ -4,40 +4,46 @@ { "rolls": 1, "entries": [ - { - "type": "minecraft:alternatives", + { + "type": "minecraft:alternatives", "children": [ { "type": "minecraft:item", + "name": "rocks:bamboo_stick", + "functions": [ + { + "function": "minecraft:copy_state", + "block": "rocks:bamboo_stick", + "properties": [ + "variation" + ] + } + ], "conditions": [ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } + "components": { + "minecraft:enchantments": { + "minecraft:silk_touch": 1 } - ] + } } } - ], - "name": "rocks:bamboo_stick" + ] }, { "type": "minecraft:item", "name": "minecraft:bamboo" } - ], - "conditions": [ + ] + } + ], + "conditions": [ { "condition": "minecraft:survives_explosion" } ] } - ] - } - ] + ] } diff --git a/src/main/resources/data/rocks/loot_tables/blocks/birch_stick.json b/src/main/resources/data/rocks/loot_table/blocks/birch_stick.json similarity index 50% rename from src/main/resources/data/rocks/loot_tables/blocks/birch_stick.json rename to src/main/resources/data/rocks/loot_table/blocks/birch_stick.json index 9a4abdf..8511d6e 100755 --- a/src/main/resources/data/rocks/loot_tables/blocks/birch_stick.json +++ b/src/main/resources/data/rocks/loot_table/blocks/birch_stick.json @@ -4,40 +4,46 @@ { "rolls": 1, "entries": [ - { - "type": "minecraft:alternatives", + { + "type": "minecraft:alternatives", "children": [ { "type": "minecraft:item", + "name": "rocks:birch_stick", + "functions": [ + { + "function": "minecraft:copy_state", + "block": "rocks:birch_stick", + "properties": [ + "variation" + ] + } + ], "conditions": [ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } + "components": { + "minecraft:enchantments": { + "minecraft:silk_touch": 1 } - ] + } } } - ], - "name": "rocks:birch_stick" + ] }, { "type": "minecraft:item", "name": "minecraft:stick" } - ], - "conditions": [ + ] + } + ], + "conditions": [ { "condition": "minecraft:survives_explosion" } ] } - ] - } - ] + ] } diff --git a/src/main/resources/data/rocks/loot_tables/blocks/cherry_stick.json b/src/main/resources/data/rocks/loot_table/blocks/cherry_stick.json similarity index 50% rename from src/main/resources/data/rocks/loot_tables/blocks/cherry_stick.json rename to src/main/resources/data/rocks/loot_table/blocks/cherry_stick.json index dcc73ba..f995602 100755 --- a/src/main/resources/data/rocks/loot_tables/blocks/cherry_stick.json +++ b/src/main/resources/data/rocks/loot_table/blocks/cherry_stick.json @@ -4,40 +4,46 @@ { "rolls": 1, "entries": [ - { - "type": "minecraft:alternatives", + { + "type": "minecraft:alternatives", "children": [ { "type": "minecraft:item", + "name": "rocks:cherry_stick", + "functions": [ + { + "function": "minecraft:copy_state", + "block": "rocks:cherry_stick", + "properties": [ + "variation" + ] + } + ], "conditions": [ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } + "components": { + "minecraft:enchantments": { + "minecraft:silk_touch": 1 } - ] + } } } - ], - "name": "rocks:cherry_stick" + ] }, { "type": "minecraft:item", "name": "minecraft:stick" } - ], - "conditions": [ + ] + } + ], + "conditions": [ { "condition": "minecraft:survives_explosion" } ] } - ] - } - ] + ] } diff --git a/src/main/resources/data/rocks/loot_tables/blocks/crimson_stick.json b/src/main/resources/data/rocks/loot_table/blocks/crimson_stick.json similarity index 50% rename from src/main/resources/data/rocks/loot_tables/blocks/crimson_stick.json rename to src/main/resources/data/rocks/loot_table/blocks/crimson_stick.json index 6649202..566ca3c 100755 --- a/src/main/resources/data/rocks/loot_tables/blocks/crimson_stick.json +++ b/src/main/resources/data/rocks/loot_table/blocks/crimson_stick.json @@ -4,40 +4,46 @@ { "rolls": 1, "entries": [ - { - "type": "minecraft:alternatives", + { + "type": "minecraft:alternatives", "children": [ { "type": "minecraft:item", + "name": "rocks:crimson_stick", + "functions": [ + { + "function": "minecraft:copy_state", + "block": "rocks:crimson_stick", + "properties": [ + "variation" + ] + } + ], "conditions": [ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } + "components": { + "minecraft:enchantments": { + "minecraft:silk_touch": 1 } - ] + } } } - ], - "name": "rocks:crimson_stick" + ] }, { "type": "minecraft:item", "name": "minecraft:stick" } - ], - "conditions": [ + ] + } + ], + "conditions": [ { "condition": "minecraft:survives_explosion" } ] } - ] - } - ] + ] } diff --git a/src/main/resources/data/rocks/loot_tables/blocks/dark_oak_stick.json b/src/main/resources/data/rocks/loot_table/blocks/dark_oak_stick.json similarity index 50% rename from src/main/resources/data/rocks/loot_tables/blocks/dark_oak_stick.json rename to src/main/resources/data/rocks/loot_table/blocks/dark_oak_stick.json index 1947779..c78c210 100755 --- a/src/main/resources/data/rocks/loot_tables/blocks/dark_oak_stick.json +++ b/src/main/resources/data/rocks/loot_table/blocks/dark_oak_stick.json @@ -4,40 +4,46 @@ { "rolls": 1, "entries": [ - { - "type": "minecraft:alternatives", + { + "type": "minecraft:alternatives", "children": [ { "type": "minecraft:item", + "name": "rocks:dark_oak_stick", + "functions": [ + { + "function": "minecraft:copy_state", + "block": "rocks:dark_oak_stick", + "properties": [ + "variation" + ] + } + ], "conditions": [ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } + "components": { + "minecraft:enchantments": { + "minecraft:silk_touch": 1 } - ] + } } } - ], - "name": "rocks:dark_oak_stick" + ] }, { "type": "minecraft:item", "name": "minecraft:stick" } - ], - "conditions": [ + ] + } + ], + "conditions": [ { "condition": "minecraft:survives_explosion" } ] } - ] - } - ] + ] } diff --git a/src/main/resources/data/rocks/loot_tables/blocks/diorite_rock.json b/src/main/resources/data/rocks/loot_table/blocks/diorite_rock.json similarity index 50% rename from src/main/resources/data/rocks/loot_tables/blocks/diorite_rock.json rename to src/main/resources/data/rocks/loot_table/blocks/diorite_rock.json index dcc309d..3dd0dbe 100755 --- a/src/main/resources/data/rocks/loot_tables/blocks/diorite_rock.json +++ b/src/main/resources/data/rocks/loot_table/blocks/diorite_rock.json @@ -4,40 +4,46 @@ { "rolls": 1, "entries": [ - { - "type": "minecraft:alternatives", + { + "type": "minecraft:alternatives", "children": [ { "type": "minecraft:item", + "name": "rocks:diorite_rock", + "functions": [ + { + "function": "minecraft:copy_state", + "block": "rocks:diorite_rock", + "properties": [ + "variation" + ] + } + ], "conditions": [ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } + "components": { + "minecraft:enchantments": { + "minecraft:silk_touch": 1 } - ] + } } } - ], - "name": "rocks:diorite_rock" + ] }, { "type": "minecraft:item", "name": "rocks:diorite_splitter" } - ], - "conditions": [ + ] + } + ], + "conditions": [ { "condition": "minecraft:survives_explosion" } ] } - ] - } - ] + ] } diff --git a/src/main/resources/data/rocks/loot_tables/blocks/end_stone_rock.json b/src/main/resources/data/rocks/loot_table/blocks/end_stone_rock.json similarity index 50% rename from src/main/resources/data/rocks/loot_tables/blocks/end_stone_rock.json rename to src/main/resources/data/rocks/loot_table/blocks/end_stone_rock.json index e922d20..879155a 100755 --- a/src/main/resources/data/rocks/loot_tables/blocks/end_stone_rock.json +++ b/src/main/resources/data/rocks/loot_table/blocks/end_stone_rock.json @@ -4,40 +4,46 @@ { "rolls": 1, "entries": [ - { - "type": "minecraft:alternatives", + { + "type": "minecraft:alternatives", "children": [ { "type": "minecraft:item", + "name": "rocks:end_stone_rock", + "functions": [ + { + "function": "minecraft:copy_state", + "block": "rocks:end_stone_rock", + "properties": [ + "variation" + ] + } + ], "conditions": [ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } + "components": { + "minecraft:enchantments": { + "minecraft:silk_touch": 1 } - ] + } } } - ], - "name": "rocks:end_stone_rock" + ] }, { "type": "minecraft:item", "name": "rocks:end_stone_splitter" } - ], - "conditions": [ + ] + } + ], + "conditions": [ { "condition": "minecraft:survives_explosion" } ] } - ] - } - ] + ] } diff --git a/src/main/resources/data/rocks/loot_tables/blocks/granite_rock.json b/src/main/resources/data/rocks/loot_table/blocks/granite_rock.json similarity index 50% rename from src/main/resources/data/rocks/loot_tables/blocks/granite_rock.json rename to src/main/resources/data/rocks/loot_table/blocks/granite_rock.json index 4c1b983..21c0418 100755 --- a/src/main/resources/data/rocks/loot_tables/blocks/granite_rock.json +++ b/src/main/resources/data/rocks/loot_table/blocks/granite_rock.json @@ -4,40 +4,46 @@ { "rolls": 1, "entries": [ - { - "type": "minecraft:alternatives", + { + "type": "minecraft:alternatives", "children": [ { "type": "minecraft:item", + "name": "rocks:granite_rock", + "functions": [ + { + "function": "minecraft:copy_state", + "block": "rocks:granite_rock", + "properties": [ + "variation" + ] + } + ], "conditions": [ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } + "components": { + "minecraft:enchantments": { + "minecraft:silk_touch": 1 } - ] + } } } - ], - "name": "rocks:granite_rock" + ] }, { "type": "minecraft:item", "name": "rocks:granite_splitter" } - ], - "conditions": [ + ] + } + ], + "conditions": [ { "condition": "minecraft:survives_explosion" } ] } - ] - } - ] + ] } diff --git a/src/main/resources/data/rocks/loot_tables/blocks/gravel_rock.json b/src/main/resources/data/rocks/loot_table/blocks/gravel_rock.json similarity index 50% rename from src/main/resources/data/rocks/loot_tables/blocks/gravel_rock.json rename to src/main/resources/data/rocks/loot_table/blocks/gravel_rock.json index adb3696..2713d49 100755 --- a/src/main/resources/data/rocks/loot_tables/blocks/gravel_rock.json +++ b/src/main/resources/data/rocks/loot_table/blocks/gravel_rock.json @@ -4,40 +4,46 @@ { "rolls": 1, "entries": [ - { - "type": "minecraft:alternatives", + { + "type": "minecraft:alternatives", "children": [ { "type": "minecraft:item", + "name": "rocks:gravel_rock", + "functions": [ + { + "function": "minecraft:copy_state", + "block": "rocks:gravel_rock", + "properties": [ + "variation" + ] + } + ], "conditions": [ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } + "components": { + "minecraft:enchantments": { + "minecraft:silk_touch": 1 } - ] + } } } - ], - "name": "rocks:gravel_rock" + ] }, { "type": "minecraft:item", "name": "minecraft:flint" } - ], - "conditions": [ + ] + } + ], + "conditions": [ { "condition": "minecraft:survives_explosion" } ] } - ] - } - ] + ] } diff --git a/src/main/resources/data/rocks/loot_tables/blocks/jungle_stick.json b/src/main/resources/data/rocks/loot_table/blocks/jungle_stick.json similarity index 50% rename from src/main/resources/data/rocks/loot_tables/blocks/jungle_stick.json rename to src/main/resources/data/rocks/loot_table/blocks/jungle_stick.json index 2795ed7..c006a09 100755 --- a/src/main/resources/data/rocks/loot_tables/blocks/jungle_stick.json +++ b/src/main/resources/data/rocks/loot_table/blocks/jungle_stick.json @@ -4,40 +4,46 @@ { "rolls": 1, "entries": [ - { - "type": "minecraft:alternatives", + { + "type": "minecraft:alternatives", "children": [ { "type": "minecraft:item", + "name": "rocks:jungle_stick", + "functions": [ + { + "function": "minecraft:copy_state", + "block": "rocks:jungle_stick", + "properties": [ + "variation" + ] + } + ], "conditions": [ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } + "components": { + "minecraft:enchantments": { + "minecraft:silk_touch": 1 } - ] + } } } - ], - "name": "rocks:jungle_stick" + ] }, { "type": "minecraft:item", "name": "minecraft:stick" } - ], - "conditions": [ + ] + } + ], + "conditions": [ { "condition": "minecraft:survives_explosion" } ] } - ] - } - ] + ] } diff --git a/src/main/resources/data/rocks/loot_tables/blocks/mangrove_stick.json b/src/main/resources/data/rocks/loot_table/blocks/mangrove_stick.json similarity index 50% rename from src/main/resources/data/rocks/loot_tables/blocks/mangrove_stick.json rename to src/main/resources/data/rocks/loot_table/blocks/mangrove_stick.json index 38a50b3..1ca5a50 100755 --- a/src/main/resources/data/rocks/loot_tables/blocks/mangrove_stick.json +++ b/src/main/resources/data/rocks/loot_table/blocks/mangrove_stick.json @@ -4,40 +4,46 @@ { "rolls": 1, "entries": [ - { - "type": "minecraft:alternatives", + { + "type": "minecraft:alternatives", "children": [ { "type": "minecraft:item", + "name": "rocks:mangrove_stick", + "functions": [ + { + "function": "minecraft:copy_state", + "block": "rocks:mangrove_stick", + "properties": [ + "variation" + ] + } + ], "conditions": [ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } + "components": { + "minecraft:enchantments": { + "minecraft:silk_touch": 1 } - ] + } } } - ], - "name": "rocks:mangrove_stick" + ] }, { "type": "minecraft:item", "name": "minecraft:stick" } - ], - "conditions": [ + ] + } + ], + "conditions": [ { "condition": "minecraft:survives_explosion" } ] } - ] - } - ] + ] } diff --git a/src/main/resources/data/rocks/loot_tables/blocks/netherrack_rock.json b/src/main/resources/data/rocks/loot_table/blocks/netherrack_rock.json similarity index 50% rename from src/main/resources/data/rocks/loot_tables/blocks/netherrack_rock.json rename to src/main/resources/data/rocks/loot_table/blocks/netherrack_rock.json index c40b19f..65a3e5f 100755 --- a/src/main/resources/data/rocks/loot_tables/blocks/netherrack_rock.json +++ b/src/main/resources/data/rocks/loot_table/blocks/netherrack_rock.json @@ -4,40 +4,46 @@ { "rolls": 1, "entries": [ - { - "type": "minecraft:alternatives", + { + "type": "minecraft:alternatives", "children": [ { "type": "minecraft:item", + "name": "rocks:netherrack_rock", + "functions": [ + { + "function": "minecraft:copy_state", + "block": "rocks:netherrack_rock", + "properties": [ + "variation" + ] + } + ], "conditions": [ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } + "components": { + "minecraft:enchantments": { + "minecraft:silk_touch": 1 } - ] + } } } - ], - "name": "rocks:netherrack_rock" + ] }, { "type": "minecraft:item", "name": "rocks:netherrack_splitter" } - ], - "conditions": [ + ] + } + ], + "conditions": [ { "condition": "minecraft:survives_explosion" } ] } - ] - } - ] + ] } diff --git a/src/main/resources/data/rocks/loot_tables/blocks/oak_stick.json b/src/main/resources/data/rocks/loot_table/blocks/oak_stick.json similarity index 50% rename from src/main/resources/data/rocks/loot_tables/blocks/oak_stick.json rename to src/main/resources/data/rocks/loot_table/blocks/oak_stick.json index c98b2b7..997070f 100755 --- a/src/main/resources/data/rocks/loot_tables/blocks/oak_stick.json +++ b/src/main/resources/data/rocks/loot_table/blocks/oak_stick.json @@ -4,40 +4,46 @@ { "rolls": 1, "entries": [ - { - "type": "minecraft:alternatives", + { + "type": "minecraft:alternatives", "children": [ { "type": "minecraft:item", + "name": "rocks:oak_stick", + "functions": [ + { + "function": "minecraft:copy_state", + "block": "rocks:oak_stick", + "properties": [ + "variation" + ] + } + ], "conditions": [ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } + "components": { + "minecraft:enchantments": { + "minecraft:silk_touch": 1 } - ] + } } } - ], - "name": "rocks:oak_stick" + ] }, { "type": "minecraft:item", "name": "minecraft:stick" } - ], - "conditions": [ + ] + } + ], + "conditions": [ { "condition": "minecraft:survives_explosion" } ] } - ] - } - ] + ] } diff --git a/src/main/resources/data/rocks/loot_tables/blocks/pinecone.json b/src/main/resources/data/rocks/loot_table/blocks/pinecone.json similarity index 59% rename from src/main/resources/data/rocks/loot_tables/blocks/pinecone.json rename to src/main/resources/data/rocks/loot_table/blocks/pinecone.json index 83c3cf1..430d4c1 100755 --- a/src/main/resources/data/rocks/loot_tables/blocks/pinecone.json +++ b/src/main/resources/data/rocks/loot_table/blocks/pinecone.json @@ -4,40 +4,37 @@ { "rolls": 1, "entries": [ - { - "type": "minecraft:alternatives", + { + "type": "minecraft:alternatives", "children": [ { "type": "minecraft:item", + "name": "rocks:pinecone", "conditions": [ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } + "components": { + "minecraft:enchantments": { + "minecraft:silk_touch": 1 } - ] + } } } - ], - "name": "rocks:pinecone" + ] }, { "type": "minecraft:item", "name": "minecraft:spruce_sapling" } - ], - "conditions": [ + ] + } + ], + "conditions": [ { "condition": "minecraft:survives_explosion" } ] } - ] - } - ] + ] } diff --git a/src/main/resources/data/rocks/loot_tables/blocks/red_sand_rock.json b/src/main/resources/data/rocks/loot_table/blocks/red_sand_rock.json similarity index 50% rename from src/main/resources/data/rocks/loot_tables/blocks/red_sand_rock.json rename to src/main/resources/data/rocks/loot_table/blocks/red_sand_rock.json index 719b011..10622e4 100755 --- a/src/main/resources/data/rocks/loot_tables/blocks/red_sand_rock.json +++ b/src/main/resources/data/rocks/loot_table/blocks/red_sand_rock.json @@ -4,40 +4,46 @@ { "rolls": 1, "entries": [ - { - "type": "minecraft:alternatives", + { + "type": "minecraft:alternatives", "children": [ { "type": "minecraft:item", + "name": "rocks:red_sand_rock", + "functions": [ + { + "function": "minecraft:copy_state", + "block": "rocks:red_sand_rock", + "properties": [ + "variation" + ] + } + ], "conditions": [ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } + "components": { + "minecraft:enchantments": { + "minecraft:silk_touch": 1 } - ] + } } } - ], - "name": "rocks:red_sand_rock" + ] }, { "type": "minecraft:item", "name": "rocks:red_sandstone_splitter" } - ], - "conditions": [ + ] + } + ], + "conditions": [ { "condition": "minecraft:survives_explosion" } ] } - ] - } - ] + ] } diff --git a/src/main/resources/data/rocks/loot_tables/blocks/rock.json b/src/main/resources/data/rocks/loot_table/blocks/rock.json similarity index 51% rename from src/main/resources/data/rocks/loot_tables/blocks/rock.json rename to src/main/resources/data/rocks/loot_table/blocks/rock.json index 7e15e16..4b5cc09 100755 --- a/src/main/resources/data/rocks/loot_tables/blocks/rock.json +++ b/src/main/resources/data/rocks/loot_table/blocks/rock.json @@ -4,40 +4,46 @@ { "rolls": 1, "entries": [ - { - "type": "minecraft:alternatives", + { + "type": "minecraft:alternatives", "children": [ { "type": "minecraft:item", + "name": "rocks:rock", + "functions": [ + { + "function": "minecraft:copy_state", + "block": "rocks:rock", + "properties": [ + "variation" + ] + } + ], "conditions": [ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } + "components": { + "minecraft:enchantments": { + "minecraft:silk_touch": 1 } - ] + } } } - ], - "name": "rocks:rock" + ] }, { "type": "minecraft:item", "name": "rocks:cobblestone_splitter" } - ], - "conditions": [ + ] + } + ], + "conditions": [ { "condition": "minecraft:survives_explosion" } ] } - ] - } - ] + ] } diff --git a/src/main/resources/data/rocks/loot_tables/blocks/sand_rock.json b/src/main/resources/data/rocks/loot_table/blocks/sand_rock.json similarity index 51% rename from src/main/resources/data/rocks/loot_tables/blocks/sand_rock.json rename to src/main/resources/data/rocks/loot_table/blocks/sand_rock.json index 225a205..cba409e 100755 --- a/src/main/resources/data/rocks/loot_tables/blocks/sand_rock.json +++ b/src/main/resources/data/rocks/loot_table/blocks/sand_rock.json @@ -4,40 +4,46 @@ { "rolls": 1, "entries": [ - { - "type": "minecraft:alternatives", + { + "type": "minecraft:alternatives", "children": [ { "type": "minecraft:item", + "name": "rocks:sand_rock", + "functions": [ + { + "function": "minecraft:copy_state", + "block": "rocks:sand_rock", + "properties": [ + "variation" + ] + } + ], "conditions": [ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } + "components": { + "minecraft:enchantments": { + "minecraft:silk_touch": 1 } - ] + } } } - ], - "name": "rocks:sand_rock" + ] }, { "type": "minecraft:item", "name": "rocks:sandstone_splitter" } - ], - "conditions": [ + ] + } + ], + "conditions": [ { "condition": "minecraft:survives_explosion" } ] } - ] - } - ] + ] } diff --git a/src/main/resources/data/rocks/loot_tables/blocks/seashell.json b/src/main/resources/data/rocks/loot_table/blocks/seashell.json similarity index 100% rename from src/main/resources/data/rocks/loot_tables/blocks/seashell.json rename to src/main/resources/data/rocks/loot_table/blocks/seashell.json diff --git a/src/main/resources/data/rocks/loot_tables/blocks/soul_soil_rock.json b/src/main/resources/data/rocks/loot_table/blocks/soul_soil_rock.json similarity index 50% rename from src/main/resources/data/rocks/loot_tables/blocks/soul_soil_rock.json rename to src/main/resources/data/rocks/loot_table/blocks/soul_soil_rock.json index e3e2b63..7d4b82a 100755 --- a/src/main/resources/data/rocks/loot_tables/blocks/soul_soil_rock.json +++ b/src/main/resources/data/rocks/loot_table/blocks/soul_soil_rock.json @@ -4,40 +4,46 @@ { "rolls": 1, "entries": [ - { - "type": "minecraft:alternatives", + { + "type": "minecraft:alternatives", "children": [ { "type": "minecraft:item", + "name": "rocks:soul_soil_rock", + "functions": [ + { + "function": "minecraft:copy_state", + "block": "rocks:soul_soil_rock", + "properties": [ + "variation" + ] + } + ], "conditions": [ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } + "components": { + "minecraft:enchantments": { + "minecraft:silk_touch": 1 } - ] + } } } - ], - "name": "rocks:soul_soil_rock" + ] }, { "type": "minecraft:item", "name": "rocks:soul_soil_splitter" } - ], - "conditions": [ + ] + } + ], + "conditions": [ { "condition": "minecraft:survives_explosion" } ] } - ] - } - ] + ] } diff --git a/src/main/resources/data/rocks/loot_tables/blocks/spruce_stick.json b/src/main/resources/data/rocks/loot_table/blocks/spruce_stick.json similarity index 50% rename from src/main/resources/data/rocks/loot_tables/blocks/spruce_stick.json rename to src/main/resources/data/rocks/loot_table/blocks/spruce_stick.json index 9dcfea6..ff09a87 100755 --- a/src/main/resources/data/rocks/loot_tables/blocks/spruce_stick.json +++ b/src/main/resources/data/rocks/loot_table/blocks/spruce_stick.json @@ -4,40 +4,46 @@ { "rolls": 1, "entries": [ - { - "type": "minecraft:alternatives", + { + "type": "minecraft:alternatives", "children": [ { "type": "minecraft:item", + "name": "rocks:spruce_stick", + "functions": [ + { + "function": "minecraft:copy_state", + "block": "rocks:spruce_stick", + "properties": [ + "variation" + ] + } + ], "conditions": [ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } + "components": { + "minecraft:enchantments": { + "minecraft:silk_touch": 1 } - ] + } } } - ], - "name": "rocks:spruce_stick" + ] }, { "type": "minecraft:item", "name": "minecraft:stick" } - ], - "conditions": [ + ] + } + ], + "conditions": [ { "condition": "minecraft:survives_explosion" } ] } - ] - } - ] + ] } diff --git a/src/main/resources/data/rocks/loot_table/blocks/starfish.json b/src/main/resources/data/rocks/loot_table/blocks/starfish.json new file mode 100755 index 0000000..834fceb --- /dev/null +++ b/src/main/resources/data/rocks/loot_table/blocks/starfish.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "rocks:starfish", + "functions": [ + { + "function": "minecraft:copy_state", + "block": "rocks:starfish", + "properties": [ + "variation" + ] + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/rocks/loot_tables/blocks/warped_stick.json b/src/main/resources/data/rocks/loot_table/blocks/warped_stick.json similarity index 50% rename from src/main/resources/data/rocks/loot_tables/blocks/warped_stick.json rename to src/main/resources/data/rocks/loot_table/blocks/warped_stick.json index 65d70b4..ff09a87 100755 --- a/src/main/resources/data/rocks/loot_tables/blocks/warped_stick.json +++ b/src/main/resources/data/rocks/loot_table/blocks/warped_stick.json @@ -4,40 +4,46 @@ { "rolls": 1, "entries": [ - { - "type": "minecraft:alternatives", + { + "type": "minecraft:alternatives", "children": [ { "type": "minecraft:item", + "name": "rocks:spruce_stick", + "functions": [ + { + "function": "minecraft:copy_state", + "block": "rocks:spruce_stick", + "properties": [ + "variation" + ] + } + ], "conditions": [ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } + "components": { + "minecraft:enchantments": { + "minecraft:silk_touch": 1 } - ] + } } } - ], - "name": "rocks:warped_stick" + ] }, { "type": "minecraft:item", "name": "minecraft:stick" } - ], - "conditions": [ + ] + } + ], + "conditions": [ { "condition": "minecraft:survives_explosion" } ] } - ] - } - ] + ] } diff --git a/src/main/resources/data/rocks/loot_tables/blocks/starfish.json b/src/main/resources/data/rocks/loot_tables/blocks/starfish.json deleted file mode 100755 index 8125938..0000000 --- a/src/main/resources/data/rocks/loot_tables/blocks/starfish.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "rolls": 1, - "entries": [ - { - "type": "minecraft:item", - "conditions": [ - { - "condition": "minecraft:block_state_property", - "block": "rocks:starfish", - "properties": { - "variation": "red" - } - } - ], - "functions": [ - { - "function": "minecraft:set_nbt", - "tag": "{variation:red}" - } - ], - "name": "rocks:starfish" - }, - { - "type": "minecraft:item", - "conditions": [ - { - "condition": "minecraft:block_state_property", - "block": "rocks:starfish", - "properties": { - "variation": "pink" - } - } - ], - "functions": [ - { - "function": "minecraft:set_nbt", - "tag": "{variation:pink}" - } - ], - "name": "rocks:starfish" - }, - { - "type": "minecraft:item", - "conditions": [ - { - "condition": "minecraft:block_state_property", - "block": "rocks:starfish", - "properties": { - "variation": "orange" - } - } - ], - "functions": [ - { - "function": "minecraft:set_nbt", - "tag": "{variation:orange}" - } - ], - "name": "rocks:starfish" - } - ], - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ] - } - ] -}