Exemplo n.º 1
0
  public void doTallImpact(
      World var1, ItemStack var2, EntityHuman var3, int var4, int var5, int var6, double var7) {
    cleanDroplist(var2);

    for (int var9 = -1; var9 <= 1; var9++) {
      int var10 = var4;
      int var11 = var5;
      int var12 = var6;

      if (var9 == 0) continue;
      if ((var7 != 0.0D) && (var7 != 1.0D)) {
        var11 = var5 + var9;
      } else if ((EEBase.heading(var3) != 2.0D) && (EEBase.heading(var3) != 4.0D)) {
        var10 = var4 + var9;
      } else {
        var12 = var6 + var9;
      }

      int var13 = var1.getTypeId(var10, var11, var12);
      int var14 = var1.getData(var10, var11, var12);

      if (!canBreak(var13, var14)) continue;
      scanBlockAndBreak(var3, var1, var2, var10, var11, var12);
    }

    ejectDropList(var1, var2, var4, var5 + 0.5D, var6);
  }
Exemplo n.º 2
0
  public void doBreakShovel(
      World var1, EntityHuman var2, ItemStack var3, int var4, int var5, int var6, int var7) {
    int typeId = var1.getTypeId(var5, var6, var7);
    int var8 = var1.getData(var5, var6, var7);
    ArrayList var9 = Block.byId[var4].getBlockDropped(var1, var5, var6, var7, var8, 0);
    Iterator var10 = var9.iterator();

    if (!breakBlock(null, var2, var1, var5, var6, var7, typeId, var8)) return;

    while (var10.hasNext()) {
      ItemStack var11 = (ItemStack) var10.next();
      addToDroplist(var3, var11);
    }

    BigWorldHook.setTypeIdHooked(var1, var5, var6, var7, 0);

    for (int var14 = -1; var14 <= 1; var14++) {
      for (int var13 = -1; var13 <= 1; var13++) {
        for (int var12 = -1; var12 <= 1; var12++) {
          if (var1.getTypeId(var5 + var14, var6 + var13, var7 + var12) != var4) continue;
          doBreakShovelAdd(var1, var2, var3, var4, var5 + var14, var6 + var13, var7 + var12);
        }
      }
    }

    if (var1.random.nextInt(8) == 0) {
      var1.a("largesmoke", var5, var6 + 1, var7, 0.0D, 0.0D, 0.0D);
    }

    if (var1.random.nextInt(8) == 0) {
      var1.a("explode", var5, var6 + 1, var7, 0.0D, 0.0D, 0.0D);
    }
    ejectDropList(var1, var3, var5, var6, var7);
  }
  public boolean a(World var1, Random var2, int var3, int var4, int var5) {
    if (ExtrabiomesBlock.quickSand != null) {
      while (var1.isEmpty(var3, var4, var5) && var4 > 2) {
        --var4;
      }

      if (var1.getTypeId(var3, var4, var5) != Block.GRASS.id) {
        return false;
      }

      int var6;
      int var7;

      for (var6 = -2; var6 <= 2; ++var6) {
        for (var7 = -2; var7 <= 2; ++var7) {
          if (var1.isEmpty(var3 + var6, var4 - 1, var5 + var7)
              && var1.isEmpty(var3 + var6, var4 - 2, var5 + var7)) {
            return false;
          }
        }
      }

      for (var6 = -1; var6 <= 1; ++var6) {
        for (var7 = -1; var7 <= 1; ++var7) {
          for (int var8 = -2; var8 <= 0; ++var8) {
            var1.setRawTypeId(var3 + var6, var4 + var8, var5 + var7, ExtrabiomesBlock.quickSand.id);
          }
        }
      }
    }

    return true;
  }
Exemplo n.º 4
0
  public void b(World var1, BlockPosition var2, IBlockData var3, Random var4) {
    super.b(var1, var2, var3, var4);
    if (var1.worldProvider.d()
        && var1.getGameRules().getBoolean("doMobSpawning")
        && var4.nextInt(2000) < var1.getDifficulty().a()) {
      int var5 = var2.getY();

      BlockPosition var6;
      for (var6 = var2;
          !World.a((IBlockAccess) var1, (BlockPosition) var6) && var6.getY() > 0;
          var6 = var6.down()) {;
      }

      if (var5 > 0 && !var1.getType(var6.up()).getBlock().isOccluding()) {
        Entity var7 =
            ItemMonsterEgg.a(
                var1,
                57,
                (double) var6.getX() + 0.5D,
                (double) var6.getY() + 1.1D,
                (double) var6.getZ() + 0.5D);
        if (var7 != null) {
          var7.portalCooldown = var7.aq();
        }
      }
    }
  }
Exemplo n.º 5
0
  public void b(World var1, BlockPosition var2, IBlockData var3, Random var4) {
    if (this.material == Material.LAVA) {
      if (var1.getGameRules().getBoolean("doFireTick")) {
        int var5 = var4.nextInt(3);
        if (var5 > 0) {
          BlockPosition var6 = var2;

          for (int var7 = 0; var7 < var5; ++var7) {
            var6 = var6.a(var4.nextInt(3) - 1, 1, var4.nextInt(3) - 1);
            Block var8 = var1.getType(var6).getBlock();
            if (var8.material == Material.AIR) {
              if (this.f(var1, var6)) {
                var1.setTypeUpdate(var6, Blocks.FIRE.getBlockData());
                return;
              }
            } else if (var8.material.isSolid()) {
              return;
            }
          }
        } else {
          for (int var9 = 0; var9 < 3; ++var9) {
            BlockPosition var10 = var2.a(var4.nextInt(3) - 1, 0, var4.nextInt(3) - 1);
            if (var1.isEmpty(var10.up()) && this.m(var1, var10)) {
              var1.setTypeUpdate(var10.up(), Blocks.FIRE.getBlockData());
            }
          }
        }
      }
    }
  }
Exemplo n.º 6
0
  public void doMegaImpact(
      EntityHuman ply, ItemStack var2, int var3, int var4, int var5, double var6) {
    World var1 = ply.world;
    cleanDroplist(var2);
    for (int var8 = -1; var8 <= 1; var8++) {
      for (int var9 = -1; var9 <= 1; var9++) {
        int var10 = var3;
        int var11 = var4;
        int var12 = var5;
        if (var8 != 0 || var9 != 0) {
          if (var6 != 0.0D && var6 != 1.0D) {
            if (var6 != 2D && var6 != 4D) {
              if (var6 == 3D || var6 == 5D) {
                var11 = var4 + var8;
                var12 = var5 + var9;
              }
            } else {
              var10 = var3 + var8;
              var11 = var4 + var9;
            }
          } else {
            var10 = var3 + var8;
            var12 = var5 + var9;
          }
          int var13 = var1.getTypeId(var10, var11, var12);
          int var14 = var1.getData(var10, var11, var12);
          if (canBreak(var13, var14) && attemptBreak(ply, var10, var11, var12))
            scanBlockAndBreak(var1, var2, var10, var11, var12);
        }
      }
    }

    ejectDropList(var1, var2, var3, (double) var4 + 0.5D, var5);
  }
Exemplo n.º 7
0
  /** set a blocks direction */
  private void g(World par1World, int par2, int par3, int par4) {
    if (par1World.isStatic) {
      return;
    }

    int i = par1World.getTypeId(par2, par3, par4 - 1);
    int j = par1World.getTypeId(par2, par3, par4 + 1);
    int k = par1World.getTypeId(par2 - 1, par3, par4);
    int l = par1World.getTypeId(par2 + 1, par3, par4);
    byte byte0 = 3;

    if (Block.n[i] && !Block.n[j]) {
      byte0 = 3;
    }

    if (Block.n[j] && !Block.n[i]) {
      byte0 = 2;
    }

    if (Block.n[k] && !Block.n[l]) {
      byte0 = 5;
    }

    if (Block.n[l] && !Block.n[k]) {
      byte0 = 4;
    }

    par1World.setData(par2, par3, par4, byte0);
  }
Exemplo n.º 8
0
  private void spawnMeteorNaturallyAndRandomly(World world, double x, double z) {
    net.minecraft.server.World meteoriteWorld = ((CraftWorld) world).getHandle();

    EntityMeteor meteor =
        new EntityMeteor(
            meteoriteWorld,
            rand.nextInt(7) + 1,
            10,
            rand.nextInt(5) + 5,
            rand.nextInt(50) + 25,
            100,
            glob.Natural__Disasters_Meteor_Message__On__Meteor__Crash,
            9,
            80,
            glob.Natural__Disasters_Meteor_Shockwave_Damage__Message,
            rand.nextInt(100) + 200,
            glob.Natural__Disasters_Meteor_Meteor_Spawn,
            glob.Natural__Disasters_Meteor_Meteor_Radius);

    meteor.spawn();

    meteor.setPosition(x, rand.nextInt(100) + 156, z);
    meteor.yaw = (float) rand.nextInt(360);
    meteor.pitch = -9;
    meteoriteWorld.addEntity(meteor, SpawnReason.DEFAULT);

    Fireball fireMeteor = (Fireball) meteor.getBukkitEntity();

    fireMeteor.setDirection(fireMeteor.getDirection().setY(-1));
  }
Exemplo n.º 9
0
  public static boolean SpawnCustomTrees(
      World world, Random rand, WorldConfig worldSettings, int x, int y, int z) {

    if (!worldSettings.HasCustomTrees) return false;

    Chunk chunk = world.getWorld().getChunkAt(x >> 4, z >> 4);

    BiomeBase localBiomeBase =
        world.getWorldChunkManager().getBiome(chunk.getX() * 16 + 16, chunk.getZ() * 16 + 16);

    boolean objectSpawned = false;
    int spawnattemps = 0;
    while (!objectSpawned && spawnattemps < worldSettings.objectSpawnRatio) {
      CustomObject SelectedObject =
          worldSettings.Objects.get(rand.nextInt(worldSettings.Objects.size()));

      spawnattemps++;

      if (SelectedObject.branch
          || !SelectedObject.canSpawnInBiome(localBiomeBase)
          || !SelectedObject.tree) continue;

      int randomRoll = rand.nextInt(100);

      if (randomRoll < SelectedObject.rarity) {
        if (CustomObjectGen.ObjectCanSpawn(world, x, y, z, SelectedObject))
          objectSpawned =
              GenerateCustomObject(world, rand, worldSettings, x, y, z, SelectedObject, true);
      }
    }
    return objectSpawned;
  }
Exemplo n.º 10
0
  @Override
  public boolean onBlockActivated(
      World world,
      int x,
      int y,
      int z,
      EntityPlayer entityplayer,
      int side,
      float hitX,
      float hitY,
      float hitZ) {
    super.onBlockActivated(world, x, y, z, entityplayer, side, hitX, hitY, hitZ);
    TileEntityQuern te = (TileEntityQuern) world.getBlockTileEntity(x, y, z);
    if (!world.isRemote) {
      if (!te.shouldRotate && hitX >= 0.65 && hitZ >= 0.65 && te.storage[2] != null) {
        te.shouldRotate = true;
        world.playSoundEffect(x, y, z, TFC_Sounds.STONEDRAG, 1, 1);
      } else if ((!te.shouldRotate && (hitX < 0.65 || hitZ < 0.65)) || te.storage[2] == null) {
        entityplayer.openGui(TerraFirmaCraft.instance, 33, world, x, y, z);
      }
    } else if (!te.shouldRotate && hitX >= 0.65 && hitZ >= 0.65 && te.hasQuern) {
      te.shouldRotate = true;
    }

    return true;
  }
Exemplo n.º 11
0
 @Override
 public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int i, int j, int k) {
   if (world.getBlockId(i, j - 1, k) == this.blockID || world.isBlockOpaqueCube(i, j - 1, k)) {
     return AxisAlignedBB.getBoundingBox(i + 0.3, j, k + 0.3, i + 0.7, j + 1, k + 0.7);
   }
   return AxisAlignedBB.getBoundingBox(i, j + 0.4, k, i + 1, j + 0.6, k + 1);
 }
Exemplo n.º 12
0
 public boolean interact(
     World var1,
     BlockPosition var2,
     IBlockData var3,
     EntityHuman var4,
     EnumUsedHand var5,
     ItemStack var6,
     EnumDirection var7,
     float var8,
     float var9,
     float var10) {
   class_yu var11 = var4.cq();
   TileEntity var12 = var1.getTileEntity(var2);
   if (var11 != null && var12 instanceof TileEntityEnderChest) {
     if (var1.getType(var2.up()).getBlock().isOccluding()) {
       return true;
     } else if (var1.isClientSide) {
       return true;
     } else {
       var11.a((TileEntityEnderChest) var12);
       var4.openContainer((IInventory) var11);
       var4.b(StatisticList.V);
       return true;
     }
   } else {
     return true;
   }
 }
Exemplo n.º 13
0
  /** Called whenever the block is removed. */
  @Override
  public void remove(World par1World, int par2, int par3, int par4) {
    if (!c) {
      TileEntityIronFurnace tileentityfurnace =
          (TileEntityIronFurnace) par1World.getTileEntity(par2, par3, par4);

      if (tileentityfurnace != null) {
        label0:
        for (int i = 0; i < tileentityfurnace.getSize(); i++) {
          ItemStack itemstack = tileentityfurnace.getItem(i);

          if (itemstack == null) {
            continue;
          }

          float f = a.nextFloat() * 0.8F + 0.1F;
          float f1 = a.nextFloat() * 0.8F + 0.1F;
          float f2 = a.nextFloat() * 0.8F + 0.1F;

          do {
            if (itemstack.count <= 0) {
              continue label0;
            }

            int j = a.nextInt(21) + 10;

            if (j > itemstack.count) {
              j = itemstack.count;
            }

            itemstack.count -= j;
            EntityItem entityitem =
                new EntityItem(
                    par1World,
                    par2 + f,
                    par3 + f1,
                    par4 + f2,
                    new ItemStack(itemstack.id, j, itemstack.getData()));

            if (itemstack.hasTag()) {
              entityitem.itemStack.setTag((NBTTagCompound) itemstack.getTag().clone());
            }

            float f3 = 0.05F;
            entityitem.motX = (float) a.nextGaussian() * f3;
            entityitem.motY = (float) a.nextGaussian() * f3 + 0.2F;
            entityitem.motZ = (float) a.nextGaussian() * f3;
            par1World.addEntity(entityitem);
          } while (true);
        }
      }
    }

    super.remove(par1World, par2, par3, par4);
  }
Exemplo n.º 14
0
  public void onNeighborBlockChange(World world, int i, int j, int k, int l) {
    int dir = world.getBlockMetadata(i, j, k);

    if (dir == 0) {
      if (!world.isBlockOpaqueCube(i, j, k + 1)) {
        this.breakBlock(world, i, j, k, blockID, dir);
        world.setBlock(i, j, k, 0);
      }
    } else if (dir == 1) {
      if (!world.isBlockOpaqueCube(i - 1, j, k)) {
        this.breakBlock(world, i, j, k, blockID, dir);
        world.setBlock(i, j, k, 0);
      }
    } else if (dir == 2) {
      if (!world.isBlockOpaqueCube(i, j, k - 1)) {
        this.breakBlock(world, i, j, k, blockID, dir);
        world.setBlock(i, j, k, 0);
      }
    } else if (dir == 3) {
      if (!world.isBlockOpaqueCube(i + 1, j, k)) {
        this.breakBlock(world, i, j, k, blockID, dir);
        world.setBlock(i, j, k, 0);
      }
    }
  }
Exemplo n.º 15
0
 public void b(World var1, BlockPosition var2, IBlockData var3, Random var4) {
   super.b(var1, var2, var3, var4);
   if (var1.getLightLevel(var2.up()) >= 9) {
     int var5 = ((Integer) var3.get(AGE)).intValue();
     if (var5 < 7) {
       float var6 = a(this, var1, var2);
       if (var4.nextInt((int) (25.0F / var6) + 1) == 0) {
         var1.setTypeAndData(var2, var3.set(AGE, Integer.valueOf(var5 + 1)), 2);
       }
     }
   }
 }
Exemplo n.º 16
0
  public void scanBlockAndBreak(World var1, ItemStack var2, int var3, int var4, int var5) {
    int var6 = var1.getTypeId(var3, var4, var5);
    int var7 = var1.getData(var3, var4, var5);
    ArrayList var8 = Block.byId[var6].getBlockDropped(var1, var3, var4, var5, var7, 0);
    ItemStack var10;
    for (Iterator var9 = var8.iterator(); var9.hasNext(); addToDroplist(var2, var10))
      var10 = (ItemStack) var9.next();

    var1.setTypeId(var3, var4, var5, 0);
    if (var1.random.nextInt(8) == 0) var1.a("largesmoke", var3, var4, var5, 0.0D, 0.0D, 0.0D);
    if (var1.random.nextInt(8) == 0) var1.a("explode", var3, var4, var5, 0.0D, 0.0D, 0.0D);
  }
Exemplo n.º 17
0
  @Override
  public void harvestBlock(World world, EntityPlayer entityplayer, int i, int j, int k, int l) {
    // we need to make sure the player has the correct tool out
    boolean isAxeorSaw = false;
    boolean isHammer = false;
    ItemStack equip = entityplayer.getCurrentEquippedItem();
    if (!world.isRemote) {
      if (equip != null) {
        for (int cnt = 0; cnt < Recipes.Axes.length && !isAxeorSaw; cnt++) {
          if (equip.getItem() == Recipes.Axes[cnt]) {
            isAxeorSaw = true;
            if (cnt < 4) isStone = true;
          }
        }
        //				for(int cnt = 0; cnt < Recipes.Saws.length && !isAxeorSaw; cnt++)
        //				{
        //					if(equip.getItem() == Recipes.Saws[cnt])
        //					{
        //						isAxeorSaw = true;
        //					}
        //				}
        for (int cnt = 0; cnt < Recipes.Hammers.length && !isAxeorSaw; cnt++) {
          if (equip.getItem() == Recipes.Hammers[cnt]) {
            isHammer = true;
          }
        }
      }
      if (isAxeorSaw) {
        damage = -1;
        ProcessTree(world, i, j, k, l, equip);

        if (damage + equip.getItemDamage() > equip.getMaxDamage()) {
          int ind = entityplayer.inventory.currentItem;
          entityplayer.inventory.setInventorySlotContents(ind, null);
          world.setBlockAndMetadataWithNotify(i, j, k, blockID, l, 3);
        } else {
          equip.damageItem(damage, entityplayer);
        }
      } else if (isHammer) {
        EntityItem item =
            new EntityItem(
                world,
                i + 0.5,
                j + 0.5,
                k + 0.5,
                new ItemStack(Item.stick, 1 + world.rand.nextInt(3)));
        world.spawnEntityInWorld(item);
      } else {
        world.setBlockAndMetadataWithNotify(i, j, k, blockID, l, 3);
      }
    }
  }
Exemplo n.º 18
0
  /**
   * Returns a boolean array indicating which flow directions are optimal based on each direction's
   * calculated flow cost. Each array index corresponds to one of the four cardinal directions. A
   * value of true indicates the direction is optimal.
   */
  private boolean[] getOptimalFlowDirections(World par1World, int par2, int par3, int par4) {
    int var5;
    int var6;

    for (var5 = 0; var5 < 4; ++var5) {
      this.flowCost[var5] = 1000;
      var6 = par2;
      int var8 = par4;

      if (var5 == 0) {
        var6 = par2 - 1;
      }

      if (var5 == 1) {
        ++var6;
      }

      if (var5 == 2) {
        var8 = par4 - 1;
      }

      if (var5 == 3) {
        ++var8;
      }

      if (!this.blockBlocksFlow(par1World, var6, par3, var8)
          && (par1World.getBlockId(var6, par3, var8) != this.blockID
              || par1World.getBlockMetadata(var6, par3, var8) != 0)) {
        if (!this.blockBlocksFlow(par1World, var6, par3 - 1, var8)) {
          this.flowCost[var5] = 0;
        } else {
          this.flowCost[var5] = this.calculateFlowCost(par1World, var6, par3, var8, 1, var5);
        }
      }
    }

    var5 = this.flowCost[0];

    for (var6 = 1; var6 < 4; ++var6) {
      if (this.flowCost[var6] < var5) {
        var5 = this.flowCost[var6];
      }
    }

    for (var6 = 0; var6 < 4; ++var6) {
      this.isOptimalFlowDirection[var6] = this.flowCost[var6] == var5;
    }

    return this.isOptimalFlowDirection;
  }
Exemplo n.º 19
0
 public void doPhysics(World var1, BlockPosition var2, IBlockData var3, Block var4) {
   EnumDirection.EnumAxis var5 = (EnumDirection.EnumAxis) var3.get(AXIS);
   BlockPortal.Shape var6;
   if (var5 == EnumDirection.EnumAxis.X) {
     var6 = new BlockPortal.Shape(var1, var2, EnumDirection.EnumAxis.X);
     if (!var6.d() || var6.e < var6.h * var6.g) {
       var1.setTypeUpdate(var2, Blocks.AIR.getBlockData());
     }
   } else if (var5 == EnumDirection.EnumAxis.Z) {
     var6 = new BlockPortal.Shape(var1, var2, EnumDirection.EnumAxis.Z);
     if (!var6.d() || var6.e < var6.h * var6.g) {
       var1.setTypeUpdate(var2, Blocks.AIR.getBlockData());
     }
   }
 }
 public void playServerSound(World world) {
   world.makeSound(
       this,
       ((ItemGun) mod_ModernWarfare.itemGunFlamethrower).firingSound,
       ((ItemGun) mod_ModernWarfare.itemGunFlamethrower).soundRangeFactor,
       1.0F / (random.nextFloat() * 0.1F + 0.95F));
 }
Exemplo n.º 21
0
    public Shape(World var1, BlockPosition var2, EnumDirection.EnumAxis var3) {
      this.a = var1;
      this.b = var3;
      if (var3 == EnumDirection.EnumAxis.X) {
        this.d = EnumDirection.EAST;
        this.c = EnumDirection.WEST;
      } else {
        this.d = EnumDirection.NORTH;
        this.c = EnumDirection.SOUTH;
      }

      for (BlockPosition var4 = var2;
          var2.getY() > var4.getY() - 21
              && var2.getY() > 0
              && this.a(var1.getType(var2.down()).getBlock());
          var2 = var2.down()) {;
      }

      int var5 = this.a(var2, this.d) - 1;
      if (var5 >= 0) {
        this.f = var2.shift(this.d, var5);
        this.h = this.a(this.f, this.c);
        if (this.h < 2 || this.h > 21) {
          this.f = null;
          this.h = 0;
        }
      }

      if (this.f != null) {
        this.g = this.c();
      }
    }
Exemplo n.º 22
0
  public void g(World var1, BlockPosition var2, IBlockData var3) {
    int var4 = ((Integer) var3.get(AGE)).intValue() + MathHelper.nextInt(var1.random, 2, 5);
    if (var4 > 7) {
      var4 = 7;
    }

    var1.setTypeAndData(var2, var3.set(AGE, Integer.valueOf(var4)), 2);
  }
Exemplo n.º 23
0
 @Override
 public void onNeighborBlockChange(World world, int i, int j, int k, int l) {
   boolean check = false;
   for (int h = -1; h <= 1; h++) {
     for (int g = -1; g <= 1; g++) {
       for (int f = -1; f <= 1; f++) {
         if (world.getBlockId(i + h, j + g, k + f) == blockID
             && world.getBlockMetadata(i + h, j + g, k + f) == world.getBlockMetadata(i, j, k)) {
           check = true;
         }
       }
     }
   }
   if (!check) {
     world.setBlock(i, j, k, 0);
   }
 }
Exemplo n.º 24
0
  /** 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.getBlockId(par2, par3, par4) == this.blockID)
    //        {
    par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, this.tickRate());
    //        }
  }
Exemplo n.º 25
0
  public boolean interactWith(
      ItemStack var1,
      EntityHuman var2,
      World var3,
      BlockPosition var4,
      EnumDirection var5,
      float var6,
      float var7,
      float var8) {
    if (var5 == EnumDirection.DOWN) {
      return false;
    } else if (!var3.getType(var4).getBlock().getMaterial().isBuildable()) {
      return false;
    } else {
      var4 = var4.shift(var5);
      if (!var2.a(var4, var5, var1)) {
        return false;
      } else if (!Blocks.STANDING_SIGN.canPlace(var3, var4)) {
        return false;
      } else if (var3.isClientSide) {
        return true;
      } else {
        if (var5 == EnumDirection.UP) {
          int var9 = MathHelper.floor((double) ((var2.yaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15;
          var3.setTypeAndData(
              var4,
              Blocks.STANDING_SIGN
                  .getBlockData()
                  .set(BlockFloorSign.ROTATION, Integer.valueOf(var9)),
              3);
        } else {
          var3.setTypeAndData(
              var4, Blocks.WALL_SIGN.getBlockData().set(BlockWallSign.FACING, var5), 3);
        }

        --var1.count;
        TileEntity var10 = var3.getTileEntity(var4);
        if (var10 instanceof TileEntitySign && !ItemBlock.a(var3, var2, var4, var1)) {
          var2.openSign((TileEntitySign) var10);
        }

        return true;
      }
    }
  }
Exemplo n.º 26
0
 @Override
 public void onNeighborBlockChange(World world, int i, int j, int k, int l) {
   boolean check = false;
   for (int h = -2; h <= 2; h++) {
     for (int g = -2; g <= 2; g++) {
       for (int f = -2; f <= 2; f++) {
         if (world.getBlockId(i + h, j + g, k + f) == blockID
             && world.getBlockMetadata(i + h, j + g, k + f) == world.getBlockMetadata(i, j, k)) {
           check = true;
         }
       }
     }
   }
   if (!check) {
     world.setBlock(i, j, k, 0);
     dropBlockAsItem_do(world, i, j, k, new ItemStack(Item.itemsList[TFCItems.Logs.itemID], 1, l));
   }
 }
Exemplo n.º 27
0
 public void a(World var1, Random var2, BlockPosition var3) {
   super.a(var1, var2, var3);
   if (var2.nextInt(1000) == 0) {
     int var4 = var2.nextInt(16) + 8;
     int var5 = var2.nextInt(16) + 8;
     BlockPosition var6 = var1.m(var3.add(var4, 0, var5)).up();
     (new class_aqg()).b(var1, var2, var6);
   }
 }
Exemplo n.º 28
0
  public boolean interactWith(
      ItemStack var1,
      EntityHuman var2,
      World var3,
      BlockPosition var4,
      EnumDirection var5,
      float var6,
      float var7,
      float var8) {
    if (var3.isClientSide) {
      return true;
    } else if (var5 != EnumDirection.UP) {
      return false;
    } else {
      IBlockData var9 = var3.getType(var4);
      Block var10 = var9.getBlock();
      boolean var11 = var10.a(var3, var4);
      if (!var11) {
        var4 = var4.up();
      }

      int var12 = MathHelper.floor((double) (var2.yaw * 4.0F / 360.0F) + 0.5D) & 3;
      EnumDirection var13 = EnumDirection.fromType2(var12);
      BlockPosition var14 = var4.shift(var13);
      if (var2.a(var4, var5, var1) && var2.a(var14, var5, var1)) {
        boolean var15 = var3.getType(var14).getBlock().a(var3, var14);
        boolean var16 = var11 || var3.isEmpty(var4);
        boolean var17 = var15 || var3.isEmpty(var14);
        if (var16
            && var17
            && World.a((IBlockAccess) var3, (BlockPosition) var4.down())
            && World.a((IBlockAccess) var3, (BlockPosition) var14.down())) {
          IBlockData var18 =
              Blocks.BED
                  .getBlockData()
                  .set(BlockBed.OCCUPIED, Boolean.valueOf(false))
                  .set(BlockBed.FACING, var13)
                  .set(BlockBed.PART, BlockBed.EnumBedPart.FOOT);
          if (var3.setTypeAndData(var4, var18, 3)) {
            IBlockData var19 = var18.set(BlockBed.PART, BlockBed.EnumBedPart.HEAD);
            var3.setTypeAndData(var14, var19, 3);
          }

          --var1.count;
          return true;
        } else {
          return false;
        }
      } else {
        return false;
      }
    }
  }
Exemplo n.º 29
0
  @Override
  public boolean a(
      World paramWorld, Random paramRandom, int paramInt1, int paramInt2, int paramInt3) {
    for (int i = 0; i < 10; i++) {
      int j = paramInt1 + paramRandom.nextInt(8) - paramRandom.nextInt(8);
      int k = paramInt2 + paramRandom.nextInt(4) - paramRandom.nextInt(4);
      int m = paramInt3 + paramRandom.nextInt(8) - paramRandom.nextInt(8);
      if (paramWorld.isEmpty(j, k, m)) {
        int n = 1 + paramRandom.nextInt(paramRandom.nextInt(3) + 1);
        for (int i1 = 0; i1 < n; i1++) {
          if (Block.CACTUS.f(paramWorld, j, k + i1, m)) {
            paramWorld.setRawTypeId(j, k + i1, m, Block.CACTUS.id);
          }
        }
      }
    }

    return true;
  }
 public void postPlace(
     World var1, BlockPosition var2, IBlockData var3, EntityLiving var4, ItemStack var5) {
   super.postPlace(var1, var2, var3, var4, var5);
   if (var5.hasDisplayName()) {
     TileEntity var6 = var1.getTileEntity(var2);
     if (var6 instanceof TileEntityEnchantTable) {
       ((TileEntityEnchantTable) var6).a(var5.getDisplayName());
     }
   }
 }