org.bukkit.block.banner.Pattern#net.minecraft.nbt.NBTTagCompound源码实例Demo

下面列出了org.bukkit.block.banner.Pattern#net.minecraft.nbt.NBTTagCompound 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Kettle   文件: CraftOfflinePlayer.java
public String getName() {
    Player player = getPlayer();
    if (player != null) {
        return player.getName();
    }

    // This might not match lastKnownName but if not it should be more correct
    if (profile.getName() != null) {
        return profile.getName();
    }

    NBTTagCompound data = getBukkitData();

    if (data != null) {
        if (data.hasKey("lastKnownName")) {
            return data.getString("lastKnownName");
        }
    }

    return null;
}
 
源代码2 项目: BigReactors   文件: TileEntityBeefBase.java
@Override
public void readFromNBT(NBTTagCompound tag) {
	super.readFromNBT(tag);
	
	// Rotation
	if(tag.hasKey("facing")) {
		facing = Math.max(0, Math.min(5, tag.getInteger("facing")));
	}
	else {
		facing = 2;
	}

	// Exposure settings
	if(tag.hasKey("exposures")) {
		int[] tagExposures = tag.getIntArray("exposures");
		assert(tagExposures.length == exposures.length);
		System.arraycopy(tagExposures, 0, exposures, 0, exposures.length);
	}
}
 
源代码3 项目: NOVA-Core   文件: BWBlockTransform.java
@Override
public void setWorld(World world) {
	net.minecraft.world.World oldWorld = (net.minecraft.world.World) WorldConverter.instance().toNative(this.world);
	net.minecraft.world.World newWorld = (net.minecraft.world.World) WorldConverter.instance().toNative(world);
	Optional<TileEntity> tileEntity = Optional.ofNullable(oldWorld.getTileEntity((int) position.getX(), (int) position.getY(), (int) position.getZ()));
	Optional<NBTTagCompound> nbt = Optional.empty();
	if (tileEntity.isPresent()) {
		NBTTagCompound compound = new NBTTagCompound();
		tileEntity.get().writeToNBT(compound);
		nbt = Optional.of(compound);
	}
	newWorld.setBlock((int) position.getX(), (int) position.getY(), (int) position.getZ(), block.mcBlock, block.getMetadata(), 3);
	oldWorld.removeTileEntity((int) position.getX(), (int) position.getY(), (int) position.getZ());
	oldWorld.setBlockToAir((int) position.getX(), (int) position.getY(), (int) position.getZ());
	Optional<TileEntity> newTileEntity = Optional.ofNullable(newWorld.getTileEntity((int) position.getX(), (int) position.getY(), (int) position.getZ()));
	if (newTileEntity.isPresent() && nbt.isPresent()) {
		newTileEntity.get().readFromNBT(nbt.get());
	}
	this.world = world;
}
 
源代码4 项目: Production-Line   文件: ItemBlockEUStorage.java
/**
 * returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
 */
@SideOnly(Side.CLIENT)
@Override
public void getSubItems(@Nonnull Item item, @Nonnull CreativeTabs creativeTabs, @Nonnull List<ItemStack> list) {
    super.getSubItems(item, creativeTabs, list);
    ItemStack itemStack;
    NBTTagCompound nbt;

    itemStack = PLBlocks.evsu.copy();
    nbt = StackUtil.getOrCreateNbtData(itemStack);
    nbt.setInteger("energy", (int) 1E8);
    list.add(itemStack);

    itemStack = PLBlocks.cseu.copy();
    nbt = StackUtil.getOrCreateNbtData(itemStack);
    nbt.setInteger("energy", (int) 720E3);
    list.add(itemStack);

    itemStack = PLBlocks.parallelSpaceSU.copy();
    nbt = StackUtil.getOrCreateNbtData(itemStack);
    nbt.setInteger("energy", (int) 2E8);
    list.add(itemStack);
}
 
源代码5 项目: PneumaticCraft   文件: ItemGPSTool.java
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List infoList, boolean par4){
    super.addInformation(stack, player, infoList, par4);
    NBTTagCompound compound = stack.stackTagCompound;
    if(compound != null) {
        int x = compound.getInteger("x");
        int y = compound.getInteger("y");
        int z = compound.getInteger("z");
        if(x != 0 || y != 0 || z != 0) {
            infoList.add("\u00a72Set to " + x + ", " + y + ", " + z);
        }
        String varName = getVariable(stack);
        if(!varName.equals("")) {
            infoList.add(I18n.format("gui.tooltip.gpsTool.variable", varName));
        }
    }
}
 
源代码6 项目: Cyberware   文件: CyberwareDataHandler.java
@SubscribeEvent
public void startTrackingEvent(StartTracking event)
{			
	EntityPlayer tracker = event.getEntityPlayer();
	Entity target = event.getTarget();
	
	if (!target.worldObj.isRemote)
	{
		if (CyberwareAPI.hasCapability(target))
		{
			if (target instanceof EntityPlayer)
			{
				//System.out.println("Sent data for player " + ((EntityPlayer) target).getName() + " to player " + tracker.getName());
			}

			NBTTagCompound nbt = CyberwareAPI.getCapability(target).serializeNBT();
			CyberwarePacketHandler.INSTANCE.sendTo(new CyberwareSyncPacket(nbt, target.getEntityId()), (EntityPlayerMP) tracker);
		}
	}
	
}
 
源代码7 项目: Logistics-Pipes-2   文件: LPRoutedItem.java
public NBTTagCompound writeToNBT() {
	NBTTagCompound tag = new NBTTagCompound();
	Triple<Double, Double, Double> pos = getPosition();
	tag.setDouble("posX", pos.getFirst());
	tag.setDouble("posY", pos.getSecnd());
	tag.setDouble("posZ", pos.getThird());
	tag.setInteger("heading", heading.ordinal());
	tag.setUniqueId("UID", this.ID);
	tag.setTag("inventory", stack.serializeNBT());
	tag.setInteger("ticks", this.ticks);
	NBTTagList routeList = new NBTTagList();
	for(EnumFacing node : route) {
		NBTTagCompound nodeTag = new NBTTagCompound();
		//nodeTag.setUniqueId("UID", node.getKey());
		nodeTag.setInteger("heading", node.ordinal());
		routeList.appendTag(nodeTag);
	}
	tag.setTag("route", routeList);
	return tag;
}
 
源代码8 项目: mocreaturesdev   文件: MoCEntityWyvern.java
@Override
public void readEntityFromNBT(NBTTagCompound nbttagcompound)
{
	super.readEntityFromNBT(nbttagcompound);
	setRideable(nbttagcompound.getBoolean("Saddle"));
	setIsChested(nbttagcompound.getBoolean("Chested"));
	setArmorType(nbttagcompound.getByte("ArmorType"));
	setSitting(nbttagcompound.getBoolean("isSitting"));
	if (getIsChested())
	{
		NBTTagList nbttaglist = nbttagcompound.getTagList("Items");
		localchest = new MoCAnimalChest("WyvernChest", 14);
		for (int i = 0; i < nbttaglist.tagCount(); i++)
		{
			NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.tagAt(i);
			int j = nbttagcompound1.getByte("Slot") & 0xff;
			if ((j >= 0) && j < localchest.getSizeInventory())
			{
				localchest.setInventorySlotContents(j, ItemStack.loadItemStackFromNBT(nbttagcompound1));
			}
		}
	}
}
 
@Override
public Object getMeta(Item target, ItemStack stack) {
	Map<String, Object> result = Maps.newHashMap();

	String type = safariNets.get(target.getUnlocalizedName());
	result.put("type", Objects.firstNonNull(type, "unknown"));

	NBTTagCompound tag = stack.getTagCompound();
	if (tag != null) {
		if (tag.getBoolean("hide")) {
			result.put("captured", "?");
		} else if (tag.hasKey("id", Constants.NBT.TAG_STRING)) {
			result.put("captured", tag.getString("id"));
		}
	}

	return result;
}
 
源代码10 项目: Wizardry   文件: StandardWizardryWorld.java
@Override
public NBTTagCompound serializeNBT() {
	NBTTagCompound compound = new NBTTagCompound();

	compound.setTag("spell_object_manager", spellObjectManager.manager.toNbt());

	NBTTagList driveNBT = new NBTTagList();
	for (Map.Entry<BlockPos, NemezTracker> entry : blockNemezDrives.entrySet()) {
		if (entry == null) continue;
		NBTTagCompound compound1 = new NBTTagCompound();
		compound1.setLong("pos", entry.getKey().toLong());
		compound1.setTag("drive", entry.getValue().serializeNBT());
		driveNBT.appendTag(compound1);
	}

	compound.setTag("drives", driveNBT);
	return compound;
}
 
源代码11 项目: Sakura_mod   文件: TileEntityShoji.java
@Override
public void readFromNBT(NBTTagCompound compound) {
    super.readFromNBT(compound);
    if (compound.hasKey("type")) {
        type = compound.getInteger("type");
    }
    if (compound.hasKey("facing")) {
        facing = EnumFacing.byName(compound.getString("facing"));
    }
    if (compound.hasKey("open")) {
        open = compound.getBoolean("open");
    }
    if (compound.hasKey("animation")) {
        animation = compound.getInteger("animation");
    }
}
 
源代码12 项目: PneumaticCraft   文件: AmadronOfferCustom.java
@Override
public void writeToNBT(NBTTagCompound tag){
    super.writeToNBT(tag);
    tag.setString("offeringPlayerId", offeringPlayerId);
    tag.setString("offeringPlayerName", offeringPlayerName);
    tag.setInteger("inStock", inStock);
    tag.setInteger("maxTrades", maxTrades);
    tag.setInteger("pendingPayments", pendingPayments);
    if(providingPosition != null) {
        tag.setInteger("providingDimensionId", providingDimensionId);
        tag.setInteger("providingX", providingPosition.chunkPosX);
        tag.setInteger("providingY", providingPosition.chunkPosY);
        tag.setInteger("providingZ", providingPosition.chunkPosZ);
    }
    if(returningPosition != null) {
        tag.setInteger("returningDimensionId", returningDimensionId);
        tag.setInteger("returningX", returningPosition.chunkPosX);
        tag.setInteger("returningY", returningPosition.chunkPosY);
        tag.setInteger("returningZ", returningPosition.chunkPosZ);
    }
}
 
源代码13 项目: Valkyrien-Skies   文件: TileEntityGearbox.java
@Override
public void readFromNBT(NBTTagCompound compound) {
    super.readFromNBT(compound);
    if (compound.hasKey("inputFacing")) {
        this.inputFacing = EnumFacing.values()[compound.getByte("inputFacing")];
    }
    if (compound.hasKey("hasOutput")) {
        if (compound.getBoolean("hasOutput")) {
            if (compound.hasKey("outputRatio")) {
                this.outputRatio = Optional.of(compound.getDouble("outpuRatio"));
            }
        }
    }
}
 
源代码14 项目: AdvancedRocketry   文件: TileSatelliteBuilder.java
@Override
public void useNetworkData(EntityPlayer player, Side side, byte id,
		NBTTagCompound nbt) {
	super.useNetworkData(player, side, id, nbt);


	onInventoryButtonPressed(id - 100);
}
 
源代码15 项目: Cyberware   文件: TileEntityEngineeringTable.java
@Override
public void readFromNBT(NBTTagCompound compound)
{
	super.readFromNBT(compound);
	
	slots.deserializeNBT(compound.getCompoundTag("inv"));
	
	if (compound.hasKey("CustomName", 8))
	{
		customName = compound.getString("CustomName");
	}
	
	this.time = compound.getInteger("time");
	
	lastPlayerArchive = new HashMap<String, BlockPos>();
	NBTTagList list = (NBTTagList) compound.getTag("playerArchive");
	for (int i = 0; i < list.tagCount(); i++)
	{
		NBTTagCompound comp = list.getCompoundTagAt(i);
		String name = comp.getString("name");
		int x = comp.getInteger("x");
		int y = comp.getInteger("y");
		int z = comp.getInteger("z");
		BlockPos pos = new BlockPos(x, y, z);
		lastPlayerArchive.put(name, pos);
	}

}
 
源代码16 项目: PneumaticCraft   文件: TileEntityPneumaticDynamo.java
@Override
public void writeToNBT(NBTTagCompound tag){
    super.writeToNBT(tag);
    energy.writeToNBT(tag);
    writeInventoryToNBT(tag, inventory);
    tag.setInteger("redstoneMode", redstoneMode);
    tag.setBoolean("isEnabled", isEnabled);
}
 
源代码17 项目: TFC2   文件: TileSmallVessel.java
/***********************************************************************************
 * 3. NBT Methods
 ***********************************************************************************/
@Override
public void readSyncableNBT(NBTTagCompound nbt)
{
	NBTTagList invList = nbt.getTagList("inventory", 10);
	inventory = Helper.readStackArrayFromNBTList(invList, getSizeInventory());
	rotation = EnumFacing.Axis.values()[nbt.getInteger("axis")];
}
 
源代码18 项目: enderutilities   文件: ItemBuildersWand.java
private void setSelectedFixedBlockType(ItemStack stack, EntityPlayer player, World world, BlockPos pos, boolean secondary)
{
    int sel = this.getSelectionIndex(stack, secondary);

    if (sel < 0)
    {
        return;
    }

    String tagName = secondary ? TAG_NAME_BLOCKS + "2" : TAG_NAME_BLOCKS;
    NBTTagCompound blocksTag = NBTUtils.getCompoundTag(stack, WRAPPER_TAG_NAME, tagName, true);
    NBTTagCompound tag = NBTUtils.getCompoundTag(blocksTag, TAG_NAME_BLOCK_PRE + sel, true);

    this.setSelectedFixedBlockType(tag, player, world, pos);
}
 
源代码19 项目: ExNihiloAdscensio   文件: ItemInfo.java
public NBTTagCompound writeToNBT(NBTTagCompound tag)
{
    tag.setString("item", Item.REGISTRY.getNameForObject(item).toString());
    tag.setInteger("meta", meta);
    
    return tag;
}
 
源代码20 项目: AdvancedRocketry   文件: ItemStationChip.java
/**
 * @param stack
 * @return Vector3F containing the takeoff coords or null if there is none
 */
public Vector3F<Float> getTakeoffCoords(ItemStack stack, int dimid) {
	if(stack.hasTagCompound()) {
		NBTTagCompound nbt = stack.getTagCompound();
		if(nbt.hasKey("dimid" + dimid)) {
			nbt = nbt.getCompoundTag("dimid" + dimid);
			return new Vector3F<Float>(nbt.getFloat("x"), nbt.getFloat("y"),nbt.getFloat("z"));
		}
	}
	return null;
}
 
源代码21 项目: EmergingTechnology   文件: BioreactorTileEntity.java
@Override
public void readFromNBT(NBTTagCompound compound) {
    super.readFromNBT(compound);

    this.itemHandler.deserializeNBT(compound.getCompoundTag("Inventory"));

    this.setWater(compound.getInteger("GuiWater"));
    this.setEnergy(compound.getInteger("GuiEnergy"));
    this.setProgress(compound.getInteger("GuiProgress"));

    this.fluidHandler.readFromNBT(compound);
    this.energyHandler.readFromNBT(compound);
}
 
源代码22 项目: PneumaticCraft   文件: ProgWidgetInventoryBase.java
@Override
public void writeToNBT(NBTTagCompound tag){
    super.writeToNBT(tag);
    for(int i = 0; i < 6; i++) {
        tag.setBoolean(ForgeDirection.getOrientation(i).name(), accessingSides[i]);
    }
    tag.setBoolean("useCount", useCount);
    tag.setInteger("count", count);
}
 
源代码23 项目: NBTEdit   文件: SaveStates.java
public void read() throws IOException{
	if (file.exists() && file.canRead()){
		NBTTagCompound root = CompressedStreamTools.read(file);
		for (int i =0; i < 7; ++i){
			String name = "slot" + (i+1);
			if (root.hasKey(name))
				tags[i].tag = root.getCompoundTag(name);
			if (root.hasKey(name+"Name"))
				tags[i].name = root.getString(name+"Name");
		}
	}
}
 
源代码24 项目: ExtraCells1   文件: TileEntityCertusTank.java
public FluidTank readFromNBT(NBTTagCompound nbt)
{
	if (!nbt.hasKey("Empty"))
	{
		FluidStack fluid = FluidStack.loadFluidStackFromNBT(nbt);
		setFluid(fluid);
	} else
	{
		setFluid(null);
	}
	return this;
}
 
源代码25 项目: GardenCollection   文件: AspectList.java
public void writeToNBT(NBTTagCompound nbttagcompound, String label)
  {
      NBTTagList tlist = new NBTTagList();
nbttagcompound.setTag(label, tlist);
for (Aspect aspect : getAspects())
	if (aspect != null) {
		NBTTagCompound f = new NBTTagCompound();
		f.setString("key", aspect.getTag());
		f.setInteger("amount", getAmount(aspect));
		tlist.appendTag(f);
	}
  }
 
源代码26 项目: ExNihiloAdscensio   文件: BlockInfo.java
public static BlockInfo readFromNBT(NBTTagCompound tag)
{
    Block item_ = Block.REGISTRY.getObject(new ResourceLocation(tag.getString("block")));
    int meta_ = tag.getInteger("meta");
    
    return new BlockInfo(item_, meta_);
}
 
源代码27 项目: enderutilities   文件: NBTUtils.java
/**
 * Cycle a byte value in the given ItemStack's NBT in a tag <b>tagName</b>. If <b>containerTagName</b>
 * is not null, then the value is stored inside a compound tag by that name.
 * The low end of the range is 0.
 */
public static void cycleByteValue(@Nonnull ItemStack stack, @Nullable String containerTagName,
        @Nonnull String tagName, int maxValue, boolean reverse)
{
    NBTTagCompound nbt = getCompoundTag(stack, containerTagName, true);
    cycleByteValue(nbt, tagName, 0, maxValue, reverse);
}
 
源代码28 项目: EmergingTechnology   文件: SolarGlassTileEntity.java
@Override
public void readFromNBT(NBTTagCompound compound) {
    super.readFromNBT(compound);

    this.energyHandler.readFromNBT(compound);

    this.setEnergy(compound.getInteger("GuiEnergy"));
}
 
/**
 * (abstract) Helper method to write subclass data to NBT
 */
protected void writeStructureToNBT(NBTTagCompound tagCompound) {
    super.writeStructureToNBT(tagCompound);
    NBTTagList nbttaglist = new NBTTagList();

    for (StructureBoundingBox structureboundingbox : this.connectedRooms) {
        nbttaglist.appendTag(structureboundingbox.toNBTTagIntArray());
    }

    tagCompound.setTag("Entrances", nbttaglist);
}
 
源代码30 项目: CommunityMod   文件: TileEntityGnode.java
/**
    * Writes a tile entity to NBT.
    * @return 
    */
@Override
   public NBTTagCompound writeToNBT(NBTTagCompound nbt)
   {
       NBTTagCompound compound = super.writeToNBT(nbt);
       nbt.setLong("buildseed", this.buildseed);
       return compound;
   }