Skip to content

Commit

Permalink
This Rocks 1.5.0 - Crimson & Warped Sticks, Config, Compat
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
Motschen committed Sep 19, 2021
1 parent 55cb0ec commit f09b349
Show file tree
Hide file tree
Showing 26 changed files with 317 additions and 123 deletions.
7 changes: 5 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ minecraft {
repositories {
maven { url "https://maven.terraformersmc.com/releases" }
maven { url "https://jitpack.io" }
flatDir {
dirs 'local_maven'
}
}

dependencies {
Expand All @@ -28,8 +31,8 @@ dependencies {
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

modImplementation "com.github.TeamMidnightDust:MidnightLib:${midnightlib_version}"
include "com.github.TeamMidnightDust:MidnightLib:${midnightlib_version}"
modImplementation "eu.midnightdust:midnightlib:${midnightlib_version}"
include "eu.midnightdust:midnightlib:${midnightlib_version}"
}

processResources {
Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ org.gradle.jvmargs=-Xmx2G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.17-pre1
yarn_mappings=1.17-pre1+build.9
loader_version=0.11.3
minecraft_version=1.17.1
yarn_mappings=1.17.1+build.61
loader_version=0.11.7

# Mod Properties
mod_version = 1.4.0
mod_version = 1.5.0
maven_group = eu.midnightdust.motschen
archives_base_name = rocks

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.34.8+1.17
midnightlib_version=v0.2.2
fabric_version=0.40.1+1.17
midnightlib_version=0.2.5
Binary file added local_maven/midnightlib-0.2.5.jar
Binary file not shown.
6 changes: 3 additions & 3 deletions src/main/java/eu/midnightdust/motschen/rocks/RocksClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
public class RocksClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
FabricModelPredicateProviderRegistry.register(RocksMain.Starfish.asItem(), new Identifier("red"), (stack, world, entity, seed) -> (stack.getTag() != null && stack.getTag().getString("variation").equals("red")) ? 1 : 0);
FabricModelPredicateProviderRegistry.register(RocksMain.Starfish.asItem(), new Identifier("pink"), (stack, world, entity, seed) -> (stack.getTag() != null && stack.getTag().getString("variation").equals("pink")) ? 1 : 0);
FabricModelPredicateProviderRegistry.register(RocksMain.Starfish.asItem(), new Identifier("orange"), (stack, world, entity, seed) -> (stack.getTag() != null && stack.getTag().getString("variation").equals("orange")) ? 1 : 0);
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);
}
}
11 changes: 9 additions & 2 deletions src/main/java/eu/midnightdust/motschen/rocks/RocksMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import eu.midnightdust.motschen.rocks.blockstates.SeashellVariation;
import eu.midnightdust.motschen.rocks.blockstates.StarfishVariation;
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.configured_feature.MiscFeatures;
import eu.midnightdust.motschen.rocks.world.configured_feature.NetherFeatures;
Expand All @@ -20,9 +21,7 @@
import net.minecraft.util.registry.Registry;

public class RocksMain implements ModInitializer {

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 EnumProperty<RockVariation> ROCK_VARIATION = EnumProperty.of("variation", RockVariation.class);
Expand All @@ -47,6 +46,8 @@ public class RocksMain implements ModInitializer {
public static Block AcaciaStick = new Stick();
public static Block JungleStick = 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 Seashell = new Seashell();
Expand All @@ -66,6 +67,8 @@ public class RocksMain implements ModInitializer {

@Override
public void onInitialize() {
RocksConfig.init("rocks", RocksConfig.class);

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.BLOCK, new Identifier(MOD_ID,"granite_rock"), GraniteRock);
Expand Down Expand Up @@ -99,6 +102,10 @@ public void onInitialize() {
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.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.ITEM, new Identifier(MOD_ID,"geyser"), new BlockItem(Geyser, new Item.Settings().group(RocksMain.RocksGroup)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public FluidState getFluidState(BlockState blockState_1) {
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
ItemStack stack = itemPlacementContext.getStack();
StarfishVariation variation = StarfishVariation.RED;
if (stack.getTag() != null) {
var optionalVariation = STARFISH_VARIATION.parse(stack.getTag().getString("variation"));
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());
Expand All @@ -61,7 +61,7 @@ public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
@Override
public ItemStack getPickStack(BlockView world, BlockPos pos, BlockState state) {
ItemStack stack = new ItemStack(this);
stack.getOrCreateTag().putString("variation", state.get(STARFISH_VARIATION).asString());
stack.getNbt().putString("variation", state.get(STARFISH_VARIATION).asString());
LOGGER.info(state.get(STARFISH_VARIATION).asString());
return stack;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}

This file was deleted.

Loading

0 comments on commit f09b349

Please sign in to comment.