fix(blocks): honor mob-spawn config on Waterstone/Lavastone/Sand (#104)

* fix(blocks): honor mob-spawn config on Waterstone/Lavastone

BlockMultiLayer implements ICarvable, so its item tooltip shows "Mobs
cannot Spawn on this Block" whenever canMobsSpawnOnTheChiselBlocks is
disabled, but unlike BlockCarvable it never overrode canCreatureSpawn,
so the setting was never actually enforced on Waterstone (and
Lavastone, which happened to mask the bug via its high light level
blocking hostile spawns).

Fixes GTNewHorizons/GT-New-Horizons-Modpack#26703

* fix(blocks): honor mob-spawn config on carvable Sand

Same root cause as Waterstone/Lavastone: BlockCarvableSand is a full
opaque block (Material.sand) implementing ICarvable, so it shows the
"Mobs cannot Spawn on this Block" tooltip whenever
canMobsSpawnOnTheChiselBlocks is disabled, but never overrode
canCreatureSpawn to actually enforce it.

Verified against the decompiled Forge source in build/rfg: unlike the
carvable Glass/Ice/PackedIce/Beacon blocks (which never reach
canCreatureSpawn at all because they fail the earlier solid-top-surface
check via a translucent material or renderAsNormalBlock=false), Sand
uses an opaque material with no such override, so it passes that check
and defaults canCreatureSpawn to true.
This commit is contained in:
PLASMAchicken authored and GitHub committed 2026-09-09 08:27:21 +02:00
1 parent ff70c8b2e3
commit 3d3260cd71
2 files changed
+15

No files matched your search

@@ -6,6 +6,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockSand;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
@@ -19,6 +20,7 @@ import com.cricketcraft.chisel.api.rendering.ClientUtils;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import team.chisel.Chisel;
import team.chisel.config.Configurations;
public class BlockCarvableSand extends BlockSand implements ICarvable {
@@ -83,6 +85,11 @@ public class BlockCarvableSand extends BlockSand implements ICarvable {
return carverHelper.getVariation(meta);
}
@Override
public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) {
return Configurations.canMobsSpawnOnTheChiselBlocks;
}
public static class SoundType extends Block.SoundType {
public final String soundNameStep;
@@ -6,6 +6,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
@@ -14,6 +15,8 @@ import com.cricketcraft.chisel.api.ICarvable;
import com.cricketcraft.chisel.api.carving.CarvableHelper;
import com.cricketcraft.chisel.api.carving.IVariationInfo;
import team.chisel.config.Configurations;
public class BlockMultiLayer extends BlockMultiLayerBase implements ICarvable {
public CarvableHelper carverHelper;
@@ -62,4 +65,9 @@ public class BlockMultiLayer extends BlockMultiLayerBase implements ICarvable {
public IVariationInfo getManager(int meta) {
return carverHelper.getVariation(meta);
}
@Override
public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) {
return Configurations.canMobsSpawnOnTheChiselBlocks;
}
}