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.

gokiburi

Members
  • Joined

  • Last visited

Everything posted by gokiburi

  1. Thanks for the information. I'll see what I can do about it not firing on servers, knowing this.
  2. Edit + Explanation: Turns out you have to create and manage a packet with data to send to the client yourself. As I was creating a chest that had individual stack sizes saved and loaded for use elsewhere, I wrote an NBTTagCompound that sent the information of the array: Forge 4.2.5 @Override public Packet getDescriptionPacket() { NBTTagCompound tag = new NBTTagCompound(); for ( int i = 0; i < inv.length; i++ ){ tag.setInteger("StackSize"+i, stackSize[i]); } return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 1, tag); } Forge 4.1.1: @Override public Packet getAuxillaryInfoPacket() { NBTTagCompound tag = new NBTTagCompound(); for ( int i = 0; i < inv.length; i++ ){ tag.setInteger("StackSize"+i, stackSize[i]); } return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 1, tag); } I also had to read that data and load it into the array: @Override public void onDataPacket(NetworkManager net, Packet132TileEntityData pkt) { NBTTagCompound tag = pkt.customParam1; for ( int i = 0; i < inv.length; i++ ){ stackSize[i] = tag.getInteger("StackSize"+i); } } Using these functions, I was able to get the CLIENT chest reading the right value. I chose to send an Integer because this chest handles large values of items, not single stacks. -- Original Post -- I've made a custom chest that stores a stackSize in a separate NBT tag from the normal itemStack tags. I save and load the integer value successfully, but the CLIENT does not recognize this. The readFromNBT event is thrown once, while during init the tileEntity is created multiple times, at least once for CLIENT and once for SERVER. Apparently, CLIENT chests do not perform a readFromNBT function, and thus I can not load the value on the CLIENT chest. Right now, I can take the item out, but the CLIENT returns a stack size of 0 while the SERVER returns a proper stack size. Is it possible to make a CLIENT tileEntity call readFromNBT? If not, is there a recommended way to let my CLIENT tileEntity know what stackSize it should be using? Below is the output from which I inferred my current situation (all I did was load the world, open the gui and click slot 1): InfiniChest Init (Server Side?) InfiniChest: Read from NBT (Size 32) [slot 1] InfiniChest Init (Client Side?) Taking out a 0 stack. (Client?) New Stored Amount: 0. Taking out a 32 stack. (Server?) New Stored Amount: 0.
  3. The main conditional in the EntityItems onCollideWithPlayer is if (!this.worldObj.isRemote){...} The event never fires when connected to a server and I can't find the alternative place for when a player collides with an EntityItem.

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.