Jump to content

grand_mind1

Members
  • Posts

    122
  • Joined

  • Last visited

Everything posted by grand_mind1

  1. Seems I should start reading things in general. Completely blind me missed that. Thanks for the advice!
  2. I'm trying to understand the NBT spec as described here: http://wiki.vg/NBT http://web.archive.org/web/20110723210920/http://www.minecraft.net/docs/NBT.txt http://minecraft.gamepedia.com/NBT_format However, I'm having some problems with it. I've decided to use the "Hello World" example in the first link. According to NBTExplorer, it looks like this: http://i.imgur.com/tGBXrbd.png I'm printing out the bytes to get a better idea of how it's actually stored. It contained the following bytes: 10 0 11 104 101 108 108 111 32 119 111 114 108 100 8 0 4 110 97 109 101 0 9 66 97 110 97 110 114 97 109 97 0 So far, I have "decoded" this to: http://i.imgur.com/z4TsbLe.png As you can see, I have some question marks by some bytes. I'm unsure of what these bytes represent. I think they're related to the data types but I'm not sure. For example, at the beginning, I assume the first byte "10" is Tag_Compound, but it is then followed by "0" and "11" neither of which I understand in context of the spec. The same thing for 8,0,4 and 0,9. I would be greatly appreciative if someone would explain how to interpret these values.
  3. I'm updating my mod from 1.7.10 to 1.8.9 and noticed that there is no longer a ForgeDirection enum. What should I use instead?
  4. You really don't understand. I am using one NBTTagCompound. Let's say I write some tank data to it while the tank has some water in it. This works fine and can be read later. Now, I remove the water and save. Because the fluid was null, the "empty" tag was added to the compound. If I add water again and write, it will still be read as empty because the tag was not removed on write.
  5. It will never be read because the "Empty" tag is present. It doesn't matter what other data is there, if the "Empty" tag is present, the fluid is set to null. The "Empty" tag is created in writeToNBT() of FluidTank if there is no fluid. Meaning that if I ever save the tank while it is empty, it will never be read from properly again. This is because the "Empty" tag is not removed if I write with fluid present.
  6. I think you're misunderstanding. That code is entirely relevant, it's the two methods this post is about in the first place. You're claiming that they function in a way they do not. Yes, the fluidstack the tank creates will be null, because the "empty" tag is present. You are correct in saying that the data saved to the compound in writeToNBT() will not be null, however that is irrelevant as it will never be read.
  7. I don't think that's true. public FluidTank readFromNBT(NBTTagCompound nbt) { if (!nbt.hasKey("Empty")) { FluidStack fluid = FluidStack.loadFluidStackFromNBT(nbt); setFluid(fluid); } else { setFluid(null); } return this; } public NBTTagCompound writeToNBT(NBTTagCompound nbt) { if (fluid != null) { fluid.writeToNBT(nbt); } else { nbt.setString("Empty", ""); } return nbt; }
  8. I ran into some trouble when using the NBT read/write methods of FluidTank. The writeToNBT() method creates a string tag with the key "Empty" if the fluid being saved is null. However, this tag is never removed if the same compound is written to with fluid present. This means that the first time the tank saves while empty, it will never be able to be read from properly again, because the readFromNBT() method simply sets the fluid to null if the "Empty" tag is present. I understand that I can solve this problem by creating a new tag every time I write and save all of my other data to it as well, however this problem seems like an oversight.
  9. I want to check if a block at a given position in the world is a full (source) block of fluid or if it is flowing. I thought I could simply check if the block is Blocks.flowing_water or Blocks.flowing_lava, but I must be misunderstanding something because every water block on screen in this screenshot is reported as BlockStaticLiquid rather than BlockDynamicLiquid. As a side question, would it be any different for forge fluid blocks compared to vanilla liquids? Edit: I'm an idiot and didn't include the screenshot http://i.imgur.com/fgDIjVG.png
  10. Is there a way I can get the flowing version of any fluid block? I want to use any placeable forge fluid, so I can't hard code flowing_water.
  11. I'm trying to force a water block to update after being placed so that it flows. I've tried world#scheduleBlockUpdate() however that did not work. How can I force the water to flow?
  12. Look at the way vanilla TNT is handled.
  13. 1.7.10 really isn't that much "easier" to mod for than 1.8 is. It's just different and some people didn't like some of the changes in 1.8 and stayed on 1.7.10. Good on you for actually trying to learn rather than copying a pasting, however it is extremely helpful to be a bit more familiar with java before trying to create a mod. That said, there are plenty of tutorials online that do a great job explaining what you want. A quick google search for forge events or proxies should be enough to get the basics down. You can also get some examples and see how other people are doing things by looking at mods on Github. As for the stair, take a look at BlockStairs.
  14. You can use the onBlockActivated method in Block to do something when the block is right clicked.
  15. The problem with using two different events is I don't think there is any way you can link the two events to make sure that the block they broke is the block they pick up. I'm pretty sure you can get what block is about to be broken in the BlockBreak event.
  16. Why do you need to get what item the player picks up? Wouldn't the block they broke suffice? I can see getting the items to be quite troublesome when dealing with breaking something like a chest that had multiple items in it. I might be misunderstanding you.
  17. From your title, I'm guessing you mean you would like to know how to make a mob for 1.8 rather than a mod. There are plenty of tutorials you can find online with a quick google search.
  18. I've also noticed that I'm unable to get any GUI to show using showGuiScreen(). I'm not sure if this is related, but perhaps it is because the connection is done directly through the GuiConnecting gui shown in the connectToServer() method.
  19. Hi, I'm trying to have the client connect to a server with FMLClientHandler.instance().connectToServer(mc.currentScreen, serverData) where serverData is the data of the most recently-connected server. I'm able to get the server data just fine, however the connectToServer() method seems to be going wrong somewhere. The GuiConnecting gui is never shown, however the correct server data is logged in the gui's connecting method here: logger.info("Connecting to " + ip + ", " + port); After that, nothing happens. I tried to use breakpoints to determine where it fails, however I wasn't able to find anything. No exceptions are thrown. I'm using GuiMultiplayer as reference, however it seems that it just uses the client handler's connectToServer() method like I am. Do I need to handle anything afterwards? Thanks!
  20. Damn, I couldn't find it because my mcp was out of date and it was still obfuscated. Thanks.
  21. To automatically relog into a server. I need the ServerData to connect to a server with the FMLClientHandler.
  22. Hello, as the title says, I'm looking for a way to get the ServerData of the current connected server on the client side. I've looked around a bit but I can't think of anything that would need this that I could look at in the source. Thanks!
  23. Hello, I'm making a clientside mod that I would like have read chat messages, however I am only able to find ServerChatEvent which I assume is only going to work on the server. I feel like I'm just missing it somewhere. If there is not an event I can listen for, is there any other way I can get chat messages client side? Thanks!
  24. It seems that the check for the tag being null is returning false for some reason... Sorry, I have no idea why it would be doing that. Hopefully someone else on the forums can help.
×
×
  • Create New...

Important Information

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