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


Java ForgeChunkManager类代码示例

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


ForgeChunkManager类属于net.minecraftforge.common包,在下文中一共展示了ForgeChunkManager类的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: buildChildScreen

import net.minecraftforge.common.ForgeChunkManager; //导入依赖的package包/类
@Override
protected GuiScreen buildChildScreen()
{
    List<IConfigElement> list = new ArrayList<IConfigElement>();

    list.add(new DummyCategoryElement("forgeChunkLoadingModCfg", "forge.configgui.ctgy.forgeChunkLoadingModConfig",
            ModOverridesEntry.class));
    list.addAll((new ConfigElement(ForgeChunkManager.getDefaultsCategory())).getChildElements());

    // This GuiConfig object specifies the configID of the object and as such will force-save when it is closed. The parent
    // GuiConfig object's propertyList will also be refreshed to reflect the changes.
    return new GuiConfig(this.owningScreen, list, this.owningScreen.modID, "chunkLoader",
            this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
            this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart,
            GuiConfig.getAbridgedConfigPath(ForgeChunkManager.getConfig().toString()),
            I18n.format("forge.configgui.ctgy.forgeChunkLoadingConfig"));
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:18,代码来源:ForgeGuiFactory.java

示例5: nextChunk

import net.minecraftforge.common.ForgeChunkManager; //导入依赖的package包/类
public void nextChunk() {
    this.unloadChunk();
    ++this.chunk_x;
    if (this.chunk_x << 4 >= this.max_x) {
        this.chunk_x = this.min_x + 1 >> 4;
        ++this.chunk_z;
        if (this.chunk_z << 4 >= this.max_z) {
            this.finished = true;
            this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, 2, 2);
            ForgeChunkManager.releaseTicket(this.chunkTicket);
            return;
        }
    }
    this.dy = this.chunk_y;
    this.loadChunk();
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:17,代码来源:TileEntityEnderQuarry.java

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

示例7: forceChunk

import net.minecraftforge.common.ForgeChunkManager; //导入依赖的package包/类
public static void forceChunk(Ticket ticket, World world, int x, int y, int z, String playerName)
{
    ChunkLoadingCallback.addToList(world, x, y, z, playerName);
    ChunkCoordIntPair chunkPos = new ChunkCoordIntPair(x >> 4, z >> 4);
    ForgeChunkManager.forceChunk(ticket, chunkPos);
    //
    // TileEntity tile = world.getTileEntity(x, y, z);
    //
    // if (tile instanceof IChunkLoader)
    // {
    // IChunkLoader chunkLoader = (IChunkLoader) tile;
    // int dimID = world.provider.dimensionId;
    //
    // HashSet<IChunkLoader> chunkList = loadedChunks.get(dimID);
    //
    // if (chunkList == null)
    // {
    // chunkList = new HashSet<IChunkLoader>();
    // }
    //
    // ForgeChunkManager.forceChunk(ticket, chunkPos);
    // chunkList.add(chunkLoader);
    // loadedChunks.put(dimID, chunkList);
    // }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:26,代码来源:ChunkLoadingCallback.java

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

示例9: buildChildScreen

import net.minecraftforge.common.ForgeChunkManager; //导入依赖的package包/类
@Override
protected GuiScreen buildChildScreen()
{
    List<IConfigElement> list = new ArrayList<IConfigElement>();
    
    list.add(new DummyCategoryElement("forgeChunkLoadingModCfg", "forge.configgui.ctgy.forgeChunkLoadingModConfig", 
            ModOverridesEntry.class));
    list.addAll((new ConfigElement(ForgeChunkManager.getDefaultsCategory())).getChildElements());
    
    // This GuiConfig object specifies the configID of the object and as such will force-save when it is closed. The parent
    // GuiConfig object's propertyList will also be refreshed to reflect the changes.
    return new GuiConfig(this.owningScreen, list, this.owningScreen.modID, "chunkLoader", 
            this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart, 
            this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart,
            GuiConfig.getAbridgedConfigPath(ForgeChunkManager.getConfig().toString()),
            I18n.func_135052_a("forge.configgui.ctgy.forgeChunkLoadingConfig"));
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:18,代码来源:ForgeGuiFactory.java

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

示例11: disable

import net.minecraftforge.common.ForgeChunkManager; //导入依赖的package包/类
public void disable()
{
    if(enabled)
    {
        //FMLLog.log(Level.INFO, "Disabling chunk at: " + toString() + " for owner: " + ownerId);

        // Unforce chunk, release ticket
        unforceChunkLoading();

        if(ticket != null)
        {
            ForgeChunkManager.releaseTicket(ticket);
            ticket = null;
        }

        enabled = false;
    }
}
 
开发者ID:CorwinJV,项目名称:AChunkLoader,代码行数:19,代码来源:ChunkLoaderTileEntity.java

示例12: invalidate

import net.minecraftforge.common.ForgeChunkManager; //导入依赖的package包/类
@Override
public void invalidate() {
    if(ticket != null)
    {
        ForgeChunkManager.releaseTicket(ticket);
        ticket = null;
    }

    // Remove loader from world data
    SavedData data = SavedData.get(world);
    if(world.isRemote
            || data == null)
    {
        return;
    }

    ChunkLoaders cl = data.getChunkLoaders();
    if(world.provider != null)
    {
        cl.removeLoader(new ChunkLoaderPos(ownerId.toString(), world.provider.getDimension(), getPos(), 0));
        data.setChunkLoaders(cl);
    }

    super.invalidate();
}
 
开发者ID:CorwinJV,项目名称:AChunkLoader,代码行数:26,代码来源:ChunkLoaderTileEntity.java

示例13: unforceChunkLoading

import net.minecraftforge.common.ForgeChunkManager; //导入依赖的package包/类
public void unforceChunkLoading()
{
    int size = ConfigurationHandler.chunkLoaderSize;
    if(size % 2 != 0 && size > 1)
    {
        size--;
    }
    int dist = size / 2;

    ChunkPos centerPos = new ChunkPos(pos.getX() / 16, pos.getZ() / 16);
    for(int x = centerPos.chunkXPos - dist; x <= centerPos.chunkXPos + dist; x++) {
        for (int z = centerPos.chunkZPos - dist; z <= centerPos.chunkZPos + dist; z++) {
            ChunkPos chunkPos = new ChunkPos(x, z);
            ForgeChunkManager.unforceChunk(ticket, chunkPos);
            FMLLog.log(Level.INFO, "Unchunkloading at chunk pos: " + chunkPos);
        }
    }
}
 
开发者ID:CorwinJV,项目名称:AChunkLoader,代码行数:19,代码来源:ChunkLoaderTileEntity.java

示例14: preInit

import net.minecraftforge.common.ForgeChunkManager; //导入依赖的package包/类
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
    // Config
    ConfigurationHandler.Init(event.getSuggestedConfigurationFile());
    MinecraftForge.EVENT_BUS.register(new ConfigurationHandler());

    // Login/Logout Tracking
    MinecraftForge.EVENT_BUS.register(new PlayerActivity());
    MinecraftForge.EVENT_BUS.register(new PlayerTimeout());

    // Chunk Loading
    ForgeChunkManager.setForcedChunkLoadingCallback(instance, new ChunkLoadingCallback());

    // Blocks and Items
    ModBlocks.init();
    ModBlocks.registerBlocks();
    ModBlocks.registerRecipes();

    // Keybinds
    proxy.registerKeys();
}
 
开发者ID:CorwinJV,项目名称:AChunkLoader,代码行数:23,代码来源:AChunkLoader.java

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


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