Posted December 12, 20159 yr 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?
December 12, 20159 yr Author Ok i tried this and it works but the silverfish don't move and when the tnt explodes nothing happend
December 12, 20159 yr Author 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--; } }
December 12, 20159 yr Author 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^^
December 12, 20159 yr Author 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
December 12, 20159 yr 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.
December 13, 20159 yr Author How can I get the world and the player from the server? Can I get it from MinecraftServer.getServer or something like that?!
December 13, 20159 yr No. Where do you call your function? I might be terribly wrong.. Like really, really wrong. But I'm just trying to help.
December 13, 20159 yr 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.
December 13, 20159 yr Author 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
December 13, 20159 yr 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.
December 13, 20159 yr 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.
December 14, 20159 yr Author 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.