Java Code Examples for net.minecraft.nbt.NBTTagList.forEach()

The following are Jave code examples for showing how to use forEach() of the net.minecraft.nbt.NBTTagList class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Bewitchment   File: Ritual.java   View Source Code Vote up 5 votes
public static NonNullList<ItemStack> getItemsUsedForInput(NBTTagCompound tag) {
	NonNullList<ItemStack> list = NonNullList.create();
	NBTTagList tagList = tag.getTagList("itemsUsed", NBT.TAG_COMPOUND);
	tagList.forEach(nbt -> {
		NBTTagCompound itemTag = (NBTTagCompound) nbt;
		list.add(new ItemStack(itemTag));
	});
	return list;
}
 
Example 2
Project: Solar   File: WorldMonolithData.java   View Source Code Vote up 5 votes
@Override
public void readFromNBT(NBTTagCompound compound) {
	NBTTagList monoliths = (NBTTagList) compound.getTag(MONOLITH_LIST);
	monoliths.forEach(nbt -> {
		NBTTagCompound tag = (NBTTagCompound) nbt;
		this.monoliths.add(new BlockPos(tag.getInteger("x"), 0, tag.getInteger("z")));
	});
}
 
Example 3
Project: Solar   File: WorldQuantumData.java   View Source Code Vote up 5 votes
@Override
public void readFromNBT(NBTTagCompound compound) {
	NBTTagList list = (NBTTagList) compound.getTag(QuantumHandler.NBT_TAG);
	list.forEach(stackList -> {
		NBTTagList stacks = (NBTTagList) ((NBTTagCompound) stackList).getTag("list");
		UUID key = ((NBTTagCompound) stackList).getUniqueId("key");
		if(key != null) {
			getEntanglement(key).clear();
			stacks.forEach(tag -> getEntanglement(key).add(new ItemStack((NBTTagCompound) tag)));
		}
	});
}