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


Java ForgeChunkManager.Ticket方法代码示例

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


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

示例1: breakBlock

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
	SimpleChunks.logger.info("Releasing chunkloading ticket");

	TileEntity te = worldIn.getTileEntity(pos);
	if (te instanceof TileEntityChunkLoader)
	{
		TileEntityChunkLoader loader = (TileEntityChunkLoader) te;

		loader.clearTicketChunks();
		ForgeChunkManager.Ticket tkt = loader.getChunkTicket();
		ForgeChunkManager.releaseTicket(tkt);
	}

	super.breakBlock(worldIn, pos, state);
}
 
开发者ID:DarkMorford,项目名称:Simple-Chunks,代码行数:18,代码来源:BlockChunkLoader.java

示例2: ticketsLoaded

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的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

示例3: playerTicketsLoaded

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的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

示例4: ticketsLoaded

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
public void ticketsLoaded(final List<ForgeChunkManager.Ticket> tickets, final World world) {
    for (final ForgeChunkManager.Ticket ticket : tickets) {
        final String ticket_id = ticket.getModData().getString("id");
        if (ticket_id.equals("pump")) {
            final int pumpX = ticket.getModData().getInteger("pumpX");
            final int pumpY = ticket.getModData().getInteger("pumpY");
            final int pumpZ = ticket.getModData().getInteger("pumpZ");
            final TileEntityEnderThermicLavaPump tq = (TileEntityEnderThermicLavaPump)world.getTileEntity(pumpX, pumpY, pumpZ);
            tq.forceChunkLoading(ticket);
        }
        if (ticket_id.equals("quarry")) {
            final int x = ticket.getModData().getInteger("x");
            final int y = ticket.getModData().getInteger("y");
            final int z = ticket.getModData().getInteger("z");
            final TileEntityEnderQuarry tq2 = (TileEntityEnderQuarry)world.getTileEntity(x, y, z);
            tq2.forceChunkLoading(ticket);
        }
    }
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:20,代码来源:ExtraUtils.java

示例5: 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

示例6: getChunkCount

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
public int getChunkCount(ImmutableSetMultimap<ChunkPos, ForgeChunkManager.Ticket> tickets)
{
    int count = 0;
    for(ChunkPos key : tickets.asMap().keySet())
    {
        Collection<ForgeChunkManager.Ticket> ticketList = tickets.asMap().get(key);
        for(ForgeChunkManager.Ticket ticket : ticketList)
        {
            if(Reference.MOD_ID.equals(ticket.getModId()))
            {
                count++;
            }
        }
    }
    return count;
}
 
开发者ID:CorwinJV,项目名称:AChunkLoader,代码行数:17,代码来源:CommandStats.java

示例7: register

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
public ForgeChunkManager.Ticket register(Set<Chunk> chunkSet) {
    ForgeChunkManager.Ticket ticket = ForgeChunkManager.requestTicket(Hammer.instance, DeltaChunk.getServerShadowWorld(), ForgeChunkManager.Type.NORMAL);
    if (ticket == null) {
        Hammer.logSevere("Failed to acquire chunk ticket. You may need to adjust config/forgeChunkLoading.cfg");
        return null;
    }
    final int maxSize = ticket.getMaxChunkListDepth();
    final int size = chunkSet.size();
    if (size > maxSize) {
        Hammer.logSevere("Registering %s chunks for loading, but ticket only has room for %s. You may need to adjust config/forgeChunkLoading.cfg", size, maxSize);
    }
    for (Chunk chunk : chunkSet) {
        ForgeChunkManager.forceChunk(ticket, chunk.getChunkCoordIntPair());
    }
    return ticket;
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:17,代码来源:PPPChunkLoader.java

示例8: ticketsLoaded

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
@Override
public void ticketsLoaded(List<Ticket> tickets, World world)
{
    for (ForgeChunkManager.Ticket ticket : tickets)
    {
        int xPos = ticket.getModData().getInteger("xPos");
        int yPos = ticket.getModData().getInteger("yPos");
        int zPos = ticket.getModData().getInteger("zPos");

        BlockPos pos = new BlockPos(xPos, yPos, zPos);

        Block block = world.getBlockState(pos).getBlock();
        if (block == ModBlocks.getBlock(ModBlocks.CHUNK_LOADER)) {
            ChunkLoaderTileEntity chunkLoaderTile = (ChunkLoaderTileEntity) world.getTileEntity(pos);
            if(chunkLoaderTile != null)
            {
                chunkLoaderTile.forceChunkLoading(ticket);
            }
        }
    }
}
 
开发者ID:CorwinJV,项目名称:AChunkLoader,代码行数:22,代码来源:ChunkLoadingCallback.java

示例9: ticketsLoaded

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
@Override
public List<ForgeChunkManager.Ticket> ticketsLoaded(List<ForgeChunkManager.Ticket> tickets, World world, int maxTicketCount) {
    Set<ForgeChunkManager.Ticket> worldTickets = new HashSet<ForgeChunkManager.Ticket>();
    Set<ForgeChunkManager.Ticket> cartTickets = new HashSet<ForgeChunkManager.Ticket>();
    for (ForgeChunkManager.Ticket ticket : tickets) {
        Entity entity = ticket.getEntity();
        if (entity == null) {
            int y = ticket.getModData().getInteger("yCoord");
            if (y >= 0) {
                worldTickets.add(ticket);
            }
        } else {
            if (entity instanceof LocoBase) {
                cartTickets.add(ticket);
            }
        }
    }

    List<ForgeChunkManager.Ticket> claimedTickets = new LinkedList<ForgeChunkManager.Ticket>();
    claimedTickets.addAll(cartTickets);
    claimedTickets.addAll(worldTickets);
    return claimedTickets;
}
 
开发者ID:NSDN,项目名称:NyaSamaRailway,代码行数:24,代码来源:ChunkLoaderHandler.java

示例10: onEnterChunk

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
@SubscribeEvent
public void onEnterChunk(EntityEvent.EnteringChunk event)
{
    if(FMLCommonHandler.instance().getEffectiveSide().isServer() && (event.entity instanceof EntityMeteorite || event.entity instanceof EntityPigzilla) && !event.entity.isDead)
    {
        ForgeChunkManager.Ticket ticket = ChunkLoadHandler.tickets.get(event.entity);
        if(ticket == null)
        {
            ticket = ForgeChunkManager.requestTicket(ItFellFromTheSky.instance, event.entity.worldObj, ForgeChunkManager.Type.ENTITY);
            if(ticket != null)
            {
                ticket.bindEntity(event.entity);
                ChunkLoadHandler.addTicket(event.entity, ticket);
            }
        }
        if(ticket != null)
        {
            if(event.oldChunkX != 0 && event.oldChunkZ != 0)
            {
                ForgeChunkManager.unforceChunk(ticket, new ChunkCoordIntPair(event.oldChunkX, event.oldChunkZ));
            }
            ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(event.newChunkX, event.newChunkZ));
        }
    }
}
 
开发者ID:iChun,项目名称:ItFellFromTheSky,代码行数:26,代码来源:EventHandler.java

示例11: ticketsLoaded

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
@Override
public void ticketsLoaded(List<ForgeChunkManager.Ticket> tickets, World world)
{
    for(ForgeChunkManager.Ticket ticket : tickets)
    {
        boolean saved = false;
        Entity ent = ticket.getEntity();
        if(ent instanceof EntityMeteorite || ent instanceof EntityTransformer || ent instanceof EntityPigzilla)
        {
            if(!ent.isDead)
            {
                saved = true;
                addTicket(ent, ticket);
            }
        }
        if(!saved)
        {
            ForgeChunkManager.releaseTicket(ticket);
        }
    }
}
 
开发者ID:iChun,项目名称:ItFellFromTheSky,代码行数:22,代码来源:ChunkLoadHandler.java

示例12: get

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
@Override
public ForgeChunkManager.Ticket get(Object key) {
    if (key instanceof Integer) {
        if (super.get(key) == null) {
            World world = DimensionManager.getWorld((Integer) key);
            if (world == null) {
                return null;
            }

            ForgeChunkManager.Ticket ticket = ForgeChunkManager.requestTicket(MyTown.instance, world, ForgeChunkManager.Type.NORMAL);
            ticket.getModData().setString("townName", town.getName());
            ticket.getModData().setTag("chunkCoords", new NBTTagList());
            put((Integer) key, ticket);
            return ticket;
        } else {
            return super.get(key);
        }
    }
    return null;
}
 
开发者ID:MyEssentials,项目名称:MyTown2,代码行数:21,代码来源:TicketMap.java

示例13: chunkUnload

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
public void chunkUnload(TownBlock block) {
    ForgeChunkManager.Ticket ticket = get(block.getDim());
    ForgeChunkManager.unforceChunk(ticket, block.toChunkCoords());

    NBTTagList list = ticket.getModData().getTagList("chunkCoords", Constants.NBT.TAG_COMPOUND);
    for (int i = 0; i < list.tagCount(); i++) {
        NBTTagCompound chunkNBT = list.getCompoundTagAt(i);
        int x = chunkNBT.getInteger("x");
        int z = chunkNBT.getInteger("z");

        if (x == block.getX() && z == block.getZ()) {
            list.removeTag(i);
            break;
        }
    }
}
 
开发者ID:MyEssentials,项目名称:MyTown2,代码行数:17,代码来源:TicketMap.java

示例14: ticketLoad

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
private static boolean ticketLoad(ForgeChunkManager.Ticket ticket, World world) {
    final NBTTagCompound tag = ticket.getModData();
    int x = tag.getInteger("targetX");
    int y = tag.getInteger("targetY");
    int z = tag.getInteger("targetZ");

    TileEntity tile = world.getTileEntity(x, y, z);

    if (tile == null) {
        LogUtil.debug(String.format("No TileEntity at %d %d %d", x, y, z));
        return false;
    }

    if (!(tile instanceof IChunkLoader)) {
        LogUtil.warn(String.format("Served ticket for TileEntity at %d %d %d that is not one of mine", x, y, z));
        return false;
    }

    ForgeChunkManager.forceChunk(ticket, ((IChunkLoader) tile).getChunkCoord());

    TICKET_LIST.put((IChunkLoader) tile, ticket);

    return true;
}
 
开发者ID:theoriginalbit,项目名称:MoarPeripherals,代码行数:25,代码来源:ChunkLoadingCallback.java

示例15: 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


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