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

Here is a few questions that I dont quite understand:

 

1. How to IO tileEntity data on world IO? (Do I need to call read/write NBT at any position?)

2. TileEntities act strange when reloaded. It always execute client-side. Is this related to Question 1?

Read and write nbt is only for saving data, like when the game is shutting down. It gets called by Minecraft ,no need to do it manually.

What exactly do you mean with acting strange? TE's execute on Server and client side

1. ALWAYS post your code.

2. ALWAYS define exact problem and situation, not "are acting weird".

3. ITS GOOD TO write what you are after (exactly, not "if it's possible", but "what i want")

(Trying to help in future :D)

 

As to problem - world calls NBT-saving automatically. Anything that has to be saved in TE, will be savedloaded if you put it in write/read NBT methods.

As to why it's not saving? - When you want TileEntity to save, you need to mark it as "dirty" to inform world that chunk TE is in needs to be saved to disk.

 

this.markDirty() in TE.class

1.7.10 is no longer supported by forge, you are on your own.

  • Author

OK, I'll go clear this time:

 

I want a TIleEntity that follows a block, and generates a counter per tick (or more).

That TileEntity generates counters per ticks. Which is fine.

When I load my world to see if it has any problems, it gave me this:

java.lang.InstantiationException: com.wwy.mod.te.techno.TETechnoReplenisher

 

Block class:

http://pastebin.com/3rH3qXnh

 

TE Class:

http://pastebin.com/uipjaJ7U

 

Interestingly, even the "heal and boost" ability does not activate, it still generates counters...

 

EDIT: So, my objective is, when the counter (datum variable) reaches 1000, find a random player with lowest health, and then heal him ,and boost him.

  • Author

OK, that Block instance is solved.

 

BUT, problem is, updateEntity() does not go server-side after the world is reloaded...

WorldObj#isRemote always return true after the world is reloaded.

  • Author

a) But I need to acquire info from that specific tile entity. Do I use World#getTileEntity(Stuff) instead?

b) No problem. I registered it.

  • Author

Can anyone tell me what went wrong in the bottom of the TE class, when I am doing Nbt IO?

I dont seem to b able to save any variable despite any changes!

  • Author

Like, everything is reset when I rejoin world.

"Datum" points get back to 0 instead of the value of the last load.

 

EDIT: Now I got some debug outputs.

It seems that NBT are read correctly, but somehow it is not properly processed in / into the TileENtity.

Try printing the datum field every time you changes the field.

Then please post the console log with the value of datum field printed.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Weird, man, server said I have more datum points, but client responded with less.

http://pastebin.com/29nVSykc

 

Do I need any kind of syncing?

Ah that was the problem! As minecraft does not automatically sync your field, you should sync it yourself.

@see TileEntity#onDataPacket(Receive) and TileEntity#getDescriptionPacket(Send)

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

  • Author

NBTTagCompound tag = new NBTTagCompound();

tag.setInteger("datum", this.datum);

tag.setInteger("currentCooldown", this.currentCountdown);

tag.setInteger("maxCountdown", this.maxCountdown);

 

Alright. I have the code. And then? How to return a Packet in getDescriptionPacket?

  • Author

It seems that that 'data' parameter can be anything?

 

So, in onDataPacket i will be catching back that nbt again...

What about that "NetworkManager net"? Anything related to IMessage?

 

Do I need to check if getDescriptionPacket() is executed in server?

  • Author

So,I guess the following meaningless function brings back that nbt and ends this topic right?

ThatPacket#func_148857_g();

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.