Posted January 10, 20196 yr So I've got some simple code that should spawn in a zombie in the onBlockActivated method of my block, but it doesn't seem to be doing anything, even though I could spawn in item entities just fine. EntityZombie mobEntity = new EntityZombie(world); mobEntity.setPosition(pos.getX(), pos.getZ(), pos.getZ()); world.spawnEntity(mobEntity); Also, if someone could tell me how to properly post code, that would be great. Edited January 10, 20196 yr by MrDireball
January 10, 20196 yr Author 5 hours ago, diesieben07 said: Show more of your code. You can do the following to post code (ordered from best to "worst"): Create a Git repository of your code. Use Github Gists. Use pastebin.com or similar. Use the Code-Button on the forum editor (opening and closing angle bracket icon). @Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { if (!world.isRemote) { if (side == state.getValue(FACING)) { //world.spawnEntity(new EntityItem(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(Items.DIAMOND))); EntityZombie mobEntity = new EntityZombie(world); mobEntity.setPosition(pos.getX(), pos.getZ(), pos.getZ()); world.spawnEntity(mobEntity); } } return true; }
January 10, 20196 yr Author Idiot me. If you look closely at line 9, you'll see that I accidentally set y to z, hence why they were falling from the sky just now, and presumably being teleported under the world before.
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.