本文整理汇总了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;
}
示例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!");
}
}
示例3: createTicket
import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
@Override
public Ticket createTicket(int dimension) {
return ForgeChunkManager.requestPlayerTicket(instance, username, DimensionManager.getWorld(dimension), Type.NORMAL);
}