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

The following examples show how to use net.minecraft.nbt.NBTTagCompound#getBoolean() . 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: TileEntityMultiblockPart.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
@Override
public void readFromNBT(NBTTagCompound compound) {
    super.readFromNBT(compound);
    isAssembled = compound.getBoolean("isAssembled");
    isMaster = compound.getBoolean("isMaster");
    offsetPos = new BlockPos(compound.getInteger("offsetPosX"),
        compound.getInteger("offsetPosY"), compound.getInteger("offsetPosZ"));
    multiblockSchematic = (E) MultiblockRegistry
        .getSchematicByID(compound.getString("multiblockSchematicID"));
}
 
Example 2
Source File: TileSpaceLaser.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
public void useNetworkData(EntityPlayer player, Side side, byte id,
		NBTTagCompound nbt) {
	
	super.useNetworkData(player, side, id, nbt);
	if(id == 10) {
		this.laserX = nbt.getInteger("laserX");
		finished = false;

		if(mode == MODE.SPIRAL)
			resetSpiral();
	}
	else if(id == 11) {
		this.laserZ = nbt.getInteger("laserZ");
		finished = false;
		if(mode == MODE.SPIRAL)
			resetSpiral();
	}
	else if(id == 12)
		this.isRunning = nbt.getBoolean("isRunning");
	else if(id == 13 && !isRunning())
		this.mode = MODE.values()[nbt.getInteger("mode")];
	else if(id == 14)
		this.attempUnjam();

	markDirty();
}
 
Example 3
Source File: TileAstrobodyDataProcessor.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
protected void readNetworkData(NBTTagCompound nbt) {
	super.readNetworkData(nbt);
	researchingAtmosphere = nbt.getBoolean("researchingAtmosphere");
	researchingDistance = nbt.getBoolean("researchingDistance");
	researchingMass = nbt.getBoolean("researchingMass");
}
 
Example 4
Source File: GT_TileEntity_THTR.java    From bartworks with MIT License 5 votes vote down vote up
@Override
public void loadNBTData(NBTTagCompound aNBT) {
    super.loadNBTData(aNBT);
    this.HeliumSupply = aNBT.getInteger("HeliumSupply");
    this.BISOPeletSupply = aNBT.getInteger("BISOPeletSupply");
    this.TRISOPeletSupply = aNBT.getInteger("TRISOPeletSupply");
    this.savedBISO = aNBT.getInteger("savedBISO");
    this.savedTRISO = aNBT.getInteger("savedTRISO");
    this.empty = aNBT.getBoolean("EmptyMode");
}
 
Example 5
Source File: Province.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
public void readNBT(NBTTagCompound c) {
	id = uuid(c.getString("id"));
	chunkX = c.getInteger("chunkX");
	chunkZ = c.getInteger("chunkZ");
	name = c.getString("name");
	lowerVillageBoundX = c.getInteger("lX");
	upperVillageBoundX = c.getInteger("uX");
	lowerVillageBoundZ = c.getInteger("lZ");
	upperVillageBoundZ = c.getInteger("uZ");
	civilization = e(c.getString("civilization"));
	hasLord = c.getBoolean("hasLord");
	computeSize();
}
 
Example 6
Source File: LakeAttribute.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void readFromNBT(NBTTagCompound nbt, com.bioxx.jmapgen.IslandMap m) 
{
	this.id = UUID.fromString(nbt.getString("uuid"));
	this.lakeID = nbt.getInteger("lakeID");
	this.borderDistance = nbt.getInteger("borderDistance");
	this.isMarsh = nbt.getBoolean("isMarsh");
	this.lakeElev = nbt.getDouble("lakeElev");
}
 
Example 7
Source File: EntityTofunian.java    From TofuCraftReload with MIT License 5 votes vote down vote up
public void readEntityFromNBT(NBTTagCompound compound) {
    super.readEntityFromNBT(compound);
    this.getDataManager().set(TOFUPROFESSION, compound.getInteger("tofu_profession"));
    //Load villager's CarrierLevel and make it usable as tofunian CareerLevel
    this.tofunianCareerLevel = compound.getInteger("CareerLevel");

    this.wealth = compound.getInteger("Riches");

    if (compound.hasKey("Offers", 10)) {
        NBTTagCompound nbttagcompound = compound.getCompoundTag("Offers");
        this.buyingList = new MerchantRecipeList(nbttagcompound);
    }

    this.isWillingToMate = compound.getBoolean("Willing");

    NBTTagList nbttaglist = compound.getTagList("Inventory", 10);

    for (int i = 0; i < nbttaglist.tagCount(); ++i) {
        ItemStack itemstack = new ItemStack(nbttaglist.getCompoundTagAt(i));

        if (!itemstack.isEmpty()) {
            this.villagerInventory.addItem(itemstack);
        }
    }

    this.setCanPickUpLoot(true);
    this.updateEntityAI();
}
 
Example 8
Source File: TileWirelessTransciever.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
public void readFromNBT(NBTTagCompound nbt) {
	super.readFromNBT(nbt);

	extractMode = nbt.getBoolean("mode");
	enabled = nbt.getBoolean("enabled");
	networkID = nbt.getInteger("networkID");
	data.readFromNBT(nbt);
	addToNetwork();

	toggle.setToggleState(extractMode);
	toggleSwitch.setToggleState(enabled);
}
 
Example 9
Source File: NBTHelper.java    From SimplyJetpacks with MIT License 5 votes vote down vote up
public static boolean getNBTBoolean(ItemStack stack, String tag, boolean fallback) {
    NBTTagCompound tagCompound = getNBT(stack);
    if (!tagCompound.hasKey(tag)) {
        tagCompound.setBoolean(tag, fallback);
    }
    return tagCompound.getBoolean(tag);
}
 
Example 10
Source File: IslandData.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
public void readFromNBT(NBTTagCompound nbt)
{
	isIslandUnlocked = nbt.getBoolean("isIslandUnlocked");
	northPortalState = PortalEnumType.values()[nbt.getInteger("northPortalState")];
	southPortalState = PortalEnumType.values()[nbt.getInteger("southPortalState")];
	eastPortalState = PortalEnumType.values()[nbt.getInteger("eastPortalState")];
	westPortalState = PortalEnumType.values()[nbt.getInteger("westPortalState")];
	islandLevel = nbt.getInteger("islandLevel");
	wildlifeManager.readFromNBT(nbt.getCompoundTag("wildlifeManager"));
}
 
Example 11
Source File: TileEntityQuantumComputer.java    From qcraft-mod with Apache License 2.0 5 votes vote down vote up
@Override
public void readFromNBT( NBTTagCompound nbttagcompound )
{
    // Read properties
    super.readFromNBT( nbttagcompound );
    m_powered = nbttagcompound.getBoolean( "p" );
    m_timeSinceEnergize = nbttagcompound.getInteger( "tse" );
    m_entanglementFrequency = nbttagcompound.getInteger( "f" );
    if( nbttagcompound.hasKey( "d" ) )
    {
        m_storedData = AreaData.decode( nbttagcompound.getCompoundTag( "d" ) );
    }
    if( nbttagcompound.hasKey( "portalID" ) )
    {
        m_portalID = nbttagcompound.getString( "portalID" );
    }
    m_portalNameConflict = nbttagcompound.getBoolean( "portalNameConflict" );
    if( nbttagcompound.hasKey( "remoteIPAddress" ) )
    {
        m_remoteServerAddress = nbttagcompound.getString( "remoteIPAddress" );
    }
    if( nbttagcompound.hasKey( "remoteIPName" ) )
    {
        m_remoteServerName = nbttagcompound.getString( "remoteIPName" );
    }
    else
    {
        m_remoteServerName = m_remoteServerAddress;
    }
    if( nbttagcompound.hasKey( "remotePortalID" ) )
    {
        m_remotePortalID = nbttagcompound.getString( "remotePortalID" );
    }
}
 
Example 12
Source File: SemiBlockLogistics.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void readFromNBT(NBTTagCompound tag){
    super.readFromNBT(tag);
    TileEntityBase.readInventoryFromNBT(tag, filters, "filters");

    NBTTagList tagList = tag.getTagList("fluidFilters", 10);
    for(int i = 0; i < tagList.tagCount(); i++) {
        fluidFilters[tagList.getCompoundTagAt(i).getInteger("index")].readFromNBT(tagList.getCompoundTagAt(i));
    }

    invisible = tag.getBoolean("invisible");
}
 
Example 13
Source File: TileEntityQBlock.java    From qcraft-mod with Apache License 2.0 4 votes vote down vote up
@Override
public void readFromNBT( NBTTagCompound nbttagcompound )
{
    // Read properties
    super.readFromNBT( nbttagcompound );
    m_currentlyObserved = nbttagcompound.getBoolean( "o" );
    m_currentDisplayedSide = nbttagcompound.getInteger( "d" );
    m_entanglementFrequency = nbttagcompound.hasKey( "f" ) ? nbttagcompound.getInteger( "f" ) : -1;
    m_currentlyForcedSide = nbttagcompound.hasKey( "c" ) ? nbttagcompound.getInteger( "c" ) : -1;
    for( int i = 0; i < 6; ++i )
    {
        m_sideBlockTypes[ i ] = nbttagcompound.getInteger( "s" + i );
        m_forceObserved[ i ] = nbttagcompound.getBoolean( "c" + i );
    }
    
    if (hasJustFallen) {
        validate(); //to re-entangle Quantum blocks that have just solidified from a falling block entity
                    
        //[copied from the getObservationResult method]
        if( m_entanglementFrequency >= 0 ) // force-updates blocks to the state of the rest of their entanglement group (this is a very crude implementation
        {
            List<TileEntityQBlock> twins = getEntanglementRegistry().getEntangledObjects( m_entanglementFrequency );
            if( twins != null )
            {
             Iterator<TileEntityQBlock> it = twins.iterator();
                while( it.hasNext() )
                {
                    TileEntityQBlock twin = it.next();
                    if( twin != this )
                    {
                        //[/copied]
                        setDisplayedSide(false, twin.isForceObserved(1), twin.m_currentlyForcedSide );
                        break;
                    }
                }
            }
        }
        
        
        hasJustFallen = false; //to prevent all kinds of problems
    }
}
 
Example 14
Source File: ItemStackMap.java    From NotEnoughItems with MIT License 4 votes vote down vote up
public static boolean isWildcard(NBTTagCompound tag) {
    return tag != null && tag.getBoolean("*");
}
 
Example 15
Source File: Food.java    From TFC2 with GNU General Public License v3.0 4 votes vote down vote up
public static boolean isSalted(ItemStack is)
{
	NBTTagCompound nbt = getProcTag(is);
	return nbt.getBoolean("Salted");
}
 
Example 16
Source File: TileMotor.java    From Framez with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void readFromNBT(NBTTagCompound tag) {

    super.readFromNBT(tag);

    redstoneInput = tag.getBoolean("redstoneInput");

    face = ForgeDirection.getOrientation(tag.getInteger("face"));

    getMovement().readFromNBT(tag.getCompoundTag("movement"));

    settings.clear();
    NBTTagList l = tag.getTagList("settings", new NBTTagString().getId());
    for (int i = 0; i < l.tagCount(); i++)
        settings.add(MotorSetting.values()[Integer.parseInt(l.getStringTagAt(i))]);

    storedPower = tag.getDouble("power");
}
 
Example 17
Source File: NBTUtil.java    From TofuCraftReload with MIT License 4 votes vote down vote up
public static boolean getBoolean(NBTTagCompound compound, String key, boolean ifnone) {
    if (compound == null) return ifnone;
    return compound.hasKey(key) ? compound.getBoolean(key) : ifnone;
}
 
Example 18
Source File: StructureTofuMineshaftPieces.java    From TofuCraftReload with MIT License 4 votes vote down vote up
/**
 * (abstract) Helper method to read subclass data from NBT
 */
protected void readStructureFromNBT(NBTTagCompound tagCompound, TemplateManager p_143011_2_) {
    super.readStructureFromNBT(tagCompound, p_143011_2_);
    this.isMultipleFloors = tagCompound.getBoolean("tf");
    this.corridorDirection = EnumFacing.getHorizontal(tagCompound.getInteger("D"));
}
 
Example 19
Source File: SchematicMask.java    From Framez with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void readSchematicFromNBT(NBTTagCompound nbt,	MappingRegistry registry) {
	isConcrete = nbt.getBoolean("isConcrete");
}
 
Example 20
Source File: GT_TileEntity_ElectricImplosionCompressor.java    From bartworks with MIT License 4 votes vote down vote up
@Override
public void loadNBTData(NBTTagCompound aNBT) {
    this.piston = aNBT.getBoolean("piston");
    super.loadNBTData(aNBT);
}