Posted June 8, 201510 yr okay I have a OnRightclick method that spawns 5 entitys into the world, the problem is, is that the item spawns 5 ghost entitys as well, here's my code. package com.OlympiansMod.Item; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import com.OlympiansMod.entity.EntitySGolem; import com.OlympiansMod.entity.EntityUndead; public class UndeadRomanSpawn extends Item{ public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player){ if(!player.capabilities.isCreativeMode){ --itemstack.stackSize; } EntityUndead undead = new EntityUndead(world); undead.setPosition(player.posX, player.posY, player.posZ); world.spawnEntityInWorld(undead); return itemstack; } } Im serious don't look at it!!
June 8, 201510 yr Entities should be spawned server-side. Wrap your spawning with if (!world.isRemote). (I am not sure of stuff below, I am only pointing out what you might run into) Also: After direct manipulation of ItemStack: "--itemstack.stackSize;" you might have to do player.inventory.detectAndSendChanges() (not sure about method name). You will most certainly NOT have to do this if you would run "--itemstack.stackSize;" on both sides, and spawning entity on server only. 1.7.10 is no longer supported by forge, you are on your own.
June 8, 201510 yr Author ok I changed it but it still is not working package com.OlympiansMod.Item; import com.OlympiansMod.entity.EntityUndead; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class DioceltiansSepter extends Item{ public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player){ if(player.capabilities.isCreativeMode){ } if(!world.isRemote); for (int i = 0 ; i < 5 ; i++){ EntityUndead undead = new EntityUndead(world); undead.setPosition(player.posX, player.posY, player.posZ); world.spawnEntityInWorld(undead); } return itemstack; } } Im serious don't look at it!!
June 8, 201510 yr Isnt there a method that takes x, y, and z parameters? I think its world.spawnEntityInWorld(entity, x, y, z, motionX, motionY, motionZ); I think your problem is that your entity hasn't been spawned before you set its coordinates.
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.