当前位置: 首页>>代码示例>>Java>>正文


Java ForgeChunkManager.requestPlayerTicket方法代码示例

本文整理汇总了Java中net.minecraftforge.common.ForgeChunkManager.requestPlayerTicket方法的典型用法代码示例。如果您正苦于以下问题:Java ForgeChunkManager.requestPlayerTicket方法的具体用法?Java ForgeChunkManager.requestPlayerTicket怎么用?Java ForgeChunkManager.requestPlayerTicket使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.common.ForgeChunkManager的用法示例。


在下文中一共展示了ForgeChunkManager.requestPlayerTicket方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPlayerTicket

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
public ForgeChunkManager.Ticket getPlayerTicket(final GameProfile profile) {
    HashMap<GameProfile, ForgeChunkManager.Ticket> gameProfileTicketHashMap = PlayerCubeChunkLoaderManager.playerTickets;
    if (gameProfileTicketHashMap == null) {
        PlayerCubeChunkLoaderManager.playerTickets = gameProfileTicketHashMap = new HashMap<GameProfile, ForgeChunkManager.Ticket>();
    }
    ForgeChunkManager.Ticket ticket = gameProfileTicketHashMap.get(profile);
    if (ticket == null) {
        ticket = ForgeChunkManager.requestPlayerTicket(CrystalMod.instance, profile.getName(), CubeManager.getInstance().getWorld(), ForgeChunkManager.Type.NORMAL);
        final NBTTagCompound tag = ticket.getModData();
        tag.setString("Name", profile.getName());
        final UUID id = profile.getId();
        if (id != null) {
            tag.setLong("UUIDL", id.getLeastSignificantBits());
            tag.setLong("UUIDU", id.getMostSignificantBits());
        }
        gameProfileTicketHashMap.put(profile, ticket);
    }
    return ticket;
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:20,代码来源:PlayerCubeChunkLoaderManager.java

示例2: onBlockPlacedBy

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
	if (worldIn.isRemote)
	{
		return;
	}

	if (!(placer instanceof EntityPlayer))
	{
		SimpleChunks.logger.warn("Chunk loader placed by " + placer);
		return;
	}

	EntityPlayer player = (EntityPlayer)placer;

	ForgeChunkManager.Ticket tkt = ForgeChunkManager.requestPlayerTicket(SimpleChunks.instance, player.getName(), worldIn, ForgeChunkManager.Type.NORMAL);
	if (tkt != null)
	{
		SimpleChunks.logger.info("Received ticket from Forge Chunk Manager");
		tkt.getModData().setTag("position", NBTUtil.createPosTag(pos));

		TileEntity te = worldIn.getTileEntity(pos);
		if (te instanceof TileEntityChunkLoader)
		{
			TileEntityChunkLoader loader = (TileEntityChunkLoader) te;
			loader.setChunkTicket(tkt);
			loader.forceChunks();
		}
	}
	else
	{
		SimpleChunks.logger.error("Unable to get ticket from Forge Chunk Manager!");
	}
}
 
开发者ID:DarkMorford,项目名称:Simple-Chunks,代码行数:36,代码来源:BlockChunkLoader.java

示例3: createTicket

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
@Override
public Ticket createTicket(int dimension) {
    return ForgeChunkManager.requestPlayerTicket(instance, username, DimensionManager.getWorld(dimension), Type.NORMAL);
}
 
开发者ID:TheCBProject,项目名称:ChickenChunks,代码行数:5,代码来源:ChunkLoaderManager.java


注:本文中的net.minecraftforge.common.ForgeChunkManager.requestPlayerTicket方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。