Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Merging Tag Compounds?
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 0
Blaez

Merging Tag Compounds?

By Blaez, May 6, 2018 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

Blaez    0

Blaez

Blaez    0

  • Tree Puncher
  • Blaez
  • Members
  • 0
  • 23 posts
Posted May 6, 2018
        if (!world.isRemote && this.data != null) {
            NBTTagCompound atag = is.getTagCompound();
            if (atag == null) atag = new NBTTagCompound();
            if (!atag.hasKey(KEY)) {
                atag.setBoolean(KEY, true);
                is.setTagCompound(atag);
                try {
                    is.setTagCompound(JsonToNBT.getTagFromJson(this.data));
                    is.getTagCompound().setBoolean(KEY, true);
                } catch (NBTException nbtexception) {
                    LogManager.getLogger(RWBYModels.MODID).error("Couldn't load data tag for " + this.getRegistryName());
                }
            }

        }

atag is the first part of this which is the current data of the item. the portion inside of try is replacing the tag compound from before while this might be all well and good.it doesn't pass along Enchantments which is why I'm curious if there's a way to merge the two data sets rather then completely override the data though I suspect that's not possible just from looking around. though there is this 

is.getEnchantmentTagList()

which would appear to get a retrievable list of the enchantments in the tagcompound though I'm not sure if there is a way to use that data to reapply the enchantments after the data is wiped. **please keep in mind I am not really familiar with nbt stuff so this all could be entirely wrong and I'm missing a simpler way to do this. but live and learn the reason I'm wiping the data in the first place is because the items have attribute modifiers and I don't want those passed to the new item when they transform however I'd like to keep enchantments if possible.

  • Quote

Share this post


Link to post
Share on other sites

Blaez    0

Blaez

Blaez    0

  • Tree Puncher
  • Blaez
  • Members
  • 0
  • 23 posts
Posted May 6, 2018

XX figured it out is.gettagcompound().merge(atag) incase someone finds that they need this info cause I didn't notice it for quite awhile :x

  • Quote

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

  • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 0
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Oliviafrostpaw
      [1.14.4] Injecting into Existing Loot Tables, Blocks

      By Oliviafrostpaw · Posted 12 minutes ago

      Ah, thank you very very much. Having attempted to look and find the correct bus/subscriber and or examples for its usage I found no instance of @Mod.EventBusSubscriber on the classes, is this necessary or am I just looking in the wrong places? Any Guidance would be appreciated 
    • bluey418
      Error with running modpack on twitch

      By bluey418 · Posted 24 minutes ago

      I have opened up minecraft for the first time in a while, and I wanted to run a modpack off of the twitch launcher. Every time I try to run MC, and I've tried this for a few modpacks, I get the following error in my game output tab:   OpenJDK 64-Bit Server VM warning: Ignoring option PermSize; support was removed in 8.0 Error: Could not find or load main class = Caused by: java.lang.ClassNotFoundException: =   Any idea what is causing this? I am running on a Mac, FYI.   Thanks!
    • Draco18s
      [1.14.4] Injecting into Existing Loot Tables, Blocks

      By Draco18s · Posted 50 minutes ago

      @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)   That is not the correct bus for that event.
    • Draco18s
      [1.14.4] Dimensions

      By Draco18s · Posted 52 minutes ago

      When you create a dimension, you have to pass a DimensionType to DimensionManager.registerDimension()   Why not...hold onto it?   If you have access to the world, you can also query that world for its dimension information, which includes the DimensionType.
    • Draco18s
      CORAL TOMBSTONE MOD NOT WORKS

      By Draco18s · Posted 55 minutes ago

      Talk to the mod author. Those of us here have no idea what that mod is, where the problem could be, or how to fix it. This is the Forge forums. We deal with Forge.
  • Topics

    • Oliviafrostpaw
      10
      [1.14.4] Injecting into Existing Loot Tables, Blocks

      By Oliviafrostpaw
      Started December 8

    • bluey418
      0
      Error with running modpack on twitch

      By bluey418
      Started 24 minutes ago

    • RaphGamingz
      2
      [1.14.4] Dimensions

      By RaphGamingz
      Started Yesterday at 07:45 AM

    • martingabrixx
      1
      CORAL TOMBSTONE MOD NOT WORKS

      By martingabrixx
      Started 5 hours ago

    • Edivad99
      1
      Minecraft Forge for 1.15

      By Edivad99
      Started 1 hour ago

  • Who's Online (See full list)

    • Oliviafrostpaw
    • AnonymousVoidF
    • bluey418
    • Edivad99
    • geekles
    • J0WAY
    • Skyriis
    • PrinceRaiden
    • Kerman
    • LexManos
    • ErdbeerbaerLP
    • Draco18s
    • hohserg
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Merging Tag Compounds?
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community