Jump to content

Any NBTBoolean available? (Instead of creating NBTTagCompounds for this purpose)


Recommended Posts

Posted

Helllo,

 

I have a Method which requires converting a Map<INBTSerializable,Boolean> into NBTTagLists, but it looks like NBTTagByte (and similiar primitves) are package-private classes and there fore cannot be used.

More specifically here is some simplified code of what I'm doing:

	private NBTTagList[] getConditionValueResources() {
            NBTTagList[] locations  = {new NBTTagList(), new NBTTagList() };
            for (Map.Entry<ISpellCondition,Boolean> condition :
                    conditions.entrySet()) {
                locations[0].appendTag(condition.getKey().serializeNBT());
                NBTTagCompound compound = new NBTTagCompound();
                compound.setBoolean(KEY_BOOLEAN_VALUE,condition.getValue());
                locations[1].appendTag(compound);
            }
            return locations;
        }

 

and what I'm looking for would be sth like:

	private NBTTagList[] getConditionValueResources() {
            NBTTagList[] locations  = {new NBTTagList(), new NBTTagList() };
            for (Map.Entry<ISpellCondition,Boolean> condition :
                    conditions.entrySet()) {
                locations[0].appendTag(new NBTTagBoolean(condition.getValue());
                locations[1].appendTag(compound);
            }
            return locations;
        }

This piece of code would allow for far less Overhead (an NBTTagCompound is contains an entire Map, although i only need on byte!) and I would omit this stupid converting NBTTagCompound and back...

(Note: I know, that there is no NBTTagBoolean Class, but that NBTTagByte is used instead. This would make it far easier too... But it is not public... :()

 

Posted (edited)

Sry...

I'm such an idiot at Times...

:(

I used auto completion, and tried to access the private Constructor which naturally wouldn't work (and I didn't try to add a value to it, but rather tried to find an alternative to that...)

 

Sry sry sry sry sry.

(I have been looking for that for about the last 1.5h  xD) (I think programming scince 2 O'clock (am) doesn't do anything good to your mind...)

 

Edit:

Is it possible to close Stupid Topics like this? 

Edited by Major Tuvok
incomplete

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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