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.

[solved] [1.7.10] review how I'm storing data please, tile entity!

Featured Replies

Posted

So here is the section that is giving me problems:

 

http://pastebin.com/LGj2xqBV

 

Basically, it prints the correct integer for entry in the update entity, but when I go to write it, it prints incorrect. I commented  //this.sendInventory();  and  //this.entry = -1;    but it still doesn't work. The value printed in updateEntity still prints correct, but when I go to write it, it prints wrong before write.

 

I did the same thing that I did to store values in 2 other tile entities, and I can't seem to find anything different going on here. Am I overlooking something, or is this just being obnoxiously picky and not working for some reason?

Everything in "public void updateEntity()" should be in "if (!worldObj.isRemote)" .    Might be wrong on your "this.updateBlock();" since its code isn't shown. 

 

The redundant "this.markDirty();" is excessive.

 

how do you think this will work?  you are never saving your items NBT to the main nbt.

 

 

 

                NBTTagList items = new NBTTagList();

 

                for (int i = 0; i < getSizeInventory(); i++)

                {

                        ItemStack stack = this.getStackInSlot(i);

 

                        if (stack != null)

                        {

                                NBTTagCompound item = new NBTTagCompound();

                                item.setByte("Slot", (byte) i);

                                stack.writeToNBT(item);

                                items.appendTag(item);

                        }

                }

[\spoiler]

 

What is "entry".  Its not defined anywhere so hard to tell what it is or what you meant to do.  If at this point, it doens't print the right value, then 'entry' is the wrong variables in your code.

 

 

System.out.println(entry);

                compound.setInteger("intEntry", this.entry);

[\spoiler]

 

 

 

Long time Bukkit & Forge Programmer

Happy to try and help

  • Author

Oh wow, I feel like an idiot now. Yes, the problem was both the not running the code in (!worldObj.isRemote) like my other two tile entities, and I completely forgot the compound.setTag("Items", items);

 

As for the this.entry, I have it being declared as -1 to start, and then whenever an itemstack enters the block, it changes it to the side it entered from. Basically, I'm making a transport block similar to pipes and it needs to lock behind it when it goes through so it doesn't head backwards. It all is working now thank you so much for proofreading that!

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.