ThisRocks 1.8.0 - Update to 1.21

- Fixed #15
- Allow blocks to replace rocks and sticks (closes #43)
- Added unifiedPublishing for a better workflow
This commit is contained in:
Martin Prokoph
2024-06-16 23:24:49 +02:00
parent d66ee7abb4
commit ac3c519fc4
45 changed files with 813 additions and 619 deletions

View File

@@ -1,10 +1,11 @@
plugins { plugins {
id 'fabric-loom' version '1.1-SNAPSHOT' id 'fabric-loom' version '1.6-SNAPSHOT'
id 'maven-publish' id 'maven-publish'
id "me.shedaniel.unified-publishing" version "0.1.+"
} }
sourceCompatibility = JavaVersion.VERSION_17 sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_21
archivesBaseName = project.archives_base_name archivesBaseName = project.archives_base_name
version = project.mod_version version = project.mod_version
@@ -64,8 +65,7 @@ tasks.withType(JavaCompile).configureEach {
// If Javadoc is generated, this must be specified in that task too. // If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8" it.options.encoding = "UTF-8"
// Minecraft 1.17 (21w19a) upwards uses Java 16. it.options.release = 21
it.options.release = 17
} }
sourceSets { sourceSets {
main { main {
@@ -112,3 +112,55 @@ publishing {
// retrieving dependencies. // 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
}
}
}
}

View File

@@ -3,16 +3,19 @@ org.gradle.jvmargs=-Xmx2G
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/use # check these on https://fabricmc.net/use
minecraft_version=1.19.4 minecraft_version=1.21
yarn_mappings=1.19.4+build.2 yarn_mappings=1.21+build.2
loader_version=0.14.19 loader_version=0.15.11
# Mod Properties # Mod Properties
mod_version = 1.7.0 mod_version = 1.8.0
maven_group = eu.midnightdust.motschen maven_group = eu.midnightdust.motschen
archives_base_name = rocks archives_base_name = rocks
release_type=release
curseforge_id=416283
modrinth_id=Sb5ypgDP
# Dependencies # Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api # 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 fabric_version=0.100.1+1.21
midnightlib_version=1.3.0-fabric midnightlib_version=1.5.7-fabric

Binary file not shown.

View File

@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists 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 zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

41
gradlew vendored
View File

@@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (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. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,13 +80,11 @@ do
esac esac
done done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # This is normally unused
# shellcheck disable=SC2034
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@@ -133,22 +131,29 @@ location of your Java installation."
fi fi
else else
JAVACMD=java 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 Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) 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 ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
case $MAX_FD in #( case $MAX_FD in #(
'' | soft) :;; #( '' | 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" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then
done done
fi fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
# shell script including quotes and variable substitutions, so put them in DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded. # 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 -- \ set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \ "-Dorg.gradle.appname=$APP_BASE_NAME" \
@@ -205,6 +214,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \ 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. # Use "xargs" to parse quoted args.
# #
# With -n1 it outputs one arg per line, with the quotes and backslashes removed. # With -n1 it outputs one arg per line, with the quotes and backslashes removed.

181
gradlew.bat vendored
View File

@@ -1,89 +1,92 @@
@rem @rem
@rem Copyright 2015 the original author or authors. @rem Copyright 2015 the original author or authors.
@rem @rem
@rem Licensed under the Apache License, Version 2.0 (the "License"); @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 not use this file except in compliance with the License.
@rem You may obtain a copy of the License at @rem You may obtain a copy of the License at
@rem @rem
@rem https://www.apache.org/licenses/LICENSE-2.0 @rem https://www.apache.org/licenses/LICENSE-2.0
@rem @rem
@rem Unless required by applicable law or agreed to in writing, software @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 distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@if "%DEBUG%" == "" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem Gradle startup script for Windows @rem Gradle startup script for Windows
@rem @rem
@rem ########################################################################## @rem ##########################################################################
@rem Set local scope for the variables with windows NT shell @rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=. if "%DIRNAME%"=="" set DIRNAME=.
set APP_BASE_NAME=%~n0 @rem This is normally unused
set APP_HOME=%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 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 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 @rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 set JAVA_EXE=java.exe
if "%ERRORLEVEL%" == "0" goto execute %JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo. 1>&2
echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo. 1>&2
echo location of your Java installation. 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
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=% :findJavaFromJavaHome
set JAVA_EXE=%JAVA_HOME%/bin/java.exe set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo. 1>&2
echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo. 1>&2
echo location of your Java installation. 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
goto fail
:execute
@rem Setup the command line :execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
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 %* @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 :end
if "%ERRORLEVEL%"=="0" goto mainEnd @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 :fail
rem the _cmd.exe /c_ return code! rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 rem the _cmd.exe /c_ return code!
exit /b 1 set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
:mainEnd if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
if "%OS%"=="Windows_NT" endlocal exit /b %EXIT_CODE%
:omega :mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -1,10 +1,10 @@
pluginManagement { pluginManagement {
repositories { repositories {
jcenter()
maven { maven {
name = 'Fabric' name = 'Fabric'
url = 'https://maven.fabricmc.net/' url = 'https://maven.fabricmc.net/'
} }
maven { url "https://maven.architectury.dev/" }
gradlePluginPortal() gradlePluginPortal()
} }
} }

View File

@@ -1,14 +1,26 @@
package eu.midnightdust.motschen.rocks; package eu.midnightdust.motschen.rocks;
import eu.midnightdust.motschen.rocks.blockstates.StarfishVariation;
import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.ClientModInitializer;
import net.minecraft.client.item.ModelPredicateProviderRegistry; import net.minecraft.client.item.ModelPredicateProviderRegistry;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import java.util.Objects;
import static eu.midnightdust.motschen.rocks.RocksMain.STARFISH_VARIATION;
public class RocksClient implements ClientModInitializer { public class RocksClient implements ClientModInitializer {
@Override @Override
public void onInitializeClient() { 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(), Identifier.of("red"), (stack, world, entity, seed) -> matchesVariation(stack, StarfishVariation.RED));
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(), Identifier.of("pink"), (stack, world, entity, seed) -> matchesVariation(stack, StarfishVariation.PINK));
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("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;
} }
} }

View File

@@ -1,6 +1,5 @@
package eu.midnightdust.motschen.rocks; package eu.midnightdust.motschen.rocks;
import com.google.common.collect.Lists;
import eu.midnightdust.motschen.rocks.block.*; import eu.midnightdust.motschen.rocks.block.*;
import eu.midnightdust.motschen.rocks.block.blockentity.BlockEntityInit; import eu.midnightdust.motschen.rocks.block.blockentity.BlockEntityInit;
import eu.midnightdust.motschen.rocks.blockstates.RockVariation; 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 eu.midnightdust.motschen.rocks.world.*;
import net.fabricmc.api.ModInitializer; import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.*; 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.state.property.EnumProperty;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import static eu.midnightdust.motschen.rocks.RocksRegistryUtils.registerBlockWithItem; 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 NetherrackSplitter = new Item(new Item.Settings());
public static Item SoulSoilSplitter = new Item(new Item.Settings()); public static Item SoulSoilSplitter = new Item(new Item.Settings());
public static List<ItemStack> groupItems = new ArrayList<>(); public static List<ItemStack> groupItems = new ArrayList<>();
public static ItemStack cherryStack;
public static ItemGroup RocksGroup; public static ItemGroup RocksGroup;
public static final RegistryKey<ItemGroup> ROCKS_GROUP = RegistryKey.of(RegistryKeys.ITEM_GROUP, Identifier.of(MOD_ID, "rocks"));
@Override @Override
public void onInitialize() { public void onInitialize() {
RocksConfig.init("rocks", RocksConfig.class); RocksConfig.init("rocks", RocksConfig.class);
registerBlockWithItem(new Identifier(MOD_ID,"rock"), Rock); registerBlockWithItem(Identifier.of(MOD_ID,"rock"), Rock);
registerBlockWithItem(new Identifier(MOD_ID,"granite_rock"), GraniteRock); registerBlockWithItem(Identifier.of(MOD_ID,"granite_rock"), GraniteRock);
registerBlockWithItem(new Identifier(MOD_ID,"diorite_rock"), DioriteRock); registerBlockWithItem(Identifier.of(MOD_ID,"diorite_rock"), DioriteRock);
registerBlockWithItem(new Identifier(MOD_ID,"andesite_rock"), AndesiteRock); registerBlockWithItem(Identifier.of(MOD_ID,"andesite_rock"), AndesiteRock);
registerBlockWithItem(new Identifier(MOD_ID,"sand_rock"), SandRock); registerBlockWithItem(Identifier.of(MOD_ID,"sand_rock"), SandRock);
registerBlockWithItem(new Identifier(MOD_ID,"red_sand_rock"), RedSandRock); registerBlockWithItem(Identifier.of(MOD_ID,"red_sand_rock"), RedSandRock);
registerBlockWithItem(new Identifier(MOD_ID,"gravel_rock"), GravelRock); registerBlockWithItem(Identifier.of(MOD_ID,"gravel_rock"), GravelRock);
registerBlockWithItem(new Identifier(MOD_ID,"end_stone_rock"), EndstoneRock); registerBlockWithItem(Identifier.of(MOD_ID,"end_stone_rock"), EndstoneRock);
registerBlockWithItem(new Identifier(MOD_ID,"netherrack_rock"), NetherrackRock); registerBlockWithItem(Identifier.of(MOD_ID,"netherrack_rock"), NetherrackRock);
registerBlockWithItem(new Identifier(MOD_ID,"soul_soil_rock"), SoulSoilRock); registerBlockWithItem(Identifier.of(MOD_ID,"soul_soil_rock"), SoulSoilRock);
registerBlockWithItem(new Identifier(MOD_ID,"oak_stick"), OakStick); registerBlockWithItem(Identifier.of(MOD_ID,"oak_stick"), OakStick);
registerBlockWithItem(new Identifier(MOD_ID,"spruce_stick"), SpruceStick); registerBlockWithItem(Identifier.of(MOD_ID,"spruce_stick"), SpruceStick);
registerBlockWithItem(new Identifier(MOD_ID,"birch_stick"), BirchStick); registerBlockWithItem(Identifier.of(MOD_ID,"birch_stick"), BirchStick);
registerBlockWithItem(new Identifier(MOD_ID,"acacia_stick"), AcaciaStick); registerBlockWithItem(Identifier.of(MOD_ID,"acacia_stick"), AcaciaStick);
registerBlockWithItem(new Identifier(MOD_ID,"jungle_stick"), JungleStick); registerBlockWithItem(Identifier.of(MOD_ID,"jungle_stick"), JungleStick);
registerBlockWithItem(new Identifier(MOD_ID,"dark_oak_stick"), DarkOakStick); registerBlockWithItem(Identifier.of(MOD_ID,"dark_oak_stick"), DarkOakStick);
registerBlockWithItem(new Identifier(MOD_ID,"mangrove_stick"), MangroveStick); registerBlockWithItem(Identifier.of(MOD_ID,"mangrove_stick"), MangroveStick);
registerBlockWithItem(new Identifier(MOD_ID,"cherry_stick"), CherryStick); registerBlockWithItem(Identifier.of(MOD_ID,"cherry_stick"), CherryStick);
registerBlockWithItem(new Identifier(MOD_ID,"bamboo_stick"), BambooStick); registerBlockWithItem(Identifier.of(MOD_ID,"bamboo_stick"), BambooStick);
registerBlockWithItem(new Identifier(MOD_ID,"crimson_stick"), CrimsonStick); registerBlockWithItem(Identifier.of(MOD_ID,"crimson_stick"), CrimsonStick);
registerBlockWithItem(new Identifier(MOD_ID,"warped_stick"), WarpedStick); registerBlockWithItem(Identifier.of(MOD_ID,"warped_stick"), WarpedStick);
registerBlockWithItem(new Identifier(MOD_ID,"geyser"), Geyser); registerBlockWithItem(Identifier.of(MOD_ID,"geyser"), Geyser);
registerBlockWithItem(new Identifier(MOD_ID,"nether_geyser"), NetherGeyser); registerBlockWithItem(Identifier.of(MOD_ID,"nether_geyser"), NetherGeyser);
registerBlockWithItem(new Identifier(MOD_ID,"pinecone"), Pinecone); registerBlockWithItem(Identifier.of(MOD_ID,"pinecone"), Pinecone);
registerBlockWithItem(new Identifier(MOD_ID,"seashell"), Seashell); registerBlockWithItem(Identifier.of(MOD_ID,"seashell"), Seashell);
registerBlockWithItem(new Identifier(MOD_ID,"starfish"), Starfish); registerBlockWithItem(Identifier.of(MOD_ID,"starfish"), Starfish);
registerItem(new Identifier(MOD_ID,"cobblestone_splitter"), CobblestoneSplitter); registerItem(Identifier.of(MOD_ID,"cobblestone_splitter"), CobblestoneSplitter);
registerItem(new Identifier(MOD_ID,"granite_splitter"), GraniteSplitter); registerItem(Identifier.of(MOD_ID,"granite_splitter"), GraniteSplitter);
registerItem(new Identifier(MOD_ID,"diorite_splitter"), DioriteSplitter); registerItem(Identifier.of(MOD_ID,"diorite_splitter"), DioriteSplitter);
registerItem(new Identifier(MOD_ID,"andesite_splitter"), AndesiteSplitter); registerItem(Identifier.of(MOD_ID,"andesite_splitter"), AndesiteSplitter);
registerItem(new Identifier(MOD_ID,"sandstone_splitter"), SandStoneSplitter); registerItem(Identifier.of(MOD_ID,"sandstone_splitter"), SandStoneSplitter);
registerItem(new Identifier(MOD_ID,"red_sandstone_splitter"), RedSandStoneSplitter); registerItem(Identifier.of(MOD_ID,"red_sandstone_splitter"), RedSandStoneSplitter);
registerItem(new Identifier(MOD_ID,"end_stone_splitter"), EndStoneSplitter); registerItem(Identifier.of(MOD_ID,"end_stone_splitter"), EndStoneSplitter);
registerItem(new Identifier(MOD_ID,"netherrack_splitter"), NetherrackSplitter); registerItem(Identifier.of(MOD_ID,"netherrack_splitter"), NetherrackSplitter);
registerItem(new Identifier(MOD_ID,"soul_soil_splitter"), SoulSoilSplitter); 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<ItemStack> visibleGroupItems = new ArrayList<>(groupItems); List<ItemStack> visibleGroupItems = new ArrayList<>(groupItems);
if (!displayContext.enabledFeatures().contains(FeatureFlags.UPDATE_1_20)) visibleGroupItems.remove(cherryStack);
entries.addAll(visibleGroupItems); entries.addAll(visibleGroupItems);
})).build(); })).build();
Registry.register(Registries.ITEM_GROUP, ROCKS_GROUP, RocksGroup);
new FeatureRegistry<>(); new FeatureRegistry<>();
FeatureInjector.init(); FeatureInjector.init();
BlockEntityInit.init(); BlockEntityInit.init();

View File

@@ -1,6 +1,10 @@
package eu.midnightdust.motschen.rocks; package eu.midnightdust.motschen.rocks;
import eu.midnightdust.motschen.rocks.blockstates.StarfishVariation;
import net.minecraft.block.Block; 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.BlockItem;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; 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.ConfiguredFeature;
import net.minecraft.world.gen.feature.PlacedFeature; import net.minecraft.world.gen.feature.PlacedFeature;
import static eu.midnightdust.motschen.rocks.RocksMain.STARFISH_VARIATION;
public class RocksRegistryUtils { public class RocksRegistryUtils {
public static void registerBlockWithItem(Identifier id, Block block) { public static void registerBlockWithItem(Identifier id, Block block) {
Registry.register(Registries.BLOCK, id, block); Registry.register(Registries.BLOCK, id, block);
@@ -16,28 +22,27 @@ public class RocksRegistryUtils {
} }
public static void registerItem(Identifier id, Item item) { public static void registerItem(Identifier id, Item item) {
Registry.register(Registries.ITEM, id, 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 { else {
ItemStack itemStack = new ItemStack(item); ItemStack itemStack = new ItemStack(item);
RocksMain.groupItems.add(itemStack); RocksMain.groupItems.add(itemStack);
if (id.equals(new Identifier(RocksMain.MOD_ID, "cherry_stick"))) RocksMain.cherryStack = itemStack;
} }
} }
private static void putStarfishItems(Item starfish) { private static void putStarfishItems(Item starfish) {
ItemStack redStarfish = new ItemStack(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); RocksMain.groupItems.add(redStarfish);
ItemStack orangeStarfish = new ItemStack(starfish); 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); RocksMain.groupItems.add(orangeStarfish);
ItemStack pinkStarfish = new ItemStack(starfish); 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); RocksMain.groupItems.add(pinkStarfish);
} }
public static void register(Registerable<ConfiguredFeature<?, ?>> context, String name, ConfiguredFeature<?, ?> feature) { public static void register(Registerable<ConfiguredFeature<?, ?>> 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<PlacedFeature> context, String name, PlacedFeature feature) { public static void register(Registerable<PlacedFeature> 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);
} }
} }

View File

@@ -1,5 +1,6 @@
package eu.midnightdust.motschen.rocks.block; 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.BlockEntityInit;
import eu.midnightdust.motschen.rocks.block.blockentity.NetherGeyserBlockEntity; import eu.midnightdust.motschen.rocks.block.blockentity.NetherGeyserBlockEntity;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; 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 static final BooleanProperty ACTIVE = BooleanProperty.of("active");
public NetherGeyser() { 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)); this.setDefaultState(this.stateManager.getDefaultState().with(ACTIVE, false));
} }
@Override
protected MapCodec<? extends BlockWithEntity> getCodec() {
return null;
}
@Override @Override
public BlockRenderType getRenderType(BlockState state) { public BlockRenderType getRenderType(BlockState state) {
return BlockRenderType.MODEL; return BlockRenderType.MODEL;
@@ -40,7 +47,7 @@ public class NetherGeyser extends BlockWithEntity implements BlockEntityProvider
} }
@Nullable @Nullable
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) { public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) {
return checkType(type, BlockEntityInit.NETHER_GEYSER_BE, NetherGeyserBlockEntity::tick); return validateTicker(type, BlockEntityInit.NETHER_GEYSER_BE, NetherGeyserBlockEntity::tick);
} }
@Override @Override
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) { public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {

View File

@@ -1,5 +1,6 @@
package eu.midnightdust.motschen.rocks.block; 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.BlockEntityInit;
import eu.midnightdust.motschen.rocks.block.blockentity.OverworldGeyserBlockEntity; import eu.midnightdust.motschen.rocks.block.blockentity.OverworldGeyserBlockEntity;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; 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 static final BooleanProperty SNOWY = Properties.SNOWY;
public OverworldGeyser() { 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)); this.setDefaultState(this.stateManager.getDefaultState().with(ACTIVE, false).with(SNOWY, false));
} }
@Override
protected MapCodec<? extends BlockWithEntity> getCodec() {
return null;
}
@Override @Override
public BlockRenderType getRenderType(BlockState state) { public BlockRenderType getRenderType(BlockState state) {
return BlockRenderType.MODEL; return BlockRenderType.MODEL;
@@ -44,7 +51,7 @@ public class OverworldGeyser extends BlockWithEntity implements BlockEntityProvi
} }
@Nullable @Nullable
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) { public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) {
return checkType(type, BlockEntityInit.OVERWORLD_GEYSER_BE, OverworldGeyserBlockEntity::tick); return validateTicker(type, BlockEntityInit.OVERWORLD_GEYSER_BE, OverworldGeyserBlockEntity::tick);
} }
@Override @Override
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) { public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {

View File

@@ -2,6 +2,7 @@ package eu.midnightdust.motschen.rocks.block;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.*; import net.minecraft.block.*;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
@@ -15,7 +16,7 @@ public class Pinecone extends Block {
private static final VoxelShape SHAPE; private static final VoxelShape SHAPE;
public Pinecone() { 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()); 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) { 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); 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;}
} }

View File

@@ -2,7 +2,6 @@ package eu.midnightdust.motschen.rocks.block;
import eu.midnightdust.motschen.rocks.RocksMain; import eu.midnightdust.motschen.rocks.RocksMain;
import eu.midnightdust.motschen.rocks.blockstates.RockVariation; import eu.midnightdust.motschen.rocks.blockstates.RockVariation;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.*; import net.minecraft.block.*;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemPlacementContext;
@@ -25,10 +24,11 @@ import java.util.Objects;
public class Rock extends Block { public class Rock extends Block {
private static final VoxelShape SHAPE; private static final VoxelShape SHAPE;
private static final VoxelShape SHAPE_LARGE;
private static final EnumProperty<RockVariation> ROCK_VARIATION = RocksMain.ROCK_VARIATION; private static final EnumProperty<RockVariation> ROCK_VARIATION = RocksMain.ROCK_VARIATION;
public Rock() { 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)); 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)) return Objects.requireNonNull(super.getPlacementState(itemPlacementContext))
.with(ROCK_VARIATION, RockVariation.TINY); .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 (player.isCreative()) {
if (state.get(ROCK_VARIATION) == RockVariation.TINY) { if (state.get(ROCK_VARIATION) == RockVariation.TINY) {
world.setBlockState(pos, state.with(ROCK_VARIATION, RockVariation.SMALL)); world.setBlockState(pos, state.with(ROCK_VARIATION, RockVariation.SMALL));
@@ -62,10 +63,11 @@ public class Rock extends Block {
} }
@Override @Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) { 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 { 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) { 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) { 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); 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;}
} }

View File

@@ -33,7 +33,7 @@ public class Seashell extends Block implements Waterloggable {
public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED;
public Seashell() { 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)); 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); .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 (player.isCreative()) {
if (state.get(SEASHELL_VARIATION) == SeashellVariation.YELLOW) { if (state.get(SEASHELL_VARIATION) == SeashellVariation.YELLOW) {
world.setBlockState(pos, state.with(SEASHELL_VARIATION, SeashellVariation.WHITE)); 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) { 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); 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;}
} }

View File

@@ -4,6 +4,9 @@ import eu.midnightdust.motschen.rocks.RocksMain;
import eu.midnightdust.motschen.rocks.blockstates.StarfishVariation; import eu.midnightdust.motschen.rocks.blockstates.StarfishVariation;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.*; 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.entity.player.PlayerEntity;
import net.minecraft.fluid.FluidState; import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids; import net.minecraft.fluid.Fluids;
@@ -27,6 +30,8 @@ import net.minecraft.world.WorldView;
import java.util.Objects; import java.util.Objects;
import static eu.midnightdust.motschen.rocks.RocksMain.STARFISH_VARIATION;
public class Starfish extends Block implements Waterloggable { public class Starfish extends Block implements Waterloggable {
private static final VoxelShape SHAPE; private static final VoxelShape SHAPE;
@@ -34,7 +39,7 @@ public class Starfish extends Block implements Waterloggable {
public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED;
public Starfish() { 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)); 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 @Override
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) { 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()); FluidState fluidState = itemPlacementContext.getWorld().getFluidState(itemPlacementContext.getBlockPos());
return Objects.requireNonNull(super.getPlacementState(itemPlacementContext)) return Objects.requireNonNull(super.getPlacementState(itemPlacementContext))
.with(STARFISH_VARIATION, variation).with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); .with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER);
} }
@Override @Override
public ItemStack getPickStack(BlockView world, BlockPos pos, BlockState state) { public ItemStack getPickStack(WorldView world, BlockPos pos, BlockState state) {
ItemStack stack = new ItemStack(this); 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; 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 (player.isCreative()) {
if (state.get(STARFISH_VARIATION) == StarfishVariation.RED) { if (state.get(STARFISH_VARIATION) == StarfishVariation.RED) {
world.setBlockState(pos, state.with(STARFISH_VARIATION, StarfishVariation.PINK)); 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) { 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); 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;}
} }

View File

@@ -31,7 +31,7 @@ public class Stick extends Block {
public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED;
public Stick() { 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)); 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)) return Objects.requireNonNull(super.getPlacementState(itemPlacementContext))
.with(STICK_VARIATION, StickVariation.SMALL).with(WATERLOGGED, false); .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 (player.isCreative()) {
if (state.get(STICK_VARIATION) == StickVariation.SMALL) { if (state.get(STICK_VARIATION) == StickVariation.SMALL) {
world.setBlockState(pos, state.with(STICK_VARIATION, StickVariation.MEDIUM)); 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) { 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); 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;}
} }

View File

@@ -12,7 +12,7 @@ public class BlockEntityInit {
public static BlockEntityType<NetherGeyserBlockEntity> NETHER_GEYSER_BE; public static BlockEntityType<NetherGeyserBlockEntity> NETHER_GEYSER_BE;
public static void init() { 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)); 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, new Identifier(RocksMain.MOD_ID,"nether_geyser_blockentity"), FabricBlockEntityTypeBuilder.create(NetherGeyserBlockEntity::new, RocksMain.NetherGeyser).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));
} }
} }

View File

@@ -7,7 +7,7 @@ public enum StarfishVariation implements StringIdentifiable {
PINK("pink"), PINK("pink"),
ORANGE("orange"); ORANGE("orange");
private final String name; public final String name;
StarfishVariation(String name) { StarfishVariation(String name) {
this.name = name; this.name = name;

View File

@@ -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")); 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<PlacedFeature> getKey(String name) { public static RegistryKey<PlacedFeature> 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));
} }
} }

View File

@@ -4,40 +4,46 @@
{ {
"rolls": 1, "rolls": 1,
"entries": [ "entries": [
{ {
"type": "minecraft:alternatives", "type": "minecraft:alternatives",
"children": [ "children": [
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:acacia_stick",
"functions": [
{
"function": "minecraft:copy_state",
"block": "rocks:acacia_stick",
"properties": [
"variation"
]
}
],
"conditions": [ "conditions": [
{ {
"condition": "minecraft:match_tool", "condition": "minecraft:match_tool",
"predicate": { "predicate": {
"enchantments": [ "components": {
{ "minecraft:enchantments": {
"enchantment": "minecraft:silk_touch", "minecraft:silk_touch": 1
"levels": {
"min": 1
}
} }
] }
} }
} }
], ]
"name": "rocks:acacia_stick"
}, },
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "minecraft:stick" "name": "minecraft:stick"
} }
], ]
"conditions": [ }
],
"conditions": [
{ {
"condition": "minecraft:survives_explosion" "condition": "minecraft:survives_explosion"
} }
] ]
} }
] ]
}
]
} }

View File

@@ -4,40 +4,46 @@
{ {
"rolls": 1, "rolls": 1,
"entries": [ "entries": [
{ {
"type": "minecraft:alternatives", "type": "minecraft:alternatives",
"children": [ "children": [
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:andesite_rock",
"functions": [
{
"function": "minecraft:copy_state",
"block": "rocks:andesite_rock",
"properties": [
"variation"
]
}
],
"conditions": [ "conditions": [
{ {
"condition": "minecraft:match_tool", "condition": "minecraft:match_tool",
"predicate": { "predicate": {
"enchantments": [ "components": {
{ "minecraft:enchantments": {
"enchantment": "minecraft:silk_touch", "minecraft:silk_touch": 1
"levels": {
"min": 1
}
} }
] }
} }
} }
], ]
"name": "rocks:andesite_rock"
}, },
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:andesite_splitter" "name": "rocks:andesite_splitter"
} }
], ]
"conditions": [ }
],
"conditions": [
{ {
"condition": "minecraft:survives_explosion" "condition": "minecraft:survives_explosion"
} }
] ]
} }
] ]
}
]
} }

View File

@@ -4,40 +4,46 @@
{ {
"rolls": 1, "rolls": 1,
"entries": [ "entries": [
{ {
"type": "minecraft:alternatives", "type": "minecraft:alternatives",
"children": [ "children": [
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:bamboo_stick",
"functions": [
{
"function": "minecraft:copy_state",
"block": "rocks:bamboo_stick",
"properties": [
"variation"
]
}
],
"conditions": [ "conditions": [
{ {
"condition": "minecraft:match_tool", "condition": "minecraft:match_tool",
"predicate": { "predicate": {
"enchantments": [ "components": {
{ "minecraft:enchantments": {
"enchantment": "minecraft:silk_touch", "minecraft:silk_touch": 1
"levels": {
"min": 1
}
} }
] }
} }
} }
], ]
"name": "rocks:bamboo_stick"
}, },
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "minecraft:bamboo" "name": "minecraft:bamboo"
} }
], ]
"conditions": [ }
],
"conditions": [
{ {
"condition": "minecraft:survives_explosion" "condition": "minecraft:survives_explosion"
} }
] ]
} }
] ]
}
]
} }

View File

@@ -4,40 +4,46 @@
{ {
"rolls": 1, "rolls": 1,
"entries": [ "entries": [
{ {
"type": "minecraft:alternatives", "type": "minecraft:alternatives",
"children": [ "children": [
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:birch_stick",
"functions": [
{
"function": "minecraft:copy_state",
"block": "rocks:birch_stick",
"properties": [
"variation"
]
}
],
"conditions": [ "conditions": [
{ {
"condition": "minecraft:match_tool", "condition": "minecraft:match_tool",
"predicate": { "predicate": {
"enchantments": [ "components": {
{ "minecraft:enchantments": {
"enchantment": "minecraft:silk_touch", "minecraft:silk_touch": 1
"levels": {
"min": 1
}
} }
] }
} }
} }
], ]
"name": "rocks:birch_stick"
}, },
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "minecraft:stick" "name": "minecraft:stick"
} }
], ]
"conditions": [ }
],
"conditions": [
{ {
"condition": "minecraft:survives_explosion" "condition": "minecraft:survives_explosion"
} }
] ]
} }
] ]
}
]
} }

View File

@@ -4,40 +4,46 @@
{ {
"rolls": 1, "rolls": 1,
"entries": [ "entries": [
{ {
"type": "minecraft:alternatives", "type": "minecraft:alternatives",
"children": [ "children": [
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:cherry_stick",
"functions": [
{
"function": "minecraft:copy_state",
"block": "rocks:cherry_stick",
"properties": [
"variation"
]
}
],
"conditions": [ "conditions": [
{ {
"condition": "minecraft:match_tool", "condition": "minecraft:match_tool",
"predicate": { "predicate": {
"enchantments": [ "components": {
{ "minecraft:enchantments": {
"enchantment": "minecraft:silk_touch", "minecraft:silk_touch": 1
"levels": {
"min": 1
}
} }
] }
} }
} }
], ]
"name": "rocks:cherry_stick"
}, },
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "minecraft:stick" "name": "minecraft:stick"
} }
], ]
"conditions": [ }
],
"conditions": [
{ {
"condition": "minecraft:survives_explosion" "condition": "minecraft:survives_explosion"
} }
] ]
} }
] ]
}
]
} }

View File

@@ -4,40 +4,46 @@
{ {
"rolls": 1, "rolls": 1,
"entries": [ "entries": [
{ {
"type": "minecraft:alternatives", "type": "minecraft:alternatives",
"children": [ "children": [
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:crimson_stick",
"functions": [
{
"function": "minecraft:copy_state",
"block": "rocks:crimson_stick",
"properties": [
"variation"
]
}
],
"conditions": [ "conditions": [
{ {
"condition": "minecraft:match_tool", "condition": "minecraft:match_tool",
"predicate": { "predicate": {
"enchantments": [ "components": {
{ "minecraft:enchantments": {
"enchantment": "minecraft:silk_touch", "minecraft:silk_touch": 1
"levels": {
"min": 1
}
} }
] }
} }
} }
], ]
"name": "rocks:crimson_stick"
}, },
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "minecraft:stick" "name": "minecraft:stick"
} }
], ]
"conditions": [ }
],
"conditions": [
{ {
"condition": "minecraft:survives_explosion" "condition": "minecraft:survives_explosion"
} }
] ]
} }
] ]
}
]
} }

View File

@@ -4,40 +4,46 @@
{ {
"rolls": 1, "rolls": 1,
"entries": [ "entries": [
{ {
"type": "minecraft:alternatives", "type": "minecraft:alternatives",
"children": [ "children": [
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:dark_oak_stick",
"functions": [
{
"function": "minecraft:copy_state",
"block": "rocks:dark_oak_stick",
"properties": [
"variation"
]
}
],
"conditions": [ "conditions": [
{ {
"condition": "minecraft:match_tool", "condition": "minecraft:match_tool",
"predicate": { "predicate": {
"enchantments": [ "components": {
{ "minecraft:enchantments": {
"enchantment": "minecraft:silk_touch", "minecraft:silk_touch": 1
"levels": {
"min": 1
}
} }
] }
} }
} }
], ]
"name": "rocks:dark_oak_stick"
}, },
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "minecraft:stick" "name": "minecraft:stick"
} }
], ]
"conditions": [ }
],
"conditions": [
{ {
"condition": "minecraft:survives_explosion" "condition": "minecraft:survives_explosion"
} }
] ]
} }
] ]
}
]
} }

View File

@@ -4,40 +4,46 @@
{ {
"rolls": 1, "rolls": 1,
"entries": [ "entries": [
{ {
"type": "minecraft:alternatives", "type": "minecraft:alternatives",
"children": [ "children": [
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:diorite_rock",
"functions": [
{
"function": "minecraft:copy_state",
"block": "rocks:diorite_rock",
"properties": [
"variation"
]
}
],
"conditions": [ "conditions": [
{ {
"condition": "minecraft:match_tool", "condition": "minecraft:match_tool",
"predicate": { "predicate": {
"enchantments": [ "components": {
{ "minecraft:enchantments": {
"enchantment": "minecraft:silk_touch", "minecraft:silk_touch": 1
"levels": {
"min": 1
}
} }
] }
} }
} }
], ]
"name": "rocks:diorite_rock"
}, },
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:diorite_splitter" "name": "rocks:diorite_splitter"
} }
], ]
"conditions": [ }
],
"conditions": [
{ {
"condition": "minecraft:survives_explosion" "condition": "minecraft:survives_explosion"
} }
] ]
} }
] ]
}
]
} }

View File

@@ -4,40 +4,46 @@
{ {
"rolls": 1, "rolls": 1,
"entries": [ "entries": [
{ {
"type": "minecraft:alternatives", "type": "minecraft:alternatives",
"children": [ "children": [
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:end_stone_rock",
"functions": [
{
"function": "minecraft:copy_state",
"block": "rocks:end_stone_rock",
"properties": [
"variation"
]
}
],
"conditions": [ "conditions": [
{ {
"condition": "minecraft:match_tool", "condition": "minecraft:match_tool",
"predicate": { "predicate": {
"enchantments": [ "components": {
{ "minecraft:enchantments": {
"enchantment": "minecraft:silk_touch", "minecraft:silk_touch": 1
"levels": {
"min": 1
}
} }
] }
} }
} }
], ]
"name": "rocks:end_stone_rock"
}, },
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:end_stone_splitter" "name": "rocks:end_stone_splitter"
} }
], ]
"conditions": [ }
],
"conditions": [
{ {
"condition": "minecraft:survives_explosion" "condition": "minecraft:survives_explosion"
} }
] ]
} }
] ]
}
]
} }

View File

@@ -4,40 +4,46 @@
{ {
"rolls": 1, "rolls": 1,
"entries": [ "entries": [
{ {
"type": "minecraft:alternatives", "type": "minecraft:alternatives",
"children": [ "children": [
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:granite_rock",
"functions": [
{
"function": "minecraft:copy_state",
"block": "rocks:granite_rock",
"properties": [
"variation"
]
}
],
"conditions": [ "conditions": [
{ {
"condition": "minecraft:match_tool", "condition": "minecraft:match_tool",
"predicate": { "predicate": {
"enchantments": [ "components": {
{ "minecraft:enchantments": {
"enchantment": "minecraft:silk_touch", "minecraft:silk_touch": 1
"levels": {
"min": 1
}
} }
] }
} }
} }
], ]
"name": "rocks:granite_rock"
}, },
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:granite_splitter" "name": "rocks:granite_splitter"
} }
], ]
"conditions": [ }
],
"conditions": [
{ {
"condition": "minecraft:survives_explosion" "condition": "minecraft:survives_explosion"
} }
] ]
} }
] ]
}
]
} }

View File

@@ -4,40 +4,46 @@
{ {
"rolls": 1, "rolls": 1,
"entries": [ "entries": [
{ {
"type": "minecraft:alternatives", "type": "minecraft:alternatives",
"children": [ "children": [
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:gravel_rock",
"functions": [
{
"function": "minecraft:copy_state",
"block": "rocks:gravel_rock",
"properties": [
"variation"
]
}
],
"conditions": [ "conditions": [
{ {
"condition": "minecraft:match_tool", "condition": "minecraft:match_tool",
"predicate": { "predicate": {
"enchantments": [ "components": {
{ "minecraft:enchantments": {
"enchantment": "minecraft:silk_touch", "minecraft:silk_touch": 1
"levels": {
"min": 1
}
} }
] }
} }
} }
], ]
"name": "rocks:gravel_rock"
}, },
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "minecraft:flint" "name": "minecraft:flint"
} }
], ]
"conditions": [ }
],
"conditions": [
{ {
"condition": "minecraft:survives_explosion" "condition": "minecraft:survives_explosion"
} }
] ]
} }
] ]
}
]
} }

View File

@@ -4,40 +4,46 @@
{ {
"rolls": 1, "rolls": 1,
"entries": [ "entries": [
{ {
"type": "minecraft:alternatives", "type": "minecraft:alternatives",
"children": [ "children": [
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:jungle_stick",
"functions": [
{
"function": "minecraft:copy_state",
"block": "rocks:jungle_stick",
"properties": [
"variation"
]
}
],
"conditions": [ "conditions": [
{ {
"condition": "minecraft:match_tool", "condition": "minecraft:match_tool",
"predicate": { "predicate": {
"enchantments": [ "components": {
{ "minecraft:enchantments": {
"enchantment": "minecraft:silk_touch", "minecraft:silk_touch": 1
"levels": {
"min": 1
}
} }
] }
} }
} }
], ]
"name": "rocks:jungle_stick"
}, },
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "minecraft:stick" "name": "minecraft:stick"
} }
], ]
"conditions": [ }
],
"conditions": [
{ {
"condition": "minecraft:survives_explosion" "condition": "minecraft:survives_explosion"
} }
] ]
} }
] ]
}
]
} }

View File

@@ -4,40 +4,46 @@
{ {
"rolls": 1, "rolls": 1,
"entries": [ "entries": [
{ {
"type": "minecraft:alternatives", "type": "minecraft:alternatives",
"children": [ "children": [
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:mangrove_stick",
"functions": [
{
"function": "minecraft:copy_state",
"block": "rocks:mangrove_stick",
"properties": [
"variation"
]
}
],
"conditions": [ "conditions": [
{ {
"condition": "minecraft:match_tool", "condition": "minecraft:match_tool",
"predicate": { "predicate": {
"enchantments": [ "components": {
{ "minecraft:enchantments": {
"enchantment": "minecraft:silk_touch", "minecraft:silk_touch": 1
"levels": {
"min": 1
}
} }
] }
} }
} }
], ]
"name": "rocks:mangrove_stick"
}, },
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "minecraft:stick" "name": "minecraft:stick"
} }
], ]
"conditions": [ }
],
"conditions": [
{ {
"condition": "minecraft:survives_explosion" "condition": "minecraft:survives_explosion"
} }
] ]
} }
] ]
}
]
} }

View File

@@ -4,40 +4,46 @@
{ {
"rolls": 1, "rolls": 1,
"entries": [ "entries": [
{ {
"type": "minecraft:alternatives", "type": "minecraft:alternatives",
"children": [ "children": [
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:netherrack_rock",
"functions": [
{
"function": "minecraft:copy_state",
"block": "rocks:netherrack_rock",
"properties": [
"variation"
]
}
],
"conditions": [ "conditions": [
{ {
"condition": "minecraft:match_tool", "condition": "minecraft:match_tool",
"predicate": { "predicate": {
"enchantments": [ "components": {
{ "minecraft:enchantments": {
"enchantment": "minecraft:silk_touch", "minecraft:silk_touch": 1
"levels": {
"min": 1
}
} }
] }
} }
} }
], ]
"name": "rocks:netherrack_rock"
}, },
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:netherrack_splitter" "name": "rocks:netherrack_splitter"
} }
], ]
"conditions": [ }
],
"conditions": [
{ {
"condition": "minecraft:survives_explosion" "condition": "minecraft:survives_explosion"
} }
] ]
} }
] ]
}
]
} }

View File

@@ -4,40 +4,46 @@
{ {
"rolls": 1, "rolls": 1,
"entries": [ "entries": [
{ {
"type": "minecraft:alternatives", "type": "minecraft:alternatives",
"children": [ "children": [
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:oak_stick",
"functions": [
{
"function": "minecraft:copy_state",
"block": "rocks:oak_stick",
"properties": [
"variation"
]
}
],
"conditions": [ "conditions": [
{ {
"condition": "minecraft:match_tool", "condition": "minecraft:match_tool",
"predicate": { "predicate": {
"enchantments": [ "components": {
{ "minecraft:enchantments": {
"enchantment": "minecraft:silk_touch", "minecraft:silk_touch": 1
"levels": {
"min": 1
}
} }
] }
} }
} }
], ]
"name": "rocks:oak_stick"
}, },
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "minecraft:stick" "name": "minecraft:stick"
} }
], ]
"conditions": [ }
],
"conditions": [
{ {
"condition": "minecraft:survives_explosion" "condition": "minecraft:survives_explosion"
} }
] ]
} }
] ]
}
]
} }

View File

@@ -4,40 +4,37 @@
{ {
"rolls": 1, "rolls": 1,
"entries": [ "entries": [
{ {
"type": "minecraft:alternatives", "type": "minecraft:alternatives",
"children": [ "children": [
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:pinecone",
"conditions": [ "conditions": [
{ {
"condition": "minecraft:match_tool", "condition": "minecraft:match_tool",
"predicate": { "predicate": {
"enchantments": [ "components": {
{ "minecraft:enchantments": {
"enchantment": "minecraft:silk_touch", "minecraft:silk_touch": 1
"levels": {
"min": 1
}
} }
] }
} }
} }
], ]
"name": "rocks:pinecone"
}, },
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "minecraft:spruce_sapling" "name": "minecraft:spruce_sapling"
} }
], ]
"conditions": [ }
],
"conditions": [
{ {
"condition": "minecraft:survives_explosion" "condition": "minecraft:survives_explosion"
} }
] ]
} }
] ]
}
]
} }

View File

@@ -4,40 +4,46 @@
{ {
"rolls": 1, "rolls": 1,
"entries": [ "entries": [
{ {
"type": "minecraft:alternatives", "type": "minecraft:alternatives",
"children": [ "children": [
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:red_sand_rock",
"functions": [
{
"function": "minecraft:copy_state",
"block": "rocks:red_sand_rock",
"properties": [
"variation"
]
}
],
"conditions": [ "conditions": [
{ {
"condition": "minecraft:match_tool", "condition": "minecraft:match_tool",
"predicate": { "predicate": {
"enchantments": [ "components": {
{ "minecraft:enchantments": {
"enchantment": "minecraft:silk_touch", "minecraft:silk_touch": 1
"levels": {
"min": 1
}
} }
] }
} }
} }
], ]
"name": "rocks:red_sand_rock"
}, },
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:red_sandstone_splitter" "name": "rocks:red_sandstone_splitter"
} }
], ]
"conditions": [ }
],
"conditions": [
{ {
"condition": "minecraft:survives_explosion" "condition": "minecraft:survives_explosion"
} }
] ]
} }
] ]
}
]
} }

View File

@@ -4,40 +4,46 @@
{ {
"rolls": 1, "rolls": 1,
"entries": [ "entries": [
{ {
"type": "minecraft:alternatives", "type": "minecraft:alternatives",
"children": [ "children": [
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:rock",
"functions": [
{
"function": "minecraft:copy_state",
"block": "rocks:rock",
"properties": [
"variation"
]
}
],
"conditions": [ "conditions": [
{ {
"condition": "minecraft:match_tool", "condition": "minecraft:match_tool",
"predicate": { "predicate": {
"enchantments": [ "components": {
{ "minecraft:enchantments": {
"enchantment": "minecraft:silk_touch", "minecraft:silk_touch": 1
"levels": {
"min": 1
}
} }
] }
} }
} }
], ]
"name": "rocks:rock"
}, },
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:cobblestone_splitter" "name": "rocks:cobblestone_splitter"
} }
], ]
"conditions": [ }
],
"conditions": [
{ {
"condition": "minecraft:survives_explosion" "condition": "minecraft:survives_explosion"
} }
] ]
} }
] ]
}
]
} }

View File

@@ -4,40 +4,46 @@
{ {
"rolls": 1, "rolls": 1,
"entries": [ "entries": [
{ {
"type": "minecraft:alternatives", "type": "minecraft:alternatives",
"children": [ "children": [
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:sand_rock",
"functions": [
{
"function": "minecraft:copy_state",
"block": "rocks:sand_rock",
"properties": [
"variation"
]
}
],
"conditions": [ "conditions": [
{ {
"condition": "minecraft:match_tool", "condition": "minecraft:match_tool",
"predicate": { "predicate": {
"enchantments": [ "components": {
{ "minecraft:enchantments": {
"enchantment": "minecraft:silk_touch", "minecraft:silk_touch": 1
"levels": {
"min": 1
}
} }
] }
} }
} }
], ]
"name": "rocks:sand_rock"
}, },
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:sandstone_splitter" "name": "rocks:sandstone_splitter"
} }
], ]
"conditions": [ }
],
"conditions": [
{ {
"condition": "minecraft:survives_explosion" "condition": "minecraft:survives_explosion"
} }
] ]
} }
] ]
}
]
} }

View File

@@ -4,40 +4,46 @@
{ {
"rolls": 1, "rolls": 1,
"entries": [ "entries": [
{ {
"type": "minecraft:alternatives", "type": "minecraft:alternatives",
"children": [ "children": [
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:soul_soil_rock",
"functions": [
{
"function": "minecraft:copy_state",
"block": "rocks:soul_soil_rock",
"properties": [
"variation"
]
}
],
"conditions": [ "conditions": [
{ {
"condition": "minecraft:match_tool", "condition": "minecraft:match_tool",
"predicate": { "predicate": {
"enchantments": [ "components": {
{ "minecraft:enchantments": {
"enchantment": "minecraft:silk_touch", "minecraft:silk_touch": 1
"levels": {
"min": 1
}
} }
] }
} }
} }
], ]
"name": "rocks:soul_soil_rock"
}, },
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:soul_soil_splitter" "name": "rocks:soul_soil_splitter"
} }
], ]
"conditions": [ }
],
"conditions": [
{ {
"condition": "minecraft:survives_explosion" "condition": "minecraft:survives_explosion"
} }
] ]
} }
] ]
}
]
} }

View File

@@ -4,40 +4,46 @@
{ {
"rolls": 1, "rolls": 1,
"entries": [ "entries": [
{ {
"type": "minecraft:alternatives", "type": "minecraft:alternatives",
"children": [ "children": [
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:spruce_stick",
"functions": [
{
"function": "minecraft:copy_state",
"block": "rocks:spruce_stick",
"properties": [
"variation"
]
}
],
"conditions": [ "conditions": [
{ {
"condition": "minecraft:match_tool", "condition": "minecraft:match_tool",
"predicate": { "predicate": {
"enchantments": [ "components": {
{ "minecraft:enchantments": {
"enchantment": "minecraft:silk_touch", "minecraft:silk_touch": 1
"levels": {
"min": 1
}
} }
] }
} }
} }
], ]
"name": "rocks:spruce_stick"
}, },
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "minecraft:stick" "name": "minecraft:stick"
} }
], ]
"conditions": [ }
],
"conditions": [
{ {
"condition": "minecraft:survives_explosion" "condition": "minecraft:survives_explosion"
} }
] ]
} }
] ]
}
]
} }

View File

@@ -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"
]
}
]
}
]
}
]
}

View File

@@ -4,40 +4,46 @@
{ {
"rolls": 1, "rolls": 1,
"entries": [ "entries": [
{ {
"type": "minecraft:alternatives", "type": "minecraft:alternatives",
"children": [ "children": [
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "rocks:spruce_stick",
"functions": [
{
"function": "minecraft:copy_state",
"block": "rocks:spruce_stick",
"properties": [
"variation"
]
}
],
"conditions": [ "conditions": [
{ {
"condition": "minecraft:match_tool", "condition": "minecraft:match_tool",
"predicate": { "predicate": {
"enchantments": [ "components": {
{ "minecraft:enchantments": {
"enchantment": "minecraft:silk_touch", "minecraft:silk_touch": 1
"levels": {
"min": 1
}
} }
] }
} }
} }
], ]
"name": "rocks:warped_stick"
}, },
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "minecraft:stick" "name": "minecraft:stick"
} }
], ]
"conditions": [ }
],
"conditions": [
{ {
"condition": "minecraft:survives_explosion" "condition": "minecraft:survives_explosion"
} }
] ]
} }
] ]
}
]
} }

View File

@@ -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"
}
]
}
]
}