Posted May 8, 201510 yr Hello guys, I'm having a problem, I'm making a block spawn items when it's break, but for some reason the spawnEntityInWorld it does spawn the item on the x y x specified but the items float to the west ending at around 1 or 2 blocks to the West from where they were called. Is there a way to fix this? Does this happen for any reason? I know I could do x+1 or x+2 when I call the item to spawn, but it doesn't look good, I would like them to spawn in place and not move. Thanks in advance for any tip
May 8, 201510 yr Author Set their velocity to 0. Thanks diesieben07, but I seem to be having some problems, most likely because I'm not really that good and Modding or even with Java lol It works when I do: ItemStack drop0 = new ItemStack(Items.apple,reward,0); EntityItem itemDrop = new EntityItem(world, x, y, z, drop0); world.spawnEntityInWorld(itemDrop); But when I add: ItemStack drop0 = new ItemStack(Items.apple,reward,0); EntityItem itemDrop = new EntityItem(world, x, y, z, drop0); world.spawnEntityInWorld(itemDrop.setVelocity(0F, 0F, 0F)); I get an error saying: The method spawnEntityInWorld(Entity) in the type World is not applicable for the arguments(void) The code is like this: public static void init(World world, int x, int y, int z) { //Amount of items final int reward = (int) ((Math.random() * +2); ItemStack drop0 = new ItemStack(Items.apple,reward,0); EntityItem itemDrop = new EntityItem(world, x, y, z, drop0); world.spawnEntityInWorld(itemDrop.setVelocity(0F, 0F, 0F)); } I know I must be falling into some mistake because I'm not sure what I'm doing lol
May 9, 201510 yr setVelocity does NOT return EntityItem, its a void method. Learn java. 1st setVelocity, then in next line spawn entity. 1.7.10 is no longer supported by forge, you are on your own.
May 9, 201510 yr Author setVelocity does NOT return EntityItem, its a void method. Learn java. 1st setVelocity, then in next line spawn entity. I tired to learn Java several times, but it's way too confusing for me. I think I see what you mean, I will give a try and see if I get it. PS: I'm trying to learn, but again, Java beats me
May 9, 201510 yr If Java is "way too confusing" for you, then you shouldn't be modding; you will inevitable screw up something major. So, go learn Java. Don't make mods if you don't know Java. Check out my website: http://shadowfacts.net Developer of many mods
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.