mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-25 06:34:35 +00:00
* 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.
74 lines
2.0 KiB
Java
74 lines
2.0 KiB
Java
package team.chisel.block;
|
|
|
|
import java.util.List;
|
|
|
|
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;
|
|
|
|
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;
|
|
|
|
public BlockMultiLayer(Material mat, String baseIcon) {
|
|
super(mat, baseIcon);
|
|
|
|
carverHelper = new CarvableHelper(this);
|
|
}
|
|
|
|
public BlockMultiLayer(Material mat, Block block) {
|
|
super(mat, block);
|
|
|
|
carverHelper = new CarvableHelper(this);
|
|
}
|
|
|
|
@Override
|
|
public IIcon getIcon(int side, int metadata) {
|
|
return carverHelper.getIcon(side, metadata);
|
|
}
|
|
|
|
@Override
|
|
public int damageDropped(int i) {
|
|
return i;
|
|
}
|
|
|
|
@Override
|
|
public void registerBlockIcons(IIconRegister register) {
|
|
super.registerBlockIcons(register);
|
|
|
|
carverHelper.registerBlockIcons("Chisel", this, register);
|
|
}
|
|
|
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
|
@Override
|
|
public void getSubBlocks(Item block, CreativeTabs tabs, List list) {
|
|
carverHelper.registerSubBlocks(this, tabs, list);
|
|
}
|
|
|
|
@Override
|
|
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
|
return carverHelper.getVariation(metadata);
|
|
}
|
|
|
|
@Override
|
|
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;
|
|
}
|
|
}
|