當前位置: 首頁>>代碼示例>>Java>>正文


Java NBTUtil.getPosFromTag方法代碼示例

本文整理匯總了Java中net.minecraft.nbt.NBTUtil.getPosFromTag方法的典型用法代碼示例。如果您正苦於以下問題:Java NBTUtil.getPosFromTag方法的具體用法?Java NBTUtil.getPosFromTag怎麽用?Java NBTUtil.getPosFromTag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.nbt.NBTUtil的用法示例。


在下文中一共展示了NBTUtil.getPosFromTag方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ticketsLoaded

import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
@Override
public void ticketsLoaded(List<ForgeChunkManager.Ticket> tickets, World world)
{
	for (ForgeChunkManager.Ticket ticket : tickets)
	{
		BlockPos ticketPosition = NBTUtil.getPosFromTag(ticket.getModData().getCompoundTag("position"));
		TileEntity te = world.getTileEntity(ticketPosition);
		if (te instanceof TileEntityChunkLoader)
		{
			TileEntityChunkLoader loader = (TileEntityChunkLoader) te;
			loader.setChunkTicket(ticket);
			loader.forceChunks();
		}
		else
		{
			ForgeChunkManager.releaseTicket(ticket);
		}
	}
}
 
開發者ID:DarkMorford,項目名稱:Simple-Chunks,代碼行數:20,代碼來源:ChunkLoadingHandler.java

示例2: playerTicketsLoaded

import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
@Override
public ListMultimap<String, ForgeChunkManager.Ticket> playerTicketsLoaded(ListMultimap<String, ForgeChunkManager.Ticket> tickets, World world)
{
	// We don't care what order the tickets are in, but filter out the invalid ones
	ListMultimap<String, ForgeChunkManager.Ticket> validTickets = ArrayListMultimap.create();

	for (String playerName : tickets.keySet())
	{
		List<ForgeChunkManager.Ticket> playerTickets = new ArrayList<>();

		for (ForgeChunkManager.Ticket tkt : tickets.get(playerName))
		{
			BlockPos ticketPosition = NBTUtil.getPosFromTag(tkt.getModData().getCompoundTag("position"));
			TileEntity te = world.getTileEntity(ticketPosition);
			if (te instanceof TileEntityChunkLoader)
			{
				playerTickets.add(tkt);
			}
		}

		validTickets.putAll(playerName, playerTickets);
	}

	return validTickets;
}
 
開發者ID:DarkMorford,項目名稱:Simple-Chunks,代碼行數:26,代碼來源:ChunkLoadingHandler.java

示例3: onBlockActivated

import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
   {
	if(worldIn.isRemote)return true;
	TileEntity tile = worldIn.getTileEntity(pos);
	if(tile == null || !(tile instanceof TileTelePortal)) return false;
	ItemStack stack = player.getHeldItem(hand);
	if(ItemStackTools.isValid(stack)){
		if(stack.getItem() == ModItems.miscCard && stack.getMetadata() == CardType.TELEPORT_PORTAL.getMetadata()){
			if(ItemNBTHelper.verifyExistance(stack, "PortalPos")){
				BlockPos portalPos = NBTUtil.getPosFromTag(ItemNBTHelper.getCompound(stack).getCompoundTag("PortalPos"));
				int dim = ItemNBTHelper.getInteger(stack, "PortalDim", 0);
				TileTelePortal portal = (TileTelePortal)tile;
				portal.otherPortalPos = portalPos;
				portal.otherPortalDim = dim;
				ModLogger.info("Set link to "+portalPos);
				return true;
			}
		}
	}
	return false;
   }
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:23,代碼來源:BlockTelePortal.java

示例4: PacketDescription

import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
public PacketDescription(NBTTagCompound compound) {
    super(NBTUtil.getPosFromTag(compound.getCompoundTag("Pos")));
    type = IDescSynced.Type.values()[compound.getInteger("SyncType")];
    values = new Object[compound.getInteger("Length")];
    types = new byte[values.length];
    NBTTagList list = compound.getTagList("Data", Constants.NBT.TAG_COMPOUND);
    for (int i = 0; i < values.length; i++) {
        NBTTagCompound element = list.getCompoundTagAt(i);
        types[i] = element.getByte("Type");
        byte[] b = element.getByteArray("Value");
        values[i] = PacketUpdateGui.readField(Unpooled.wrappedBuffer(b), types[i]);
    }
    extraData = compound.getCompoundTag("Extra");
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:15,代碼來源:PacketDescription.java

示例5: readFromNBT

import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
public void readFromNBT(NBTTagCompound compound)
{
    super.readFromNBT(compound);
    this.age = compound.getLong("Age");

    if (compound.hasKey("ExitPortal", 10))
    {
        this.exitPortal = NBTUtil.getPosFromTag(compound.getCompoundTag("ExitPortal"));
    }

    this.exactTeleport = compound.getBoolean("ExactTeleport");
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:13,代碼來源:TileEntityEndGateway.java

示例6: readCustomNBT

import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
@Override
public void readCustomNBT(NBTTagCompound nbt){
	super.readCustomNBT(nbt);
	if(nbt.hasKey("PortalPos")){
		otherPortalPos = NBTUtil.getPosFromTag(nbt.getCompoundTag("PortalPos"));
		otherPortalDim = nbt.getInteger("PortalDim");
	}
	this.facing = EnumFacing.getFront(nbt.getInteger("Facing"));
}
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:10,代碼來源:TileTelePortal.java

示例7: DragonFightManager

import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
public DragonFightManager(WorldServer worldIn, NBTTagCompound compound)
{
    this.world = worldIn;

    if (compound.hasKey("DragonKilled", 99))
    {
        if (compound.hasUniqueId("DragonUUID"))
        {
            this.dragonUniqueId = compound.getUniqueId("DragonUUID");
        }

        this.dragonKilled = compound.getBoolean("DragonKilled");
        this.previouslyKilled = compound.getBoolean("PreviouslyKilled");

        if (compound.getBoolean("IsRespawning"))
        {
            this.respawnState = DragonSpawnManager.START;
        }

        if (compound.hasKey("ExitPortalLocation", 10))
        {
            this.exitPortalLocation = NBTUtil.getPosFromTag(compound.getCompoundTag("ExitPortalLocation"));
        }
    }
    else
    {
        this.dragonKilled = true;
        this.previouslyKilled = true;
    }

    if (compound.hasKey("Gateways", 9))
    {
        NBTTagList nbttaglist = compound.getTagList("Gateways", 3);

        for (int i = 0; i < nbttaglist.tagCount(); ++i)
        {
            this.gateways.add(Integer.valueOf(nbttaglist.getIntAt(i)));
        }
    }
    else
    {
        this.gateways.addAll(ContiguousSet.<Integer>create(Range.<Integer>closedOpen(Integer.valueOf(0), Integer.valueOf(20)), DiscreteDomain.integers()));
        Collections.shuffle(this.gateways, new Random(worldIn.getSeed()));
    }

    this.portalPattern = FactoryBlockPattern.start().aisle(new String[] {"       ", "       ", "       ", "   #   ", "       ", "       ", "       "}).aisle(new String[] {"       ", "       ", "       ", "   #   ", "       ", "       ", "       "}).aisle(new String[] {"       ", "       ", "       ", "   #   ", "       ", "       ", "       "}).aisle(new String[] {"  ###  ", " #   # ", "#     #", "#  #  #", "#     #", " #   # ", "  ###  "}).aisle(new String[] {"       ", "  ###  ", " ##### ", " ##### ", " ##### ", "  ###  ", "       "}).where('#', BlockWorldState.hasState(BlockMatcher.forBlock(Blocks.BEDROCK))).build();
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:48,代碼來源:DragonFightManager.java


注:本文中的net.minecraft.nbt.NBTUtil.getPosFromTag方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。