Posted May 12, 201312 yr Ok, so I am trying to get a feel of structure generations and what can be done with it and im trying to generate a village for example when you right click with an item called Generator1. Any suggestions on how to go about doing that?
May 12, 201312 yr Mark a point as the center and the do setblock so many x y and z from it to make what you want.
May 12, 201312 yr The basic is simple public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { par1World.setBlock(par2, par3, par4, BlockID); } par2 is your X coordinate of your block par3 is your Y coordinate of your block par4 is your Z coordinate of your block BlockId is the block you want to place at that coordinate Here is some example code im using in my mod to build a small tent public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { par1World.spawnParticle("smoke", par2, par3, par4, 0.1F, 0.1F, 0.1F); par1World.setBlock(par2, par3, par4,61); par1World.setBlock(par2, par3+1, par4,61); par1World.setBlock(par2, par3+2, par4,35); par1World.setBlock(par2-1, par3, par4,58); par1World.setBlock(par2-2, par3, par4,35); par1World.setBlock(par2-1, par3+1, par4,35); par1World.setBlock(par2+1, par3, par4,58); par1World.setBlock(par2+2, par3, par4,35); par1World.setBlock(par2+1, par3+1, par4,35); par1World.setBlock(par2-1, par3, par4-1,85); par1World.setBlock(par2-2, par3, par4-1,35); par1World.setBlock(par2-1, par3+1, par4-1,35); par1World.setBlock(par2+1, par3, par4-1,85); par1World.setBlock(par2+2, par3, par4-1,35); par1World.setBlock(par2+1, par3+1, par4-1,35); par1World.setBlock(par2, par3, par4-1,85); par1World.setBlock(par2, par3+1, par4-1,85); par1World.setBlock(par2, par3+2, par4-1,35); par1World.setBlock(par2-2, par3, par4+1,35); par1World.setBlock(par2-1, par3+1, par4+1,35); par1World.setBlock(par2+2, par3, par4+1,35); par1World.setBlock(par2+1, par3+1, par4+1,35); par1World.setBlock(par2, par3+2, par4+1,35); return true; }; http://r1306.hizliresim.com/1b/1/np1mm.png[/img]
May 12, 201312 yr Author Now i am running into a problem where it is returning both feet post, and eye pos. public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { World world = par3World; EntityPlayer ply = par2EntityPlayer; double posX = ply.lastTickPosX; double posY = ply.lastTickPosY; double posZ = ply.lastTickPosZ; System.out.println("X: " + posX); System.out.println("Y: " + posY); System.out.println("Z: " + posZ); System.out.println("Int 1: " + par4); System.out.println("Int 2: " + par5); System.out.println("Int 3: " + par6); System.out.println("Int 4: " + par7); System.out.println("Float 1: " + par8); System.out.println("Float 2: " + par9); System.out.println("Float 3: " + par10); return true; } This is what it outputs: 2013-05-12 15:02:17 [iNFO] [sTDOUT] X: 1573.8539209767246 2013-05-12 15:02:17 [iNFO] [sTDOUT] Y: 8.485128304470969 2013-05-12 15:02:17 [iNFO] [sTDOUT] Z: 35.771595298500344 2013-05-12 15:02:17 [iNFO] [sTDOUT] Int 1: 1574 2013-05-12 15:02:17 [iNFO] [sTDOUT] Int 2: 3 2013-05-12 15:02:17 [iNFO] [sTDOUT] Int 3: 35 2013-05-12 15:02:17 [iNFO] [sTDOUT] Int 4: 1 2013-05-12 15:02:17 [iNFO] [sTDOUT] Float 1: 0.03881836 2013-05-12 15:02:17 [iNFO] [sTDOUT] Float 2: 1.0 2013-05-12 15:02:17 [iNFO] [sTDOUT] Float 3: 0.87386703 2013-05-12 15:02:17 [iNFO] [sTDOUT] X: 1573.8539209767246 2013-05-12 15:02:17 [iNFO] [sTDOUT] Y: 6.865128299702597 2013-05-12 15:02:17 [iNFO] [sTDOUT] Z: 35.771595298500344 2013-05-12 15:02:17 [iNFO] [sTDOUT] Int 1: 1574 2013-05-12 15:02:17 [iNFO] [sTDOUT] Int 2: 3 2013-05-12 15:02:17 [iNFO] [sTDOUT] Int 3: 35 2013-05-12 15:02:17 [iNFO] [sTDOUT] Int 4: 1 2013-05-12 15:02:17 [iNFO] [sTDOUT] Float 1: 0.03881836 2013-05-12 15:02:17 [iNFO] [sTDOUT] Float 2: 1.0 2013-05-12 15:02:17 [iNFO] [sTDOUT] Float 3: 0.87386703
May 12, 201312 yr You can find the block right clicked on with a Forge event. Heres some code: @ForgeSubscribe public void buildVillage(PlayerInteractEvent event) { if (Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem() == youritemid) { //event.x, event.y,event.z are the block coordinates for the block you right clicked on //your code for generating } }
May 12, 201312 yr Author Oh, thank you , i will for sure try that out Wait, how would i get my item in the if statement? Its probably obvious but im drawing a blank. Because it is asking for an itemstack but my item is an item...
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.