/** Called whenever the block is added into the world. Args: world, x, y, z */
  public void onBlockAdded(World par1World, int par2, int par3, int par4) {
    super.onBlockAdded(par1World, par2, par3, par4);

    if (par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) {
      this.onBlockDestroyedByPlayer(par1World, par2, par3, par4, 1);
      par1World.setBlockToAir(par2, par3, par4);
    }
  }
示例#2
0
  /** Called whenever the block is added into the world. Args: world, x, y, z */
  public void onBlockAdded(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_) {
    super.onBlockAdded(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_);

    if (p_149726_1_.isBlockIndirectlyGettingPowered(p_149726_2_, p_149726_3_, p_149726_4_)) {
      this.onBlockDestroyedByPlayer(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_, 1);
      p_149726_1_.setBlockToAir(p_149726_2_, p_149726_3_, p_149726_4_);
    }
  }
示例#3
0
  @Override
  public void onBlockAdded(World worldIn, net.minecraft.util.math.BlockPos pos, IBlockState state) {
    super.onBlockAdded(worldIn, pos, state);
    int rng = Reference.RANDOM.nextInt(3);
    EnumType enumType = EnumType.byMetadata(rng);

    IBlockState outState = state.withProperty(BlockCrystal.PROPERTY_ENUM, enumType);

    worldIn.setBlockState(pos, outState);

    TileSource crystal = (TileSource) worldIn.getTileEntity(pos);
    crystal.setScanMode();
  }
  @Override
  public void onBlockAdded(World world, int i, int j, int k) {
    super.onBlockAdded(world, i, j, k);

    if (!world.isRemote) {
      this.updateAndPropagateCurrentStrength(world, i, j, k);
      this.notifyWireNeighborsOfNeighborChange(world, i - 1, j, k);
      this.notifyWireNeighborsOfNeighborChange(world, i + 1, j, k);
      this.notifyWireNeighborsOfNeighborChange(world, i, j, k - 1);
      this.notifyWireNeighborsOfNeighborChange(world, i, j, k + 1);
      this.notifyWireNeighborsOfNeighborChange(world, i, j + 1, k);
      this.notifyWireNeighborsOfNeighborChange(world, i, j - 1, k);
    }
  }
  protected boolean setHive(World world, int x, int y, int z, Hive hive) {
    Block hiveBlock = hive.getHiveBlock();
    boolean placed =
        world.setBlock(x, y, z, hiveBlock, hive.getHiveMeta(), Defaults.FLAG_BLOCK_SYNCH);
    if (!placed) {
      return false;
    }

    Block placedBlock = world.getBlock(x, y, z);
    if (!Block.isEqualTo(hiveBlock, placedBlock)) {
      return false;
    }

    hiveBlock.onBlockAdded(world, x, y, z);
    world.markBlockForUpdate(x, y, z);

    if (!Config.generateBeehivesDebug) {
      hive.postGen(world, x, y, z);
    }
    return true;
  }
 public void onBlockAdded(World par1World, int par2, int par3, int par4) {
   super.onBlockAdded(par1World, par2, par3, par4);
   this.setDefaultDirection(par1World, par2, par3, par4);
 }