Skip to content

Commit

Permalink
FuranceGriefing config option
Browse files Browse the repository at this point in the history
  • Loading branch information
jiink committed May 16, 2024
1 parent 7ab44fa commit d0d8b84
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package jiink.smeltinginapinch;

import jiink.smeltinginapinch.config.MyConfig;
import net.minecraft.block.AbstractFireBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
Expand Down Expand Up @@ -29,8 +30,13 @@ protected void burnoutDestroy(World world, BlockPos pos, BlockState state) {
1f,
1f
);
world.setBlockState(pos, net.minecraft.block.Blocks.FIRE.getDefaultState());
// explode
world.createExplosion(null, (double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), 4.0f, true, World.ExplosionSourceType.MOB);
if (MyConfig.HANDLER.instance().furnaceGriefing) {
world.createExplosion(null, (double) pos.getX(), (double) pos.getY(), (double) pos.getZ(), 1.0f, true, World.ExplosionSourceType.MOB);
} else {
world.syncWorldEvent(WorldEvents.BLOCK_BROKEN, pos, Block.getRawIdFromState(state));
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package jiink.smeltinginapinch;

import jiink.smeltinginapinch.config.MyConfig;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
Expand All @@ -16,7 +17,12 @@ public GunpowderFurnaceBlockEntity(BlockPos pos, BlockState state) {

@Override
protected void burnoutDestroy(World world, BlockPos pos, BlockState state) {
world.setBlockState(pos, net.minecraft.block.Blocks.FIRE.getDefaultState());
// explode
world.createExplosion(null, (double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), 4.0f, true, World.ExplosionSourceType.BLOCK);
if (MyConfig.HANDLER.instance().furnaceGriefing) {
world.createExplosion(null, (double) pos.getX(), (double) pos.getY(), (double) pos.getZ(), 4.0f, false, World.ExplosionSourceType.BLOCK);
} else {
world.syncWorldEvent(WorldEvents.BLOCK_BROKEN, pos, Block.getRawIdFromState(state));
}
}
}
3 changes: 3 additions & 0 deletions src/main/java/jiink/smeltinginapinch/config/MyConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public class MyConfig {
.build())
.build();

@SerialEntry (comment = "Disable explosions from certain powerful furnaces. May cause the mod to become unbalanced.")
public boolean furnaceGriefing = true;

@SerialEntry
public int numItemsCanSmeltWooden = 8;
@SerialEntry
Expand Down

0 comments on commit d0d8b84

Please sign in to comment.