Jump to content

Recommended Posts

Posted

1. How can I spawn an entity like a Zombie, which is wearing an enchanted Armor and enchanted Weapons in the hand?

2. And how can I spawn a silverfish with an primed tnt (which explodes after 5 seconds) on the head?

3. And how can I summon an primed tnt whithout silverfish?

Posted

I made it so:

public static void spawnExSilverfish(){

int i = 5;

while(i != 0){

World world = Minecraft.getMinecraft().theWorld;

EntityPlayer p = Minecraft.getMinecraft().thePlayer;

EntitySilverfish sf = new EntitySilverfish(world);

sf.setLocationAndAngles(p.posX, p.posY, p.posZ, 0, 0);

world.spawnEntityInWorld(sf);

 

EntityTNTPrimed tnt = new EntityTNTPrimed(world);

tnt.fuse = 20 * 5;

world.spawnEntityInWorld(tnt);

tnt.mountEntity(sf);

i--;

}

 

 

}

Posted

Ohh ok, I am new and i think its a stupid question put how can I get the world and the player from the server I searched for tutorials but nothing found^^

Posted

I am making on a Lucky Blocks Mod. Therefor I have Random Class (GENERATOR). The Random Method will activate when you destroy the block. The Output of the Random Gen is an Integer. So when you destroy the block a random number is "in" the integer then I would like to do it with IF: if(integer = 1) then should happen one of the events. For Example: The Explosive Silverfish. Summary: You break the Block and the method will activate and than it should happend

Posted

Then you need the EntityPlayer and the World as arguments in your function.

I might be terribly wrong.. Like really, really wrong. But I'm just trying to help.

Posted

In the onBlockHarvested Event in the Block Class of the Block

 

Then you already have the

World

the block was in, the

BlockPos

it was located at, the

IBlockState

and the

EntityPlayer

who harvested it as arguments of the

onBlockHarvested

method. Pass the required values to the code that handles the random events.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

No the thing is that i want to make a lucky block and I have a random class which will "activate" when you harvest the block and when you do that the random class search for an event so the explosive silverfish event. I connect the random class with the harvest event and the explosive silverfish event with the random class

Posted

No the thing is that i want to make a lucky block and I have a random class which will "activate" when you harvest the block and when you do that the random class search for an event so the explosive silverfish event. I connect the random class with the harvest event and the explosive silverfish event with the random class

 

What I said before still applies: you have the world, position, blockstate and player as arguments of

onBlockHarvested

; so pass whichever of these you need to the random class and then pass them to the random event.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

How can I do this I had an idea but it don't work^^

 

Do you actually know Java? A solid understanding of Java is required to create mods.

 

Pass the arguments of

onBlockHarvested

to the random class as method arguments, then do the same from the random class to the random event.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

I solved it. I made it so: I have the method onBlockHarvested in the Block class and another meghod in the SpawnExSilverfish class the method in the SpawnExSilverfish class shows like: public static void name (World w, EntityPlayer p) ...and the code...and the only thing I did was that I write this method in the block class onBlockHarvested method an write in the () the parameter world and EntityPlayer of the onBlockHarvested event

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.

Announcements



×
×
  • Create New...

Important Information

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