Add option (disabled by default) to make dirt from witch water and water flowing together

This commit is contained in:
thedarkcolour 2024-02-15 17:19:13 -08:00
parent 57db1c6d2c
commit ff4a00c609
2 changed files with 14 additions and 1 deletions

View File

@ -125,6 +125,7 @@ public class EConfig {
public final IntValue simultaneousSieveUsageRange;
public final BooleanValue automatedSieves;
public final DoubleValue barrelProgressStep;
public final BooleanValue witchWaterDirtGenerator;
public final BooleanValue witchWaterNetherrackGenerator;
public final ConfigValue<String> defaultSpawnTreeFeature;
public final BooleanValue useBiomeAppropriateTree;
@ -158,6 +159,9 @@ public class EConfig {
this.barrelProgressStep = builder
.comment("The progress to increment by each tick for barrel composting.")
.defineInRange("barrel_progress_step", 0.004, 0.0f, 1.0f);
this.witchWaterDirtGenerator = builder
.comment("Whether Witch Water forms dirt when water flows into it, allowing for a dirt version of a cobblestone generator.")
.define("witch_water_dirt_generator", false);
this.witchWaterNetherrackGenerator = builder
.comment("Whether Witch Water forms netherrack when lava flows into it, allowing for a netherrack version of a cobblestone generator.")
.define("witch_water_netherrack_generator", true);

View File

@ -18,6 +18,7 @@
package thedarkcolour.exdeorum.event;
import net.minecraft.Util;
import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Holder;
@ -28,12 +29,15 @@ import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.util.RandomSource;
import net.minecraft.util.Unit;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.level.levelgen.XoroshiroRandomSource;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
@ -170,6 +174,12 @@ public final class EventHandler {
EFluids.WITCH_WATER_TYPE.get(),
fluidState -> fluidState.isSource() ? Blocks.OBSIDIAN.defaultBlockState() : (EConfig.SERVER.witchWaterNetherrackGenerator.get() ? Blocks.NETHERRACK.defaultBlockState() : Blocks.COBBLESTONE.defaultBlockState())
));
var dirtVariants = new BlockState[]{Blocks.DIRT.defaultBlockState(), Blocks.PODZOL.defaultBlockState(), Blocks.COARSE_DIRT.defaultBlockState()};
var rng = RandomSource.create();
FluidInteractionRegistry.addInteraction(EFluids.WITCH_WATER_TYPE.get(), new FluidInteractionRegistry.InteractionInformation(
(level, pos, relative, state) -> level.getFluidState(relative).getFluidType() == ForgeMod.WATER_TYPE.get() && EConfig.SERVER.witchWaterDirtGenerator.get(),
fluidState -> Util.getRandom(dirtVariants, rng)
));
});
}
@ -230,7 +240,6 @@ public final class EventHandler {
if (ModList.get().isLoaded(ModIds.THE_ONE_PROBE)) {
InterModComms.sendTo(ModIds.THE_ONE_PROBE, "getTheOneProbe", ExDeorumTopCompat::new);
}
// todo instead of doing this, figure out the real reason sorting voids items
if (ModList.get().isLoaded(ModIds.INVENTORY_SORTER)) {
InterModComms.sendTo(ModIds.INVENTORY_SORTER, "slotblacklist", ItemHelper.Slot.class::getName);
}