• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ChunkWatchEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: onChunkWatchedByPlayer

import net.minecraftforge.event.world.ChunkWatchEvent; //导入依赖的package包/类
@SubscribeEvent
public void onChunkWatchedByPlayer(ChunkWatchEvent event)
{
	if (!event.player.worldObj.isRemote)
	{
		//get all the TileEntities in the chunk
		Chunk c = event.player.worldObj.getChunkFromChunkCoords(event.chunk.chunkXPos, event.chunk.chunkZPos);
		int nt = 0;
		for (Object t : c.chunkTileEntityMap.values())
		{
			if (t instanceof TileEntityGX)
			{
				nt++;
			}
		}
		if (nt>0)
		{
			System.out.println(event.player.getDisplayName()+" is watching chunk with "+nt+" TileEntityGX tile entities");
		}
	}
}
 
开发者ID:ds84182,项目名称:OpenGX,代码行数:22,代码来源:Events.java


示例2: onChunkWatch

import net.minecraftforge.event.world.ChunkWatchEvent; //导入依赖的package包/类
@SubscribeEvent
public static void onChunkWatch(ChunkWatchEvent.Watch event)
{
	IChunkLevel chunkLevel = getChunkLevel(event.getPlayer().getEntityWorld(), event.getChunk());
	
	LootSlashConquer.network.sendTo(new PacketUpdateChunkLevel(chunkLevel.getChunkPos().x, chunkLevel.getChunkPos().z, chunkLevel.getChunkLevel()), event.getPlayer());
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:8,代码来源:CapabilityChunkLevel.java


示例3: onChunkWatch

import net.minecraftforge.event.world.ChunkWatchEvent; //导入依赖的package包/类
@SubscribeEvent
public static void onChunkWatch(ChunkWatchEvent.Watch e)
{
    try
    {
        GlobalChunkPos pos = new GlobalChunkPos(e.getChunk().x, e.getChunk().z, e.getPlayer().dimension);
        NetworkManager.sendTo(new CPacketSyncSif(pos, PurMag.INSTANCE.sif_storage.get(pos)), e.getPlayer());
    }
    catch (Exception ex)
    {
        PurMag.INSTANCE.log.error("Can't sync the SIF chunk data with player!", ex);
    }
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:14,代码来源:SifEvents.java


示例4: onChunkUnWatch

import net.minecraftforge.event.world.ChunkWatchEvent; //导入依赖的package包/类
@SubscribeEvent
public static void onChunkUnWatch(ChunkWatchEvent.UnWatch e)
{
    try
    {
        GlobalChunkPos pos = new GlobalChunkPos(e.getChunk().x, e.getChunk().z, e.getPlayer().dimension);
        NetworkManager.sendTo(new CPacketDesyncSif(pos), e.getPlayer());
    }
    catch (Exception ex)
    {
        PurMag.INSTANCE.log.error("Can't desync the SIF chunk data with player!", ex);
    }
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:14,代码来源:SifEvents.java


示例5: playerWatchesChunk

import net.minecraftforge.event.world.ChunkWatchEvent; //导入依赖的package包/类
@SubscribeEvent
public void playerWatchesChunk(ChunkWatchEvent.Watch event) {
    Chunk chunk = event.player.worldObj.getChunkFromChunkCoords(event.chunk.chunkXPos, event.chunk.chunkZPos);
    IExtraChunkData ecd = (IExtraChunkData) chunk;
    FlatChunkLayer layer = ecd.getFlatLayer();
    if (layer.isEmpty()) return;
    SyncWrite sw = new SyncWrite();
    layer.iterate(sw);
    send(event.player, build(sw.finish()));
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:11,代码来源:FlatNet.java


示例6: onPlayWatchChunk

import net.minecraftforge.event.world.ChunkWatchEvent; //导入依赖的package包/类
@SubscribeEvent
public void onPlayWatchChunk(ChunkWatchEvent.Watch event)
{
    Chunk chunk = event.player.worldObj.getChunkFromChunkCoords(event.chunk.chunkXPos, event.chunk.chunkZPos);
    BioSystem bioSystem = BioSystemHandler.getBioSystem(event.player.worldObj, chunk);
    if (bioSystem != null)
    {
        NetworkHandler.INSTANCE.sendTo(new MessageBioSystemUpdate(bioSystem), event.player);
    }
}
 
开发者ID:Dynious,项目名称:Biota,代码行数:11,代码来源:CommonEventHandler.java


示例7: removePlayer

import net.minecraftforge.event.world.ChunkWatchEvent; //导入依赖的package包/类
public void removePlayer(EntityPlayerMP par1EntityPlayerMP)
{
    if (this.playersInChunk.contains(par1EntityPlayerMP))
    {
        Chunk chunk = PlayerManager.getWorldServer(this.thePlayerManager).getChunkFromChunkCoords(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos);
        par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet51MapChunk(chunk, true, 0));
        this.playersInChunk.remove(par1EntityPlayerMP);
        par1EntityPlayerMP.loadedChunks.remove(this.chunkLocation);

        MinecraftForge.EVENT_BUS.post(new ChunkWatchEvent.UnWatch(chunkLocation, par1EntityPlayerMP));

        if (this.playersInChunk.isEmpty())
        {
            long i = (long)this.chunkLocation.chunkXPos + 2147483647L | (long)this.chunkLocation.chunkZPos + 2147483647L << 32;
            this.increaseInhabitedTime(chunk);
            PlayerManager.getChunkWatchers(this.thePlayerManager).remove(i);
            PlayerManager.getChunkWatcherList(this.thePlayerManager).remove(this);

            if (this.numberOfTilesToUpdate > 0)
            {
                PlayerManager.getChunkWatchersWithPlayers(this.thePlayerManager).remove(this);
            }

            this.thePlayerManager.getWorldServer().theChunkProviderServer.unloadChunksIfNotNearSpawn(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos);
        }
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:28,代码来源:PlayerInstance.java


示例8: watchChunk

import net.minecraftforge.event.world.ChunkWatchEvent; //导入依赖的package包/类
@SubscribeEvent
public void watchChunk(ChunkWatchEvent.Watch event) {
    registrant.register(event.player.worldObj, event.chunk.chunkXPos, event.chunk.chunkZPos);

}
 
开发者ID:ternsip,项目名称:StabilizerMod,代码行数:6,代码来源:Stabilizermod.java


示例9: unwatchChunk

import net.minecraftforge.event.world.ChunkWatchEvent; //导入依赖的package包/类
@SubscribeEvent
public void unwatchChunk(ChunkWatchEvent.UnWatch event) {
    registrant.unregister(event.chunk.chunkXPos, event.chunk.chunkZPos);
}
 
开发者ID:ternsip,项目名称:StabilizerMod,代码行数:5,代码来源:Stabilizermod.java


示例10: onChunkWatch

import net.minecraftforge.event.world.ChunkWatchEvent; //导入依赖的package包/类
@SubscribeEvent
public void onChunkWatch(ChunkWatchEvent.Watch event) {
	long index = ChunkPos2Index(event.chunk.chunkXPos, event.chunk.chunkZPos);
	VintageTG.packetPipeline.sendTo(new ChunkPutNbt(index, VintageTG.proxy.getChunkNbt(index)), event.player);
}
 
开发者ID:tyronx,项目名称:vintagetg,代码行数:6,代码来源:VCraftWorld.java


示例11: onChunkUnWatch

import net.minecraftforge.event.world.ChunkWatchEvent; //导入依赖的package包/类
@SubscribeEvent
public void onChunkUnWatch(ChunkWatchEvent.UnWatch event) {
	long index = ChunkPos2Index(event.chunk.chunkXPos, event.chunk.chunkZPos);
	VintageTG.packetPipeline.sendTo(new ChunkRemoveNbt(index), event.player);
}
 
开发者ID:tyronx,项目名称:vintagetg,代码行数:6,代码来源:VCraftWorld.java


示例12: onChunkWatch

import net.minecraftforge.event.world.ChunkWatchEvent; //导入依赖的package包/类
@SubscribeEvent
public void onChunkWatch(ChunkWatchEvent.Watch event) {
	long index = ChunkPos2Index(event.chunk.chunkXPos, event.chunk.chunkZPos);
	VintageCraft.packetPipeline.sendTo(new ChunkPutNbtPacket(index, VintageCraft.proxy.getChunkNbt(index)), event.player);
}
 
开发者ID:tyronx,项目名称:vintagecraft,代码行数:6,代码来源:VCraftWorld.java


示例13: onChunkUnWatch

import net.minecraftforge.event.world.ChunkWatchEvent; //导入依赖的package包/类
@SubscribeEvent
public void onChunkUnWatch(ChunkWatchEvent.UnWatch event) {
	long index = ChunkPos2Index(event.chunk.chunkXPos, event.chunk.chunkZPos);
	VintageCraft.packetPipeline.sendTo(new ChunkRemoveNbtPacket(index), event.player);
}
 
开发者ID:tyronx,项目名称:vintagecraft,代码行数:6,代码来源:VCraftWorld.java


示例14: UnloadChunk

import net.minecraftforge.event.world.ChunkWatchEvent; //导入依赖的package包/类
@SubscribeEvent
public void UnloadChunk(ChunkWatchEvent.UnWatch event) {
    //FMLLog.info("UnloadChunk at (%s,%s) for %s", event.chunk.chunkXPos, event.chunk.chunkZPos, event.player.getDisplayName());
}
 
开发者ID:AnDwHaT5,项目名称:PixelUtilities,代码行数:5,代码来源:ChunkDataEventHandler.java


示例15: onUpdate

import net.minecraftforge.event.world.ChunkWatchEvent; //导入依赖的package包/类
/**
 * Called to update the entity's position/logic.
 */
public void onUpdate()
{
    this.theItemInWorldManager.updateBlockRemoving();
    --this.initialInvulnerability;
    this.openContainer.detectAndSendChanges();

    if (!this.worldObj.isRemote && !ForgeHooks.canInteractWith(this, this.openContainer))
    {
        this.closeScreen();
        this.openContainer = this.inventoryContainer;
    }

    while (!this.destroyedItemsNetCache.isEmpty())
    {
        int i = Math.min(this.destroyedItemsNetCache.size(), 127);
        int[] aint = new int[i];
        Iterator iterator = this.destroyedItemsNetCache.iterator();
        int j = 0;

        while (iterator.hasNext() && j < i)
        {
            aint[j++] = ((Integer)iterator.next()).intValue();
            iterator.remove();
        }

        this.playerNetServerHandler.sendPacketToPlayer(new Packet29DestroyEntity(aint));
    }

    if (!this.loadedChunks.isEmpty())
    {
        ArrayList arraylist = new ArrayList();
        Iterator iterator1 = this.loadedChunks.iterator();
        ArrayList arraylist1 = new ArrayList();

        while (iterator1.hasNext() && arraylist.size() < 5)
        {
            ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair)iterator1.next();
            iterator1.remove();

            if (chunkcoordintpair != null && this.worldObj.blockExists(chunkcoordintpair.chunkXPos << 4, 0, chunkcoordintpair.chunkZPos << 4))
            {
                arraylist.add(this.worldObj.getChunkFromChunkCoords(chunkcoordintpair.chunkXPos, chunkcoordintpair.chunkZPos));
                //BugFix: 16 makes it load an extra chunk, which isn't associated with a player, which makes it not unload unless a player walks near it.
                //ToDo: Find a way to efficiently clean abandoned chunks.
                //arraylist1.addAll(((WorldServer)this.worldObj).getAllTileEntityInBox(chunkcoordintpair.chunkXPos * 16, 0, chunkcoordintpair.chunkZPos * 16, chunkcoordintpair.chunkXPos * 16 + 16, 256, chunkcoordintpair.chunkZPos * 16 + 16));
                arraylist1.addAll(((WorldServer)this.worldObj).getAllTileEntityInBox(chunkcoordintpair.chunkXPos * 16, 0, chunkcoordintpair.chunkZPos * 16, chunkcoordintpair.chunkXPos * 16 + 15, 256, chunkcoordintpair.chunkZPos * 16 + 15));
            }
        }

        if (!arraylist.isEmpty())
        {
            this.playerNetServerHandler.sendPacketToPlayer(new Packet56MapChunks(arraylist));
            Iterator iterator2 = arraylist1.iterator();

            while (iterator2.hasNext())
            {
                TileEntity tileentity = (TileEntity)iterator2.next();
                this.sendTileEntityToPlayer(tileentity);
            }

            iterator2 = arraylist.iterator();

            while (iterator2.hasNext())
            {
                Chunk chunk = (Chunk)iterator2.next();
                this.getServerForPlayer().getEntityTracker().func_85172_a(this, chunk);
                MinecraftForge.EVENT_BUS.post(new ChunkWatchEvent.Watch(chunk.getChunkCoordIntPair(), this));
            }
        }
    }

    if (this.field_143005_bX > 0L && this.mcServer.func_143007_ar() > 0 && MinecraftServer.getSystemTimeMillis() - this.field_143005_bX > (long)(this.mcServer.func_143007_ar() * 1000 * 60))
    {
        this.playerNetServerHandler.kickPlayerFromServer("You have been idle for too long!");
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:80,代码来源:EntityPlayerMP.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HiveChar类代码示例发布时间:2022-05-21
下一篇:
Java Options类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap