net.minecraft.world.World.checkLight()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(87)

本文整理了Java中net.minecraft.world.World.checkLight()方法的一些代码示例,展示了World.checkLight()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。World.checkLight()方法的具体详情如下:
包路径:net.minecraft.world.World
类名称:World
方法名:checkLight

World.checkLight介绍

暂无

代码示例

代码示例来源:origin: EngineHub/WorldEdit

newState = old;
world.checkLight(pos);
world.markAndNotifyBlock(pos, chunk, old, newState, UPDATE | NOTIFY);

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public void markForUpdate()
{
  super.markForUpdate();
  final boolean hasLight = this.getLightValue() > 0;
  if( hasLight != this.didHaveLight )
  {
    this.didHaveLight = hasLight;
    this.world.checkLight( this.pos );
    // world.updateAllLightTypes( xCoord, yCoord, zCoord );
  }
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public void markForUpdate()
{
  if( this.world == null )
  {
    return;
  }
  final int newLV = this.getCableBus().getLightValue();
  if( newLV != this.oldLV )
  {
    this.oldLV = newLV;
    this.world.checkLight( this.pos );
  }
  super.markForUpdate();
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
protected boolean readFromStream( final ByteBuf data ) throws IOException
{
  final boolean c = super.readFromStream( data );
  boolean ret = this.getCableBus().readFromStream( data );
  final int newLV = this.getCableBus().getLightValue();
  if( newLV != this.oldLV )
  {
    this.oldLV = newLV;
    this.world.checkLight( this.pos );
    ret = true;
  }
  this.updateTileSetting();
  return ret || c;
}

代码示例来源:origin: TheCBProject/EnderStorage

@Override
  public void onLiquidChanged() {
    world.checkLight(pos);
  }
}

代码示例来源:origin: SleepyTrousers/EnderIO

@Override
public boolean checkLight(@Nonnull BlockPos pos) {
 return wrapped.checkLight(pos);
}

代码示例来源:origin: Vazkii/Botania

world.checkLight(pos);
tile.setWater(false);
world.updateComparatorOutputLevel(pos, this);
world.checkLight(pos);
else tile.setWater(false);
world.updateComparatorOutputLevel(pos, this);
world.checkLight(pos);

代码示例来源:origin: amadornes/MCMultiPart

@Override
public boolean checkLight(BlockPos pos) {
  return getActualWorld().checkLight(pos);
}

代码示例来源:origin: CoFH/CoFHCore

@Override
@SideOnly (Side.CLIENT)
public void handleTilePacket(PacketBase payload) {
  customName = payload.getString();
  world.checkLight(pos);
}

代码示例来源:origin: GregTechCE/GregTech

private void updateLightValue() {
  int newLightValue = getLightValue();
  if(oldLightValue != newLightValue) {
    MetaTileEntityTank.this.oldLightValue = newLightValue;
    getWorld().checkLight(getPos());
  }
}

代码示例来源:origin: CyclopsMC/IntegratedDynamics

@Override
public void onUpdateReceived() {
  if(!lightLevels.equals(previousLightLevels)) {
    previousLightLevels = lightLevels;
    getWorld().checkLight(getPos());
  }
  cachedState = null;
}

代码示例来源: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: TeamWizardry/Wizardry

@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
  if (ItemNBTHelper.getBoolean(stack, Constants.NBT.FAIRY_INSIDE, false)) {
    TileEntity entity = worldIn.getTileEntity(pos);
    if (entity != null && entity instanceof TileJar) {
      TileJar jar = (TileJar) entity;
      jar.color = new Color(ItemNBTHelper.getInt(stack, Constants.NBT.FAIRY_COLOR, 0xFFFFFF));
      jar.age = ItemNBTHelper.getInt(stack, Constants.NBT.FAIRY_AGE, 0);
      jar.hasFairy = true;
      jar.markDirty();
      worldIn.checkLight(pos);
    }
  }
}

代码示例来源:origin: AlgorithmX2/Chisels-and-Bits

@Override
public void breakBlock(
    final World worldIn,
    final BlockPos pos,
    final IBlockState state )
{
  try
  {
    final TileEntityBlockChiseled tebc = getTileEntity( worldIn, pos );
    tebc.setNormalCube( false );
    worldIn.checkLight( pos );
  }
  catch ( final ExceptionNoTileEntity e )
  {
  }
  finally
  {
    super.breakBlock( worldIn, pos, state );
  }
}

代码示例来源:origin: GregTechCE/GregTech

@Override
public void update() {
  if(metaTileEntity != null) {
    metaTileEntity.update();
  }
  if(this.needToUpdateLightning) {
    getWorld().checkLight(getPos());
    this.needToUpdateLightning = false;
  }
  //increment only after current tick, so meta tile entities will get first tick as timer == 0
  //and update their settings which depend on getTimer() % N properly
  super.update();
}

代码示例来源:origin: AlgorithmX2/Chisels-and-Bits

@Override
public void onDataPacket(
    final NetworkManager net,
    final SPacketUpdateTileEntity pkt )
{
  final int oldLight = lightlevel;
  final boolean changed = readChisleData( pkt.getNbtCompound() );
  if ( worldObj != null && changed )
  {
    worldObj.markBlockRangeForRenderUpdate( pos, pos );
    triggerDynamicUpdates();
    // fixes lighting on placement when tile packet arrives.
    if ( oldLight != lightlevel )
    {
      worldObj.checkLight( pos );
    }
  }
}

代码示例来源:origin: AlgorithmX2/Chisels-and-Bits

private void saveAndUpdate()
{
  markDirty();
  ModUtil.sendUpdate( worldObj, getPos() );
  final int lv = getLightValue();
  if ( oldLV != lv )
  {
    getWorld().checkLight( getPos() );
    oldLV = lv;
  }
}

代码示例来源:origin: ForestryMC/ForestryMC

@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
  TileCandle tileCandle = TileUtil.getTile(world, pos, TileCandle.class);
  if (tileCandle != null) {
    int colour = getColourValueFromItemStack(stack);
    boolean isLit = isLit(stack);
    tileCandle.setColour(colour);
    tileCandle.setLit(isLit);
    if (tileCandle.isLit()) {
      world.profiler.startSection("checkLight");
      world.checkLight(pos);
      world.profiler.endSection();
    }
  }
}

代码示例来源: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);
}

相关文章

微信公众号

最新文章

更多

World类方法