Is there an ID or Type where I can detect door objects in the databases?
Method of detecting door objects?
- angriff
- Thread is Unresolved
A new update is now available, introducing a lot of new content!
-
-
Is there an ID or Type where I can detect door objects in the databases?
Where do you want to detect them specifically? In the definitions.db database? Or the world database files?
In the definitions database, there is a "type" column in the objects table which is Door for every door object.
In the world databases (i.e the files stored in your world folder), however, you cannot access this data easily. The game serializes and compresses all objects in a chunk, so they're stored as a non-human-readable blob (binary data).
Usually it's better to use the Plugin API for this.
-
Can you identify a door exactly or is it just by raycast layers? Either will work for what I am experimenting with.
-
Can you identify a door exactly or is it just by raycast layers? Either will work for what I am experimenting with.
You mean through the Plugin API? If you have an ObjectElement instance, you can get the definition from it via getDefinition() and check if the type is Type.Door. If you're working with events (e.g. if the player interacts with the object), the object events already have a getObject() method to get the according ObjectElement instance directly.
But of course you can also get the object from a raycast. The code to get an object via raycast and check if it's a door could look like this:
Java
Participate now!
Don’t have an account yet? Create a new account now and be part of our community!