Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Posts

  • Joined

  • Last visited

Everything posted by Atijaf

  1. WorldData extends WorldSavedData When overriding writeToNBT(NBTTagCompound nbt), does the nbt that is passed store the information I once have written to it? Reason being is that I don't want to overwrite data that was previously there and was wondering if I can obtain the data from within #writeToNBT(...).
  2. Perhaps I can use the chunk's hashCode to obtain a unique Identifier? Or... I can make a matches method that compares the x and z coords and return true if... Yeah.. Would you happen to know the max and min x and z position of chunks?
  3. Do chunks have an ID associated with them, or just the x,z coords? I need to store information into a list about a block that exists inside a certain chunk. Hard to explain... I am saving data to the world and would only like to access NBT data if needed. That's where the chunk ID would come to play. I would check to see if NBT has a tag associated with the ID of the chunk so that I may load it's data into memory. If there is no such thing as a chunk ID, what are some alternatives I can do? Thank you!
  4. Thanks! That's exactly what I needed to get started. I would like to read the data as needed. Is there a way to determine what chunks are loaded and when readingFromNBT I can read the data that's useful?
  5. I would like to store data for blocks that have been placed by a player. I could make this based on the BlockPos and then accessing a HashMap... Which ties to the question. I would think that this data would be stored server side, to the world, and then whenever a player enters a new location, check with the server to see if there is any data about player placed blocks and send the player data. Is my logic sound? Also, should I store this information to disk, then load the information that is relative to the part of the world that is "active"? Is that even possible? And for the last bit, what would you recommend I store the information in? I would only store BlockPos locations (Or is there something I should use instead) that were placed by players, so just by data existing means that the block was placed by a player. Thank you!
  6. Would detectAndSendChanges() do the trick? I want it to update on game load, so probably not. And you're definitely correct about it saving serverside. Sorry about that
  7. The setting Prior to saving and quitting, it is working properly. But when I load the game.. When the TE is linked, it displays particles above it. Also, when the inventory is opened, text is displayed saying whether or not it is linked. It says it isn't. While debugging, I notice that #world.isRemote is always false while reading from nbt. But here is the interesting part. When I open one of the TE's, it still doesn't work. But when I open the second TE, (The one that it's suppose to be linked to) everything goes back into motion and particles are displayed on both blocks, as well as a message saying they are linked. Edit: worldObj is now null. Maybe I misread. So now I can't really tell. I'm guessing that is is being run on the server side, because #readFromNBT is being called twice
  8. You are most likely correct... Main tile entity class -- EnergyTE http://pastebin.com/kwCEgV6W Teleporter Tile Entity class -- the one with the issue, but I'm sure it's related to the main TE class http://pastebin.com/S2tMU2qn Teleporter Container -- Not sure if needed, but just in case http://pastebin.com/zcXTMCYW Yikes! I always get so nervous when I share my code. All I know is i'm super happy it's not the code it use to be. The previous code would give everyone a heart attack -- (Wrote code, caused problems, wrote more code to solve problems, caused more problems and so on... haha) Thanks for helping! Edit: Noticed #markDirty() was called every tick. Fixed it
  9. I'm not sure I quite understand. I Notice that it's only saving nbt on the client side. Is that correct? Why is it that when I load back into the game, the server still doesn't update it's data. (Client data is correct, server data isn't)
  10. I have a boolean called isLinked. That determines a number of things, which is whether or not the player can use it and if the block should have particles. It saves everything just fine, but is there something I'm missing, because when I debug, it isn't updated server side when reading. Do I need to send a packet to the server, or is there something that I can implement in my class that'll take care of it?
  11. Reevaluated and redid much of the code. Works By redoing the code, i removed a TON of nonsense, but the best part is that I didn't even have to use packets. I overrid #markDirty() and it synced for both sides. Thanks to all that helped! Instead of one tile entity determining a few variables of the other tile entity, I have them act independently (ALMOST!) I use to use a boolean to determine if they needed updating, but that caused a ton of resources being used (Called markdirty every tick... AND IT ALSO DIDN'T WORK) I now use an int. It'll return 0 if player placed item and 1 if player removed item from inventory. (That takes care of the source tile entity) Now.. It'll return 2 if nothing has changed and then it'll check if it's linked. If so, double check to see if it is truly linked (Do some of the math), and if it isn't truly linked (Target TE isn't correct), set linked to false and a few other variables... I know I didn't have to write that, but I wasn't even sure if I quite understood it:p Mainly just excited after the many hours spent on it, and after redoing it, figuring it out after a few hours was just thrilling. THANKS A TON!
  12. Everything is done server side and only the required information is send to the client. Though, I'm not in the container when i edit the itemstack's nbt. I think I'm going to send a packet to the client side. If that doesn't work, I'm going to reevaluate and redo the code with the now better understanding I have. Thanks again:) I'm sure I'll be back...
  13. Thanks! Gosh I keep running into bugs and this last one stumped me. I have an item that is stored within a TE. The itemstack, it is associated with, contains NBT int and whenever the block is right clicked, that int is reduced by 20. (I say right click just to simplify. I actually do something else, but the point stays the same) The action is only done serverSide and I thought that setting nbt data syncs between server and client, regardless of what side the nbt data was set. The reason I know it isn't syncing on client side is when I open my gui, i step through the process, check the inventory slot for that itemstack, and the int hasn't changed. If i'm on the server side, it has changed. Does itemstack NBT data sync automatically if it's not in the player's inventory? I'll figure out what I'm doing wrong, but just need to understand that. Thanks for all the help!
  14. Currently working on it now. Thanks:) I believe this is exactly what I needed to know. One more thing. Is #setInventorySlotContents called when the game loads the world? .. Two more things. If I use #markDirty() on server side, must I do that on client as well?
  15. I have a two Tile Entities that links with one another when the correct coordinate item is placed inside. The item holds the block pos location. TileEntity1 - the item inside points to TileEntity2 TileEntity2 - the item inside points to TileEntity1 They have to point to each other for them to be linked. So the question... I need to update TileEntity2 when I remove TileEntity1's item so that they aren't linked anymore, but I can't access TileEntity2's location when TileEntity1's item doesn't exist. (the item that points to TileEntity2) Can I instead use Container#slotClick to obtain the item the player removed and update TileEntity2? Or should I avoid using the container to do this? Hope this makes sense...
  16. Lets get the setting. I am in a class that extends TileEntity and implements both IInventory and ITickable. CordeCache is a class that extends Item. I use it to store ItemStack nbt data, BlockPos position. http://pastebin.com/KvbucNNy I have debugged, and stepped through each method. On client side, the te is found. On Server side, the te is not found and equals null. It uses the same blockpos postions. Is there a reason the the server side cannot find it? Thank you for the great amount of help from this forum. I would have never gotten this far without it.
  17. Umm... great, let's take "unknown" x/y/z and ask for TE. I belive not defined BlockPos has x/y/z = 0/0/0 so yeah... Obviously my second question was not heard. Will create new topic so it's easy to follow. Also, you don't know at all whether or not i have a tile entity at 0, 0, 0. That was not the point I was trying to make. I said the location definitely has a te, so lets go with that? It was obviously a typo, I did not copy and paste, but if you'd like, I will. I was merely trying to make it more simple and direct to the question at hand. Thanks for the help. I really should have just created another topic...
  18. Would there be a reason #worldObj.getTileEntity(pos) would return null, even though there is for a fact, a te at pos. I have null checks and all, but removed them to show my example // Extends TileEntity implements IInventory, ITickable @Override public void update() { ItemStack stack = getStackInSlot(1); CordeCacheItem item = (CordeCacheItem)stack.getItem(); item.getPos(cacheStack); BlockPos pos = new BlockPos(); this.worldObj.getTileEntity(pos); //There is, for a fact, a te here, but returns null only on server side. }
  19. For this instance, it was an item in my gui that needed syncing when the game reloaded. Syncing to the server solved this one, but you're definitely right about running mostly everything on the server. Thanks!
  20. When using player.worldObj.getTileEntity(pos), it returns null. is that because not all te's are loaded upon start? I need to sync a boolean value on both Te's. The first te has a blockpos to the second te and vice versa. They are linked. On the client side, I check if the first blockpos contains a tile entity (it does) It then checks if if the second tile entity is pointing back at the first tile entity (it does) So isLinked = true; It then attempts to find a tile entity on the server side, but it finds nothing. I'm in the process of writing a packet to the server, but am unsure if this'll work if the server can't find a tile entity.
  21. DERP! Forgot to override #updateProgressBar. Thanks everyone!
  22. @Override public void detectAndSendChanges() { // TODO Auto-generated method stub super.detectAndSendChanges(); //I Understand I need to loop through all of these for each player, just not yet ICrafting icrafting = (ICrafting)this.crafters.get(0); if(this.tileentitycharge != this.te.getField(0)){ /** this, id, the TileEntity variable */ icrafting.sendProgressBarUpdate(this, 0, this.te.getField(0)); } this.tileentitycharge = this.te.getField(0); } @Override public int getField(int id) { switch(id){ case(0): return this.TileEntityCharge; } return 0; } @Override public void setField(int id, int value) { switch(id){ case(0): this.TileEntityCharge = value; break; } } @Override public int getFieldCount() { return 1; } did this, but it's still not updating the gui screen variables after restarting the game. Have I missed something?
  23. Would it be the method "detectAndSendChanges()"? I'll try it when I get back home. Thanks
  24. Unfortunately, I've already done that. I probably should have included that code. I've edited my previous post and have added it.
  25. After a long while, I have gotten my tile entity to work just the way I want it to... I just want to add a couple lines of text that display information about what the Tile Entity contains, such as it's current amount of "Energy" and "Energy Rate" Pictures and explanations I Believe the problem begins with the creation of a new TileEntity When I start up the game, I notice that the method "createNewTileEntity" is called BlockKineticRelocator: -- (When activated, passes TileEntity it obtains from a location. Somehow, it isn't correct?) http://pastebin.com/JzpxCrZu GuiKineticRelocator -- (Information here is correct until restart) http://pastebin.com/XA6AgdrY KineticRelocatorTileEntity http://pastebin.com/DTdX0yKy As in the last gif, it's obvious a Tile Entity has the data I'm looking for, but I'm unsure how to find it. Everytime I use the method, "World.getTileEntity(pos)" , it returns a tileEntity but it doesn't have the correct information. (The data I'm looking for are all 0) While T300kCapsule is being charged, if I debug and set breakpoints in the tile entity that takes care of that, it shows the data correctly. I know this is a lot to take in, but hopefully it's just something silly that's happening... Thanks a bunch for anyone that helps
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.