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


  • Posts

  • Joined

  • Last visited

Posts posted by grand_mind1

  1. I'm trying to understand the NBT spec as described here:





    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:


    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:


    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.

  2. 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.

  3. 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.

  4. 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.

  5. I don't think that's true.

    public FluidTank readFromNBT(NBTTagCompound nbt)
            if (!nbt.hasKey("Empty"))
                FluidStack fluid = FluidStack.loadFluidStackFromNBT(nbt);
            return this;
        public NBTTagCompound writeToNBT(NBTTagCompound nbt)
            if (fluid != null)
                nbt.setString("Empty", "");
            return nbt;

  6. 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.

  7. 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 :D


  8. 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.

  9. 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?


  10. 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?


  • Create New...

Important Information

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