Jump to content

[1.8.9] [SOLVED] Ticking Entity Crash Help/How To Use DataWatcher


Recommended Posts

Posted

I keep getting this crash when I am trying to load a world that has already been created where I have spawned my broken entity.

 

I say broken because it isn't rendering correctly, it just spawns a white box that runs around. I have no idea where to go from here about fixing that and making it render the model I have created. I'm not sure what is wrong though.

 

What should I be doing differently?

 

 

  Reveal hidden contents

 

Posted

Okay. Thanks for giving me a place to start.

 

How did you know it was the dataWatcher? I am still learning how to read the console errors.

 

I've been using some stuff from the vanilla code without really understanding all of it, so no wonder I'm having problems.

 

I've been reading up on the datawatcher stuff and it's starting to make sense, but can someone explain it a bit more for me?

 

So the data watcher can have 32 objects of type [byte, Short, Integer, Float, String, ItemStack and ChunkCoordinates]

So I'm assuming the string is for the name, ItemStack is for what the entity has, and the chunkCoordinates is for where it is located, right?

What are the other types for? I have looked at this chart but I'm not quite sure how to read it.

http://www.minecraftforge.net/wiki/Datawatcher

 

 

And when you do have a specific number like 18 or something what does that mean? I know the wolf uses it, but I'm confused about what it means.

 

Or does it not work like that?

 

 

If you still need me to paste my code after this I will.

Posted

The IDs are arbitrary and must be unique; if you use an already taken ID the conflict will result in a crash, so you must check all super classes to see what DataWatcher IDs they use.

 

It is not recommended to use DataWatcher in things like IExtendedEntityProperties as it is impossible to know what DataWatcher IDs other mod entities use and/or add, but it's fine to use it in your own custom entity classes.

 

As for the Objects that the DataWatcher contains, they can mean anything you want them to mean. An ItemStack, for example, may be the object held by the entity, or it may not be; it all depends on how that particular DW index is used in the code. It could be that it is a piece of armor, or a cape, or any number of other things.

 

The only reason to use DataWatcher, btw, is when you have a value on the server (e.g. the held item) that you need to keep up-to-date on the client, usually because you want to use that value when rendering. If you don't need the value client side, don't use DataWatcher.

 

Also, DataWatcher is just a convenience wrapper around a system that sends packets in the background, so you can easily provide the same functionality by sending a packet yourself and not using DataWatcher at all.

Posted

The client handles anything that the player needs to see or interact with, but doesn't keep track of the actual game state - it merely tries to represent the game state.

 

Anything that needs to be remembered or has a real effect in the game, such as health, needs to be handled on the server. The client only needs to know about it if you are going to display it.

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.

Announcements



×
×
  • Create New...

Important Information

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