Everything posted by J3ramy
-
[1.18.2] Get world data file path
Ok I will figure it out when my attempt now is not working. Right now I am trying to send a CompoundNBT from the server to client. My class looks like that: As you can see I am writing my compound tag in toBytes. The tag is not null - I can get all the contents of the Server class. But in my constructor the compount tag is null. If I use a string instead it works fine. Can you find my mistake?
-
[1.18.2] Get world data file path
Ok thank you. Would I still be able to get the data in a screen container class?
-
[1.18.2] Get world data file path
Hello together, I want to save custom data in JSON format in the world's data folder. How can I retrieve the path to it? Thanks for your help!
-
[1.16.5] Write/read custom class to/from NBT
Nice thank you. It works now!
-
[1.16.5] Write/read custom class to/from NBT
Thank you. I decided for the constructor way and changed the class to But how am I supposed to save/load this in the tile entity write and read method? EDIT: I created a getData method in Server which returns a CompoundNBT containing the class data. Now, I do this in my tile entity:
-
[1.16.5] Write/read custom class to/from NBT
Thanks. I forgot to add the key ^^ Do you have an example?
-
[1.16.5] Write/read custom class to/from NBT
Hey guys, I am trying to save a custom class in my tile entity`s NBT data. I think I figured out how to save it, but I don't know how to load it. Ingame Server class (Class that should be saved to nbt) My tile entity class Thanks for your help
-
[1.16.5] move block and tileentity
Okay I try to find a solution. Thank you
-
[1.16.5] move block and tileentity
That's not a good thing to do? Do you know the MCP names for those methods?
-
[1.16.5] move block and tileentity
Weird. The only method that I get suggested is TileEntity#readTileEntity() ...
-
[1.16.5] move block and tileentity
Ok thanks but there is no save and load method if I type TileEntity.save() TileEntity.load() //or tileEntity.save() tileEntity.load() Did I misunterstand you?
-
[1.16.5] move block and tileentity
How can I get and save the tile entity nbt in my block class? Do you have any tutorial or minecraft example? Because in onBlockActivated you don't have access to any Compund Tag.
-
[1.16.5] move block and tileentity
You mean save it in the tile entity nbt itself or where do you mean? Because if I destroy the block, the tile entity gets destroyed as well right?
-
[1.16.5] move block and tileentity
Good morning, I am trying to move a block and his attached tile entity by right-clicking it, because I need the same tile entity data but at another position. Right now I am moving the block one to the north. Then I get the tile entity at the new position and assign the value of the old tile entity to the new one. It works, but is there an easier way to solve this without a lot of reassigning? I tried TileEntity#setPos as well but it doesn't work. This is my code:
-
[1.16.5] Send string data to client
Nice thank you. It works perfectly
-
[1.16.5] Send string data to client
Nice thanks. I changed the line to Network.INSTANCE.send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) player), new PacketSendName(tileEntity.getName())); and it calls the handler method. But how do I now pass this to the screen container class?
-
[1.16.5] Send string data to client
The error is "Simple Channel is not compatible with NetworkManager", so it means that the second parameter is the wrong type but I don't which variable I should pass instead of Network.INSTANCE: Network.INSTANCE.send(new PacketSendName(tileEntity.getName()), Network.INSTANCE, NetworkDirection.PLAY_TO_CLIENT);
-
[1.16.5] Send string data to client
Hello, I am trying to send a string name (which is stored in NBT data in my tile entity) to the client screen, but I don't know where/how I should call the send network package and how to get it in the screen class. My Packet class: I can access the name from the tile entity via tileEntity.getName() In my screen class I just call this.container.getTileEntity().getName() to get the name. Saving the name with nbt works fine. I just want to know how I can get the name from the tile entity In my block class I called Network.INSTANCE.send(new PacketSendName(tileEntity.getName()), Network.INSTANCE, NetworkDirection.PLAY_TO_CLIENT); but it is an error because SimpleChannel is not compatible with NetworkManager. I don't know which variable I should pass instead. And I questioned as well: Would it make more sense to pass a position parameter, so it can get to the right player or screen? Thanks for your help EDIT: Maybe you can name an example where Mojangs is using it in that way ^^
-
[1.16.5] tile entity tick performance
Thank you!
-
[1.16.5] tile entity tick performance
Nice good to know. Thank you both. In general, will the tick methods only be called when the chunk is loaded or even when it's not loaded?
-
[1.16.5] tile entity tick performance
Hey guys, I don't have a problem, but I want to know if using the tick method in the tile entity affects the game's performance. Of course it depends on what you do in the method but I want to know it in general and if I can use a lot of blocks then. Additionally, I update the block state in a special tick interval. And I dont't know if this is an efficient solution to execute things after some amount of ticks. It looks like that: Thanks for the feedback!
-
[1.16.5] Sync data from tile entity to screen
Okay thanks. I already did that. I just was not sure if there is an easier solution
-
[1.16.5] Sync data from tile entity to screen
I'm sorry. I thought you mean the field in the container class... But it works now. Thank you very much! Btw. Is it possible to get other data like booleans instead of only using ints with this method?
-
[1.16.5] Sync data from tile entity to screen
Okay and is there a solution? I removed the field in the container class and accessed the data directly via the tile entity in the screen class But it is still 1.
-
[1.16.5] Sync data from tile entity to screen
Hello guys, I am trying to sync an integer value from a tile entity with my screen class. It works in general, but not the first time when I open the screen after loading the world. If I open it a second time it works. I am using the screen container class and IIntArray for the data. Maybe you can see what's wrong Tile Entity Container Screen
IPS spam blocked by CleanTalk.