Jump to content

Recommended Posts

Posted

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!

Posted
3 hours ago, jackdog336 said:

BlockPos pos

I wonder what this is.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.