Java Code Examples for net.minecraft.nbt.NBTTagCompound#copy()

The following examples show how to use net.minecraft.nbt.NBTTagCompound#copy() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FuzzyStack.java    From AgriCraft with MIT License 5 votes vote down vote up
@Nonnull
private NBTTagCompound stripTags(@Nullable NBTTagCompound tag) {
    if ((tag == null) || this.ignoreTags.contains("*")) {
        return new NBTTagCompound();
    } else {
        final NBTTagCompound stripped = tag.copy();
        this.ignoreTags.forEach(stripped::removeTag);
        return stripped;
    }
}
 
Example 2
Source File: Shield.java    From minecraft-roguelike with GNU General Public License v3.0 5 votes vote down vote up
public static void applyBanner(ItemStack banner, ItemStack shield){
	
       NBTTagCompound bannerNBT = banner.getSubCompound("BlockEntityTag");
       NBTTagCompound shieldNBT = bannerNBT == null ? new NBTTagCompound() : bannerNBT.copy();
       shieldNBT.setInteger("Base", banner.getMetadata() & 15);
       shield.setTagInfo("BlockEntityTag", shieldNBT);

}
 
Example 3
Source File: SyncableNBT.java    From OpenModsLib with MIT License 4 votes vote down vote up
public SyncableNBT(NBTTagCompound nbt) {
	tag = nbt.copy();
}
 
Example 4
Source File: SyncableNBT.java    From OpenModsLib with MIT License 4 votes vote down vote up
public void setValue(NBTTagCompound tag) {
	this.tag = tag.copy();
}