Jump to content

[1.7.10][SOLVED Finally]Tile Entity Questions


BuddingDev

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

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