Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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");

  • 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.

  • 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

  • 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

  • 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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.