Skip to content

Commit

Permalink
add config option for lead block melting
Browse files Browse the repository at this point in the history
  • Loading branch information
PssbleTrngle committed Oct 17, 2024
1 parent ce1a279 commit c538aa5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/main/java/galena/oreganized/Oreganized.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,12 @@ private void setup(FMLCommonSetupEvent event) {
POWDER_SNOW.put(OItems.MOLTEN_LEAD_BUCKET.get(), MoltenLeadCauldronBlock.FILL_MOLTEN_LEAD);
LEAD.put(OItems.MOLTEN_LEAD_BUCKET.get(), MoltenLeadCauldronBlock.FILL_MOLTEN_LEAD);

EMPTY.put(OBlocks.LEAD_BLOCK.get().asItem(), MoltenLeadCauldronBlock.FILL_LEAD_BLOCK);
WATER.put(OBlocks.LEAD_BLOCK.get().asItem(), MoltenLeadCauldronBlock.FILL_LEAD_BLOCK);
LAVA.put(OBlocks.LEAD_BLOCK.get().asItem(), MoltenLeadCauldronBlock.FILL_LEAD_BLOCK);
POWDER_SNOW.put(OBlocks.LEAD_BLOCK.get().asItem(), MoltenLeadCauldronBlock.FILL_LEAD_BLOCK);
if(OreganizedConfig.COMMON.cauldronLeadMelting.get()) {
EMPTY.put(OBlocks.LEAD_BLOCK.get().asItem(), MoltenLeadCauldronBlock.FILL_LEAD_BLOCK);
WATER.put(OBlocks.LEAD_BLOCK.get().asItem(), MoltenLeadCauldronBlock.FILL_LEAD_BLOCK);
LAVA.put(OBlocks.LEAD_BLOCK.get().asItem(), MoltenLeadCauldronBlock.FILL_LEAD_BLOCK);
POWDER_SNOW.put(OBlocks.LEAD_BLOCK.get().asItem(), MoltenLeadCauldronBlock.FILL_LEAD_BLOCK);
}

LEAD.put(Items.AIR, MoltenLeadCauldronBlock.EMPTY_LEAD_BLOCK);
LEAD.put(Items.BUCKET, MoltenLeadCauldronBlock.EMPTY_MOLTEN_LEAD);
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/galena/oreganized/OreganizedConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public static class Common {
public final ConfigValue<Boolean> pillagerSpawnWithBolts;
public final ConfigValue<Boolean> scribeSilkTouchStone;
public final ConfigValue<Integer> moltenLeadDelay;
public final ConfigValue<Boolean> cauldronLeadMelting;

private Common(ForgeConfigSpec.Builder builder) {
builder.comment("Common");
Expand All @@ -30,6 +31,7 @@ private Common(ForgeConfigSpec.Builder builder) {
pillagerSpawnWithBolts = builder.comment("Pillagers have a chance to spawn with a lead bolt in their offhand").define("pillagerSpawnWithBolts", true);
scribeSilkTouchStone = builder.comment("The scribe is able to silk-touch pickaxe-related blocks").define("scribeSilkTouchStone", true);
moltenLeadDelay = builder.comment("Time in ticks molten lead waits until flowing downwards").defineInRange("moltenLeadDelay", 20 * 10, 0, 20 * 100);
cauldronLeadMelting = builder.comment("Can lead blocks be placed into a cauldron to melt?").define("cauldronLeadMelting", true);

builder.pop();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package galena.oreganized.content.block;

import galena.oreganized.OreganizedConfig;
import galena.oreganized.index.OBlocks;
import galena.oreganized.index.OItems;
import galena.oreganized.index.OTags;
Expand All @@ -25,7 +26,6 @@
import net.minecraft.world.level.block.AbstractCauldronBlock;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.CauldronBlock;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
Expand Down Expand Up @@ -113,7 +113,7 @@ public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource
int age = state.getValue(AGE);
if (age < max_age && random.nextInt(1) == 0) {
BlockState below = world.getBlockState(pos.below());
if (below.is(OTags.Blocks.FIRE_SOURCE) || below.getFluidState().is(FluidTags.LAVA)) {
if ((below.is(OTags.Blocks.FIRE_SOURCE) || below.getFluidState().is(FluidTags.LAVA)) && OreganizedConfig.COMMON.cauldronLeadMelting.get()) {
world.setBlockAndUpdate(pos, state.setValue(AGE, age + 1));
return;
}
Expand Down

0 comments on commit c538aa5

Please sign in to comment.