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


Java Chunk.markDirty方法代码示例

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


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

示例1: onServerTick

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
@SubscribeEvent
public void onServerTick(TickEvent.ServerTickEvent event) {
    for (ISemiBlock semiBlock : addingBlocks) {
        Chunk chunk = semiBlock.getWorld().getChunkFromBlockCoords(semiBlock.getPos());
        addPendingBlock(chunk, semiBlock);
        chunk.markDirty();

        for (EntityPlayer player : syncList.get(chunk)) {
            NetworkHandler.sendTo(new PacketAddSemiBlock(semiBlock), (EntityPlayerMP) player);
            PacketDescription descPacket = semiBlock.getDescriptionPacket();
            if (descPacket != null) NetworkHandler.sendTo(descPacket, (EntityPlayerMP) player);
        }
    }
    addingBlocks.clear();

    for (Chunk removingChunk : chunksMarkedForRemoval) {
        if (!removingChunk.isLoaded()) {
            semiBlocks.remove(removingChunk);
            syncList.remove(removingChunk);
        }
    }
    chunksMarkedForRemoval.clear();

    semiBlocks.values().forEach(this::update);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:26,代码来源:SemiBlockManager.java

示例2: removeSemiBlock

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
public void removeSemiBlock(ISemiBlock semiBlock){
    Validate.notNull(semiBlock);
    
    int index = semiBlock.getIndex();
    semiBlock.invalidate();
    
    //Notify other semi blocks in the same pos
    World world = semiBlock.getWorld();
    BlockPos pos = semiBlock.getPos();
    Chunk chunk = world.getChunkFromBlockCoords(pos);
    List<ISemiBlock> currentBlocks = getOrCreateMap(chunk).get(pos);
    currentBlocks.forEach(s -> s.onSemiBlockRemovedFromThisPos(semiBlock));
    for (EntityPlayer player : syncList.get(chunk)) {
        NetworkHandler.sendTo(new PacketRemoveSemiBlock(semiBlock, index), (EntityPlayerMP) player);
    }
    chunk.markDirty();
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:18,代码来源:SemiBlockManager.java

示例3: addSemiBlock

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
/**
 * Queue an addition of a semi block. Don't do it immediately, because CME's.
 * @param world
 * @param pos
 * @param semiBlock
 * @param chunk
 */
private void addSemiBlock(World world, BlockPos pos, ISemiBlock semiBlock, Chunk chunk) {
    Validate.notNull(semiBlock);
    if (!registeredTypes.containsValue(semiBlock.getClass()))
        throw new IllegalStateException("ISemiBlock \"" + semiBlock + "\" was not registered!");
            
    if (semiBlock != null) {
        semiBlock.initialize(world, pos);
        addingBlocks.add(semiBlock);
    }
    
    chunk.markDirty();
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:20,代码来源:SemiBlockManager.java


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