Jump to content

(1.8) spawning lightning(SOLVED)


DaBootyO_o

Recommended Posts

package mod;

 

import net.minecraft.client.Minecraft;

import net.minecraft.entity.Entity;

import net.minecraft.entity.EntityLivingBase;

import net.minecraft.entity.effect.EntityLightningBolt;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.init.Items;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.item.ItemSword;

import net.minecraft.util.AxisAlignedBB;

import net.minecraft.util.BlockPos;

import net.minecraft.util.ChatComponentText;

import net.minecraft.util.EnumFacing;

import net.minecraft.util.MathHelper;

import net.minecraft.util.MovingObjectPosition;

import net.minecraft.util.MovingObjectPosition.MovingObjectType;

import net.minecraft.util.Vec3;

import net.minecraft.world.World;

 

 

 

public class ZeusLightningBolt extends Item {

 

 

 

 

 

public ZeusLightningBolt(ToolMaterial material) {

super();

 

 

}

 

 

public ItemStack onItemRightClick(ItemStack Itemstack, World world, EntityPlayer Entityplayer)

{

 

if(Entityplayer.capabilities.isCreativeMode || Entityplayer.inventory.consumeInventoryItem(Items.redstone)) 

world.playSoundAtEntity(Entityplayer, "ambient.weather.thunder", 20.0F, 40.0F / (itemRand.nextFloat() * 20.0F + 40.0F));

 

 

world.playSoundAtEntity(Entityplayer, "random.explode", 20.0F, 40.0F / (itemRand.nextFloat() * 20.0F + 40.0F));

 

double x = 0;

double y = 0;

double z = 0;

world.spawnEntityInWorld(new EntityLightningBolt(world, x, y, z));

return Itemstack;

 

}

}

Link to comment
Share on other sites

it keeps telling me to set posX as a variable. I cant seem to get around that.

Learn Java and how minecraft works. Please.

The lightning has to be somewhere so the coordinates are necessary.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

1. use code tags

2. so. you are triing to spawn a lightning at the position 0,0,0 .. what are you expecting

 

Also, minecraft 1.8 uses

World#addWeatherEffect

not

World#spawnEntityInWorld

to spawn a lightning bolt.

CommandSummon

gives an example of how to summon lightnings.

Author of Tao Land Mod.

width=200 height=69http://taoland.herbix.me/images/1/14/TaoLandLogo.png[/img]

Also, author of RenderTo

----

I'm not an English native speaker. I just try my best.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

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