本文整理汇总了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);
}
示例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();
}
示例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();
}