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

The following examples show how to use net.minecraft.nbt.NBTTagCompound#setBoolean() . 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: SemiBlockLogistics.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void writeToNBT(NBTTagCompound tag){
    super.writeToNBT(tag);
    TileEntityBase.writeInventoryToNBT(tag, filters, "filters");

    NBTTagList tagList = new NBTTagList();
    for(int i = 0; i < fluidFilters.length; i++) {
        FluidTank filter = fluidFilters[i];
        if(filter.getFluid() != null) {
            NBTTagCompound t = new NBTTagCompound();
            t.setInteger("index", i);
            filter.writeToNBT(t);
            tagList.appendTag(t);
        }
    }
    tag.setTag("fluidFilters", tagList);

    tag.setBoolean("invisible", invisible);
}
 
Example 2
Source File: EntityExplodingChicken.java    From CommunityMod with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * (abstract) Protected helper method to write subclass entity data to NBT.
 */
public void writeEntityToNBT(NBTTagCompound compound)
{
    super.writeEntityToNBT(compound);

    if (((Boolean)this.dataManager.get(POWERED)).booleanValue())
    {
        compound.setBoolean("powered", true);
    }

    compound.setShort("Fuse", (short)this.fuseTime);
    compound.setByte("ExplosionRadius", (byte)this.explosionRadius);
    compound.setBoolean("ignited", this.hasIgnited());
    compound.setBoolean("IsChickenJockey", this.chickenJockey);
    compound.setInteger("EggLayTime", this.timeUntilNextEgg);
}
 
Example 3
Source File: MetaTileEntityPrimitiveBlastFurnace.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public NBTTagCompound writeToNBT(NBTTagCompound data) {
    super.writeToNBT(data);
    data.setBoolean("Active", isActive);
    data.setBoolean("WasActive", wasActiveAndNeedUpdate);
    data.setFloat("FuelUnitsLeft", fuelUnitsLeft);
    data.setInteger("MaxProgress", maxProgressDuration);
    if (maxProgressDuration > 0) {
        data.setInteger("Progress", currentProgress);
        NBTTagList itemOutputs = new NBTTagList();
        for (ItemStack itemStack : outputsList) {
            itemOutputs.appendTag(itemStack.writeToNBT(new NBTTagCompound()));
        }
        data.setTag("Outputs", itemOutputs);
    }
    return data;
}
 
Example 4
Source File: TileEntityAssemblyPlatform.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void writeToNBT(NBTTagCompound tag){
    super.writeToNBT(tag);
    tag.setBoolean("clawClosing", shouldClawClose);
    tag.setFloat("clawProgress", clawProgress);
    tag.setFloat("speed", speed);
    tag.setBoolean("drilled", hasDrilledStack);
    tag.setBoolean("lasered", hasLaseredStack);
    // Write the ItemStacks in the inventory to NBT
    NBTTagList tagList = new NBTTagList();
    for(int currentIndex = 0; currentIndex < inventory.length; ++currentIndex) {
        if(inventory[currentIndex] != null) {
            NBTTagCompound tagCompound = new NBTTagCompound();
            tagCompound.setByte("Slot", (byte)currentIndex);
            inventory[currentIndex].writeToNBT(tagCompound);
            tagList.appendTag(tagCompound);
        }
    }
    tag.setTag("Items", tagList);
}
 
Example 5
Source File: PlantStats.java    From AgriCraft with MIT License 5 votes vote down vote up
@Override
public boolean writeToNBT(NBTTagCompound tag) {
    tag.setByte(NBT_GROWTH, growth);
    tag.setByte(NBT_GAIN, gain);
    tag.setByte(NBT_STRENGTH, strength);
    tag.setBoolean(NBT_ANALYZED, analyzed);
    return true;
}
 
Example 6
Source File: MetaTileEntityLargeBoiler.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public NBTTagCompound writeToNBT(NBTTagCompound data) {
    super.writeToNBT(data);
    data.setInteger("CurrentTemperature", currentTemperature);
    data.setInteger("FuelBurnTicksLeft", fuelBurnTicksLeft);
    data.setBoolean("HasNoWater", hasNoWater);
    data.setInteger("ThrottlePercentage", throttlePercentage);
    return data;
}
 
Example 7
Source File: TileOxygenVent.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
public void readDataFromNetwork(ByteBuf in, byte packetId,
		NBTTagCompound nbt) {
	if(packetId == PACKET_REDSTONE_ID)
		nbt.setByte("state", in.readByte());
	else if(packetId == PACKET_TRACE_ID)
		nbt.setBoolean("trace", in.readBoolean());
}
 
Example 8
Source File: GTItemBaseToggleItem.java    From GT-Classic with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) {
	IC2.audioManager.playOnce(playerIn, toggleSound);
	if (IC2.platform.isSimulating()) {
		NBTTagCompound nbt = StackUtil.getOrCreateNbtData(playerIn.getHeldItem(handIn));
		boolean result = !nbt.getBoolean(ACTIVE);
		nbt.setBoolean(ACTIVE, result);
	}
	return ActionResult.newResult(EnumActionResult.SUCCESS, playerIn.getHeldItem(handIn));
}
 
Example 9
Source File: ProgWidgetItemFilter.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void writeToNBT(NBTTagCompound tag){
    super.writeToNBT(tag);
    if(filter != null) {
        saveItemStackByName(filter, tag);
    }
    tag.setBoolean("useMetadata", useMetadata);
    tag.setBoolean("useNBT", useNBT);
    tag.setBoolean("useOreDict", useOreDict);
    tag.setBoolean("useModSimilarity", useModSimilarity);
    tag.setInteger("specificMeta", specificMeta);
    tag.setString("variable", variable);
}
 
Example 10
Source File: TileAstrobodyDataProcessor.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
	super.writeToNBT(nbt);
	inventory.writeToNBT(nbt);

	nbt.setBoolean("researchingAtmosphere", researchingAtmosphere);
	nbt.setBoolean("researchingDistance", researchingDistance);
	nbt.setBoolean("researchingMass", researchingMass);
	nbt.setInteger("atmosphereProgress", atmosphereProgress);
	nbt.setInteger("distanceProgress", distanceProgress);
	nbt.setInteger("massProgress", massProgress);

	return nbt;
}
 
Example 11
Source File: BioCulture.java    From bartworks with MIT License 5 votes vote down vote up
public static NBTTagCompound getNBTTagFromCulture(BioCulture bioCulture) {
    if (bioCulture == null)
        return new NBTTagCompound();
    NBTTagCompound ret = new NBTTagCompound();
    ret.setString("Name", bioCulture.name);
    //ret.setInteger("ID", bioCulture.ID);
    ret.setIntArray("Color", new int[]{bioCulture.color.getRed(), bioCulture.color.getGreen(), bioCulture.color.getBlue()});
    ret.setTag("Plasmid", BioData.getNBTTagFromBioData(BioData.convertBioPlasmidToBioData(bioCulture.plasmid)));
    ret.setTag("DNA", BioData.getNBTTagFromBioData(BioData.convertBioDNAToBioData(bioCulture.dDNA)));
    ret.setBoolean("Breedable", bioCulture.bBreedable);
    ret.setByte("Rarety", BW_Util.getByteFromRarity(bioCulture.rarity));
    if (bioCulture.bBreedable)
        ret.setString("Fluid", bioCulture.getFluid().getName());
    return ret;
}
 
Example 12
Source File: TileEntityCrop.java    From AgriCraft with MIT License 5 votes vote down vote up
@Override
public void writeTileNBT(@Nonnull NBTTagCompound tag) {
    Preconditions.checkNotNull(tag);
    tag.setBoolean(AgriNBT.CROSS_CROP, crossCrop);
    tag.setInteger(AgriNBT.META, growthStage);
    if (this.hasSeed()) {
        this.getSeed().getStat().writeToNBT(tag);
        tag.setString(AgriNBT.SEED, this.getSeed().getPlant().getId());
    }
}
 
Example 13
Source File: MoCEntityAmbient.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void writeEntityToNBT(NBTTagCompound nbttagcompound)
{
	super.writeEntityToNBT(nbttagcompound);
	nbttagcompound.setBoolean("Tamed", getIsTamed());
	nbttagcompound.setBoolean("Adult", getIsAdult());
	nbttagcompound.setInteger("Edad", getEdad());
	nbttagcompound.setString("Name", getName());
	nbttagcompound.setInteger("TypeInt", getType());
	nbttagcompound.setString("Owner", getOwnerName());
}
 
Example 14
Source File: GTTileMagicEnergyAbsorber.java    From GT-Classic with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
	super.writeToNBT(nbt);
	nbt.setInteger(NBT_ENERGYSTORED, this.storage);
	nbt.setBoolean(NBT_POTIONMODE, this.potionMode);
	nbt.setBoolean(NBT_XPMODE, this.xpMode);
	nbt.setBoolean(NBT_PORTALMODE, this.portalMode);
	return nbt;
}
 
Example 15
Source File: TileAuraPylon.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void writeCustomNBT(NBTTagCompound compound) {
    compound.setBoolean("input", isInputTile);
    compound.setBoolean("master", isMasterTile);
    if (holdingAspect != null) {
        compound.setString("aspect", holdingAspect.getTag());
    }
    compound.setInteger("amount", amount);
    compound.setInteger("maxAmount", maxAmount);
    compound.setBoolean("partOfMultiblock", isPartOfMultiblock);
    if(crystalEssentiaStack != null)
        NBTHelper.setStack(compound, "crystalStack", crystalEssentiaStack);
}
 
Example 16
Source File: TileEntityElevatorCaller.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void writeToNBT(NBTTagCompound tag){
    super.writeToNBT(tag);
    tag.setBoolean("emittingRedstone", emittingRedstone);
    tag.setInteger("thisFloor", thisFloor);
    if(camoStack != null) {
        NBTTagCompound camoTag = new NBTTagCompound();
        camoStack.writeToNBT(camoTag);
        tag.setTag("camoStack", camoTag);
    }
    tag.setBoolean("shouldUpdateNeighbors", shouldUpdateNeighbors);
}
 
Example 17
Source File: CanyonAttribute.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void writeToNBT(NBTTagCompound nbt) 
{
	nbt.setString("uuid", id.toString());
	if(down != null)
		nbt.setInteger("down", down.index);

	if(up != null)
		nbt.setInteger("up", up.index);
	nbt.setBoolean("isNode", isNode);
	nbt.setInteger("nodeNum", nodeNum);
}
 
Example 18
Source File: EntityFallenKnight.java    From EnderZoo with Creative Commons Zero v1.0 Universal 4 votes vote down vote up
@Override
public void writeEntityToNBT(NBTTagCompound root) {
  super.writeEntityToNBT(root);
  root.setBoolean("canBreakDoors", canBreakDoors);
}
 
Example 19
Source File: TileEntityTransportRail.java    From Signals with GNU General Public License v3.0 4 votes vote down vote up
@Override
public NBTTagCompound writeToNBT(NBTTagCompound compound){
    compound.setBoolean("forward", forward);
    return super.writeToNBT(compound);
}
 
Example 20
Source File: TileEntityPneumaticDoor.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void writeToNBT(NBTTagCompound tag){
    super.writeToNBT(tag);
    tag.setBoolean("rightGoing", rightGoing);
}