Jump to content

Stjubit

Members
  • Posts

    63
  • Joined

  • Last visited

Everything posted by Stjubit

  1. Yeah, I know. So should I use "sendToAllAroung()"? Is the "ctx.getServerHandler().playerEntity()" then one of the players the packet was sent to? I really don't know how I should do this.
  2. Hello, I have a GUI with 2 Buttons (ON and OFF) which activates/deactivates a redstone signal. My problem is, that when two player's are accessing the same GUI and one player clicks the ON-Button, the other player doesn't see that. How can I make all other players updating their GUIs? I am already sending a packet to the server with the new state. This packet redirects the state to the container which sets it in the TileEntity. I hope you can understand my problem, thanks, Julian
  3. Hey, is there a way to emit a redstone signal with a range of more than 15 blocks? If you return more than 15 in the "isProvidingWeakPower"- and "isProvidingStrongPower"-methods it still provides a 15 block wide redstone power. Thanks, Julian
  4. Yeah, of course I can do it in the container, but can i do it in the GuiContainer also?
  5. Ok ok. Is it right that I can't get the items by doing "tileEntity.getStackInSlot(...)", because the TileEntity is server only?
  6. And where can I get the information which items are placed in the slots? I thought that this information is only available in the Container class.
  7. Okay, I want to change the GUI when a certain Item is added to the upgrade slots.
  8. Another question: If I want to know if something has been placed or removed from an upgrade slot I need to check for it in the "detectAndSendChanges()"-method, or not?
  9. Hello, I have 4 upgrade-slots in a Container and i want to notify all players using this Container to update their GUIs. I know that i need to do this with the "detectAndSendChanges(...)"-method in my Container-class. Now the question: Can/Should I use the method "sendSlotContents()" from the class "ICrafting" by iterating through all "crafters", or should I send a packet to all "crafters" to update their GUIs? Thanks, Julian
  10. You need to post your new code and write, what isn't working so that we can help you!
  11. Just overwrite the method writeToNBT and readFromNBT to save/load your data. For example: @Override public void writeToNBT(NBTTagCompound nbtTagCompound) { super.writeToNBT(nbtTagCompound); nbtTagCompound.setInteger("WorldID", world.getId()) ........ }
  12. From the WirelessControllerGuiContainer, I send a packet to the Server with the Redstone-signal and the frequency. In the onMessage()-method, I iterate through the loadedEntityList, check for the frequency and if everything's correct, i change the redstonesignal in the TileEntity. That's all working for now. In the WirelessReceiverTileEntity the setRedstoneSignal(bool) looks as follow: In the WirelessReceiver-Block-class, I implemented these two methods which get the Redstonesignal from the TileEntity and set it: I hope that i set up these methods correctly, otherwise it's going to be embarrassing EDIT: IT'S WORKING!!!!! I had to call the method "notifyBlocksOfNeighborChange" in the TileEntity and call a few times the updateTick()-method. Thanks for your help coolAlias, you helped a lot. Julian
  13. So, i can just read/write like this? redstonesignal = ByteBufUtils.readVarInt(buf,1); frequency = ByteBufUtils.readVarInt(buf, 4); I tried the "worldObj.markBlockForUpdate(pos)"-operation before, but the redstone signal still only changed when I "changed" a neighbor-block. Can i call this method in my TileEntity (Server) or should i send a Packet to the client to update the Block with the "markBlockForUpdate()"-method?
  14. I don't know if this is the right place to ask for it, but here we go: My Block's isProvidingWeakPower()-method looks in it's TileEntity, if the redstonesignal is true. If it's true, the method will return 20 (to emit redstone). If it's false, the method will return 0 (to not emit redstone). Anyway, this method is only called, when a neighbor changed or something like that. So i ever need to break anything near the block, which should emit redstone. When i did that, the Block updates and the isProvidingWeakPower()-method is called. Now, the block emits the right redstonesignal. Is there any way to update the Block immediatly after I changed the TileEntity's redstonesignal? I looked at a few Minecraft-classes like the Redstone-Torch, but I haven't figured anything out. Julian
  15. Thank you very much. Is there any way to send the redstonesignal and the frequency to the server at the same time? Or should i make two packets (one for turning redstone signal on and one for off) which only sends the frequency? EDIT: I chose the way with two packets and everything works perfect! Thank you soooo much coolAlias, you helped a lot
  16. I made a few Screenshots from what i've been doing here: The method is called when i click on the "On"-Button of the WirelessController (see image above). I'm not printing the frequency out, but i've set a Breakpoint and debugged the Mod.
  17. It's not working. The frequency is always 0 Here's my code for changing the Redstone-signal in my WirelessController:
  18. Okay, thanks. I will try it out. I just thought putting the List into a class and every time when something changes, updating the list, would be much better in performances. I will try it out and i will write back, soon.
  19. I'm 100% sure that i've saved all correctly. Otherwise it wouldn't be there after i restarted everything. Here is my code for the initialization of my TileEntity-List: When i need the List (wirelessReceiverTileEntities), i check if the List is null. If it's null, I call the initWirelessReceiverTileEntities()-method and it will be initialized, but every WirelessReceiverTileEntity's frequency is 0. Here is my WirelessReceiverTileEntity-class: The reason why i don't initialize the TileEntity-List at the startup of the mod is, because the loadedTileEntitiesList is null at the time.
  20. Yes, i have a GUI where i can set the frequency and yes, i'm sending packets to the server and to the client. Everything works perfect, there. So, is it the only way to do it with the loadedTileEntities-List? I can show you my project, if you want to. Do you have Skype or something like that?
  21. Maybe! The problem is, that the frequency in this TileEntities loaded by "world.loadedTileEntityList" is always 0. Maybe it's 0 because the readFromNBT()-method won't be executed at the time. So this method is not a option I think. I really don't know how I could do this.
  22. I'm modding for Minecraft 1.7.10. Well, the controller doesn't control only one frequency. In the controller-gui is a TextField, where you can enter the frequency, and two GuiButtons which control the Redstone-signal (on/off). So this isn't possible in my case. My WirelessReceiverTileEntitiy just saves the frequency it has and it's current redstone signal. If the frequency of the WirelessReceiver matches with the frequency I got from the TextField, the Redstone-signal should change. So i need to iterate through all of my WirelessReceiverTileEntities and check, if the frequency matches. I need to have a List of the TileEntities before i can iterate through them and that's the problem. I hope anybody can understand this, Julian
  23. I have a Block which controls the Redstone output of other blocks. This other blocks are Wireless Receiver. They have a frequency with which you can control the block from the Redstone Controller. Example: The Wireless Receiver has the frequency 123 and you define 123 to output a redstone signal in the Wireless Controller. When you restart Minecraft or the Server, all this Wireless Receivers have to be located to control them in the Wireless Controller. So i got the idea to get all TileEntities when Minecraft/the Server starts, but the problem is, that the frequency is ever 0 in the TileEntity. Has anyone got a clue, how i should accomplish this?
×
×
  • Create New...

Important Information

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