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

Java PlayerChunkMapEntry类代码示例

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

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



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

示例1: set

import net.minecraft.server.management.PlayerChunkMapEntry; //导入依赖的package包/类
@Override
public void set(GlobalChunkPos pos, float value)
{
    if (loaded.containsKey(pos))
        if (loaded.get(pos).equals(value))
            return;
    loaded.put(pos, value);
    WorldServer wrld = DimensionManager.getWorld(pos.getDimension());
    wrld.getChunkFromChunkCoords(pos.getX(), pos.getZ()).markDirty();
    PlayerChunkMapEntry map = wrld.getPlayerChunkMap().getEntry(pos.getX(), pos.getZ());
    if (map != null)
    {
        for (EntityPlayerMP p : map.players)
        {
            NetworkManager.sendTo(new CPacketSyncSif(pos, value), p);
        }
    }
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:19,代码来源:SifStorageServer.java


示例2: removeBlock

import net.minecraft.server.management.PlayerChunkMapEntry; //导入依赖的package包/类
private void removeBlock(BlockPos pos) {
	if(pos.getY() < 0 || pos.getY() >= 256)return;
    Chunk chunk = getChunk(pos);
    IBlockState oldState = chunk.getBlockState(pos);

    if (oldState.getBlock().hasTileEntity(oldState)) {
        serverWorld.setBlockToAir(pos);

        PlayerChunkMap playerChunkMap = serverWorld.getPlayerChunkMap();
        if (playerChunkMap != null) {
            PlayerChunkMapEntry watcher = playerChunkMap.getEntry(pos.getX() >> 4, pos.getZ() >> 4);
            if (watcher != null) {
                watcher.sendPacket(new SPacketBlockChange(serverWorld, pos));
            }
        }
    }

    ExtendedBlockStorage storage = getBlockStorage(pos);
    if(storage !=null){
    	storage.set(pos.getX() & 15, pos.getY() & 15, pos.getZ() & 15, AIR);
    }
    setChunkModified(pos);
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:24,代码来源:ExplosionMaker.java


示例3: finishChunks

import net.minecraft.server.management.PlayerChunkMapEntry; //导入依赖的package包/类
public void finishChunks() {
    PlayerChunkMap playerChunkMap = serverWorld.getPlayerChunkMap();
    if (playerChunkMap == null) {
        return;
    }

    for (Chunk chunk : modifiedChunks) {
        chunk.setModified(true);
        chunk.generateSkylightMap(); //This is where this falls short. It can calculate basic sky lighting for blocks exposed to the sky but thats it.

        PlayerChunkMapEntry watcher = playerChunkMap.getEntry(chunk.xPosition, chunk.zPosition);
        if (watcher != null) {
            watcher.sendPacket(new SPacketChunkData(chunk, 65535));
        }
    }

    modifiedChunks.clear();
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:19,代码来源:ExplosionMaker.java


示例4: performOperation

import net.minecraft.server.management.PlayerChunkMapEntry; //导入依赖的package包/类
@Override
public int performOperation(Region region, PositionIterator chunk, World world, Chunk c, VectorMap<BlockData> blockMap,
        MutableVectorMap<IBlockState> hitStore) {
    // send the whole chunk again
    PlayerChunkMapEntry entry = ((WorldServer) world).getPlayerChunkMap().getEntry(c.x, c.z);
    if (entry != null) {
        entry.sendPacket(new SPacketChunkData(c, SPCD_SEND_ALL));
    }
    return 1;
}
 
开发者ID:kenzierocks,项目名称:HardVox,代码行数:11,代码来源:OpSendChunks.java


示例5: remove

import net.minecraft.server.management.PlayerChunkMapEntry; //导入依赖的package包/类
@Override
public void remove(GlobalChunkPos pos)
{
    if (!loaded.containsKey(pos))
        return;
    loaded.remove(pos);
    PlayerChunkMapEntry map = DimensionManager.getWorld(pos.getDimension()).getPlayerChunkMap().getEntry(pos.getX(), pos.getZ());
    if (map != null)
    {
        for (EntityPlayerMP p : map.players)
        {
            NetworkManager.sendTo(new CPacketDesyncSif(pos), p);
        }
    }
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:16,代码来源:SifStorageServer.java


示例6: sendToChunk

import net.minecraft.server.management.PlayerChunkMapEntry; //导入依赖的package包/类
public static void sendToChunk(Packet packet, World world, int chunkX, int chunkZ) {

        PlayerChunkMapEntry playerInstance = ((WorldServer) world).getPlayerChunkMap().getEntry(chunkX, chunkZ);
        if (playerInstance != null) {
            playerInstance.sendPacket(packet);
        }
    }
 
开发者ID:TheCBProject,项目名称:CodeChickenLib,代码行数:8,代码来源:PacketCustom.java


示例7: regenerateChunk

import net.minecraft.server.management.PlayerChunkMapEntry; //导入依赖的package包/类
public static boolean regenerateChunk(Chunk chunk) {
    boolean unload = unloadChunk(chunk);
    ChunkProviderServer chunkProviderServer = (ChunkProviderServer) chunk.getWorld().getChunkProvider();

    Chunk newChunk = chunkProviderServer.chunkGenerator.generateChunk(chunk.x, chunk.z);
    PlayerChunkMapEntry playerChunk = ((WorldServer) chunk.getWorld()).getPlayerChunkMap().getEntry(chunk.x, chunk.z);
    if (playerChunk != null) {
        playerChunk.chunk = newChunk;
    }

    chunkLoadPostProcess(newChunk);
    refreshChunk(newChunk);
    return newChunk != null;
}
 
开发者ID:MinecraftPortCentral,项目名称:GriefPrevention,代码行数:15,代码来源:BlockUtils.java


示例8: getPlayersWatchingChunk

import net.minecraft.server.management.PlayerChunkMapEntry; //导入依赖的package包/类
public static Set<EntityPlayerMP> getPlayersWatchingChunk(WorldServer world, int chunkX, int chunkZ) {
	final PlayerChunkMapEntry playerChunkMap = world.getPlayerChunkMap().getEntry(chunkX, chunkZ);

	final Set<EntityPlayerMP> playerList = Sets.newHashSet();
	if (playerChunkMap == null || !playerChunkMap.isSentToPlayers())
		return playerList;

	for (EntityPlayer o : world.playerEntities) {
		EntityPlayerMP player = (EntityPlayerMP)o;
		if (playerChunkMap.containsPlayer(player)) playerList.add(player);
	}
	return playerList;
}
 
开发者ID:OpenMods,项目名称:OpenModsLib,代码行数:14,代码来源:NetUtils.java


示例9: regenerateChunk

import net.minecraft.server.management.PlayerChunkMapEntry; //导入依赖的package包/类
@Override
public boolean regenerateChunk(World world, int x, int z, BaseBiome biome, Long seed) {
    IChunkProvider provider = world.getChunkProvider();
    if (!(provider instanceof ChunkProviderServer)) {
        return false;
    }


    try {
        ChunkProviderServer chunkServer = (ChunkProviderServer) provider;
        IChunkGenerator gen = chunkServer.chunkGenerator;
        long pos = ChunkPos.chunkXZ2Int(x, z);
        Chunk mcChunk;
        if (chunkServer.chunkExists(x, z)) {
            mcChunk = chunkServer.loadChunk(x, z);
            mcChunk.onChunkUnload();
        }
        PlayerChunkMap playerManager = ((WorldServer) getWorld()).getPlayerChunkMap();
        List<EntityPlayerMP> oldWatchers = null;
        if (chunkServer.chunkExists(x, z)) {
            mcChunk = chunkServer.loadChunk(x, z);
            PlayerChunkMapEntry entry = playerManager.getEntry(x, z);
            if (entry != null) {
                Field fieldPlayers = PlayerChunkMapEntry.class.getDeclaredField("field_187283_c");
                fieldPlayers.setAccessible(true);
                oldWatchers = (List<EntityPlayerMP>) fieldPlayers.get(entry);
                playerManager.removeEntry(entry);
            }
            mcChunk.onChunkUnload();
        }
        try {
            Field droppedChunksSetField = chunkServer.getClass().getDeclaredField("field_73248_b");
            droppedChunksSetField.setAccessible(true);
            Set droppedChunksSet = (Set) droppedChunksSetField.get(chunkServer);
            droppedChunksSet.remove(pos);
        } catch (Throwable e) {
            MainUtil.handleError(e);
        }
        chunkServer.id2ChunkMap.remove(pos);
        mcChunk = gen.provideChunk(x, z);
        chunkServer.id2ChunkMap.put(pos, mcChunk);
        if (mcChunk != null) {
            mcChunk.onChunkLoad();
            mcChunk.populateChunk(chunkServer, chunkServer.chunkGenerator);
        }
        if (oldWatchers != null) {
            for (EntityPlayerMP player : oldWatchers) {
                playerManager.addPlayer(player);
            }
        }
        return true;
    } catch (Throwable t) {
        MainUtil.handleError(t);
        return false;
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:57,代码来源:ForgeQueue_All.java


示例10: regenerateChunk

import net.minecraft.server.management.PlayerChunkMapEntry; //导入依赖的package包/类
public boolean regenerateChunk(net.minecraft.world.World world, int x, int z) {
    IChunkProvider provider = world.getChunkProvider();
    if (!(provider instanceof ChunkProviderServer)) {
        return false;
    }
    BlockFalling.fallInstantly = true;
    try {
        ChunkProviderServer chunkServer = (ChunkProviderServer) provider;
        IChunkGenerator gen = (IChunkGenerator) fieldChunkGenerator.get(chunkServer);
        long pos = ChunkPos.asLong(x, z);
        Chunk mcChunk;
        if (chunkServer.chunkExists(x, z)) {
            mcChunk = chunkServer.loadChunk(x, z);
            mcChunk.onChunkUnload();
        }
        PlayerChunkMap playerManager = ((WorldServer) getWorld()).getPlayerChunkMap();
        List<EntityPlayerMP> oldWatchers = null;
        if (chunkServer.chunkExists(x, z)) {
            mcChunk = chunkServer.loadChunk(x, z);
            PlayerChunkMapEntry entry = playerManager.getEntry(x, z);
            if (entry != null) {
                Field fieldPlayers = PlayerChunkMapEntry.class.getDeclaredField("field_187283_c");
                fieldPlayers.setAccessible(true);
                oldWatchers = (List<EntityPlayerMP>) fieldPlayers.get(entry);
                playerManager.removeEntry(entry);
            }
            mcChunk.onChunkUnload();
        }
        try {
            Field droppedChunksSetField = chunkServer.getClass().getDeclaredField("field_73248_b");
            droppedChunksSetField.setAccessible(true);
            Set droppedChunksSet = (Set) droppedChunksSetField.get(chunkServer);
            droppedChunksSet.remove(pos);
        } catch (Throwable e) {
            MainUtil.handleError(e);
        }
        Long2ObjectMap<Chunk> id2ChunkMap = (Long2ObjectMap<Chunk>) fieldId2ChunkMap.get(chunkServer);
        id2ChunkMap.remove(pos);
        mcChunk = gen.provideChunk(x, z);
        id2ChunkMap.put(pos, mcChunk);
        if (mcChunk != null) {
            mcChunk.onChunkLoad();
            mcChunk.populateChunk(chunkServer, gen);
        }
        if (oldWatchers != null) {
            for (EntityPlayerMP player : oldWatchers) {
                playerManager.addPlayer(player);
            }
        }
        return true;
    } catch (Throwable t) {
        MainUtil.handleError(t);
        return false;
    } finally {
        BlockFalling.fallInstantly = false;
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:58,代码来源:SpongeQueue_1_11.java


示例11: regenerateChunk

import net.minecraft.server.management.PlayerChunkMapEntry; //导入依赖的package包/类
public boolean regenerateChunk(net.minecraft.world.World world, int x, int z) {
    IChunkProvider provider = world.getChunkProvider();
    if (!(provider instanceof ChunkProviderServer)) {
        return false;
    }
    BlockFalling.fallInstantly = true;
    try {
        ChunkProviderServer chunkServer = (ChunkProviderServer) provider;
        IChunkGenerator gen = (IChunkGenerator) fieldChunkGenerator.get(chunkServer);
        long pos = ChunkPos.asLong(x, z);
        Chunk mcChunk;
        if (chunkServer.chunkExists(x, z)) {
            mcChunk = chunkServer.loadChunk(x, z);
            mcChunk.onUnload();
        }
        PlayerChunkMap playerManager = ((WorldServer) getWorld()).getPlayerChunkMap();
        List<EntityPlayerMP> oldWatchers = null;
        if (chunkServer.chunkExists(x, z)) {
            mcChunk = chunkServer.loadChunk(x, z);
            PlayerChunkMapEntry entry = playerManager.getEntry(x, z);
            if (entry != null) {
                Field fieldPlayers = PlayerChunkMapEntry.class.getDeclaredField("field_187283_c");
                fieldPlayers.setAccessible(true);
                oldWatchers = (List<EntityPlayerMP>) fieldPlayers.get(entry);
                playerManager.removeEntry(entry);
            }
            mcChunk.onUnload();
        }
        try {
            Field droppedChunksSetField = chunkServer.getClass().getDeclaredField("field_73248_b");
            droppedChunksSetField.setAccessible(true);
            Set droppedChunksSet = (Set) droppedChunksSetField.get(chunkServer);
            droppedChunksSet.remove(pos);
        } catch (Throwable e) {
            MainUtil.handleError(e);
        }
        Long2ObjectMap<Chunk> id2ChunkMap = (Long2ObjectMap<Chunk>) fieldId2ChunkMap.get(chunkServer);
        id2ChunkMap.remove(pos);
        mcChunk = gen.generateChunk(x, z);
        id2ChunkMap.put(pos, mcChunk);
        if (mcChunk != null) {
            mcChunk.onLoad();
            mcChunk.populate(chunkServer, gen);
        }
        if (oldWatchers != null) {
            for (EntityPlayerMP player : oldWatchers) {
                playerManager.addPlayer(player);
            }
        }
        return true;
    } catch (Throwable t) {
        MainUtil.handleError(t);
        return false;
    } finally {
        BlockFalling.fallInstantly = false;
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:58,代码来源:SpongeQueue_1_12.java


示例12: regenerateChunk

import net.minecraft.server.management.PlayerChunkMapEntry; //导入依赖的package包/类
public boolean regenerateChunk(World world, int x, int z) {
    IChunkProvider provider = world.getChunkProvider();
    if (!(provider instanceof ChunkProviderServer)) {
        return false;
    }
    BlockFalling.fallInstantly = true;
    try {
        ChunkProviderServer chunkServer = (ChunkProviderServer) provider;
        IChunkGenerator gen = (IChunkGenerator) fieldChunkGenerator.get(chunkServer);
        long pos = ChunkPos.asLong(x, z);
        Chunk mcChunk;
        if (chunkServer.chunkExists(x, z)) {
            mcChunk = chunkServer.loadChunk(x, z);
            mcChunk.onUnload();
        }
        PlayerChunkMap playerManager = ((WorldServer) getWorld()).getPlayerChunkMap();
        List<EntityPlayerMP> oldWatchers = null;
        if (chunkServer.chunkExists(x, z)) {
            mcChunk = chunkServer.loadChunk(x, z);
            PlayerChunkMapEntry entry = playerManager.getEntry(x, z);
            if (entry != null) {
                Field fieldPlayers = PlayerChunkMapEntry.class.getDeclaredField("field_187283_c");
                fieldPlayers.setAccessible(true);
                oldWatchers = (List<EntityPlayerMP>) fieldPlayers.get(entry);
                playerManager.removeEntry(entry);
            }
            mcChunk.onUnload();
        }
        try {
            Field droppedChunksSetField = chunkServer.getClass().getDeclaredField("field_73248_b");
            droppedChunksSetField.setAccessible(true);
            Set droppedChunksSet = (Set) droppedChunksSetField.get(chunkServer);
            droppedChunksSet.remove(pos);
        } catch (Throwable e) {
            MainUtil.handleError(e);
        }
        Long2ObjectMap<Chunk> id2ChunkMap = chunkServer.id2ChunkMap;
        id2ChunkMap.remove(pos);
        mcChunk = gen.generateChunk(x, z);
        id2ChunkMap.put(pos, mcChunk);
        if (mcChunk != null) {
            mcChunk.onLoad();
            mcChunk.populate(chunkServer, gen);
        }
        if (oldWatchers != null) {
            for (EntityPlayerMP player : oldWatchers) {
                playerManager.addPlayer(player);
            }
        }
        return true;
    } catch (Throwable t) {
        MainUtil.handleError(t);
        return false;
    } finally {
        BlockFalling.fallInstantly = false;
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:58,代码来源:ForgeQueue_All.java


示例13: regenerateChunk

import net.minecraft.server.management.PlayerChunkMapEntry; //导入依赖的package包/类
@Override
public boolean regenerateChunk(World world, int x, int z, BaseBiome biome, Long seed) {
    IChunkProvider provider = world.getChunkProvider();
    if (!(provider instanceof ChunkProviderServer)) {
        return false;
    }
    try {
        ChunkProviderServer chunkServer = (ChunkProviderServer) provider;
        IChunkGenerator gen = chunkServer.chunkGenerator;
        long pos = ChunkPos.chunkXZ2Int(x, z);
        Chunk mcChunk;
        if (chunkServer.chunkExists(x, z)) {
            mcChunk = chunkServer.loadChunk(x, z);
            mcChunk.onChunkUnload();
        }
        PlayerChunkMap playerManager = ((WorldServer) getWorld()).getPlayerChunkMap();
        List<EntityPlayerMP> oldWatchers = null;
        if (chunkServer.chunkExists(x, z)) {
            mcChunk = chunkServer.loadChunk(x, z);
            PlayerChunkMapEntry entry = playerManager.getEntry(x, z);
            if (entry != null) {
                Field fieldPlayers = PlayerChunkMapEntry.class.getDeclaredField("field_187283_c");
                fieldPlayers.setAccessible(true);
                oldWatchers = (List<EntityPlayerMP>) fieldPlayers.get(entry);
                playerManager.removeEntry(entry);
            }
            mcChunk.onChunkUnload();
        }
        try {
            Field droppedChunksSetField = chunkServer.getClass().getDeclaredField("field_73248_b");
            droppedChunksSetField.setAccessible(true);
            Set droppedChunksSet = (Set) droppedChunksSetField.get(chunkServer);
            droppedChunksSet.remove(pos);
        } catch (Throwable e) {
            MainUtil.handleError(e);
        }
        chunkServer.id2ChunkMap.remove(pos);
        mcChunk = gen.provideChunk(x, z);
        chunkServer.id2ChunkMap.put(pos, mcChunk);
        if (mcChunk != null) {
            mcChunk.onChunkLoad();
            mcChunk.populateChunk(chunkServer, chunkServer.chunkGenerator);
        }
        if (oldWatchers != null) {
            for (EntityPlayerMP player : oldWatchers) {
                playerManager.addPlayer(player);
            }
        }
        return true;
    } catch (Throwable t) {
        MainUtil.handleError(t);
        return false;
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:55,代码来源:ForgeQueue_All.java


示例14: regenerateChunk

import net.minecraft.server.management.PlayerChunkMapEntry; //导入依赖的package包/类
public boolean regenerateChunk(World world, int x, int z) {
    IChunkProvider provider = world.getChunkProvider();
    if (!(provider instanceof ChunkProviderServer)) {
        return false;
    }
    BlockFalling.fallInstantly = true;
    try {
        ChunkProviderServer chunkServer = (ChunkProviderServer) provider;
        IChunkGenerator gen = chunkServer.chunkGenerator;
        long pos = ChunkPos.asLong(x, z);
        Chunk mcChunk;
        if (chunkServer.chunkExists(x, z)) {
            mcChunk = chunkServer.loadChunk(x, z);
            mcChunk.onChunkUnload();
        }
        PlayerChunkMap playerManager = ((WorldServer) getWorld()).getPlayerChunkMap();
        List<EntityPlayerMP> oldWatchers = null;
        if (chunkServer.chunkExists(x, z)) {
            mcChunk = chunkServer.loadChunk(x, z);
            PlayerChunkMapEntry entry = playerManager.getEntry(x, z);
            if (entry != null) {
                Field fieldPlayers = PlayerChunkMapEntry.class.getDeclaredField("field_187283_c");
                fieldPlayers.setAccessible(true);
                oldWatchers = (List<EntityPlayerMP>) fieldPlayers.get(entry);
                playerManager.removeEntry(entry);
            }
            mcChunk.onChunkUnload();
        }
        try {
            Field droppedChunksSetField = chunkServer.getClass().getDeclaredField("field_73248_b");
            droppedChunksSetField.setAccessible(true);
            Set droppedChunksSet = (Set) droppedChunksSetField.get(chunkServer);
            droppedChunksSet.remove(pos);
        } catch (Throwable e) {
            MainUtil.handleError(e);
        }
        chunkServer.id2ChunkMap.remove(pos);
        mcChunk = gen.provideChunk(x, z);
        chunkServer.id2ChunkMap.put(pos, mcChunk);
        if (mcChunk != null) {
            mcChunk.onChunkLoad();
            mcChunk.populateChunk(chunkServer, chunkServer.chunkGenerator);
        }
        if (oldWatchers != null) {
            for (EntityPlayerMP player : oldWatchers) {
                playerManager.addPlayer(player);
            }
        }
        return true;
    } catch (Throwable t) {
        MainUtil.handleError(t);
        return false;
    } finally {
        BlockFalling.fallInstantly = false;
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:57,代码来源:ForgeQueue_All.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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