So I'm new to modding (Minecraft), and I am having trouble figuring out how to spawn a lightning bolt at a specific location (My block's xyz). The lightning spawns, just not on the block. One thing to note is the lightning is only to spawn when the block is broken by the player. Here's the code for the block:
public class LightningOre extends BlockBase {
public LightningOre(String name, Material material) {
super(name, material);
setSoundType(SoundType.STONE);
setHardness(3.0F);
setResistance(15F);
setHarvestLevel("pickaxe", 3);
setLightLevel(20F);
}
@Override
public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState state) {
EntityLightningBolt lightning = new EntityLightningBolt(worldIn, blockHardness, blockHardness, blockHardness, enableStats);
worldIn.spawnEntity(lightning);
}
}
Thanks in advance!