本文整理了Java中net.minecraft.world.World.markAndNotifyBlock()
方法的一些代码示例,展示了World.markAndNotifyBlock()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。World.markAndNotifyBlock()
方法的具体详情如下:
包路径:net.minecraft.world.World
类名称:World
方法名:markAndNotifyBlock
暂无
代码示例来源:origin: EngineHub/WorldEdit
world.markAndNotifyBlock(pos, chunk, old, newState, UPDATE | NOTIFY);
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public void markAndNotifyBlock(@Nonnull BlockPos pos, @Nullable Chunk chunk, @Nonnull IBlockState iblockstate, @Nonnull IBlockState newState, int flags) {
wrapped.markAndNotifyBlock(pos, chunk, iblockstate, newState, flags);
}
代码示例来源:origin: blay09/CookingForBlockheads
@Override
protected void onContentsChanged(int slot) {
markDirty();
IBlockState blockState = world.getBlockState(pos);
world.markAndNotifyBlock(pos, world.getChunkFromBlockCoords(pos), blockState, blockState, 1 | 2);
}
};
代码示例来源:origin: blay09/CookingForBlockheads
@Override
protected void onContentsChanged(int slot) {
markDirty();
IBlockState blockState = world.getBlockState(pos);
world.markAndNotifyBlock(pos, world.getChunkFromBlockCoords(pos), blockState, blockState, 1 | 2);
}
};
代码示例来源:origin: blay09/CookingForBlockheads
@Override
protected void onContentsChanged(int slot) {
markDirty();
IBlockState blockState = world.getBlockState(pos);
world.markAndNotifyBlock(pos, world.getChunkFromBlockCoords(pos), blockState, blockState, 1 | 2);
}
};
代码示例来源:origin: blay09/CookingForBlockheads
public void setHasPowerUpgrade(boolean hasPowerUpgrade) {
this.hasPowerUpgrade = hasPowerUpgrade;
markDirty();
IBlockState state = world.getBlockState(pos);
world.markAndNotifyBlock(pos, world.getChunkFromBlockCoords(pos), state, state, 3);
}
代码示例来源:origin: blay09/CookingForBlockheads
public void markDirtyAndUpdate() {
IBlockState state = world.getBlockState(pos);
world.markAndNotifyBlock(pos, world.getChunkFromBlockCoords(pos), state, state, 3);
markDirty();
}
代码示例来源:origin: blay09/CookingForBlockheads
@Override
public void setDyedColor(EnumDyeColor color) {
this.color = color;
IBlockState state = world.getBlockState(pos);
world.markAndNotifyBlock(pos, world.getChunkFromBlockCoords(pos), state, state, 3);
markDirty();
}
代码示例来源:origin: blay09/CookingForBlockheads
@Override
public void setDyedColor(EnumDyeColor color) {
this.color = color;
IBlockState state = world.getBlockState(pos);
world.markAndNotifyBlock(pos, world.getChunkFromBlockCoords(pos), state, state, 3);
markDirty();
}
代码示例来源:origin: blay09/CookingForBlockheads
@Override
public void setDyedColor(EnumDyeColor color) {
this.color = color;
IBlockState state = world.getBlockState(pos);
world.markAndNotifyBlock(pos, world.getChunkFromBlockCoords(pos), state, state, 3);
markDirty();
}
}
代码示例来源:origin: blay09/CookingForBlockheads
@Override
public void setDyedColor(EnumDyeColor color) {
this.color = color;
IBlockState state = world.getBlockState(pos);
world.markAndNotifyBlock(pos, world.getChunkFromBlockCoords(pos), state, state, 3);
markDirty();
}
}
代码示例来源:origin: WayofTime/BloodMagic
@Override
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
boolean success = FluidUtil.interactWithFluidHandler(player, hand, world, blockPos, side);
if (success) {
world.checkLight(blockPos);
world.updateComparatorOutputLevel(blockPos, this);
world.markAndNotifyBlock(blockPos, world.getChunkFromBlockCoords(blockPos), state, state, 3);
return true;
}
return true;
}
代码示例来源:origin: blay09/CookingForBlockheads
@Override
public boolean receiveClientEvent(int id, int type) {
if (id == 0) {
world.playSound(null, pos, ModSounds.toasterStart, SoundCategory.BLOCKS, 1f, 1f);
return true;
} else if (id == 1) {
world.playSound(null, pos, ModSounds.toasterStop, SoundCategory.BLOCKS, 1f, 1f);
return true;
} else if (id == 2) {
IBlockState state = world.getBlockState(pos);
world.markAndNotifyBlock(pos, world.getChunkFromBlockCoords(pos), state, state, 3);
return true;
}
return super.receiveClientEvent(id, type);
}
代码示例来源:origin: MCTCP/TerrainControl
@Override
public void setBlock(int x, int y, int z, LocalMaterialData material) {
/*
* This method usually breaks on every Minecraft update. Always check
* whether the names are still correct. Often, you'll also need to
* rewrite parts of this method for newer block place logic.
*/
if (y < TerrainControl.WORLD_DEPTH || y >= TerrainControl.WORLD_HEIGHT) {
return;
}
BlockFalling.fallInstantly=true;
IBlockState newState = ((ForgeMaterialData) material).internalBlock();
// Get chunk from (faster) custom cache
Chunk chunk = this.getChunk(x, y, z);
if (chunk == null) {
// Chunk is unloaded
return;
}
BlockPos pos = new BlockPos(x, y, z);
IBlockState oldState = chunk.setBlockState(pos, newState);
if (oldState == null) {
return;
}
// Notify world: (2 | 16) == update client, don't update observers
this.world.markAndNotifyBlock(pos, chunk, oldState, newState, 2 | 16);
BlockFalling.fallInstantly=false;
}
代码示例来源:origin: blay09/CookingForBlockheads
public void setActive(boolean active) {
this.active = active;
if (active) {
toastTicks = TOAST_TICKS;
world.addBlockEvent(pos, ModBlocks.toaster, 0, 0);
} else {
toastTicks = 0;
world.addBlockEvent(pos, ModBlocks.toaster, 1, 0);
}
IBlockState state = world.getBlockState(pos);
world.addBlockEvent(pos, ModBlocks.toaster, 2, 0);
world.markAndNotifyBlock(pos, world.getChunkFromBlockCoords(pos), state, ModBlocks.toaster.getActualState(state, world, pos), 3);
markDirty();
}
代码示例来源:origin: WayofTime/BloodMagic
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState blockState, EntityLivingBase placer, ItemStack stack) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileBloodTank) {
TileBloodTank bloodTank = (TileBloodTank) tile;
NBTTagCompound tag = stack.getTagCompound();
if (stack.hasTagCompound() && stack.getTagCompound().hasKey("Fluid")) {
FluidStack fluidStack = FluidStack.loadFluidStackFromNBT(tag.getCompoundTag("Fluid"));
bloodTank.getTank().setFluid(fluidStack);
}
}
world.checkLight(pos);
world.updateComparatorOutputLevel(pos, this);
world.markAndNotifyBlock(pos, world.getChunkFromBlockCoords(pos), blockState, blockState, 3);
}
代码示例来源:origin: RS485/LogisticsPipes
@Override
protected void updateWorldState() {
//super.updateWorldState();
LPTickHandler.getWorldInfo(getWorld()).setSkipBlockUpdateForWorld(true);
IBlockState prevSt = this.getWorld().getBlockState(this.getPos());
IBlockState st = this.getWorld().getBlockState(this.getPos());
this.getWorld().markAndNotifyBlock(this.getPos(), (Chunk)null, prevSt, st, 1);
this.getWorld().checkLight(this.getPos());
LPTickHandler.getWorldInfo(getWorld()).setSkipBlockUpdateForWorld(true);
}
代码示例来源:origin: RS485/LogisticsPipes
@SubscribeEvent
public void onPlayerLeftClickBlock(final PlayerInteractEvent.LeftClickBlock event) {
if (MainProxy.isServer(event.getEntityPlayer().world)) {
final TileEntity tile = event.getEntityPlayer().world.getTileEntity(event.getPos());
if (tile instanceof LogisticsTileGenericPipe) {
if (((LogisticsTileGenericPipe) tile).pipe instanceof CoreRoutedPipe) {
if (!((CoreRoutedPipe) ((LogisticsTileGenericPipe) tile).pipe).canBeDestroyedByPlayer(event.getEntityPlayer())) {
event.setCanceled(true);
event.getEntityPlayer().sendMessage(new TextComponentTranslation("lp.chat.permissiondenied"));
((LogisticsTileGenericPipe) tile).scheduleNeighborChange();
World world = event.getEntityPlayer().world;
BlockPos pos = tile.getPos();
IBlockState state = world.getBlockState(pos);
world.markAndNotifyBlock(tile.getPos(), world.getChunkFromBlockCoords(pos), state, state, 2);
((CoreRoutedPipe) ((LogisticsTileGenericPipe) tile).pipe).delayTo = System.currentTimeMillis() + 200;
((CoreRoutedPipe) ((LogisticsTileGenericPipe) tile).pipe).repeatFor = 10;
} else {
((CoreRoutedPipe) ((LogisticsTileGenericPipe) tile).pipe).setDestroyByPlayer();
}
}
}
}
}
代码示例来源:origin: amadornes/MCMultiPart
getWorld().markAndNotifyBlock(getPos(), null, prevSt, st, 1); // Only cause a block update, clients are notified through a packet
getWorld().checkLight(getPos());
代码示例来源:origin: RS485/LogisticsPipes
private static void cacheTileToPreventRemoval(CoreUnroutedPipe pipe) {
final World worldCache = pipe.getWorld();
final BlockPos posCache = pipe.getPos();
final TileEntity tileCache = pipe.container;
final CoreUnroutedPipe fPipe = pipe;
fPipe.setPreventRemove(true);
QueuedTasks.queueTask(() -> {
if (!fPipe.preventRemove()) {
return null;
}
boolean changed = false;
if (worldCache.getBlockState(posCache) != null || worldCache.getBlockState(posCache).getBlock() != LPBlocks.pipe) {
worldCache.setBlockState(posCache, LPBlocks.pipe.getDefaultState());
changed = true;
}
if (worldCache.getTileEntity(posCache) != tileCache) {
worldCache.setTileEntity(posCache, tileCache);
changed = true;
}
if (changed) {
worldCache.markAndNotifyBlock(posCache, worldCache.getChunkFromBlockCoords(posCache), worldCache.getBlockState(posCache), worldCache.getBlockState(posCache), 3);
}
fPipe.setPreventRemove(false);
return null;
});
}
内容来源于网络,如有侵权,请联系作者删除!