Posted January 22, 201510 yr How would i get the code below, to work on vanilla minecraft servers? It seems to only work in singleplayer mode. Basically what i am asking, is how do I send an itemstack to a server @SubscribeEvent public void onClick(PlayerInteractEvent e) { if (e.action == Action.RIGHT_CLICK_AIR && e.entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) e.entity; ItemStack item = player.getHeldItem(); item.setTagCompound(new NBTTagCompound()); NBTTagCompound tag = item.getTagCompound(); tag.setTag("BlockEntityTag", tag.copy()); tag.setTag("display", tag.copy()); NBTTagCompound tag3 = tag.getCompoundTag("display"); tag3.setString("Name", "HELLO");
January 22, 201510 yr What do you mean "send an itemstack to a server"? What do you want the server to do with it? Don't make mods if you don't know Java. Check out my website: http://shadowfacts.net Developer of many mods
January 22, 201510 yr Author I want to be able to edit an itemstack, in creative, on a vanilla server. Currently nothing happens when i try this on servers. I know it is possible, because creative mode gives you access to nbt editing.
January 22, 201510 yr Author There is a way to do this so that it will work on vanilla, non forge, servers. It has something to do with packets
January 22, 201510 yr Author It wa possible in 1.7, using the all you want mod, it worked, i can verify that you were able to go on creative servers and add nbt tags. So much so that they even made a plugin to block it: http://www.spigotmc.org/resources/itemfix-replacement-for-nogoditems.707/
January 22, 201510 yr Author Okay so i learned that when i am connected to a multiplayer server, public void onClick(PlayerInteractEvent e) { never is called, If you can sugggest what i should do please
January 23, 201510 yr Author Okay thank you for that, but it still does not seem to work, fully, on a vanilla server: public void event(PlayerInteractEvent e) { System.out.println("test"); ItemStack item = new ItemStack(Items.sign); item.setTagCompound(new NBTTagCompound()); NBTTagCompound tag = item.getTagCompound(); tag.setTag("BlockEntityTag", tag.copy()); NBTTagCompound blockEntityTag = tag.getCompoundTag("BlockEntityTag"); blockEntityTag.setString("id", "Sign"); blockEntityTag.setString("Text1", "Line 1"); blockEntityTag.setString("Text2", "Line 2"); blockEntityTag.setString("Text3", "Line 3"); cl.mc.playerController.sendSlotPacket(item, 0 *woops I changed it to 20*); Issue is, the console in Eclipse, never spits out "test" with the code above ^. However when I just spawn in, a plain old, itemstack it spits out "test". (Plain old Itemstack public void event(PlayerInteractEvent e) { System.out.println("test"); ItemStack item = new ItemStack(Items.sign); cl.mc.playerController.sendSlotPacket(item, 20);
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.