14 Commits

Author SHA1 Message Date
Motschen
f09b349756 This Rocks 1.5.0 - Crimson & Warped Sticks, Config, Compat
- Added Crimson and Warped sticks that generate in nether forests
- Add config to disable spawning of each block
- Migrate to Fabric Biome API
(results in better compatibility with biome datapacks)
- Optimize assets by @RDKRACZ
2021-09-19 13:48:20 +02:00
Motschen
55cb0ec293 Merge pull request #22 from RDKRACZ/oxipng
Optimized assets.
2021-09-15 21:10:50 +02:00
K0RR
9e88035dba Update README.md 2021-09-09 12:48:26 +02:00
K0RR
d18c72aad4 Update gradle-wrapper.properties 2021-09-09 12:47:06 +02:00
K0RR
2056feac66 Optimized assets.
Lossless compression.
2021-08-02 01:09:31 +02:00
Motschen
2e8f562270 This Rocks 1.4.0 - 1.17 and QOL
- Update to 1.17-pre1 and Java 16
- Make starfish items contain variations
- Fix bugs
2021-05-30 13:07:44 +02:00
Motschen
ba7dc4ea23 Merge pull request #18 from RDKRACZ/main
Create pl_pl.json
2021-05-15 11:46:17 +00:00
K0RR
353234fcd2 Fix misspelling 2021-04-05 16:53:26 +02:00
K0RR
4f462a23bf Update pl_pl.json 2021-04-05 16:51:28 +02:00
K0RR
458d91fd91 Create pl_pl.json 2021-04-05 01:44:01 +02:00
Motschen
4dc7f9fa4e Merge pull request #14 from Romz24/patch-1
Update ru_ru.json
2021-02-08 19:58:22 +01:00
Roman Hubenkov
6c57822e82 Update ru_ru.json 2021-02-08 21:45:52 +03:00
Motschen
f5a3f743a5 Bump version 2021-02-08 16:24:27 +01:00
Motschen
a2a834790c Fix missing starfish particles 2021-02-08 16:21:12 +01:00
219 changed files with 926 additions and 395 deletions

2
.gitignore vendored Normal file → Executable file
View File

@@ -1,5 +1,5 @@
# gradle # gradle
build/
.gradle/ .gradle/
out/ out/
classes/ classes/

0
LICENSE Normal file → Executable file
View File

2
README.md Normal file → Executable file
View File

@@ -1,2 +1,4 @@
# This Rocks! # This Rocks!
https://www.curseforge.com/minecraft/mc-mods/this-rocks
This super amazing beautiful wonderful mod adds little rocks, sticks, pinecones and seashells to your world to make it feel more natural. This super amazing beautiful wonderful mod adds little rocks, sticks, pinecones and seashells to your world to make it feel more natural.

64
build.gradle Normal file → Executable file
View File

@@ -1,66 +1,70 @@
plugins { plugins {
id 'fabric-loom' version '0.4-SNAPSHOT' id 'fabric-loom' version '0.8-SNAPSHOT'
id 'maven-publish' id 'maven-publish'
} }
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_16
archivesBaseName = project.archives_base_name archivesBaseName = project.archives_base_name
version = project.mod_version version = project.mod_version
group = project.maven_group group = project.maven_group
minecraft { minecraft {
accessWidener = file("src/main/resources/thisrocks.accesswidener")
} }
repositories { repositories {
maven { url "https://maven.terraformersmc.com/releases" }
maven { url "https://jitpack.io" } maven { url "https://jitpack.io" }
maven { url "https://maven.blamejared.com" } flatDir {
dirs 'local_maven'
}
} }
dependencies { dependencies {
//to change the versions see the gradle.properties file //to change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}" minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modCompile "net.fabricmc:fabric-loader:${project.loader_version}" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
// Fabric API. This is technically optional, but you probably want it anyway. // Fabric API. This is technically optional, but you probably want it anyway.
modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation "eu.midnightdust:midnight-hats:${midnighthats_version}" modImplementation "eu.midnightdust:midnightlib:${midnightlib_version}"
include "eu.midnightdust:midnight-hats:${midnighthats_version}" include "eu.midnightdust:midnightlib:${midnightlib_version}"
} }
processResources { processResources {
inputs.property "version", project.version inputs.property "version", project.version
from(sourceSets.main.resources.srcDirs) { filesMatching("fabric.mod.json") {
include "fabric.mod.json"
expand "version": project.version expand "version": project.version
} }
from(sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json"
}
} }
// ensure that the encoding is set to UTF-8, no matter what the system default is tasks.withType(JavaCompile).configureEach {
// this fixes some edge cases with special characters not displaying correctly // ensure that the encoding is set to UTF-8, no matter what the system default is
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html // this fixes some edge cases with special characters not displaying correctly
tasks.withType(JavaCompile) { // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
options.encoding = "UTF-8" // 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 = 16
} }
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task java {
// if it is present. // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// If you remove this task, sources will not be generated. // if it is present.
task sourcesJar(type: Jar, dependsOn: classes) { // If you remove this line, sources will not be generated.
classifier = "sources" withSourcesJar()
from sourceSets.main.allSource
} }
jar { jar {
from "LICENSE" from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
} }
// configure the maven publication // configure the maven publication
@@ -77,9 +81,11 @@ publishing {
} }
} }
// select the repositories you want to publish to // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories { repositories {
// uncomment to publish to the local maven // Add repositories to publish to here.
// mavenLocal() // Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
} }
} }

12
gradle.properties Normal file → Executable file
View File

@@ -3,16 +3,16 @@ 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.16.4 minecraft_version=1.17.1
yarn_mappings=1.16.4+build.7 yarn_mappings=1.17.1+build.61
loader_version=0.10.8 loader_version=0.11.7
# Mod Properties # Mod Properties
mod_version = 1.3.0 mod_version = 1.5.0
maven_group = eu.midnightdust.motschen maven_group = eu.midnightdust.motschen
archives_base_name = rocks archives_base_name = rocks
# 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.17.2+build.396-1.16 fabric_version=0.40.1+1.17
midnighthats_version=2.0.1 midnightlib_version=0.2.5

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file → Executable file

Binary file not shown.

2
gradle/wrapper/gradle-wrapper.properties vendored Normal file → Executable file
View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

35
gradlew vendored Normal file → Executable file
View File

@@ -82,6 +82,7 @@ esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM. # Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -125,10 +126,11 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi fi
# For Cygwin, switch paths to Windows format before running java # For Cygwin or MSYS, switch paths to Windows format before running java
if $cygwin ; then if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"` APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"` JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath # We build the pattern for arguments to be converted via cygpath
@@ -154,19 +156,19 @@ if $cygwin ; then
else else
eval `echo args$i`="\"$arg\"" eval `echo args$i`="\"$arg\""
fi fi
i=$((i+1)) i=`expr $i + 1`
done done
case $i in case $i in
(0) set -- ;; 0) set -- ;;
(1) set -- "$args0" ;; 1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;; 2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;; 3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;; 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac esac
fi fi
@@ -175,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " " echo " "
} }
APP_ARGS=$(save "$@") APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules # Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@" exec "$JAVACMD" "$@"

25
gradlew.bat vendored Normal file → Executable file
View File

@@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% 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. @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" set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init if "%ERRORLEVEL%" == "0" goto execute
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -51,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=% set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init if exist "%JAVA_EXE%" goto execute
echo. echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -61,28 +64,14 @@ echo location of your Java installation.
goto fail goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute :execute
@rem Setup the command line @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 @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell

BIN
local_maven/midnightlib-0.2.5.jar Executable file

Binary file not shown.

0
settings.gradle Normal file → Executable file
View File

View File

@@ -0,0 +1,14 @@
package eu.midnightdust.motschen.rocks;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.object.builder.v1.client.model.FabricModelPredicateProviderRegistry;
import net.minecraft.util.Identifier;
public class RocksClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
FabricModelPredicateProviderRegistry.register(RocksMain.Starfish.asItem(), new Identifier("red"), (stack, world, entity, seed) -> (stack.getNbt() != null && stack.getNbt().getString("variation").equals("red")) ? 1 : 0);
FabricModelPredicateProviderRegistry.register(RocksMain.Starfish.asItem(), new Identifier("pink"), (stack, world, entity, seed) -> (stack.getNbt() != null && stack.getNbt().getString("variation").equals("pink")) ? 1 : 0);
FabricModelPredicateProviderRegistry.register(RocksMain.Starfish.asItem(), new Identifier("orange"), (stack, world, entity, seed) -> (stack.getNbt() != null && stack.getNbt().getString("variation").equals("orange")) ? 1 : 0);
}
}

View File

@@ -6,6 +6,7 @@ import eu.midnightdust.motschen.rocks.blockstates.RockVariation;
import eu.midnightdust.motschen.rocks.blockstates.SeashellVariation; import eu.midnightdust.motschen.rocks.blockstates.SeashellVariation;
import eu.midnightdust.motschen.rocks.blockstates.StarfishVariation; import eu.midnightdust.motschen.rocks.blockstates.StarfishVariation;
import eu.midnightdust.motschen.rocks.blockstates.StickVariation; import eu.midnightdust.motschen.rocks.blockstates.StickVariation;
import eu.midnightdust.motschen.rocks.config.RocksConfig;
import eu.midnightdust.motschen.rocks.world.*; import eu.midnightdust.motschen.rocks.world.*;
import eu.midnightdust.motschen.rocks.world.configured_feature.MiscFeatures; import eu.midnightdust.motschen.rocks.world.configured_feature.MiscFeatures;
import eu.midnightdust.motschen.rocks.world.configured_feature.NetherFeatures; import eu.midnightdust.motschen.rocks.world.configured_feature.NetherFeatures;
@@ -20,9 +21,7 @@ import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
public class RocksMain implements ModInitializer { public class RocksMain implements ModInitializer {
public static final String MOD_ID = "rocks"; public static final String MOD_ID = "rocks";
public static final ItemGroup RocksGroup = FabricItemGroupBuilder.build(new Identifier(MOD_ID, "rocks"), () -> new ItemStack(RocksMain.Rock)); public static final ItemGroup RocksGroup = FabricItemGroupBuilder.build(new Identifier(MOD_ID, "rocks"), () -> new ItemStack(RocksMain.Rock));
public static final EnumProperty<RockVariation> ROCK_VARIATION = EnumProperty.of("variation", RockVariation.class); public static final EnumProperty<RockVariation> ROCK_VARIATION = EnumProperty.of("variation", RockVariation.class);
@@ -47,6 +46,8 @@ public class RocksMain implements ModInitializer {
public static Block AcaciaStick = new Stick(); public static Block AcaciaStick = new Stick();
public static Block JungleStick = new Stick(); public static Block JungleStick = new Stick();
public static Block DarkOakStick = new Stick(); public static Block DarkOakStick = new Stick();
public static Block CrimsonStick = new Stick();
public static Block WarpedStick = new Stick();
public static Block Pinecone = new Pinecone(); public static Block Pinecone = new Pinecone();
public static Block Seashell = new Seashell(); public static Block Seashell = new Seashell();
@@ -66,6 +67,8 @@ public class RocksMain implements ModInitializer {
@Override @Override
public void onInitialize() { public void onInitialize() {
RocksConfig.init("rocks", RocksConfig.class);
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"rock"), Rock); Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"rock"), Rock);
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"rock"), new BlockItem(Rock, new Item.Settings().group(RocksMain.RocksGroup))); Registry.register(Registry.ITEM, new Identifier(MOD_ID,"rock"), new BlockItem(Rock, new Item.Settings().group(RocksMain.RocksGroup)));
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"granite_rock"), GraniteRock); Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"granite_rock"), GraniteRock);
@@ -99,6 +102,10 @@ public class RocksMain implements ModInitializer {
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"jungle_stick"), new BlockItem(JungleStick, new Item.Settings().group(RocksMain.RocksGroup))); Registry.register(Registry.ITEM, new Identifier(MOD_ID,"jungle_stick"), new BlockItem(JungleStick, new Item.Settings().group(RocksMain.RocksGroup)));
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"dark_oak_stick"), DarkOakStick); Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"dark_oak_stick"), DarkOakStick);
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"dark_oak_stick"), new BlockItem(DarkOakStick, new Item.Settings().group(RocksMain.RocksGroup))); Registry.register(Registry.ITEM, new Identifier(MOD_ID,"dark_oak_stick"), new BlockItem(DarkOakStick, new Item.Settings().group(RocksMain.RocksGroup)));
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"crimson_stick"), CrimsonStick);
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"crimson_stick"), new BlockItem(CrimsonStick, new Item.Settings().group(RocksMain.RocksGroup)));
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"warped_stick"), WarpedStick);
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"warped_stick"), new BlockItem(WarpedStick, new Item.Settings().group(RocksMain.RocksGroup)));
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"geyser"), Geyser); Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"geyser"), Geyser);
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"geyser"), new BlockItem(Geyser, new Item.Settings().group(RocksMain.RocksGroup))); Registry.register(Registry.ITEM, new Identifier(MOD_ID,"geyser"), new BlockItem(Geyser, new Item.Settings().group(RocksMain.RocksGroup)));
@@ -126,7 +133,6 @@ public class RocksMain implements ModInitializer {
StickFeatures.init(); StickFeatures.init();
MiscFeatures.init(); MiscFeatures.init();
NetherFeatures.init(); NetherFeatures.init();
FeatureInjector.init(); FeatureInjector.init();
BlockEntityInit.init(); BlockEntityInit.init();
} }

View File

@@ -1,9 +1,12 @@
package eu.midnightdust.motschen.rocks.block; package eu.midnightdust.motschen.rocks.block;
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;
import net.minecraft.block.*; import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityTicker;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.state.StateManager; import net.minecraft.state.StateManager;
@@ -12,9 +15,13 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;
import org.jetbrains.annotations.Nullable;
public class NetherGeyser extends Block implements BlockEntityProvider { import java.util.Objects;
public class NetherGeyser extends BlockWithEntity implements BlockEntityProvider {
private static final VoxelShape SHAPE; private static final VoxelShape SHAPE;
public static final BooleanProperty ACTIVE = BooleanProperty.of("active"); public static final BooleanProperty ACTIVE = BooleanProperty.of("active");
@@ -24,13 +31,20 @@ public class NetherGeyser extends Block implements BlockEntityProvider {
this.setDefaultState(this.stateManager.getDefaultState().with(ACTIVE, false)); this.setDefaultState(this.stateManager.getDefaultState().with(ACTIVE, false));
} }
@Override @Override
public BlockEntity createBlockEntity(BlockView view) { public BlockRenderType getRenderType(BlockState state) {
return new NetherGeyserBlockEntity(); return BlockRenderType.MODEL;
}
@Override
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
return new NetherGeyserBlockEntity(pos, state);
}
@Nullable
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) {
return checkType(type, BlockEntityInit.NETHER_GEYSER_BE, NetherGeyserBlockEntity::tick);
} }
@Override @Override
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) { public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
return super.getPlacementState(itemPlacementContext) return Objects.requireNonNull(super.getPlacementState(itemPlacementContext))
.with(ACTIVE, false); .with(ACTIVE, false);
} }
@@ -43,9 +57,7 @@ public class NetherGeyser extends Block implements BlockEntityProvider {
return SHAPE; return SHAPE;
} }
static { static {
VoxelShape shape = createCuboidShape(5, 0, 5, 11, 1, 11); SHAPE = createCuboidShape(5, 0, 5, 11, 1, 11);
SHAPE = shape;
} }
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {

View File

@@ -1,9 +1,12 @@
package eu.midnightdust.motschen.rocks.block; package eu.midnightdust.motschen.rocks.block;
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;
import net.minecraft.block.*; import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityTicker;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.state.StateManager; import net.minecraft.state.StateManager;
@@ -14,9 +17,13 @@ import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes; import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;
import org.jetbrains.annotations.Nullable;
public class OverworldGeyser extends Block implements BlockEntityProvider { import java.util.Objects;
public class OverworldGeyser extends BlockWithEntity implements BlockEntityProvider {
private static final VoxelShape SHAPE; private static final VoxelShape SHAPE;
private static final VoxelShape SNOWY_SHAPE; private static final VoxelShape SNOWY_SHAPE;
@@ -28,13 +35,20 @@ public class OverworldGeyser extends Block implements BlockEntityProvider {
this.setDefaultState(this.stateManager.getDefaultState().with(ACTIVE, false).with(SNOWY, false)); this.setDefaultState(this.stateManager.getDefaultState().with(ACTIVE, false).with(SNOWY, false));
} }
@Override @Override
public BlockEntity createBlockEntity(BlockView view) { public BlockRenderType getRenderType(BlockState state) {
return new OverworldGeyserBlockEntity(); return BlockRenderType.MODEL;
}
@Override
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
return new OverworldGeyserBlockEntity(pos, state);
}
@Nullable
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) {
return checkType(type, BlockEntityInit.OVERWORLD_GEYSER_BE, OverworldGeyserBlockEntity::tick);
} }
@Override @Override
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) { public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
return super.getPlacementState(itemPlacementContext) return Objects.requireNonNull(super.getPlacementState(itemPlacementContext))
.with(ACTIVE, false).with(SNOWY, false); .with(ACTIVE, false).with(SNOWY, false);
} }
@@ -44,7 +58,7 @@ public class OverworldGeyser extends Block implements BlockEntityProvider {
} }
@Override @Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) { public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {
if (state.get(SNOWY) == true) {return SNOWY_SHAPE;} if (state.get(SNOWY)) {return SNOWY_SHAPE;}
else return SHAPE; else return SHAPE;
} }
static { static {

View File

@@ -24,9 +24,7 @@ public class Pinecone extends Block {
return SHAPE; return SHAPE;
} }
static { static {
VoxelShape shape = createCuboidShape(0, 0, 0, 16, 3, 16); SHAPE = createCuboidShape(0, 0, 0, 16, 3, 16);
SHAPE = shape;
} }
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {

View File

@@ -20,6 +20,8 @@ import net.minecraft.world.World;
import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;
import java.util.Objects;
public class Rock extends Block { public class Rock extends Block {
private static final VoxelShape SHAPE; private static final VoxelShape SHAPE;
@@ -32,7 +34,7 @@ public class Rock extends Block {
@Override @Override
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) { public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
return 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) { public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
@@ -63,9 +65,7 @@ public class Rock extends Block {
return SHAPE; return SHAPE;
} }
static { static {
VoxelShape shape = createCuboidShape(0, 0, 0, 16, 3, 16); SHAPE = createCuboidShape(0, 0, 0, 16, 3, 16);
SHAPE = shape;
} }
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {

View File

@@ -24,6 +24,8 @@ import net.minecraft.world.World;
import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;
import java.util.Objects;
public class Seashell extends Block implements Waterloggable { public class Seashell extends Block implements Waterloggable {
private static final VoxelShape SHAPE; private static final VoxelShape SHAPE;
@@ -43,7 +45,7 @@ public class Seashell extends Block implements Waterloggable {
@Override @Override
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) { public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
FluidState fluidState = itemPlacementContext.getWorld().getFluidState(itemPlacementContext.getBlockPos()); FluidState fluidState = itemPlacementContext.getWorld().getFluidState(itemPlacementContext.getBlockPos());
return super.getPlacementState(itemPlacementContext) return Objects.requireNonNull(super.getPlacementState(itemPlacementContext))
.with(SEASHELL_VARIATION, SeashellVariation.PINK).with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); .with(SEASHELL_VARIATION, SeashellVariation.PINK).with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER);
} }
@@ -72,9 +74,7 @@ public class Seashell extends Block implements Waterloggable {
return SHAPE; return SHAPE;
} }
static { static {
VoxelShape shape = createCuboidShape(0, 0, 0, 16, 3, 16); SHAPE = createCuboidShape(0, 0, 0, 16, 3, 16);
SHAPE = shape;
} }
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {

View File

@@ -8,6 +8,10 @@ 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;
import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtElement;
import net.minecraft.nbt.NbtString;
import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.state.StateManager; import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.BooleanProperty;
@@ -24,6 +28,8 @@ import net.minecraft.world.World;
import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;
import java.util.Objects;
public class Starfish extends Block implements Waterloggable { public class Starfish extends Block implements Waterloggable {
private static final VoxelShape SHAPE; private static final VoxelShape SHAPE;
@@ -42,9 +48,22 @@ 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 super.getPlacementState(itemPlacementContext) return Objects.requireNonNull(super.getPlacementState(itemPlacementContext))
.with(STARFISH_VARIATION, StarfishVariation.RED).with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); .with(STARFISH_VARIATION, variation).with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER);
}
@Override
public ItemStack getPickStack(BlockView world, BlockPos pos, BlockState state) {
ItemStack stack = new ItemStack(this);
stack.getNbt().putString("variation", state.get(STARFISH_VARIATION).asString());
LOGGER.info(state.get(STARFISH_VARIATION).asString());
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, Hand hand, BlockHitResult hit) {
@@ -72,9 +91,7 @@ public class Starfish extends Block implements Waterloggable {
return SHAPE; return SHAPE;
} }
static { static {
VoxelShape shape = createCuboidShape(0, 0, 0, 16, 1, 16); SHAPE = createCuboidShape(0, 0, 0, 16, 1, 16);
SHAPE = shape;
} }
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {

View File

@@ -20,6 +20,8 @@ import net.minecraft.world.World;
import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;
import java.util.Objects;
public class Stick extends Block { public class Stick extends Block {
private static final VoxelShape SHAPE; private static final VoxelShape SHAPE;
@@ -32,7 +34,7 @@ public class Stick extends Block {
@Override @Override
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) { public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
return super.getPlacementState(itemPlacementContext) return Objects.requireNonNull(super.getPlacementState(itemPlacementContext))
.with(STICK_VARIATION, StickVariation.SMALL); .with(STICK_VARIATION, StickVariation.SMALL);
} }
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, Hand hand, BlockHitResult hit) {
@@ -60,9 +62,7 @@ public class Stick extends Block {
return SHAPE; return SHAPE;
} }
static { static {
VoxelShape shape = createCuboidShape(0, 0, 0, 16, 1, 16); SHAPE = createCuboidShape(0, 0, 0, 16, 1, 16);
SHAPE = shape;
} }
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {

View File

@@ -1,6 +1,7 @@
package eu.midnightdust.motschen.rocks.block.blockentity; package eu.midnightdust.motschen.rocks.block.blockentity;
import eu.midnightdust.motschen.rocks.RocksMain; import eu.midnightdust.motschen.rocks.RocksMain;
import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder;
import net.minecraft.block.entity.BlockEntityType; import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
@@ -10,7 +11,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(Registry.BLOCK_ENTITY_TYPE, new Identifier(RocksMain.MOD_ID,"overworld_geyser_blockentity"), BlockEntityType.Builder.create(OverworldGeyserBlockEntity::new, RocksMain.Geyser).build(null)); OVERWORLD_GEYSER_BE = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(RocksMain.MOD_ID,"overworld_geyser_blockentity"), FabricBlockEntityTypeBuilder.create(OverworldGeyserBlockEntity::new, RocksMain.Geyser).build(null));
NETHER_GEYSER_BE = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(RocksMain.MOD_ID,"nether_geyser_blockentity"), BlockEntityType.Builder.create(NetherGeyserBlockEntity::new, RocksMain.NetherGeyser).build(null)); NETHER_GEYSER_BE = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(RocksMain.MOD_ID,"nether_geyser_blockentity"), FabricBlockEntityTypeBuilder.create(NetherGeyserBlockEntity::new, RocksMain.NetherGeyser).build(null));
} }
} }

View File

@@ -7,22 +7,22 @@ import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.particle.ParticleTypes; import net.minecraft.particle.ParticleTypes;
import net.minecraft.util.Tickable;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class NetherGeyserBlockEntity extends BlockEntity implements Tickable { public class NetherGeyserBlockEntity extends BlockEntity {
private int countdown = 0; private int countdown = 0;
public NetherGeyserBlockEntity() { public NetherGeyserBlockEntity(BlockPos pos, BlockState state) {
super(BlockEntityInit.NETHER_GEYSER_BE); super(BlockEntityInit.NETHER_GEYSER_BE, pos, state);
} }
@Override public static void tick(World world, BlockPos pos, BlockState state, NetherGeyserBlockEntity blockEntity) {
public void tick() { assert world != null;
if (world.getBlockState(pos).getBlock() == RocksMain.NetherGeyser) { if (world.getBlockState(pos).getBlock() == RocksMain.NetherGeyser) {
PlayerEntity player = this.world.getClosestPlayer(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 3, true); PlayerEntity player = world.getClosestPlayer(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 3, true);
PlayerEntity player2 = this.world.getClosestPlayer(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 1, true); PlayerEntity player2 = world.getClosestPlayer(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 1, true);
BlockState state = this.getCachedState();
if (player != null) { if (player != null) {
world.setBlockState(pos, state.with(NetherGeyser.ACTIVE, true)); world.setBlockState(pos, state.with(NetherGeyser.ACTIVE, true));
@@ -31,17 +31,17 @@ public class NetherGeyserBlockEntity extends BlockEntity implements Tickable {
if (player2 != null) { if (player2 != null) {
player2.damage(DamageSource.ON_FIRE, 4); player2.damage(DamageSource.ON_FIRE, 4);
} }
countdown = 1000; blockEntity.countdown = 1000;
} else { } else {
if (countdown > 0) { if (blockEntity.countdown > 0) {
countdown = countdown - 1; blockEntity.countdown = blockEntity.countdown - 1;
} }
if (countdown == 0) { if (blockEntity.countdown == 0) {
world.setBlockState(pos, state.with(NetherGeyser.ACTIVE, false)); world.setBlockState(pos, state.with(NetherGeyser.ACTIVE, false));
} }
} }
if (Boolean.TRUE.equals(state.get(NetherGeyser.ACTIVE))) { if (state.get(NetherGeyser.ACTIVE)) {
world.addParticle(ParticleTypes.LAVA, pos.getX() + 0.5, pos.getY() + 0.1, pos.getZ() + 0.5, 1, 1.5, 1); world.addParticle(ParticleTypes.LAVA, pos.getX() + 0.5, pos.getY() + 0.1, pos.getZ() + 0.5, 1, 1.5, 1);
world.addParticle(ParticleTypes.LAVA, pos.getX() + 0.5, pos.getY() + 1.0, pos.getZ() + 0.5, 1, 1.5, 1); world.addParticle(ParticleTypes.LAVA, pos.getX() + 0.5, pos.getY() + 1.0, pos.getZ() + 0.5, 1, 1.5, 1);
world.addParticle(ParticleTypes.SMOKE, pos.getX() + 0.5, pos.getY() + 0.1, pos.getZ() + 0.5, 0, 0.3, 0); world.addParticle(ParticleTypes.SMOKE, pos.getX() + 0.5, pos.getY() + 0.1, pos.getZ() + 0.5, 0, 0.3, 0);

View File

@@ -8,45 +8,39 @@ import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects; import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.particle.ParticleTypes; import net.minecraft.particle.ParticleTypes;
import net.minecraft.util.Tickable;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class OverworldGeyserBlockEntity extends BlockEntity implements Tickable { public class OverworldGeyserBlockEntity extends BlockEntity {
private int countdown = 0; public int countdown = 0;
public OverworldGeyserBlockEntity() { public OverworldGeyserBlockEntity(BlockPos pos, BlockState state) {
super(BlockEntityInit.OVERWORLD_GEYSER_BE); super(BlockEntityInit.OVERWORLD_GEYSER_BE, pos, state);
} }
@Override public static void tick(World world, BlockPos pos, BlockState state, OverworldGeyserBlockEntity blockEntity) {
public void tick() { assert world != null;
if (world.getBlockState(pos).getBlock() == RocksMain.Geyser) { if (world.getBlockState(pos).getBlock() == RocksMain.Geyser) {
PlayerEntity player = this.world.getClosestPlayer(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 3, true); PlayerEntity player = world.getClosestPlayer(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 3, true);
PlayerEntity player2 = this.world.getClosestPlayer(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 8, true); PlayerEntity player2 = world.getClosestPlayer(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 8, true);
PlayerEntity player3 = null;
if (player2 != null && player2.getY() >= pos.getY() && (pos.getX() <= player2.getX() && pos.getX() + 1 >= player2.getX()) && (pos.getZ() <= player2.getZ() && pos.getZ() + 1 >= player2.getZ())) { if (player2 != null && player2.getY() >= pos.getY() && (pos.getX() <= player2.getX() && pos.getX() + 1 >= player2.getX()) && (pos.getZ() <= player2.getZ() && pos.getZ() + 1 >= player2.getZ())) {
player3 = player2; player2.addStatusEffect(new StatusEffectInstance(StatusEffects.LEVITATION, 2, 10, true, false, false));
} }
BlockState state = this.getCachedState();
if (player != null) { if (player != null) {
world.setBlockState(pos, state.with(OverworldGeyser.ACTIVE, true)); world.setBlockState(pos, state.with(OverworldGeyser.ACTIVE, true));
blockEntity.countdown = 1000;
if (player3 != null) {
player3.addStatusEffect(new StatusEffectInstance(StatusEffects.LEVITATION, 2, 12, true, false, false));
}
countdown = 1000;
} else { } else {
if (countdown > 0) { if (blockEntity.countdown > 0) {
countdown = countdown - 1; blockEntity.countdown = blockEntity.countdown - 1;
} }
if (countdown == 0) { if (blockEntity.countdown == 0) {
world.setBlockState(pos, state.with(OverworldGeyser.ACTIVE, false)); world.setBlockState(pos, state.with(OverworldGeyser.ACTIVE, false));
} }
} }
if (world != null && state.get(OverworldGeyser.ACTIVE) == true) { if (state.get(OverworldGeyser.ACTIVE)) {
world.addParticle(ParticleTypes.SPIT, pos.getX() + 0.5, pos.getY() + 0.1, pos.getZ() + 0.5, 0, 1.0, 0); world.addParticle(ParticleTypes.SPIT, pos.getX() + 0.5, pos.getY() + 0.1, pos.getZ() + 0.5, 0, 1.0, 0);
world.addParticle(ParticleTypes.SPIT, pos.getX() + 0.5, pos.getY() + 0.3, pos.getZ() + 0.5, 0, 1.0, 0); world.addParticle(ParticleTypes.SPIT, pos.getX() + 0.5, pos.getY() + 0.3, pos.getZ() + 0.5, 0, 1.0, 0);
world.addParticle(ParticleTypes.SPLASH, pos.getX() + 0.5, pos.getY() + 1.0, pos.getZ() + 0.5, -0.01, 1.5, -0.01); world.addParticle(ParticleTypes.SPLASH, pos.getX() + 0.5, pos.getY() + 1.0, pos.getZ() + 0.5, -0.01, 1.5, -0.01);

View File

@@ -0,0 +1,38 @@
package eu.midnightdust.motschen.rocks.config;
import eu.midnightdust.lib.config.MidnightConfig;
public class RocksConfig extends MidnightConfig {
@Comment public static Comment needs_restart;
@Comment public static Comment rocks;
@Entry(name = "block.rocks.rock") public static boolean rock = true;
@Entry(name = "block.rocks.granite_rock") public static boolean granite_rock = true;
@Entry(name = "block.rocks.diorite_rock") public static boolean diorite_rock = true;
@Entry(name = "block.rocks.andesite_rock") public static boolean andesite_rock = true;
@Entry(name = "block.rocks.sand_rock") public static boolean sand_rock = true;
@Entry(name = "block.rocks.red_sand_rock") public static boolean red_sand_rock = true;
@Entry(name = "block.rocks.gravel_rock") public static boolean gravel_rock = true;
@Entry(name = "block.rocks.end_stone_rock") public static boolean end_stone_rock = true;
@Entry(name = "block.rocks.netherrack_rock") public static boolean netherrack_rock = true;
@Entry(name = "block.rocks.soul_soil_rock") public static boolean soul_soil_rock = true;
@Comment public static Comment sticks;
@Entry(name = "block.rocks.oak_stick") public static boolean oak_stick = true;
@Entry(name = "block.rocks.spruce_stick") public static boolean spruce_stick = true;
@Entry(name = "block.rocks.birch_stick") public static boolean birch_stick = true;
@Entry(name = "block.rocks.acacia_stick") public static boolean acacia_stick = true;
@Entry(name = "block.rocks.jungle_stick") public static boolean jungle_stick = true;
@Entry(name = "block.rocks.dark_oak_stick") public static boolean dark_oak_stick = true;
@Entry(name = "block.rocks.crimson_stick") public static boolean crimson_stick = true;
@Entry(name = "block.rocks.warped_stick") public static boolean warped_stick = true;
@Comment public static Comment misc;
@Entry(name = "block.rocks.pinecone") public static boolean pinecone = true;
@Entry(name = "block.rocks.geyser") public static boolean geyser = true;
@Entry(name = "block.rocks.nether_geyser") public static boolean nether_geyser = true;
@Entry(name = "block.rocks.seashell") public static boolean seashell = true;
@Entry(name = "block.rocks.starfish") public static boolean starfish = true;
@Entry public static boolean underwater_seashell = true;
@Entry public static boolean underwater_starfish = true;
}

View File

@@ -0,0 +1,13 @@
package eu.midnightdust.motschen.rocks.item;
import eu.midnightdust.motschen.rocks.blockstates.StarfishVariation;
import net.minecraft.item.Item;
public class StarfishItem extends Item {
public final StarfishVariation variation;
public StarfishItem(Settings settings, StarfishVariation variation) {
super(settings);
this.variation = variation;
}
}

View File

@@ -1,19 +0,0 @@
package eu.midnightdust.motschen.rocks.mixin;
import net.minecraft.world.biome.GenerationSettings;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import java.util.List;
import java.util.function.Supplier;
@Mixin(GenerationSettings.class)
public interface GenerationSettingsAccessorMixin {
@Accessor
List<List<Supplier<ConfiguredFeature<?, ?>>>> getFeatures();
@Accessor
void setFeatures(List<List<Supplier<ConfiguredFeature<?, ?>>>> features);
}

View File

@@ -1,102 +1,96 @@
package eu.midnightdust.motschen.rocks.world; package eu.midnightdust.motschen.rocks.world;
import com.google.common.collect.Lists; import eu.midnightdust.motschen.rocks.config.RocksConfig;
import eu.midnightdust.motschen.rocks.mixin.GenerationSettingsAccessorMixin;
import eu.midnightdust.motschen.rocks.world.configured_feature.MiscFeatures; import eu.midnightdust.motschen.rocks.world.configured_feature.MiscFeatures;
import eu.midnightdust.motschen.rocks.world.configured_feature.NetherFeatures; import eu.midnightdust.motschen.rocks.world.configured_feature.NetherFeatures;
import eu.midnightdust.motschen.rocks.world.configured_feature.RockFeatures; import eu.midnightdust.motschen.rocks.world.configured_feature.RockFeatures;
import eu.midnightdust.motschen.rocks.world.configured_feature.StickFeatures; import eu.midnightdust.motschen.rocks.world.configured_feature.StickFeatures;
import net.fabricmc.fabric.api.event.registry.RegistryEntryAddedCallback; import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
import net.fabricmc.fabric.api.biome.v1.BiomeSelectionContext;
import net.minecraft.util.registry.BuiltinRegistries; import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.GenerationStep; import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.feature.ConfiguredFeature; import java.util.function.Predicate;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;
@SuppressWarnings({"deprecation", "OptionalGetWithoutIsPresent"})
public class FeatureInjector { public class FeatureInjector {
public static void init() { public static void init() {
BuiltinRegistries.BIOME.forEach(FeatureInjector::addRockToBiome);
RegistryEntryAddedCallback.event(BuiltinRegistries.BIOME).register((i, identifier, biome) -> addRockToBiome(biome));
}
private static void addRockToBiome(Biome biome) {
// Rocks // Rocks
if (biome.getCategory() != Biome.Category.NETHER && biome.getCategory() != Biome.Category.THEEND && biome.getCategory() != Biome.Category.BEACH && biome.getCategory() != Biome.Category.DESERT && biome.getCategory() != Biome.Category.MESA && biome.getCategory() != Biome.Category.ICY && biome.getCategory() != Biome.Category.OCEAN) { Predicate<BiomeSelectionContext> rocks = (ctx -> {
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.ROCK_FEATURE); Biome.Category cat = ctx.getBiome().getCategory();
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.GRANITE_ROCK_FEATURE); return cat != Biome.Category.NETHER && cat != Biome.Category.THEEND && cat!= Biome.Category.BEACH && cat != Biome.Category.DESERT
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.DIORITE_ROCK_FEATURE); && cat != Biome.Category.MESA && cat != Biome.Category.ICY && cat != Biome.Category.OCEAN ;});
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.ANDESITE_ROCK_FEATURE); if (RocksConfig.rock) BiomeModifications.addFeature(rocks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(RockFeatures.ROCK_FEATURE).get());
} if (RocksConfig.granite_rock) BiomeModifications.addFeature(rocks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(RockFeatures.GRANITE_ROCK_FEATURE).get());
if (biome.getCategory() == Biome.Category.BEACH || biome.getCategory() == Biome.Category.DESERT || biome.getCategory() == Biome.Category.MESA || biome.toString().contains("terrestria:lush_desert")) { if (RocksConfig.diorite_rock) BiomeModifications.addFeature(rocks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(RockFeatures.DIORITE_ROCK_FEATURE).get());
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.SAND_ROCK_FEATURE); if (RocksConfig.andesite_rock) BiomeModifications.addFeature(rocks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(RockFeatures.ANDESITE_ROCK_FEATURE).get());
}
if (biome.getCategory() == Biome.Category.MESA || biome.getCategory() == Biome.Category.DESERT || biome.toString().contains("terrestria:lush_desert")) {
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.RED_SAND_ROCK_FEATURE);
}
if (biome.getCategory() == Biome.Category.THEEND) {
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.END_STONE_ROCK_FEATURE);
}
// Sticks
if (biome.toString().contains("minecraft:forest") || biome.toString().contains("minecraft:wooded_hills") ||
biome.toString().contains("minecraft:wooded_mountains") || biome.toString().contains("minecraft:plains") ||
biome.toString().contains("minecraft:flower_forest") || biome.toString().contains("minecraft:wooded_badlands_plateau") ||
biome.toString().contains("minecraft:modified_wooded_badlands_plateau") || biome.getCategory() == Biome.Category.SWAMP) {
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, StickFeatures.OAK_STICK_FEATURE);
}
if (biome.toString().contains("minecraft:forest") || biome.toString().contains("minecraft:birch_forest") ||
biome.toString().contains("minecraft:birch_forest_hills") || biome.toString().contains("minecraft:flower_forest")) {
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, StickFeatures.BIRCH_STICK_FEATURE);
}
if (biome.toString().contains("minecraft:wooded_mountains") || biome.getCategory() == Biome.Category.TAIGA) {
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, StickFeatures.SPRUCE_STICK_FEATURE);
}
if (biome.getCategory() == Biome.Category.SAVANNA) {
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, StickFeatures.ACACIA_STICK_FEATURE);
}
if (biome.getCategory() == Biome.Category.JUNGLE) {
addRockFeature(biome, GenerationStep.Feature.UNDERGROUND_DECORATION, StickFeatures.JUNGLE_STICK_FEATURE);
}
if (biome.toString().contains("minecraft:dark_forest") || biome.toString().contains("minecraft:dark_forest_hills") ||
biome.toString().contains("minecraft:dark_forest_mountains")) {
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, StickFeatures.DARK_OAK_STICK_FEATURE);
}
// Misc
if (biome.getCategory() == Biome.Category.BEACH && !biome.toString().contains("minecraft:snowy_beach")) {
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, MiscFeatures.SEASHELL_FEATURE);
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, MiscFeatures.STARFISH_FEATURE);
}
if (biome.getCategory() == Biome.Category.OCEAN) {
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, MiscFeatures.UNDERWATER_STARFISH_FEATURE);
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, MiscFeatures.UNDERWATER_SEASHELL_FEATURE);
}
if (biome.getCategory() == Biome.Category.NETHER) {
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, NetherFeatures.NETHERRACK_ROCK_FEATURE);
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, NetherFeatures.SOUL_SOIL_ROCK_FEATURE);
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, NetherFeatures.NETHER_GRAVEL_ROCK_FEATURE);
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, NetherFeatures.NETHER_GEYSER_FEATURE);
}
if (biome.getCategory() != Biome.Category.NETHER) {
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.GRAVEL_ROCK_FEATURE);
}
if (biome.getCategory() == Biome.Category.ICY) {
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, MiscFeatures.SNOWY_GEYSER_FEATURE);
}
}
public static void addRockFeature(Biome biome, GenerationStep.Feature step, ConfiguredFeature<?, ?> feature) { Predicate<BiomeSelectionContext> sand_rocks = (ctx -> {
GenerationSettingsAccessorMixin generationSettingsAccessor = (GenerationSettingsAccessorMixin) biome.getGenerationSettings(); Biome.Category cat = ctx.getBiome().getCategory();
int stepIndex = step.ordinal(); return cat == Biome.Category.BEACH || cat == Biome.Category.DESERT || cat == Biome.Category.MESA || ctx.getBiomeKey().getValue().toString().contains("terrestria:lush_desert");
List<List<Supplier<ConfiguredFeature<?, ?>>>> featuresByStep = new ArrayList<>( generationSettingsAccessor.getFeatures()); });
while (featuresByStep.size() <= stepIndex) { if (RocksConfig.sand_rock) BiomeModifications.addFeature(sand_rocks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(RockFeatures.SAND_ROCK_FEATURE).get());
featuresByStep.add(Lists.newArrayList());
} Predicate<BiomeSelectionContext> red_sand_rocks = (ctx -> {
List<Supplier<ConfiguredFeature<?, ?>>> features = new ArrayList<>(featuresByStep.get(stepIndex)); Biome.Category cat = ctx.getBiome().getCategory();
features.add(() -> feature); return cat == Biome.Category.MESA || cat == Biome.Category.DESERT || ctx.getBiomeKey().getValue().toString().contains("terrestria:lush_desert");
featuresByStep.set(stepIndex, features); });
generationSettingsAccessor.setFeatures(featuresByStep); if (RocksConfig.red_sand_rock) BiomeModifications.addFeature(red_sand_rocks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(RockFeatures.RED_SAND_ROCK_FEATURE).get());
if (RocksConfig.end_stone_rock) BiomeModifications.addFeature(ctx -> ctx.getBiome().getCategory() == Biome.Category.THEEND, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(RockFeatures.END_STONE_ROCK_FEATURE).get());
// Sticks
Predicate<BiomeSelectionContext> oak_sticks = (ctx -> {
String name = ctx.getBiomeKey().getValue().toString();
Biome.Category cat = ctx.getBiome().getCategory();
return name.contains("minecraft:forest") || name.contains("minecraft:wooded_hills") || name.contains("oak") ||
name.contains("minecraft:wooded_mountains") || name.contains("minecraft:plains") ||
name.contains("minecraft:flower_forest") || name.contains("minecraft:wooded_badlands_plateau") ||
name.contains("minecraft:modified_wooded_badlands_plateau") || cat == Biome.Category.SWAMP;});
if (RocksConfig.oak_stick) BiomeModifications.addFeature(oak_sticks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(StickFeatures.OAK_STICK_FEATURE).get());
Predicate<BiomeSelectionContext> birch_sticks = (ctx -> {
String name = ctx.getBiomeKey().getValue().toString();
return name.contains("minecraft:forest") || name.contains("birch") || name.contains("minecraft:flower_forest");});
if (RocksConfig.birch_stick) BiomeModifications.addFeature(birch_sticks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(StickFeatures.BIRCH_STICK_FEATURE).get());
Predicate<BiomeSelectionContext> spruce_sticks = (ctx -> {
String name = ctx.getBiomeKey().getValue().toString();
Biome.Category cat = ctx.getBiome().getCategory();
return name.contains("minecraft:wooded_mountains") || cat == Biome.Category.TAIGA;});
if (RocksConfig.spruce_stick) BiomeModifications.addFeature(spruce_sticks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(StickFeatures.SPRUCE_STICK_FEATURE).get());
if (RocksConfig.acacia_stick) BiomeModifications.addFeature(ctx -> ctx.getBiome().getCategory() == Biome.Category.SAVANNA, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(StickFeatures.ACACIA_STICK_FEATURE).get());
if (RocksConfig.jungle_stick) BiomeModifications.addFeature(ctx -> ctx.getBiome().getCategory() == Biome.Category.JUNGLE, GenerationStep.Feature.UNDERGROUND_DECORATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(StickFeatures.JUNGLE_STICK_FEATURE).get());
Predicate<BiomeSelectionContext> dark_oak_sticks = (ctx -> {
String name = ctx.getBiomeKey().getValue().toString();
return name.contains("minecraft:dark_forest") || name.contains("minecraft:dark_forest_hills") ||
name.contains("minecraft:dark_forest_mountains");});
if (RocksConfig.dark_oak_stick) BiomeModifications.addFeature(dark_oak_sticks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(StickFeatures.DARK_OAK_STICK_FEATURE).get());
// Misc
Predicate<BiomeSelectionContext> beach = (ctx -> {
String name = ctx.getBiomeKey().getValue().toString();
Biome.Category cat = ctx.getBiome().getCategory();
return cat == Biome.Category.BEACH && !name.contains("snow");});
if (RocksConfig.seashell) BiomeModifications.addFeature(beach, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(MiscFeatures.SEASHELL_FEATURE).get());
if (RocksConfig.starfish) BiomeModifications.addFeature(beach, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(MiscFeatures.STARFISH_FEATURE).get());
if (RocksConfig.underwater_starfish) BiomeModifications.addFeature(ctx -> ctx.getBiome().getCategory() == Biome.Category.OCEAN, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(MiscFeatures.UNDERWATER_STARFISH_FEATURE).get());
if (RocksConfig.underwater_seashell) BiomeModifications.addFeature(ctx -> ctx.getBiome().getCategory() == Biome.Category.OCEAN, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(MiscFeatures.UNDERWATER_SEASHELL_FEATURE).get());
if (RocksConfig.netherrack_rock) BiomeModifications.addFeature(ctx -> ctx.getBiome().getCategory() == Biome.Category.NETHER, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(NetherFeatures.NETHERRACK_ROCK_FEATURE).get());
if (RocksConfig.soul_soil_rock) BiomeModifications.addFeature(ctx -> ctx.getBiome().getCategory() == Biome.Category.NETHER, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(NetherFeatures.SOUL_SOIL_ROCK_FEATURE).get());
if (RocksConfig.gravel_rock) BiomeModifications.addFeature(ctx -> ctx.getBiome().getCategory() == Biome.Category.NETHER, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(NetherFeatures.NETHER_GRAVEL_ROCK_FEATURE).get());
if (RocksConfig.nether_geyser) BiomeModifications.addFeature(ctx -> ctx.getBiome().getCategory() == Biome.Category.NETHER, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(NetherFeatures.NETHER_GEYSER_FEATURE).get());
if (RocksConfig.warped_stick) BiomeModifications.addFeature(ctx -> ctx.getBiome().getCategory() == Biome.Category.NETHER, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(NetherFeatures.WARPED_STICK_FEATURE).get());
if (RocksConfig.crimson_stick) BiomeModifications.addFeature(ctx -> ctx.getBiome().getCategory() == Biome.Category.NETHER, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(NetherFeatures.CRIMSON_STICK_FEATURE).get());
if (RocksConfig.gravel_rock) BiomeModifications.addFeature(ctx -> ctx.getBiome().getCategory() != Biome.Category.NETHER, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(RockFeatures.GRAVEL_ROCK_FEATURE).get());
if (RocksConfig.geyser) BiomeModifications.addFeature(ctx -> ctx.getBiome().getCategory() == Biome.Category.ICY, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(MiscFeatures.SNOWY_GEYSER_FEATURE).get());
} }
} }

View File

@@ -5,7 +5,9 @@ import eu.midnightdust.motschen.rocks.blockstates.SeashellVariation;
import eu.midnightdust.motschen.rocks.blockstates.StarfishVariation; import eu.midnightdust.motschen.rocks.blockstates.StarfishVariation;
import eu.midnightdust.motschen.rocks.world.feature.SnowFeature; import eu.midnightdust.motschen.rocks.world.feature.SnowFeature;
import eu.midnightdust.motschen.rocks.world.feature.UnderwaterFeature; import eu.midnightdust.motschen.rocks.world.feature.UnderwaterFeature;
import net.minecraft.block.BlockState;
import net.minecraft.state.property.Properties; import net.minecraft.state.property.Properties;
import net.minecraft.util.collection.DataPool;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import net.minecraft.world.gen.ProbabilityConfig; import net.minecraft.world.gen.ProbabilityConfig;
import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.gen.feature.Feature;
@@ -22,18 +24,18 @@ public class FeatureRegistry<FC extends FeatureConfig> {
return Registry.register(Registry.FEATURE, name, feature); return Registry.register(Registry.FEATURE, name, feature);
} }
private static final WeightedBlockStateProvider StarfishStates = new WeightedBlockStateProvider() private static final WeightedBlockStateProvider StarfishStates = new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.addState(RocksMain.Starfish.getDefaultState().with(RocksMain.STARFISH_VARIATION, StarfishVariation.RED).with(Properties.WATERLOGGED, true), 6) .add(RocksMain.Starfish.getDefaultState().with(RocksMain.STARFISH_VARIATION, StarfishVariation.RED).with(Properties.WATERLOGGED, true), 6)
.addState(RocksMain.Starfish.getDefaultState().with(RocksMain.STARFISH_VARIATION,StarfishVariation.PINK).with(Properties.WATERLOGGED, true), 7) .add(RocksMain.Starfish.getDefaultState().with(RocksMain.STARFISH_VARIATION,StarfishVariation.PINK).with(Properties.WATERLOGGED, true), 7)
.addState(RocksMain.Starfish.getDefaultState().with(RocksMain.STARFISH_VARIATION,StarfishVariation.ORANGE).with(Properties.WATERLOGGED, true), 2); .add(RocksMain.Starfish.getDefaultState().with(RocksMain.STARFISH_VARIATION,StarfishVariation.ORANGE).with(Properties.WATERLOGGED, true), 2).build());
private static final WeightedBlockStateProvider SeashellStates = new WeightedBlockStateProvider() private static final WeightedBlockStateProvider SeashellStates = new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.addState(RocksMain.Seashell.getDefaultState().with(RocksMain.SEASHELL_VARIATION, SeashellVariation.YELLOW).with(Properties.WATERLOGGED, true), 7) .add(RocksMain.Seashell.getDefaultState().with(RocksMain.SEASHELL_VARIATION, SeashellVariation.YELLOW).with(Properties.WATERLOGGED, true), 7)
.addState(RocksMain.Seashell.getDefaultState().with(RocksMain.SEASHELL_VARIATION,SeashellVariation.PINK).with(Properties.WATERLOGGED, true), 2) .add(RocksMain.Seashell.getDefaultState().with(RocksMain.SEASHELL_VARIATION,SeashellVariation.PINK).with(Properties.WATERLOGGED, true), 2)
.addState(RocksMain.Seashell.getDefaultState().with(RocksMain.SEASHELL_VARIATION,SeashellVariation.WHITE).with(Properties.WATERLOGGED, true), 6); .add(RocksMain.Seashell.getDefaultState().with(RocksMain.SEASHELL_VARIATION,SeashellVariation.WHITE).with(Properties.WATERLOGGED, true), 6).build());
private static final WeightedBlockStateProvider GeyserStates = new WeightedBlockStateProvider() private static final WeightedBlockStateProvider GeyserStates = new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.addState(RocksMain.Geyser.getDefaultState().with(Properties.SNOWY, true), 1); .add(RocksMain.Geyser.getDefaultState().with(Properties.SNOWY, true), 1).build());
static { static {
UNDERWATER_STARFISH_FEATURE = register("underwater_starfish", new UnderwaterFeature(ProbabilityConfig.CODEC, StarfishStates)); UNDERWATER_STARFISH_FEATURE = register("underwater_starfish", new UnderwaterFeature(ProbabilityConfig.CODEC, StarfishStates));

View File

@@ -0,0 +1,12 @@
package eu.midnightdust.motschen.rocks.world;
import net.minecraft.world.gen.YOffset;
import net.minecraft.world.gen.decorator.ConfiguredDecorator;
import net.minecraft.world.gen.decorator.Decorator;
import net.minecraft.world.gen.decorator.RangeDecoratorConfig;
import net.minecraft.world.gen.heightprovider.UniformHeightProvider;
public class RocksDecorators {
public static final RangeDecoratorConfig BOTTOM_TO_TOP_OFFSET_4 = new RangeDecoratorConfig(UniformHeightProvider.create(YOffset.aboveBottom(4), YOffset.belowTop(4)));
public static final ConfiguredDecorator<?> ROCK = (ConfiguredDecorator)((ConfiguredDecorator)Decorator.RANGE.configure(BOTTOM_TO_TOP_OFFSET_4).spreadHorizontally()).repeatRandomly(5);
}

View File

@@ -5,8 +5,11 @@ import eu.midnightdust.motschen.rocks.RocksMain;
import eu.midnightdust.motschen.rocks.blockstates.SeashellVariation; import eu.midnightdust.motschen.rocks.blockstates.SeashellVariation;
import eu.midnightdust.motschen.rocks.blockstates.StarfishVariation; import eu.midnightdust.motschen.rocks.blockstates.StarfishVariation;
import eu.midnightdust.motschen.rocks.world.FeatureRegistry; import eu.midnightdust.motschen.rocks.world.FeatureRegistry;
import eu.midnightdust.motschen.rocks.world.RocksDecorators;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.collection.DataPool;
import net.minecraft.util.registry.BuiltinRegistries; import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import net.minecraft.world.gen.ProbabilityConfig; import net.minecraft.world.gen.ProbabilityConfig;
@@ -17,26 +20,26 @@ import net.minecraft.world.gen.stateprovider.WeightedBlockStateProvider;
public class MiscFeatures { public class MiscFeatures {
public static ConfiguredFeature<?, ?> SEASHELL_FEATURE = Feature.RANDOM_PATCH.configure( public static ConfiguredFeature<?, ?> SEASHELL_FEATURE = Feature.RANDOM_PATCH.configure(
(new RandomPatchFeatureConfig.Builder( (new RandomPatchFeatureConfig.Builder(
new WeightedBlockStateProvider() new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.addState(RocksMain.Seashell.getDefaultState().with(RocksMain.SEASHELL_VARIATION,SeashellVariation.YELLOW), 7) .add(RocksMain.Seashell.getDefaultState().with(RocksMain.SEASHELL_VARIATION,SeashellVariation.YELLOW), 7)
.addState(RocksMain.Seashell.getDefaultState().with(RocksMain.SEASHELL_VARIATION,SeashellVariation.PINK), 2) .add(RocksMain.Seashell.getDefaultState().with(RocksMain.SEASHELL_VARIATION,SeashellVariation.PINK), 2)
.addState(RocksMain.Seashell.getDefaultState().with(RocksMain.SEASHELL_VARIATION,SeashellVariation.WHITE), 6), .add(RocksMain.Seashell.getDefaultState().with(RocksMain.SEASHELL_VARIATION,SeashellVariation.WHITE), 6).build()),
SimpleBlockPlacer.INSTANCE)) SimpleBlockPlacer.INSTANCE))
.tries(1).spreadX(0).spreadY(0).spreadZ(0).whitelist(ImmutableSet.of(Blocks.SAND, Blocks.SANDSTONE, Blocks.RED_SAND, Blocks.RED_SANDSTONE)) .tries(1).spreadX(0).spreadY(0).spreadZ(0).whitelist(ImmutableSet.of(Blocks.SAND, Blocks.SANDSTONE, Blocks.RED_SAND, Blocks.RED_SANDSTONE))
.build()).decorate(ConfiguredFeatures.Decorators.FIRE); .build()).decorate(RocksDecorators.ROCK);
public static ConfiguredFeature<?, ?> STARFISH_FEATURE = Feature.RANDOM_PATCH.configure( public static ConfiguredFeature<?, ?> STARFISH_FEATURE = Feature.RANDOM_PATCH.configure(
(new RandomPatchFeatureConfig.Builder( (new RandomPatchFeatureConfig.Builder(
new WeightedBlockStateProvider() new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.addState(RocksMain.Starfish.getDefaultState().with(RocksMain.STARFISH_VARIATION,StarfishVariation.RED), 2) .add(RocksMain.Starfish.getDefaultState().with(RocksMain.STARFISH_VARIATION,StarfishVariation.RED), 2)
.addState(RocksMain.Starfish.getDefaultState().with(RocksMain.STARFISH_VARIATION,StarfishVariation.PINK), 6) .add(RocksMain.Starfish.getDefaultState().with(RocksMain.STARFISH_VARIATION,StarfishVariation.PINK), 6)
.addState(RocksMain.Starfish.getDefaultState().with(RocksMain.STARFISH_VARIATION,StarfishVariation.ORANGE), 7), .add(RocksMain.Starfish.getDefaultState().with(RocksMain.STARFISH_VARIATION,StarfishVariation.ORANGE), 7).build()),
SimpleBlockPlacer.INSTANCE)) SimpleBlockPlacer.INSTANCE))
.tries(1).spreadX(0).spreadY(0).spreadZ(0).whitelist(ImmutableSet.of(Blocks.SAND, Blocks.SANDSTONE, Blocks.RED_SAND, Blocks.RED_SANDSTONE)) .tries(1).spreadX(0).spreadY(0).spreadZ(0).whitelist(ImmutableSet.of(Blocks.SAND, Blocks.SANDSTONE, Blocks.RED_SAND, Blocks.RED_SANDSTONE))
.build()).decorate(ConfiguredFeatures.Decorators.FIRE); .build()).decorate(RocksDecorators.ROCK);
public static ConfiguredFeature<?, ?> UNDERWATER_STARFISH_FEATURE = FeatureRegistry.UNDERWATER_STARFISH_FEATURE.configure(new ProbabilityConfig(1)); public static ConfiguredFeature<?, ?> UNDERWATER_STARFISH_FEATURE = FeatureRegistry.UNDERWATER_STARFISH_FEATURE.configure(new ProbabilityConfig(1));
public static ConfiguredFeature<?, ?> UNDERWATER_SEASHELL_FEATURE = FeatureRegistry.UNDERWATER_SEASHELL_FEATURE.configure(new ProbabilityConfig(1)); public static ConfiguredFeature<?, ?> UNDERWATER_SEASHELL_FEATURE = FeatureRegistry.UNDERWATER_SEASHELL_FEATURE.configure(new ProbabilityConfig(1));
public static ConfiguredFeature<?, ?> SNOWY_GEYSER_FEATURE = FeatureRegistry.SNOWY_GEYSER_FEATURE.configure(new ProbabilityConfig(1)).decorate(ConfiguredFeatures.Decorators.FIRE); public static ConfiguredFeature<?, ?> SNOWY_GEYSER_FEATURE = FeatureRegistry.SNOWY_GEYSER_FEATURE.configure(new ProbabilityConfig(1)).decorate(RocksDecorators.ROCK);
public static void init() { public static void init() {
Registry<ConfiguredFeature<?, ?>> registry = BuiltinRegistries.CONFIGURED_FEATURE; Registry<ConfiguredFeature<?, ?>> registry = BuiltinRegistries.CONFIGURED_FEATURE;

View File

@@ -3,8 +3,12 @@ package eu.midnightdust.motschen.rocks.world.configured_feature;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
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 eu.midnightdust.motschen.rocks.blockstates.StickVariation;
import eu.midnightdust.motschen.rocks.world.RocksDecorators;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.collection.DataPool;
import net.minecraft.util.registry.BuiltinRegistries; import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import net.minecraft.world.gen.feature.ConfiguredFeature; import net.minecraft.world.gen.feature.ConfiguredFeature;
@@ -12,47 +16,65 @@ import net.minecraft.world.gen.feature.ConfiguredFeatures;
import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.RandomPatchFeatureConfig; import net.minecraft.world.gen.feature.RandomPatchFeatureConfig;
import net.minecraft.world.gen.placer.SimpleBlockPlacer; import net.minecraft.world.gen.placer.SimpleBlockPlacer;
import net.minecraft.world.gen.stateprovider.SimpleBlockStateProvider;
import net.minecraft.world.gen.stateprovider.WeightedBlockStateProvider; import net.minecraft.world.gen.stateprovider.WeightedBlockStateProvider;
public class NetherFeatures { public class NetherFeatures {
public static ConfiguredFeature<?, ?> NETHERRACK_ROCK_FEATURE = Feature.RANDOM_PATCH.configure( public static ConfiguredFeature<?, ?> NETHERRACK_ROCK_FEATURE = Feature.RANDOM_PATCH.configure(
(new RandomPatchFeatureConfig.Builder( (new RandomPatchFeatureConfig.Builder(
new WeightedBlockStateProvider() new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.addState(RocksMain.NetherrackRock.getDefaultState().with(RocksMain.ROCK_VARIATION, RockVariation.TINY), 10) .add(RocksMain.NetherrackRock.getDefaultState().with(RocksMain.ROCK_VARIATION, RockVariation.TINY), 10)
.addState(RocksMain.NetherrackRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.SMALL), 7) .add(RocksMain.NetherrackRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.SMALL), 7)
.addState(RocksMain.NetherrackRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.MEDIUM), 5) .add(RocksMain.NetherrackRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.MEDIUM), 5)
.addState(RocksMain.NetherrackRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.LARGE), 1), .add(RocksMain.NetherrackRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.LARGE), 1).build()),
SimpleBlockPlacer.INSTANCE)) SimpleBlockPlacer.INSTANCE))
.tries(1).spreadX(0).spreadY(0).spreadZ(0) .tries(1).spreadX(0).spreadY(0).spreadZ(0)
.whitelist(ImmutableSet.of(Blocks.NETHERRACK,Blocks.WARPED_NYLIUM,Blocks.CRIMSON_NYLIUM)).cannotProject().build()).decorate(ConfiguredFeatures.Decorators.FIRE).repeat(128); .whitelist(ImmutableSet.of(Blocks.NETHERRACK,Blocks.WARPED_NYLIUM,Blocks.CRIMSON_NYLIUM)).cannotProject().build()).decorate(RocksDecorators.ROCK).repeat(128);
public static ConfiguredFeature<?, ?> SOUL_SOIL_ROCK_FEATURE = Feature.RANDOM_PATCH.configure( public static ConfiguredFeature<?, ?> SOUL_SOIL_ROCK_FEATURE = Feature.RANDOM_PATCH.configure(
(new RandomPatchFeatureConfig.Builder( (new RandomPatchFeatureConfig.Builder(
new WeightedBlockStateProvider() new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.addState(RocksMain.SoulSoilRock.getDefaultState().with(RocksMain.ROCK_VARIATION, RockVariation.TINY), 10) .add(RocksMain.SoulSoilRock.getDefaultState().with(RocksMain.ROCK_VARIATION, RockVariation.TINY), 10)
.addState(RocksMain.SoulSoilRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.SMALL), 7) .add(RocksMain.SoulSoilRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.SMALL), 7)
.addState(RocksMain.SoulSoilRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.MEDIUM), 5) .add(RocksMain.SoulSoilRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.MEDIUM), 5)
.addState(RocksMain.SoulSoilRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.LARGE), 1), .add(RocksMain.SoulSoilRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.LARGE), 1).build()),
SimpleBlockPlacer.INSTANCE)) SimpleBlockPlacer.INSTANCE))
.tries(1).spreadX(0).spreadY(0).spreadZ(0) .tries(1).spreadX(0).spreadY(0).spreadZ(0)
.whitelist(ImmutableSet.of(Blocks.SOUL_SOIL,Blocks.SOUL_SAND)).cannotProject().build()).decorate(ConfiguredFeatures.Decorators.FIRE).repeat(128); .whitelist(ImmutableSet.of(Blocks.SOUL_SOIL,Blocks.SOUL_SAND)).cannotProject().build()).decorate(RocksDecorators.ROCK).repeat(128);
public static ConfiguredFeature<?, ?> NETHER_GRAVEL_ROCK_FEATURE = Feature.RANDOM_PATCH.configure( public static ConfiguredFeature<?, ?> NETHER_GRAVEL_ROCK_FEATURE = Feature.RANDOM_PATCH.configure(
(new RandomPatchFeatureConfig.Builder( (new RandomPatchFeatureConfig.Builder(
new WeightedBlockStateProvider() new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.addState(RocksMain.GravelRock.getDefaultState().with(RocksMain.ROCK_VARIATION, RockVariation.TINY), 10) .add(RocksMain.GravelRock.getDefaultState().with(RocksMain.ROCK_VARIATION, RockVariation.TINY), 10)
.addState(RocksMain.GravelRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.SMALL), 7) .add(RocksMain.GravelRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.SMALL), 7)
.addState(RocksMain.GravelRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.MEDIUM), 5) .add(RocksMain.GravelRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.MEDIUM), 5)
.addState(RocksMain.GravelRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.LARGE), 1), .add(RocksMain.GravelRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.LARGE), 1).build()),
SimpleBlockPlacer.INSTANCE)) SimpleBlockPlacer.INSTANCE))
.tries(1).spreadX(0).spreadY(0).spreadZ(0) .tries(1).spreadX(0).spreadY(0).spreadZ(0)
.whitelist(ImmutableSet.of(Blocks.GRAVEL)).cannotProject().build()).decorate(ConfiguredFeatures.Decorators.FIRE).repeat(128); .whitelist(ImmutableSet.of(Blocks.GRAVEL)).cannotProject().build()).decorate(RocksDecorators.ROCK).repeat(128);
public static ConfiguredFeature<?, ?> NETHER_GEYSER_FEATURE = Feature.RANDOM_PATCH.configure( public static ConfiguredFeature<?, ?> NETHER_GEYSER_FEATURE = Feature.RANDOM_PATCH.configure(
(new RandomPatchFeatureConfig.Builder( (new RandomPatchFeatureConfig.Builder(
new WeightedBlockStateProvider() new SimpleBlockStateProvider(RocksMain.NetherGeyser.getDefaultState()),SimpleBlockPlacer.INSTANCE)
.addState(RocksMain.NetherGeyser.getDefaultState(),1), .tries(1).spreadX(0).spreadY(0).spreadZ(0)
.whitelist(ImmutableSet.of(Blocks.NETHERRACK)).cannotProject().build())).decorate(RocksDecorators.ROCK).repeat(16);
public static ConfiguredFeature<?, ?> WARPED_STICK_FEATURE = Feature.RANDOM_PATCH.configure(
(new RandomPatchFeatureConfig.Builder(
new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.add(RocksMain.WarpedStick.getDefaultState().with(RocksMain.STICK_VARIATION, StickVariation.SMALL), 7)
.add(RocksMain.WarpedStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.MEDIUM), 5)
.add(RocksMain.WarpedStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.LARGE), 1).build()),
SimpleBlockPlacer.INSTANCE)) SimpleBlockPlacer.INSTANCE))
.tries(1).spreadX(0).spreadY(0).spreadZ(0) .tries(1).spreadX(0).spreadY(0).spreadZ(0)
.whitelist(ImmutableSet.of(Blocks.NETHERRACK)).cannotProject().build()).decorate(ConfiguredFeatures.Decorators.FIRE).repeat(16); .whitelist(ImmutableSet.of(Blocks.WARPED_NYLIUM)).cannotProject().build()).decorate(RocksDecorators.ROCK).repeat(128);
public static ConfiguredFeature<?, ?> CRIMSON_STICK_FEATURE = Feature.RANDOM_PATCH.configure(
(new RandomPatchFeatureConfig.Builder(
new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.add(RocksMain.CrimsonStick.getDefaultState().with(RocksMain.STICK_VARIATION, StickVariation.SMALL), 7)
.add(RocksMain.CrimsonStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.MEDIUM), 5)
.add(RocksMain.CrimsonStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.LARGE), 1).build()),
SimpleBlockPlacer.INSTANCE))
.tries(1).spreadX(0).spreadY(0).spreadZ(0)
.whitelist(ImmutableSet.of(Blocks.CRIMSON_NYLIUM)).cannotProject().build()).decorate(RocksDecorators.ROCK).repeat(128);
public static void init() { public static void init() {
Registry<ConfiguredFeature<?, ?>> registry = BuiltinRegistries.CONFIGURED_FEATURE; Registry<ConfiguredFeature<?, ?>> registry = BuiltinRegistries.CONFIGURED_FEATURE;
@@ -61,6 +83,9 @@ public class NetherFeatures {
Registry.register(registry, new Identifier(RocksMain.MOD_ID, "soul_soil_rock"), SOUL_SOIL_ROCK_FEATURE); Registry.register(registry, new Identifier(RocksMain.MOD_ID, "soul_soil_rock"), SOUL_SOIL_ROCK_FEATURE);
Registry.register(registry, new Identifier(RocksMain.MOD_ID, "nether_gravel_rock"), NETHER_GRAVEL_ROCK_FEATURE); Registry.register(registry, new Identifier(RocksMain.MOD_ID, "nether_gravel_rock"), NETHER_GRAVEL_ROCK_FEATURE);
Registry.register(registry, new Identifier(RocksMain.MOD_ID, "nether_geyser"), NETHER_GEYSER_FEATURE); Registry.register(registry, new Identifier(RocksMain.MOD_ID, "nether_geyser"), NETHER_GEYSER_FEATURE);
Registry.register(registry, new Identifier(RocksMain.MOD_ID, "warped_stick"), WARPED_STICK_FEATURE);
Registry.register(registry, new Identifier(RocksMain.MOD_ID, "crimson_stick"), CRIMSON_STICK_FEATURE);
} }
} }

View File

@@ -3,8 +3,12 @@ package eu.midnightdust.motschen.rocks.world.configured_feature;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
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 eu.midnightdust.motschen.rocks.config.RocksConfig;
import eu.midnightdust.motschen.rocks.world.RocksDecorators;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.collection.DataPool;
import net.minecraft.util.registry.BuiltinRegistries; import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import net.minecraft.world.gen.feature.*; import net.minecraft.world.gen.feature.*;
@@ -14,84 +18,84 @@ import net.minecraft.world.gen.stateprovider.WeightedBlockStateProvider;
public class RockFeatures { public class RockFeatures {
public static ConfiguredFeature<?, ?> ROCK_FEATURE = Feature.RANDOM_PATCH.configure( public static ConfiguredFeature<?, ?> ROCK_FEATURE = Feature.RANDOM_PATCH.configure(
(new RandomPatchFeatureConfig.Builder( (new RandomPatchFeatureConfig.Builder(
new WeightedBlockStateProvider() new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.addState(RocksMain.Rock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.TINY), 10) .add(RocksMain.Rock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.TINY), 10)
.addState(RocksMain.Rock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.SMALL), 7) .add(RocksMain.Rock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.SMALL), 7)
.addState(RocksMain.Rock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.MEDIUM), 5) .add(RocksMain.Rock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.MEDIUM), 5)
.addState(RocksMain.Rock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.LARGE), 1), .add(RocksMain.Rock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.LARGE), 1).build()),
SimpleBlockPlacer.INSTANCE)) SimpleBlockPlacer.INSTANCE))
.tries(1).spreadX(0).spreadY(0).spreadZ(0).blacklist(ImmutableSet.of(Blocks.ICE.getDefaultState(),Blocks.SAND.getDefaultState(),Blocks.RED_SAND.getDefaultState())) .tries(1).spreadX(0).spreadY(0).spreadZ(0).blacklist(ImmutableSet.of(Blocks.ICE.getDefaultState(),Blocks.SAND.getDefaultState(),Blocks.RED_SAND.getDefaultState()))
.build()).decorate(ConfiguredFeatures.Decorators.FIRE); .build()).decorate(RocksDecorators.ROCK);
public static ConfiguredFeature<?, ?> GRANITE_ROCK_FEATURE = Feature.RANDOM_PATCH.configure( public static ConfiguredFeature<?, ?> GRANITE_ROCK_FEATURE = Feature.RANDOM_PATCH.configure(
(new RandomPatchFeatureConfig.Builder( (new RandomPatchFeatureConfig.Builder(
new WeightedBlockStateProvider() new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.addState(RocksMain.GraniteRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.TINY), 10) .add(RocksMain.GraniteRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.TINY), 10)
.addState(RocksMain.GraniteRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.SMALL), 7) .add(RocksMain.GraniteRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.SMALL), 7)
.addState(RocksMain.GraniteRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.MEDIUM), 5) .add(RocksMain.GraniteRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.MEDIUM), 5)
.addState(RocksMain.GraniteRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.LARGE), 1), .add(RocksMain.GraniteRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.LARGE), 1).build()),
SimpleBlockPlacer.INSTANCE)) SimpleBlockPlacer.INSTANCE))
.tries(1).spreadX(0).spreadY(0).spreadZ(0).whitelist(ImmutableSet.of(Blocks.GRANITE)) .tries(1).spreadX(0).spreadY(0).spreadZ(0).whitelist(ImmutableSet.of(Blocks.GRANITE))
.build()).decorate(ConfiguredFeatures.Decorators.FIRE); .build()).decorate(RocksDecorators.ROCK);
public static ConfiguredFeature<?, ?> DIORITE_ROCK_FEATURE = Feature.RANDOM_PATCH.configure( public static ConfiguredFeature<?, ?> DIORITE_ROCK_FEATURE = Feature.RANDOM_PATCH.configure(
(new RandomPatchFeatureConfig.Builder( (new RandomPatchFeatureConfig.Builder(
new WeightedBlockStateProvider() new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.addState(RocksMain.DioriteRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.TINY), 10) .add(RocksMain.DioriteRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.TINY), 10)
.addState(RocksMain.DioriteRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.SMALL), 7) .add(RocksMain.DioriteRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.SMALL), 7)
.addState(RocksMain.DioriteRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.MEDIUM), 5) .add(RocksMain.DioriteRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.MEDIUM), 5)
.addState(RocksMain.DioriteRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.LARGE), 1), .add(RocksMain.DioriteRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.LARGE), 1).build()),
SimpleBlockPlacer.INSTANCE)) SimpleBlockPlacer.INSTANCE))
.tries(1).spreadX(0).spreadY(0).spreadZ(0).whitelist(ImmutableSet.of(Blocks.DIORITE)) .tries(1).spreadX(0).spreadY(0).spreadZ(0).whitelist(ImmutableSet.of(Blocks.DIORITE))
.build()).decorate(ConfiguredFeatures.Decorators.FIRE); .build()).decorate(RocksDecorators.ROCK);
public static ConfiguredFeature<?, ?> ANDESITE_ROCK_FEATURE = Feature.RANDOM_PATCH.configure( public static ConfiguredFeature<?, ?> ANDESITE_ROCK_FEATURE = Feature.RANDOM_PATCH.configure(
(new RandomPatchFeatureConfig.Builder( (new RandomPatchFeatureConfig.Builder(
new WeightedBlockStateProvider() new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.addState(RocksMain.AndesiteRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.TINY), 10) .add(RocksMain.AndesiteRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.TINY), 10)
.addState(RocksMain.AndesiteRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.SMALL), 7) .add(RocksMain.AndesiteRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.SMALL), 7)
.addState(RocksMain.AndesiteRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.MEDIUM), 5) .add(RocksMain.AndesiteRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.MEDIUM), 5)
.addState(RocksMain.AndesiteRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.LARGE), 1), .add(RocksMain.AndesiteRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.LARGE), 1).build()),
SimpleBlockPlacer.INSTANCE)) SimpleBlockPlacer.INSTANCE))
.tries(1).spreadX(0).spreadY(0).spreadZ(0).whitelist(ImmutableSet.of(Blocks.ANDESITE)) .tries(1).spreadX(0).spreadY(0).spreadZ(0).whitelist(ImmutableSet.of(Blocks.ANDESITE))
.build()).decorate(ConfiguredFeatures.Decorators.FIRE); .build()).decorate(RocksDecorators.ROCK);
public static ConfiguredFeature<?, ?> SAND_ROCK_FEATURE = Feature.RANDOM_PATCH.configure( public static ConfiguredFeature<?, ?> SAND_ROCK_FEATURE = Feature.RANDOM_PATCH.configure(
(new RandomPatchFeatureConfig.Builder( (new RandomPatchFeatureConfig.Builder(
new WeightedBlockStateProvider() new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.addState(RocksMain.SandRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.TINY), 10) .add(RocksMain.SandRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.TINY), 10)
.addState(RocksMain.SandRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.SMALL), 7) .add(RocksMain.SandRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.SMALL), 7)
.addState(RocksMain.SandRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.MEDIUM), 5) .add(RocksMain.SandRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.MEDIUM), 5)
.addState(RocksMain.SandRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.LARGE), 1), .add(RocksMain.SandRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.LARGE), 1).build()),
SimpleBlockPlacer.INSTANCE)) SimpleBlockPlacer.INSTANCE))
.tries(1).spreadX(0).spreadY(0).spreadZ(0).whitelist(ImmutableSet.of(Blocks.SAND, Blocks.SANDSTONE)) .tries(1).spreadX(0).spreadY(0).spreadZ(0).whitelist(ImmutableSet.of(Blocks.SAND, Blocks.SANDSTONE))
.build()).decorate(ConfiguredFeatures.Decorators.FIRE); .build()).decorate(RocksDecorators.ROCK);
public static ConfiguredFeature<?, ?> RED_SAND_ROCK_FEATURE = Feature.RANDOM_PATCH.configure( public static ConfiguredFeature<?, ?> RED_SAND_ROCK_FEATURE = Feature.RANDOM_PATCH.configure(
(new RandomPatchFeatureConfig.Builder( (new RandomPatchFeatureConfig.Builder(
new WeightedBlockStateProvider() new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.addState(RocksMain.RedSandRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.TINY), 10) .add(RocksMain.RedSandRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.TINY), 10)
.addState(RocksMain.RedSandRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.SMALL), 7) .add(RocksMain.RedSandRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.SMALL), 7)
.addState(RocksMain.RedSandRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.MEDIUM), 5) .add(RocksMain.RedSandRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.MEDIUM), 5)
.addState(RocksMain.RedSandRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.LARGE), 1), .add(RocksMain.RedSandRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.LARGE), 1).build()),
SimpleBlockPlacer.INSTANCE)) SimpleBlockPlacer.INSTANCE))
.tries(1).spreadX(0).spreadY(0).spreadZ(0).whitelist(ImmutableSet.of(Blocks.RED_SAND, Blocks.RED_SANDSTONE)) .tries(1).spreadX(0).spreadY(0).spreadZ(0).whitelist(ImmutableSet.of(Blocks.RED_SAND, Blocks.RED_SANDSTONE))
.build()).decorate(ConfiguredFeatures.Decorators.FIRE); .build()).decorate(RocksDecorators.ROCK);
public static ConfiguredFeature<?, ?> END_STONE_ROCK_FEATURE = Feature.RANDOM_PATCH.configure( public static ConfiguredFeature<?, ?> END_STONE_ROCK_FEATURE = Feature.RANDOM_PATCH.configure(
(new RandomPatchFeatureConfig.Builder( (new RandomPatchFeatureConfig.Builder(
new WeightedBlockStateProvider() new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.addState(RocksMain.EndstoneRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.TINY), 10) .add(RocksMain.EndstoneRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.TINY), 10)
.addState(RocksMain.EndstoneRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.SMALL), 7) .add(RocksMain.EndstoneRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.SMALL), 7)
.addState(RocksMain.EndstoneRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.MEDIUM), 5) .add(RocksMain.EndstoneRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.MEDIUM), 5)
.addState(RocksMain.EndstoneRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.LARGE), 1), .add(RocksMain.EndstoneRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.LARGE), 1).build()),
SimpleBlockPlacer.INSTANCE)) SimpleBlockPlacer.INSTANCE))
.tries(1).spreadX(0).spreadY(0).spreadZ(0) .tries(1).spreadX(0).spreadY(0).spreadZ(0)
.build()).decorate(ConfiguredFeatures.Decorators.FIRE); .build()).decorate(RocksDecorators.ROCK);
public static ConfiguredFeature<?, ?> GRAVEL_ROCK_FEATURE = Feature.RANDOM_PATCH.configure( public static ConfiguredFeature<?, ?> GRAVEL_ROCK_FEATURE = Feature.RANDOM_PATCH.configure(
(new RandomPatchFeatureConfig.Builder( (new RandomPatchFeatureConfig.Builder(
new WeightedBlockStateProvider() new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.addState(RocksMain.GravelRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.TINY), 10) .add(RocksMain.GravelRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.TINY), 10)
.addState(RocksMain.GravelRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.SMALL), 7) .add(RocksMain.GravelRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.SMALL), 7)
.addState(RocksMain.GravelRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.MEDIUM), 5) .add(RocksMain.GravelRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.MEDIUM), 5)
.addState(RocksMain.GravelRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.LARGE), 1), .add(RocksMain.GravelRock.getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.LARGE), 1).build()),
SimpleBlockPlacer.INSTANCE)) SimpleBlockPlacer.INSTANCE))
.tries(1).spreadX(0).spreadY(0).spreadZ(0).whitelist(ImmutableSet.of(Blocks.GRAVEL)) .tries(1).spreadX(0).spreadY(0).spreadZ(0).whitelist(ImmutableSet.of(Blocks.GRAVEL))
.build()).decorate(ConfiguredFeatures.Decorators.FIRE); .build()).decorate(RocksDecorators.ROCK);
public static void init() { public static void init() {
Registry<ConfiguredFeature<?, ?>> registry = BuiltinRegistries.CONFIGURED_FEATURE; Registry<ConfiguredFeature<?, ?>> registry = BuiltinRegistries.CONFIGURED_FEATURE;

View File

@@ -3,8 +3,11 @@ package eu.midnightdust.motschen.rocks.world.configured_feature;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import eu.midnightdust.motschen.rocks.RocksMain; import eu.midnightdust.motschen.rocks.RocksMain;
import eu.midnightdust.motschen.rocks.blockstates.StickVariation; import eu.midnightdust.motschen.rocks.blockstates.StickVariation;
import eu.midnightdust.motschen.rocks.world.RocksDecorators;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.collection.DataPool;
import net.minecraft.util.registry.BuiltinRegistries; import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import net.minecraft.world.gen.feature.ConfiguredFeature; import net.minecraft.world.gen.feature.ConfiguredFeature;
@@ -17,59 +20,59 @@ import net.minecraft.world.gen.stateprovider.WeightedBlockStateProvider;
public class StickFeatures { public class StickFeatures {
public static ConfiguredFeature<?, ?> OAK_STICK_FEATURE = Feature.RANDOM_PATCH.configure( public static ConfiguredFeature<?, ?> OAK_STICK_FEATURE = Feature.RANDOM_PATCH.configure(
(new RandomPatchFeatureConfig.Builder( (new RandomPatchFeatureConfig.Builder(
new WeightedBlockStateProvider() new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.addState(RocksMain.OakStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.SMALL), 7) .add(RocksMain.OakStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.SMALL), 7)
.addState(RocksMain.OakStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.MEDIUM), 5) .add(RocksMain.OakStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.MEDIUM), 5)
.addState(RocksMain.OakStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.LARGE), 1), .add(RocksMain.OakStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.LARGE), 1).build()),
SimpleBlockPlacer.INSTANCE)) SimpleBlockPlacer.INSTANCE))
.tries(1).spreadX(0).spreadY(0).spreadZ(0).whitelist(ImmutableSet.of(Blocks.GRASS_BLOCK)) .tries(1).spreadX(0).spreadY(0).spreadZ(0).whitelist(ImmutableSet.of(Blocks.GRASS_BLOCK))
.build()).decorate(ConfiguredFeatures.Decorators.FIRE); .build()).decorate(RocksDecorators.ROCK);
public static ConfiguredFeature<?, ?> SPRUCE_STICK_FEATURE = Feature.RANDOM_PATCH.configure( public static ConfiguredFeature<?, ?> SPRUCE_STICK_FEATURE = Feature.RANDOM_PATCH.configure(
(new RandomPatchFeatureConfig.Builder( (new RandomPatchFeatureConfig.Builder(
new WeightedBlockStateProvider() new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.addState(RocksMain.SpruceStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.SMALL), 7) .add(RocksMain.SpruceStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.SMALL), 7)
.addState(RocksMain.SpruceStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.MEDIUM), 5) .add(RocksMain.SpruceStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.MEDIUM), 5)
.addState(RocksMain.SpruceStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.LARGE), 1) .add(RocksMain.SpruceStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.LARGE), 1)
.addState(RocksMain.Pinecone.getDefaultState(), 1), .add(RocksMain.Pinecone.getDefaultState(), 1).build()),
SimpleBlockPlacer.INSTANCE)) SimpleBlockPlacer.INSTANCE))
.tries(1).spreadX(0).spreadY(0).spreadZ(0) .tries(1).spreadX(0).spreadY(0).spreadZ(0)
.build()).decorate(ConfiguredFeatures.Decorators.FIRE); .build()).decorate(RocksDecorators.ROCK);
public static ConfiguredFeature<?, ?> BIRCH_STICK_FEATURE = Feature.RANDOM_PATCH.configure( public static ConfiguredFeature<?, ?> BIRCH_STICK_FEATURE = Feature.RANDOM_PATCH.configure(
(new RandomPatchFeatureConfig.Builder( (new RandomPatchFeatureConfig.Builder(
new WeightedBlockStateProvider() new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.addState(RocksMain.BirchStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.SMALL), 7) .add(RocksMain.BirchStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.SMALL), 7)
.addState(RocksMain.BirchStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.MEDIUM), 5) .add(RocksMain.BirchStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.MEDIUM), 5)
.addState(RocksMain.BirchStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.LARGE), 1), .add(RocksMain.BirchStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.LARGE), 1).build()),
SimpleBlockPlacer.INSTANCE)) SimpleBlockPlacer.INSTANCE))
.tries(1).spreadX(0).spreadY(0).spreadZ(0) .tries(1).spreadX(0).spreadY(0).spreadZ(0)
.build()).decorate(ConfiguredFeatures.Decorators.FIRE); .build()).decorate(RocksDecorators.ROCK);
public static ConfiguredFeature<?, ?> ACACIA_STICK_FEATURE = Feature.RANDOM_PATCH.configure( public static ConfiguredFeature<?, ?> ACACIA_STICK_FEATURE = Feature.RANDOM_PATCH.configure(
(new RandomPatchFeatureConfig.Builder( (new RandomPatchFeatureConfig.Builder(
new WeightedBlockStateProvider() new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.addState(RocksMain.AcaciaStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.SMALL), 7) .add(RocksMain.AcaciaStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.SMALL), 7)
.addState(RocksMain.AcaciaStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.MEDIUM), 5) .add(RocksMain.AcaciaStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.MEDIUM), 5)
.addState(RocksMain.AcaciaStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.LARGE), 1), .add(RocksMain.AcaciaStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.LARGE), 1).build()),
SimpleBlockPlacer.INSTANCE)) SimpleBlockPlacer.INSTANCE))
.tries(1).spreadX(0).spreadY(0).spreadZ(0) .tries(1).spreadX(0).spreadY(0).spreadZ(0)
.build()).decorate(ConfiguredFeatures.Decorators.FIRE); .build()).decorate(RocksDecorators.ROCK);
public static ConfiguredFeature<?, ?> JUNGLE_STICK_FEATURE = Feature.RANDOM_PATCH.configure( public static ConfiguredFeature<?, ?> JUNGLE_STICK_FEATURE = Feature.RANDOM_PATCH.configure(
(new RandomPatchFeatureConfig.Builder( (new RandomPatchFeatureConfig.Builder(
new WeightedBlockStateProvider() new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.addState(RocksMain.JungleStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.SMALL), 7) .add(RocksMain.JungleStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.SMALL), 7)
.addState(RocksMain.JungleStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.MEDIUM), 5) .add(RocksMain.JungleStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.MEDIUM), 5)
.addState(RocksMain.JungleStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.LARGE), 1), .add(RocksMain.JungleStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.LARGE), 1).build()),
SimpleBlockPlacer.INSTANCE)) SimpleBlockPlacer.INSTANCE))
.tries(1).spreadX(0).spreadY(0).spreadZ(0) .tries(1).spreadX(0).spreadY(0).spreadZ(0)
.build()).decorate(ConfiguredFeatures.Decorators.FIRE); .build()).decorate(RocksDecorators.ROCK);
public static ConfiguredFeature<?, ?> DARK_OAK_STICK_FEATURE = Feature.RANDOM_PATCH.configure( public static ConfiguredFeature<?, ?> DARK_OAK_STICK_FEATURE = Feature.RANDOM_PATCH.configure(
(new RandomPatchFeatureConfig.Builder( (new RandomPatchFeatureConfig.Builder(
new WeightedBlockStateProvider() new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.addState(RocksMain.DarkOakStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.SMALL), 7) .add(RocksMain.DarkOakStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.SMALL), 7)
.addState(RocksMain.DarkOakStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.MEDIUM), 5) .add(RocksMain.DarkOakStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.MEDIUM), 5)
.addState(RocksMain.DarkOakStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.LARGE), 1), .add(RocksMain.DarkOakStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.LARGE), 1).build()),
SimpleBlockPlacer.INSTANCE)) SimpleBlockPlacer.INSTANCE))
.tries(1).spreadX(0).spreadY(0).spreadZ(0) .tries(1).spreadX(0).spreadY(0).spreadZ(0)
.build()).decorate(ConfiguredFeatures.Decorators.FIRE); .build()).decorate(RocksDecorators.ROCK);
public static void init() { public static void init() {
Registry<ConfiguredFeature<?, ?>> registry = BuiltinRegistries.CONFIGURED_FEATURE; Registry<ConfiguredFeature<?, ?>> registry = BuiltinRegistries.CONFIGURED_FEATURE;

View File

@@ -10,6 +10,7 @@ import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.ProbabilityConfig; import net.minecraft.world.gen.ProbabilityConfig;
import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.util.FeatureContext;
import net.minecraft.world.gen.stateprovider.WeightedBlockStateProvider; import net.minecraft.world.gen.stateprovider.WeightedBlockStateProvider;
import java.util.Random; import java.util.Random;
@@ -22,7 +23,11 @@ public class SnowFeature extends Feature<ProbabilityConfig> {
weightedBlockStateProvider1 = weightedBlockStateProvider; weightedBlockStateProvider1 = weightedBlockStateProvider;
} }
public boolean generate(StructureWorldAccess structureWorldAccess, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos, ProbabilityConfig probabilityConfig) { @Override
public boolean generate(FeatureContext<ProbabilityConfig> context) {
Random random = context.getRandom();
StructureWorldAccess structureWorldAccess = context.getWorld();
BlockPos blockPos = context.getOrigin();
boolean bl = false; boolean bl = false;
int i = random.nextInt(8) - random.nextInt(8); int i = random.nextInt(8) - random.nextInt(8);
int j = random.nextInt(8) - random.nextInt(8); int j = random.nextInt(8) - random.nextInt(8);

View File

@@ -9,6 +9,7 @@ import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.ProbabilityConfig; import net.minecraft.world.gen.ProbabilityConfig;
import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.util.FeatureContext;
import net.minecraft.world.gen.stateprovider.WeightedBlockStateProvider; import net.minecraft.world.gen.stateprovider.WeightedBlockStateProvider;
import java.util.Random; import java.util.Random;
@@ -20,7 +21,11 @@ public class UnderwaterFeature extends Feature<ProbabilityConfig> {
weightedBlockStateProvider1 = weightedBlockStateProvider; weightedBlockStateProvider1 = weightedBlockStateProvider;
} }
public boolean generate(StructureWorldAccess structureWorldAccess, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos, ProbabilityConfig probabilityConfig) { @Override
public boolean generate(FeatureContext<ProbabilityConfig> context) {
Random random = context.getRandom();
StructureWorldAccess structureWorldAccess = context.getWorld();
BlockPos blockPos = context.getOrigin();
boolean bl = false; boolean bl = false;
int i = random.nextInt(8) - random.nextInt(8); int i = random.nextInt(8) - random.nextInt(8);
int j = random.nextInt(8) - random.nextInt(8); int j = random.nextInt(8) - random.nextInt(8);

View File

View File

View File

View File

@@ -0,0 +1,22 @@
{
"variants": {
"variation=small": [
{"model": "rocks:block/small_crimson_stick"},
{"model": "rocks:block/small_crimson_stick", "y": 90},
{"model": "rocks:block/small_crimson_stick", "y": 180},
{"model": "rocks:block/small_crimson_stick", "y": 270}
],
"variation=medium": [
{"model": "rocks:block/medium_crimson_stick"},
{"model": "rocks:block/medium_crimson_stick", "y": 90},
{"model": "rocks:block/medium_crimson_stick", "y": 180},
{"model": "rocks:block/medium_crimson_stick", "y": 270}
],
"variation=large": [
{"model": "rocks:block/large_crimson_stick"},
{"model": "rocks:block/large_crimson_stick", "y": 90},
{"model": "rocks:block/large_crimson_stick", "y": 180},
{"model": "rocks:block/large_crimson_stick", "y": 270}
]
}
}

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

0
src/main/resources/assets/rocks/blockstates/rock.json Normal file → Executable file
View File

View File

View File

View File

View File

View File

View File

@@ -0,0 +1,22 @@
{
"variants": {
"variation=small": [
{"model": "rocks:block/small_warped_stick"},
{"model": "rocks:block/small_warped_stick", "y": 90},
{"model": "rocks:block/small_warped_stick", "y": 180},
{"model": "rocks:block/small_warped_stick", "y": 270}
],
"variation=medium": [
{"model": "rocks:block/medium_warped_stick"},
{"model": "rocks:block/medium_warped_stick", "y": 90},
{"model": "rocks:block/medium_warped_stick", "y": 180},
{"model": "rocks:block/medium_warped_stick", "y": 270}
],
"variation=large": [
{"model": "rocks:block/large_warped_stick"},
{"model": "rocks:block/large_warped_stick", "y": 90},
{"model": "rocks:block/large_warped_stick", "y": 180},
{"model": "rocks:block/large_warped_stick", "y": 270}
]
}
}

BIN
src/main/resources/assets/rocks/icon.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

12
src/main/resources/assets/rocks/lang/de_de.json Normal file → Executable file
View File

@@ -18,6 +18,8 @@
"block.rocks.jungle_stick":"Tropenholzstock", "block.rocks.jungle_stick":"Tropenholzstock",
"block.rocks.acacia_stick":"Akazienholzstock", "block.rocks.acacia_stick":"Akazienholzstock",
"block.rocks.dark_oak_stick":"Schwarzeichenholzstock", "block.rocks.dark_oak_stick":"Schwarzeichenholzstock",
"block.rocks.crimson_stick":"Karmesinstock",
"block.rocks.warped_stick":"Wirrstock",
"block.rocks.geyser":"Geyser", "block.rocks.geyser":"Geyser",
"block.rocks.nether_geyser":"Magma Geyser", "block.rocks.nether_geyser":"Magma Geyser",
@@ -34,5 +36,13 @@
"item.rocks.red_sandstone_splitter":"Roter Sandsteinsplitter", "item.rocks.red_sandstone_splitter":"Roter Sandsteinsplitter",
"item.rocks.end_stone_splitter":"Endsteinsplitter", "item.rocks.end_stone_splitter":"Endsteinsplitter",
"item.rocks.netherrack_splitter":"Netherracksplitter", "item.rocks.netherrack_splitter":"Netherracksplitter",
"item.rocks.soul_soil_splitter":"Seelenerdesplitter" "item.rocks.soul_soil_splitter":"Seelenerdesplitter",
"rocks.midnightconfig.title": "This Rocks! Konfiguration",
"rocks.midnightconfig.needs_restart": "§c Starte das Spiel neu, nachdem du Änderungen vorgenommen hast!",
"rocks.midnightconfig.rocks": "§aBrocken",
"rocks.midnightconfig.sticks": "§aStöcke",
"rocks.midnightconfig.misc": "§aWeiteres",
"rocks.midnightconfig.underwater_seashell": "Unterwassermuschel",
"rocks.midnightconfig.underwater_starfish": "Unterwasserseestern"
} }

12
src/main/resources/assets/rocks/lang/en_us.json Normal file → Executable file
View File

@@ -18,6 +18,8 @@
"block.rocks.jungle_stick":"Jungle Stick", "block.rocks.jungle_stick":"Jungle Stick",
"block.rocks.acacia_stick":"Acacia Stick", "block.rocks.acacia_stick":"Acacia Stick",
"block.rocks.dark_oak_stick":"Dark Oak Stick", "block.rocks.dark_oak_stick":"Dark Oak Stick",
"block.rocks.crimson_stick":"Crimson Stick",
"block.rocks.warped_stick":"Warped Stick",
"block.rocks.geyser":"Geyser", "block.rocks.geyser":"Geyser",
"block.rocks.nether_geyser":"Magma Geyser", "block.rocks.nether_geyser":"Magma Geyser",
@@ -34,5 +36,13 @@
"item.rocks.red_sandstone_splitter":"Red Sandstone Splitter", "item.rocks.red_sandstone_splitter":"Red Sandstone Splitter",
"item.rocks.end_stone_splitter":"End Stone Splitter", "item.rocks.end_stone_splitter":"End Stone Splitter",
"item.rocks.netherrack_splitter":"Netherrack Splitter", "item.rocks.netherrack_splitter":"Netherrack Splitter",
"item.rocks.soul_soil_splitter":"Soul Soil Splitter" "item.rocks.soul_soil_splitter":"Soul Soil Splitter",
"rocks.midnightconfig.title":"This Rocks! Config",
"rocks.midnightconfig.needs_restart":"§c Restart game after changing config!",
"rocks.midnightconfig.rocks":"§aRocks",
"rocks.midnightconfig.sticks":"§aSticks",
"rocks.midnightconfig.misc":"§aMiscellaneous",
"rocks.midnightconfig.underwater_seashell":"Underwater Seashell",
"rocks.midnightconfig.underwater_starfish":"Underwater Starfish"
} }

View File

@@ -0,0 +1,38 @@
{
"itemGroup.rocks.rocks":"This Rocks!",
"block.rocks.rock":"Fragment kamienia",
"block.rocks.granite_rock":"Fragment granitu",
"block.rocks.diorite_rock":"Fragment diorytu",
"block.rocks.andesite_rock":"Fragment andezytu",
"block.rocks.sand_rock":"Fragment piaskowca",
"block.rocks.red_sand_rock":"Fragment czerwonego piaskowca",
"block.rocks.gravel_rock":"Fragment żwiru",
"block.rocks.end_stone_rock":"Fragment kamienia endu",
"block.rocks.netherrack_rock":"Fragment skały netheru",
"block.rocks.soul_soil_rock":"Fragment gleby dusz",
"block.rocks.oak_stick":"Dębowy patyk",
"block.rocks.birch_stick":"Brzozowy patyk",
"block.rocks.spruce_stick":"Świerkowy patyk",
"block.rocks.jungle_stick":"Tropikalny patyk",
"block.rocks.acacia_stick":"Akacjowy patyk",
"block.rocks.dark_oak_stick":"Ciemnodębowy patyk",
"block.rocks.geyser":"Gejzer",
"block.rocks.nether_geyser":"Gejzer Magmowy",
"block.rocks.pinecone":"Szyszka",
"block.rocks.seashell":"Muszla",
"block.rocks.starfish":"Rozgwiazda",
"item.rocks.cobblestone_splitter":"Fragment bruku",
"item.rocks.granite_splitter":"Fragment granitu",
"item.rocks.diorite_splitter":"Fragment diorytu",
"item.rocks.andesite_splitter":"Fragment andezytu",
"item.rocks.sandstone_splitter":"Fragment piaskowca",
"item.rocks.red_sandstone_splitter":"Fragment czerwonego piaskowca",
"item.rocks.end_stone_splitter":"Fragment kamienia endu",
"item.rocks.netherrack_splitter":"Fragment skały netheru",
"item.rocks.soul_soil_splitter":"Fragment gleby dusz"
}

16
src/main/resources/assets/rocks/lang/ru_ru.json Normal file → Executable file
View File

@@ -2,9 +2,15 @@
"itemGroup.rocks.rocks":"This Rocks!", "itemGroup.rocks.rocks":"This Rocks!",
"block.rocks.rock":"Камушек из булыжника", "block.rocks.rock":"Камушек из булыжника",
"block.rocks.granite_rock":"Камушек из гранита",
"block.rocks.diorite_rock":"Камушек из диорита",
"block.rocks.andesite_rock":"Камушек из андезита",
"block.rocks.sand_rock":"Камушек из песчаника", "block.rocks.sand_rock":"Камушек из песчаника",
"block.rocks.red_sand_rock":"Камушек из красного песчаника", "block.rocks.red_sand_rock":"Камушек из красного песчаника",
"block.rocks.gravel_rock":"Камушек из гравия",
"block.rocks.end_stone_rock":"Камушек из эндерняка", "block.rocks.end_stone_rock":"Камушек из эндерняка",
"block.rocks.netherrack_rock":"Камушек из адского камня",
"block.rocks.soul_soil_rock":"Камушек из почвы душ",
"block.rocks.oak_stick":"Дубовая палка", "block.rocks.oak_stick":"Дубовая палка",
"block.rocks.birch_stick":"Берёзовая палка", "block.rocks.birch_stick":"Берёзовая палка",
@@ -13,12 +19,20 @@
"block.rocks.acacia_stick":"Палка из акации", "block.rocks.acacia_stick":"Палка из акации",
"block.rocks.dark_oak_stick":"Палка из тёмного дуба", "block.rocks.dark_oak_stick":"Палка из тёмного дуба",
"block.rocks.geyser":"Гейзер",
"block.rocks.nether_geyser":"Магмовый гейзер",
"block.rocks.pinecone":"Шишка", "block.rocks.pinecone":"Шишка",
"block.rocks.seashell":"Морская ракушка", "block.rocks.seashell":"Морская ракушка",
"block.rocks.starfish":"Морская звезда", "block.rocks.starfish":"Морская звезда",
"item.rocks.cobblestone_splitter":"Кусочек булыжника", "item.rocks.cobblestone_splitter":"Кусочек булыжника",
"item.rocks.granite_splitter":"Кусочек гранита",
"item.rocks.diorite_splitter":"Кусочек диорита",
"item.rocks.andesite_splitter":"Кусочек андезита",
"item.rocks.sandstone_splitter":"Кусочек песчаника", "item.rocks.sandstone_splitter":"Кусочек песчаника",
"item.rocks.red_sandstone_splitter":"Кусочек красного песчаника", "item.rocks.red_sandstone_splitter":"Кусочек красного песчаника",
"item.rocks.end_stone_splitter":"Кусочек эндерняка" "item.rocks.end_stone_splitter":"Кусочек эндерняка",
"item.rocks.netherrack_splitter":"Кусочек адского камня",
"item.rocks.soul_soil_splitter":"Кусочек почвы душ"
} }

0
src/main/resources/assets/rocks/lang/zh_cn.json Normal file → Executable file
View File

View File

View File

View File

View File

View File

View File

View File

View File

@@ -0,0 +1,7 @@
{
"parent": "rocks:block/large_oak_stick",
"textures": {
"0": "block/crimson_stem",
"particle": "block/crimson_stem"
}
}

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

@@ -0,0 +1,7 @@
{
"parent": "rocks:block/large_oak_stick",
"textures": {
"0": "block/warped_stem",
"particle": "block/warped_stem"
}
}

View File

View File

View File

View File

@@ -0,0 +1,7 @@
{
"parent": "rocks:block/medium_oak_stick",
"textures": {
"0": "block/crimson_stem",
"particle": "block/crimson_stem"
}
}

View File

View File

Some files were not shown because too many files have changed in this diff Show More