Probably Fixed #4, Also little code cleanup

This commit is contained in:
Motschen
2020-11-19 08:36:37 +01:00
parent 289a2b3c44
commit 9c4c40ceb4
12 changed files with 47 additions and 35 deletions

View File

@@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx2G
loader_version=0.9.1+build.205 loader_version=0.9.1+build.205
# Mod Properties # Mod Properties
mod_version = 1.2.0 mod_version = 1.2.1
maven_group = eu.midnightdust.motschen maven_group = eu.midnightdust.motschen
archives_base_name = rocks archives_base_name = rocks

View File

@@ -7,6 +7,10 @@ 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.world.*; import eu.midnightdust.motschen.rocks.world.*;
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.RockFeatures;
import eu.midnightdust.motschen.rocks.world.configured_feature.StickFeatures;
import net.fabricmc.api.ModInitializer; import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder; import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@@ -122,6 +126,8 @@ public class RocksMain implements ModInitializer {
RockFeatures.init(); RockFeatures.init();
StickFeatures.init(); StickFeatures.init();
MiscFeatures.init(); MiscFeatures.init();
NetherFeatures.init();
FeatureInjector.init(); FeatureInjector.init();
BlockEntityInit.init(); BlockEntityInit.init();
} }

View File

@@ -25,7 +25,7 @@ public class NetherGeyserBlockEntity extends BlockEntity implements Tickable {
BlockState state = this.world.getBlockState(pos); BlockState state = this.world.getBlockState(pos);
if (player != null) { if (player != null) {
world.setBlockState(pos, RocksMain.NetherGeyser.getDefaultState().with(NetherGeyser.ACTIVE, true)); world.setBlockState(pos, state.with(NetherGeyser.ACTIVE, true));
player.damage(DamageSource.ON_FIRE,1); player.damage(DamageSource.ON_FIRE,1);
if (player2 != null) { if (player2 != null) {
player2.damage(DamageSource.ON_FIRE,4); player2.damage(DamageSource.ON_FIRE,4);
@@ -37,7 +37,7 @@ public class NetherGeyserBlockEntity extends BlockEntity implements Tickable {
countdown = countdown - 1; countdown = countdown - 1;
} }
if (countdown == 0) { if (countdown == 0) {
world.setBlockState(pos, RocksMain.NetherGeyser.getDefaultState().with(NetherGeyser.ACTIVE, false)); world.setBlockState(pos, state.with(NetherGeyser.ACTIVE, false));
} }
} }

View File

@@ -12,7 +12,6 @@ import net.minecraft.util.math.BlockPos;
public class OverworldGeyserBlockEntity extends BlockEntity implements Tickable { public class OverworldGeyserBlockEntity extends BlockEntity implements Tickable {
private int countdown = 0; private int countdown = 0;
private int pushUp = 0;
public OverworldGeyserBlockEntity() { public OverworldGeyserBlockEntity() {
super(BlockEntityInit.OVERWORLD_GEYSER_BE); super(BlockEntityInit.OVERWORLD_GEYSER_BE);
@@ -33,7 +32,7 @@ public class OverworldGeyserBlockEntity extends BlockEntity implements Tickable
if (player != null) { if (player != null) {
world.setBlockState(pos, state.with(OverworldGeyser.ACTIVE, true)); world.setBlockState(pos, state.with(OverworldGeyser.ACTIVE, true));
if (player3 != null) { if (player3 != null) {
player.addStatusEffect(new StatusEffectInstance(StatusEffects.LEVITATION, 2, 12, true, false, false)); player3.addStatusEffect(new StatusEffectInstance(StatusEffects.LEVITATION, 2, 12, true, false, false));
} }
countdown = 1000; countdown = 1000;
} }

View File

@@ -2,6 +2,10 @@ package eu.midnightdust.motschen.rocks.world;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import eu.midnightdust.motschen.rocks.mixin.GenerationSettingsAccessorMixin; import eu.midnightdust.motschen.rocks.mixin.GenerationSettingsAccessorMixin;
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.RockFeatures;
import eu.midnightdust.motschen.rocks.world.configured_feature.StickFeatures;
import net.fabricmc.fabric.api.event.registry.RegistryEntryAddedCallback; import net.fabricmc.fabric.api.event.registry.RegistryEntryAddedCallback;
import net.minecraft.util.registry.BuiltinRegistries; import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
@@ -22,68 +26,68 @@ public class FeatureInjector {
private static void addRockToBiome(Biome 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) { 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) {
addFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.ROCK_FEATURE); addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.ROCK_FEATURE);
addFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.GRANITE_ROCK_FEATURE); addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.GRANITE_ROCK_FEATURE);
addFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.DIORITE_ROCK_FEATURE); addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.DIORITE_ROCK_FEATURE);
addFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.ANDESITE_ROCK_FEATURE); addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.ANDESITE_ROCK_FEATURE);
} }
if (biome.getCategory() == Biome.Category.BEACH || biome.getCategory() == Biome.Category.DESERT || biome.getCategory() == Biome.Category.MESA || biome.toString().contains("terrestria:lush_desert")) { if (biome.getCategory() == Biome.Category.BEACH || biome.getCategory() == Biome.Category.DESERT || biome.getCategory() == Biome.Category.MESA || biome.toString().contains("terrestria:lush_desert")) {
addFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.SAND_ROCK_FEATURE); addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.SAND_ROCK_FEATURE);
} }
if (biome.getCategory() == Biome.Category.MESA || biome.getCategory() == Biome.Category.DESERT || biome.toString().contains("terrestria:lush_desert")) { if (biome.getCategory() == Biome.Category.MESA || biome.getCategory() == Biome.Category.DESERT || biome.toString().contains("terrestria:lush_desert")) {
addFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.RED_SAND_ROCK_FEATURE); addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.RED_SAND_ROCK_FEATURE);
} }
if (biome.getCategory() == Biome.Category.THEEND) { if (biome.getCategory() == Biome.Category.THEEND) {
addFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.END_STONE_ROCK_FEATURE); addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.END_STONE_ROCK_FEATURE);
} }
// Sticks // Sticks
if (biome.toString().contains("minecraft:forest") || biome.toString().contains("minecraft:wooded_hills") || 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:wooded_mountains") || biome.toString().contains("minecraft:plains") ||
biome.toString().contains("minecraft:flower_forest") || biome.toString().contains("minecraft:wooded_badlands_plateau") || 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) { biome.toString().contains("minecraft:modified_wooded_badlands_plateau") || biome.getCategory() == Biome.Category.SWAMP) {
addFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, StickFeatures.OAK_STICK_FEATURE); addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, StickFeatures.OAK_STICK_FEATURE);
} }
if (biome.toString().contains("minecraft:forest") || biome.toString().contains("minecraft:birch_forest") || 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")) { biome.toString().contains("minecraft:birch_forest_hills") || biome.toString().contains("minecraft:flower_forest")) {
addFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, StickFeatures.BIRCH_STICK_FEATURE); addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, StickFeatures.BIRCH_STICK_FEATURE);
} }
if (biome.toString().contains("minecraft:wooded_mountains") || biome.getCategory() == Biome.Category.TAIGA) { if (biome.toString().contains("minecraft:wooded_mountains") || biome.getCategory() == Biome.Category.TAIGA) {
addFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, StickFeatures.SPRUCE_STICK_FEATURE); addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, StickFeatures.SPRUCE_STICK_FEATURE);
} }
if (biome.getCategory() == Biome.Category.SAVANNA) { if (biome.getCategory() == Biome.Category.SAVANNA) {
addFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, StickFeatures.ACACIA_STICK_FEATURE); addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, StickFeatures.ACACIA_STICK_FEATURE);
} }
if (biome.getCategory() == Biome.Category.JUNGLE) { if (biome.getCategory() == Biome.Category.JUNGLE) {
addFeature(biome, GenerationStep.Feature.UNDERGROUND_DECORATION, StickFeatures.JUNGLE_STICK_FEATURE); addRockFeature(biome, GenerationStep.Feature.UNDERGROUND_DECORATION, StickFeatures.JUNGLE_STICK_FEATURE);
} }
if (biome.toString().contains("minecraft:dark_forest") || biome.toString().contains("minecraft:dark_forest_hills") || if (biome.toString().contains("minecraft:dark_forest") || biome.toString().contains("minecraft:dark_forest_hills") ||
biome.toString().contains("minecraft:dark_forest_mountains")) { biome.toString().contains("minecraft:dark_forest_mountains")) {
addFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, StickFeatures.DARK_OAK_STICK_FEATURE); addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, StickFeatures.DARK_OAK_STICK_FEATURE);
} }
// Misc // Misc
if (biome.getCategory() == Biome.Category.BEACH && !biome.toString().contains("minecraft:snowy_beach")) { if (biome.getCategory() == Biome.Category.BEACH && !biome.toString().contains("minecraft:snowy_beach")) {
addFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, MiscFeatures.SEASHELL_FEATURE); addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, MiscFeatures.SEASHELL_FEATURE);
addFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, MiscFeatures.STARFISH_FEATURE); addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, MiscFeatures.STARFISH_FEATURE);
} }
if (biome.getCategory() == Biome.Category.OCEAN) { if (biome.getCategory() == Biome.Category.OCEAN) {
addFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, MiscFeatures.UNDERWATER_STARFISH_FEATURE); addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, MiscFeatures.UNDERWATER_STARFISH_FEATURE);
addFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, MiscFeatures.UNDERWATER_SEASHELL_FEATURE); addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, MiscFeatures.UNDERWATER_SEASHELL_FEATURE);
} }
if (biome.getCategory() == Biome.Category.NETHER) { if (biome.getCategory() == Biome.Category.NETHER) {
addFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, NetherFeatures.NETHERRACK_ROCK_FEATURE); addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, NetherFeatures.NETHERRACK_ROCK_FEATURE);
addFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, NetherFeatures.SOUL_SOIL_ROCK_FEATURE); addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, NetherFeatures.SOUL_SOIL_ROCK_FEATURE);
addFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, NetherFeatures.NETHER_GRAVEL_ROCK_FEATURE); addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, NetherFeatures.NETHER_GRAVEL_ROCK_FEATURE);
addFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, NetherFeatures.NETHER_GEYSER_FEATURE); addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, NetherFeatures.NETHER_GEYSER_FEATURE);
} }
if (biome.getCategory() != Biome.Category.NETHER) { if (biome.getCategory() != Biome.Category.NETHER) {
addFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.GRAVEL_ROCK_FEATURE); addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.GRAVEL_ROCK_FEATURE);
} }
if (biome.getCategory() == Biome.Category.ICY) { if (biome.getCategory() == Biome.Category.ICY) {
addFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, MiscFeatures.SNOWY_GEYSER_FEATURE); addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, MiscFeatures.SNOWY_GEYSER_FEATURE);
} }
} }
public static void addFeature(Biome biome, GenerationStep.Feature step, ConfiguredFeature<?, ?> feature) { public static void addRockFeature(Biome biome, GenerationStep.Feature step, ConfiguredFeature<?, ?> feature) {
GenerationSettingsAccessorMixin generationSettingsAccessor = (GenerationSettingsAccessorMixin) biome.getGenerationSettings(); GenerationSettingsAccessorMixin generationSettingsAccessor = (GenerationSettingsAccessorMixin) biome.getGenerationSettings();
int stepIndex = step.ordinal(); int stepIndex = step.ordinal();
List<List<Supplier<ConfiguredFeature<?, ?>>>> featuresByStep = new ArrayList<>( generationSettingsAccessor.getFeatures()); List<List<Supplier<ConfiguredFeature<?, ?>>>> featuresByStep = new ArrayList<>( generationSettingsAccessor.getFeatures());

View File

@@ -3,6 +3,8 @@ package eu.midnightdust.motschen.rocks.world;
import eu.midnightdust.motschen.rocks.RocksMain; 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.feature.SnowFeature;
import eu.midnightdust.motschen.rocks.world.feature.UnderwaterFeature;
import net.minecraft.state.property.Properties; import net.minecraft.state.property.Properties;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import net.minecraft.world.gen.ProbabilityConfig; import net.minecraft.world.gen.ProbabilityConfig;

View File

@@ -1,9 +1,10 @@
package eu.midnightdust.motschen.rocks.world; 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.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 net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.registry.BuiltinRegistries; import net.minecraft.util.registry.BuiltinRegistries;

View File

@@ -1,4 +1,4 @@
package eu.midnightdust.motschen.rocks.world; 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;

View File

@@ -1,4 +1,4 @@
package eu.midnightdust.motschen.rocks.world; 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;

View File

@@ -1,4 +1,4 @@
package eu.midnightdust.motschen.rocks.world; 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;

View File

@@ -1,4 +1,4 @@
package eu.midnightdust.motschen.rocks.world; package eu.midnightdust.motschen.rocks.world.feature;
import com.mojang.serialization.Codec; import com.mojang.serialization.Codec;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;

View File

@@ -1,4 +1,4 @@
package eu.midnightdust.motschen.rocks.world; package eu.midnightdust.motschen.rocks.world.feature;
import com.mojang.serialization.Codec; import com.mojang.serialization.Codec;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;