Everything posted by Zeher_Monkey
-
Need help with readFrom/Write to NBT
Of course BlockCapacitorBasic TileEntityCapacitorBasic PacketCapacitorBasic If theres anything else you want to see please ask
-
Need help with readFrom/Write to NBT
Added that, doesnt seem to do much. Basically what is happening is that when i change a side, and exit the world, the side reverts to what is used to be. Say i changed it from 0 to 2, i left the world, came back and it was 0 again. With a block update (Place and destroy another block next to my block), it stays as 2. I want to know if theres a way i can make sure it gets updated so it doesnt revert or require a block update. If i leave it enough time writeToNBT gets called anyway, however i want to make sure it doesnt revert. I may not have been clear, sorry
-
Need help with readFrom/Write to NBT
I hate asking so many questions but what would i call in that packet? When a side is changed to update the block using notifyBlockUpdate(), or call it when the player hits ESC, to call the writeToNbt Directly? Short of spawning a block next to is and destroying it i cant think of what to do to get that to happen.
-
Need help with readFrom/Write to NBT
Yeah... Ive just discovered that writeToNBT isnt always called. A block update by placing and destroying a block next to it will force write to nbt, is there a way i can do that when a side is set? Also what ive got now actually works in most instances, so i dont want to change too much in case it breaks again Ive tried these : worldIn.setBlockState(pos, state); worldIn.notifyBlockUpdate(pos, state, state, 3); With no luck
-
Need help with readFrom/Write to NBT
Thanks for that reply. I get the idea about breakpoints, but i'g going to be honest here, ive never used them. Probably will look up a tutorial for those... Anyway i have it working! Ive changed that I just copied them from TileEntity.class. Its working brilliantly now, but theres only one problem. It might be the block.setBlockState() i added to onBlockActivated() in the block code, or something else im not sure, but the second gui, which uses packets to change 'both' values, now doesnt update the int. I might try adding setBlockState to the packet in some way, but so far its working great! Im also calling getUpdatePacket() anywhere the sides are changed, not sure if its nessicary, but its there. Heres my GUI and packet class. GuiCapacitorBasicDirection.java: PacketCapacitorBasic.java: But thanks to your help im 90% of the way. Which i cant thank you enough for EDIT - Ive added this line to the packet code: ctx.getServerHandler().playerEntity.world.setBlockState(pos, ctx.getServerHandler().playerEntity.world.getBlockState(pos)); Which hasnt worked EDIT 2 Its all working!!!!! Chopped some of the code and it works perfectly. Again i cant thank you all enough for your help! One silly coder to another, cheers.
-
Need help with readFrom/Write to NBT
Right so im trying out getUpdatePacket() and onDataPacket() and they arent called when the world loads, only when the block changes? Ive called the get update packet on the write to nbt function, but im not sure if thats how to do it? Also where should i be calling the setBlockState()?
-
Need help with readFrom/Write to NBT
Same issue with TESR, sets the SERVER value but not the client value... It does grab the correct value on write, but is the read... Read seems to be called twice, one returning the correct value, the other returns 0 everytime. --EDIT -- 1 Im stupid, TESR wouldnt have solved much, all rendering is done on client. Duh 2 Write also seems to be called twice.. READ is reading, WRITE is writing (to/from NBT)
-
Need help with readFrom/Write to NBT
The only reason i'm changing it on the client, is because of the way i'm rendering the sides. I'm using basic fence code, which uses getActualState() which only runs on Client. Hence the need to sync the values when reentering the world... That's why i plan to see if TESR can help/solve the issue. Also setBlock()? What for... To change the block with updated values? Or will that help sync? I know that is used for furnaces and the like to replace the block with the "active" version. Beyond that i'm not 100% sure. I realize it updates the block, but that's what i use the mark for render update line, its the model/texture that i'm looking to change, that's the only thing that depends on the side values in the TileEntity.
-
Need help with readFrom/Write to NBT
Im updating my mod from 1.7.10 This is an experiment for me, if it world itll be implemented on every machine (hopefully) Im still trying... Im also going to see if i can use TESR instead, as it wouldnt be too much of a chore, (As i already use it for other things). Maybe that will help... Ill try both methods and see which works as intended. Thanks for all the help guys, really appreciate it
-
Need help with readFrom/Write to NBT
MarkDirty()? Ive tried it and it doesnt seem to do anything. Im having a hard time actually using NBT as it doesnt always save the value in the first place. Im not sure if its how im handling the changing of the values, but everywhere the values change, i set both values (Remote and not). I works fine for _power integer, just not the side values. The only reason i ask is because when it does work, it changes the !remote value and not the remote value, so the side doesnt render correcty. Thanks for the reply, ill try the breakpoints and see where it leads me.
-
Need help with readFrom/Write to NBT
So like this? : And would i keep the original load/write NBT functions?
-
Need help with readFrom/Write to NBT
Ive looked at the vanila code, but cant make any sense of it. Im not sure what to actually do in those functions TileEntity:getUpdatePacket/onDataPacket. I should know this but its new for me --EDIT-- Starting to understand...
-
Need help with readFrom/Write to NBT
Alright, I'll take a look when I can. Cheers for the help
-
Need help with readFrom/Write to NBT
I'll take a look. I'm busy right now. I've got a basic packet set up, but I can't think of how to use packets to load items/ integers. You don't happen to have an example lying around? I've been at this for hours I see the methods you suggested to override in TileEntity
-
Need help with readFrom/Write to NBT
The mark render is for updating the texure/model when the side is changed. Without that the texture doesn't change without a block update
-
Need help with readFrom/Write to NBT
Hi all, i'm currently adding a block that has editable sides. It is very complicated, and ive got it mostly working. Only problem is, is that im using integer values in the TileEntity as values for each side. Clicking on each side with the tool cycles the values, which in turn changes the model texture on that side. Now my problem: When each side is changed, it changes both values for the integer, being the !world.isRemote, and the world.isRemote values, as rendering the block uses the client side, but storing the values is serverside. When reading from NBT it successfully updates the SERVER side value, but not the CLIENT side value. So i need to snyc them somewhere, either in the tile entity, or the block. Im in deep here! The second gui accesses all sides and edits the side textures based on a button press, using packets. FYI TileEntity class: Block class:
IPS spam blocked by CleanTalk.