Ejemplo n.º 1
0
  @Override
  public void updateEntity(World world, int x, int y, int z, int meta) {
    super.updateTileEntity();
    int temp = (int) (15 * this.getArraySize() * this.getArrayOverallBrightness());
    for (int i = -3; i <= 3; i++) {
      for (int j = -3; j <= 3; j++) {
        if (ConfigRegistry.BLOCKDAMAGE.getState()) {
          ReikaWorldHelper.temperatureEnvironment(world, x + i, y + 1, z + j, Math.min(temp, 1750));
          if (temp >= 1500) {
            this.delete();
            world.setBlock(x, y, z, Blocks.flowing_lava);
          }
        }
        AxisAlignedBB above =
            AxisAlignedBB.getBoundingBox(x + i, y + 1, z + j, x + i + 1, y + 2, z + j + 1);
        List<EntityLivingBase> in = world.getEntitiesWithinAABB(EntityLivingBase.class, above);
        for (EntityLivingBase e : in) {
          if (temp > 400) e.setFire(3);
        }
      }
    }
    if (world.getBlock(x, y - 1, z) == Blocks.air
        || MachineRegistry.getMachine(world, x, y - 1, z) != this.getMachine()) {
      // ReikaJavaLibrary.pConsole("TOWER: "+this.getTowerHeight()+";  SIZE: "+this.getArraySize());
      this.generatePower(world, x, y, z);
    } else {
      write = null;
    }
    if (world.getBlock(x, y + 1, z) != Blocks.air) return;

    mirrorTimer.update();
    if (mirrorTimer.checkCap()) {
      if (solarBlocks.isEmpty()) {
        lightMultiplier = 0;
        solarBlocks.recursiveAdd(world, x, y, z, this.getTileEntityBlockID());
        numberMirrors = solarBlocks.getSize();
        while (solarBlocks.getSize() > 0) {
          Coordinate c = solarBlocks.getNextAndMoveOn();
          MachineRegistry m = MachineRegistry.getMachine(world, c.xCoord, c.yCoord, c.zCoord);
          if (m == MachineRegistry.MIRROR) {
            TileEntityMirror te =
                (TileEntityMirror) world.getTileEntity(c.xCoord, c.yCoord, c.zCoord);
            te.targetloc = new Coordinate(x, y, z);
            float light = te.getLightLevel();
            lightMultiplier += light;
          } else numberMirrors--;
        }
        lightMultiplier /= 15F;
        lightMultiplier /= numberMirrors;
      }
    }

    if (write != null) {
      this.basicPowerReceiver();
    }
  }
Ejemplo n.º 2
0
 public void getLiq(World world, int x, int y, int z, int metadata) {
   int oldLevel = 0;
   if (liquidLevel < CAPACITY) {
     if (MachineRegistry.getMachine(world, x + 1, y, z) == MachineRegistry.PIPE) {
       TileEntityPipe tile = (TileEntityPipe) world.getBlockTileEntity(x + 1, y, z);
       if (tile != null && (tile.liquidID == liquidID || liquidID == -1) && tile.liquidLevel > 0) {
         liquidID = tile.liquidID;
         oldLevel = tile.liquidLevel;
         tile.liquidLevel =
             ReikaMathLibrary.extrema(tile.liquidLevel - tile.liquidLevel / 4 - 1, 0, "max");
         liquidLevel = ReikaMathLibrary.extrema(liquidLevel + oldLevel / 4 + 1, 0, "max");
       }
     }
     if (MachineRegistry.getMachine(world, x - 1, y, z) == MachineRegistry.PIPE) {
       TileEntityPipe tile = (TileEntityPipe) world.getBlockTileEntity(x - 1, y, z);
       if (tile != null && (tile.liquidID == liquidID || liquidID == -1) && tile.liquidLevel > 0) {
         liquidID = tile.liquidID;
         oldLevel = tile.liquidLevel;
         tile.liquidLevel =
             ReikaMathLibrary.extrema(tile.liquidLevel - tile.liquidLevel / 4 - 1, 0, "max");
         liquidLevel = ReikaMathLibrary.extrema(liquidLevel + oldLevel / 4 + 1, 0, "max");
       }
     }
     if (MachineRegistry.getMachine(world, x, y - 1, z) == MachineRegistry.PIPE) {
       TileEntityPipe tile = (TileEntityPipe) world.getBlockTileEntity(x, y - 1, z);
       if (tile != null && (tile.liquidID == liquidID || liquidID == -1) && tile.liquidLevel > 0) {
         liquidID = tile.liquidID;
         oldLevel = tile.liquidLevel;
         tile.liquidLevel =
             ReikaMathLibrary.extrema(tile.liquidLevel - tile.liquidLevel / 4 - 1, 0, "max");
         liquidLevel = ReikaMathLibrary.extrema(liquidLevel + oldLevel / 4 + 1, 0, "max");
       }
     }
     if (MachineRegistry.getMachine(world, x, y, z + 1) == MachineRegistry.PIPE) {
       TileEntityPipe tile = (TileEntityPipe) world.getBlockTileEntity(x, y, z + 1);
       if (tile != null && (tile.liquidID == liquidID || liquidID == -1) && tile.liquidLevel > 0) {
         liquidID = tile.liquidID;
         oldLevel = tile.liquidLevel;
         tile.liquidLevel =
             ReikaMathLibrary.extrema(tile.liquidLevel - tile.liquidLevel / 4 - 1, 0, "max");
         liquidLevel = ReikaMathLibrary.extrema(liquidLevel + oldLevel / 4 + 1, 0, "max");
       }
     }
     if (MachineRegistry.getMachine(world, x, y, z - 1) == MachineRegistry.PIPE) {
       TileEntityPipe tile = (TileEntityPipe) world.getBlockTileEntity(x, y, z - 1);
       if (tile != null && (tile.liquidID == liquidID || liquidID == -1) && tile.liquidLevel > 0) {
         liquidID = tile.liquidID;
         oldLevel = tile.liquidLevel;
         tile.liquidLevel =
             ReikaMathLibrary.extrema(tile.liquidLevel - tile.liquidLevel / 4 - 1, 0, "max");
         liquidLevel = ReikaMathLibrary.extrema(liquidLevel + oldLevel / 4 + 1, 0, "max");
       }
     }
   }
 }
Ejemplo n.º 3
0
 public int getBottomOfTower() {
   int y = yCoord;
   while (MachineRegistry.getMachine(worldObj, xCoord, y, zCoord) == MachineRegistry.SOLARTOWER) {
     y--;
   }
   return y + 1;
 }
Ejemplo n.º 4
0
 public int getTopOfTower() {
   int y = yCoord;
   while (MachineRegistry.getMachine(worldObj, xCoord, y, zCoord) == MachineRegistry.SOLARTOWER) {
     y++;
   }
   return y - 1;
 }
Ejemplo n.º 5
0
 public void resetOther() {
   if (!isEmitting) {
     MachineRegistry m = MachineRegistry.getMachine(worldObj, target[0], target[1], target[2]);
     if (m == MachineRegistry.BELT) {
       TileEntityBeltHub te =
           (TileEntityBeltHub) worldObj.getBlockTileEntity(target[0], target[1], target[2]);
       te.reset();
     }
   } else {
     MachineRegistry m = MachineRegistry.getMachine(worldObj, source[0], source[1], source[2]);
     if (m == MachineRegistry.BELT) {
       TileEntityBeltHub te =
           (TileEntityBeltHub) worldObj.getBlockTileEntity(source[0], source[1], source[2]);
       te.reset();
     }
   }
 }
Ejemplo n.º 6
0
 public void getTowerWater(World world, int x, int y, int z) {
   int water = tank.getLevel();
   int cy = y + 1;
   while (MachineRegistry.getMachine(world, x, cy, z) == MachineRegistry.SOLARTOWER) {
     TileEntitySolar tile = (TileEntitySolar) (world.getTileEntity(x, cy, z));
     water += tile.tank.getLevel();
     tile.tank.empty();
     cy++;
   }
   tank.setContents(water, FluidRegistry.WATER);
 }
Ejemplo n.º 7
0
 @SubscribeEvent
 public void noItemEntityPush(EntityPushOutOfBlocksEvent evt) {
   Entity e = evt.entity;
   if (e instanceof EntityItem) {
     int x = MathHelper.floor_double(e.posX);
     int y = MathHelper.floor_double(e.posY);
     int z = MathHelper.floor_double(e.posZ);
     MachineRegistry m = MachineRegistry.getMachine(e.worldObj, x, y, z);
     if (m == MachineRegistry.RESERVOIR) {
       evt.setCanceled(true);
     }
   }
 }
Ejemplo n.º 8
0
 public boolean shouldRenderBelt() {
   if (isEmitting) {
     MachineRegistry m = MachineRegistry.getMachine(worldObj, source[0], source[1], source[2]);
     return m == MachineRegistry.BELT && this.canConnect(source[0], source[1], source[2]);
   } else {
     if (target[0] != Integer.MIN_VALUE
         && target[1] != Integer.MIN_VALUE
         && target[2] != Integer.MIN_VALUE)
       // return MachineRegistry.getMachine(worldObj, target[0], target[1], target[2]) ==
       // MachineRegistry.BELT;
       return this.canConnect(target[0], target[1], target[2]);
     return false;
   }
 }
Ejemplo n.º 9
0
 private void copyPower() {
   MachineRegistry m = MachineRegistry.getMachine(worldObj, source[0], source[1], source[2]);
   // ReikaJavaLibrary.pConsole(Arrays.toString(source));
   if (m == MachineRegistry.BELT && this.canConnect(source[0], source[1], source[2])) {
     TileEntityBeltHub tile =
         (TileEntityBeltHub) worldObj.getBlockTileEntity(source[0], source[1], source[2]);
     omega = this.getSlipOmega(tile.omega);
     torque = Math.min(this.getMaxTorque(), tile.torque);
     power = tile.power;
   } else {
     if (omega > 0) omega--;
     else torque = 0;
     power = omega * torque;
   }
 }
Ejemplo n.º 10
0
  @Override
  public final void updateEntity(World world, int x, int y, int z, int meta) {
    super.updateEntity(world, x, y, z, meta);

    // if (ModList.BCFACTORY.isLoaded() && ModList.REACTORCRAFT.isLoaded()) { //Only if, since need
    // a way to pipe it
    if (this.contains(FluidRegistry.getFluid("uranium hexafluoride"))
        || this.contains(FluidRegistry.getFluid("hydrofluoric acid"))) {
      ReikaSoundHelper.playSoundAtBlock(world, x, y, z, "random.fizz");
      for (int i = 0; i < 6; i++) {
        ForgeDirection dir = dirs[i];
        int dx = x + dir.offsetX;
        int dy = y + dir.offsetY;
        int dz = z + dir.offsetZ;
        MachineRegistry m = MachineRegistry.getMachine(world, dx, dy, dz);
        if (m == MachineRegistry.PIPE) {
          TileEntityPipe p = (TileEntityPipe) world.getTileEntity(dx, dy, dz);
          p.setFluid(liquid);
          p.addFluid(5);
          // ReikaParticleHelper.SMOKE.spawnAroundBlock(world, dx, dy, dz, 8);
        }
      }
      world.setBlockToAir(x, y, z);
      ReikaParticleHelper.SMOKE.spawnAroundBlock(world, x, y, z, 8);
    }
    // }

    if (rand.nextInt(60) == 0) {
      ReikaWorldHelper.temperatureEnvironment(world, x, y, z, this.getTemperature());
    }

    if (liquid != null) {
      int temp = liquid.getTemperature(worldObj, xCoord, yCoord, zCoord);
      temperature = temp > 750 ? temp - 425 : temp - 273;
      if (temperature > this.getMaxTemperature()) {
        this.overheat(worldObj, xCoord, yCoord, zCoord);
      }
    } else {
      temperature = ReikaWorldHelper.getAmbientTemperatureAt(world, x, y, z);
    }
  }
Ejemplo n.º 11
0
 @Override
 public boolean onItemUse(
     ItemStack is,
     EntityPlayer ep,
     World world,
     int x,
     int y,
     int z,
     int side,
     float par8,
     float par9,
     float par10) {
   if (!ReikaWorldHelper.softBlocks(world, x, y, z)
       && world.getBlockMaterial(x, y, z) != Material.water
       && world.getBlockMaterial(x, y, z) != Material.lava) {
     if (side == 0) --y;
     if (side == 1) ++y;
     if (side == 2) --z;
     if (side == 3) ++z;
     if (side == 4) --x;
     if (side == 5) ++x;
     this.clearBlocks(world, x, y, z);
     int id = world.getBlockId(x, y, z);
     if (ReikaBlockHelper.isPortalBlock(world, x, y, z)) {
       TileEntityShaft sha = new TileEntityShaft();
       sha.setBlockMetadata(RotaryAux.get6SidedMetadataFromPlayerLook(ep));
       sha.getIOSides(world, x, y, z, sha.getBlockMetadata());
       sha.xCoord = x;
       sha.yCoord = y;
       sha.zCoord = z;
       int dx = sha.getReadDirection().offsetX;
       int dy = sha.getReadDirection().offsetY;
       int dz = sha.getReadDirection().offsetZ;
       MachineRegistry m = MachineRegistry.getMachine(world, dx, dy, dz);
       if (m == MachineRegistry.SHAFT) {
         TileEntityShaft te = (TileEntityShaft) world.getBlockTileEntity(dx, dy, dz);
         if (te.isWritingToCoordinate(x, y, z)) {
           world.setBlock(
               dx,
               dy,
               dz,
               MachineRegistry.PORTALSHAFT.getBlockID(),
               MachineRegistry.PORTALSHAFT.getMachineMetadata(),
               3);
           TileEntityPortalShaft ps = new TileEntityPortalShaft();
           world.setBlockTileEntity(dx, dy, dz, ps);
           ps.setBlockMetadata(te.getBlockMetadata());
           ps.setPortalType(world, x, y, z);
           ps.material = te.getShaftType();
         }
       }
     }
     if (!ReikaWorldHelper.softBlocks(world, x, y, z)
         && world.getBlockMaterial(x, y, z) != Material.water
         && world.getBlockMaterial(x, y, z) != Material.lava) return false;
   }
   this.clearBlocks(world, x, y, z);
   AxisAlignedBB box = AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1);
   List inblock = world.getEntitiesWithinAABB(EntityLivingBase.class, box);
   if (inblock.size() > 0) return false;
   if (!ep.canPlayerEdit(x, y, z, 0, is)) return false;
   else {
     if (!ep.capabilities.isCreativeMode) --is.stackSize;
     world.setBlock(x, y, z, MachineRegistry.SHAFT.getBlockID(), is.getItemDamage(), 3);
     if (is.getItemDamage() == RotaryNames.getNumberShaftTypes() - 1) {
       TileEntityShaft sha = (TileEntityShaft) world.getBlockTileEntity(x, y, z);
       if (sha != null) {
         // sha.type = MaterialRegistry.STEEL;
         sha.setBlockMetadata(6 + RotaryAux.get4SidedMetadataFromPlayerLook(ep));
       }
       return true;
     }
     TileEntityShaft sha = (TileEntityShaft) world.getBlockTileEntity(x, y, z);
     if (sha != null) {
       world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "step.stone", 1F, 1.5F);
       // sha.type = MaterialRegistry.setType(is.getItemDamage());
     }
   }
   TileEntityShaft sha = (TileEntityShaft) world.getBlockTileEntity(x, y, z);
   sha.setBlockMetadata(RotaryAux.get6SidedMetadataFromPlayerLook(ep));
   sha.placer = ep.getEntityName();
   if (RotaryAux.shouldSetFlipped(world, x, y, z)) {
     sha.isFlipped = true;
   }
   return true;
 }
Ejemplo n.º 12
0
 @Override
 public void onUpdate() {
   ticksExisted++;
   boolean hit = false;
   int id = worldObj.getBlockId((int) posX, (int) posY, (int) posZ);
   MachineRegistry m = MachineRegistry.getMachine(worldObj, posX, posY, posZ);
   List mobs =
       worldObj.getEntitiesWithinAABB(EntityLiving.class, this.getBoundingBox().expand(1, 1, 1));
   // ReikaJavaLibrary.pConsole("ID: "+id+" and "+mobs.size()+" mobs");
   hit =
       (mobs.size() > 0
           || (m != MachineRegistry.RAILGUN && id != 0 && !ReikaWorldHelper.softBlocks(id)));
   // ReikaJavaLibrary.pConsole(hit+"   by "+id+"  or mobs "+mobs.size());
   if (ReikaWorldHelper.softBlocks(id)
       && !ReikaMathLibrary.isValueInsideBoundsIncl(8, 11, id)
       && ConfigRegistry.BLOCKDAMAGE.getState())
     ReikaWorldHelper.recursiveBreakWithinSphere(
         worldObj, (int) posX, (int) posY, (int) posZ, id, -1, (int) posX, (int) posY, (int) posZ,
         4);
   if (hit) {
     // ReikaChatHelper.write("HIT  @  "+ticksExisted+"  by "+(mobs.size() > 0));
     this.onImpact(null);
     if (power < 15) this.setDead();
     return;
   }
   // ReikaChatHelper.write(this.ticksExisted);
   for (float i = -0.2F; i <= 0.2; i += 0.2F)
     worldObj.createExplosion(this, posX + i, posY + i, posZ + i, 0F, false);
   // worldObj.spawnParticle("hugeexplosion", posX, posY, posZ, 0, 0, 0);
   if (!worldObj.isRemote
       && (shootingEntity != null && shootingEntity.isDead
           || !worldObj.blockExists((int) posX, (int) posY, (int) posZ))) this.setDead();
   else {
     if (ticksExisted > 80 && !worldObj.isRemote) this.onImpact(null);
     this.onEntityUpdate();
     Vec3 var15 = worldObj.getWorldVec3Pool().getVecFromPool(posX, posY, posZ);
     Vec3 var2 =
         worldObj
             .getWorldVec3Pool()
             .getVecFromPool(posX + motionX, posY + motionY, posZ + motionZ);
     MovingObjectPosition var3 = worldObj.rayTraceBlocks(var15, var2);
     var15 = worldObj.getWorldVec3Pool().getVecFromPool(posX, posY, posZ);
     var2 =
         worldObj
             .getWorldVec3Pool()
             .getVecFromPool(posX + motionX, posY + motionY, posZ + motionZ);
     if (var3 != null)
       var2 =
           worldObj
               .getWorldVec3Pool()
               .getVecFromPool(var3.hitVec.xCoord, var3.hitVec.yCoord, var3.hitVec.zCoord);
     Entity var4 = null;
     List var5 =
         worldObj.getEntitiesWithinAABBExcludingEntity(
             this, boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D));
     double var6 = 0.0D;
     for (int var8 = 0; var8 < var5.size(); ++var8) {
       Entity var9 = (Entity) var5.get(var8);
       if (var9.canBeCollidedWith() && (!var9.isEntityEqual(shootingEntity))) {
         float var10 = 0.3F;
         AxisAlignedBB var11 = var9.boundingBox.expand(var10, var10, var10);
         MovingObjectPosition var12 = var11.calculateIntercept(var15, var2);
         if (var12 != null) {
           double var13 = var15.distanceTo(var12.hitVec);
           if (var13 < var6 || var6 == 0.0D) {
             var4 = var9;
             var6 = var13;
           }
         }
       }
     }
     if (var4 != null) var3 = new MovingObjectPosition(var4);
     if (var3 != null) this.onImpact(var3);
     posX += motionX;
     posY += motionY;
     posZ += motionZ;
     if (this.isInWater()) {
       worldObj.createExplosion(this, posX, posY, posZ, 3F, false);
       for (int var19 = 0; var19 < 4; ++var19) {
         float var18 = 0.25F;
         worldObj.spawnParticle(
             "bubble",
             posX - motionX * var18,
             posY - motionY * var18,
             posZ - motionZ * var18,
             motionX,
             motionY,
             motionZ);
       }
     }
     this.setPosition(posX, posY, posZ);
   }
 }
Ejemplo n.º 13
0
  @Override
  public void onImpact(MovingObjectPosition mov) {
    if (mov != null
        && MachineRegistry.getMachine(worldObj, mov.blockX, mov.blockY, mov.blockZ)
            == MachineRegistry.RAILGUN) {
      this.setDead();
      return;
    }
    if (isDead) return;
    World world = worldObj;
    double x = posX;
    double y = posY;
    double z = posZ;
    int x0 = (int) x;
    int y0 = (int) y;
    int z0 = (int) z;
    EntityLiving el;
    Entity ent;
    // ReikaChatHelper.writeCoords(world, x, y, z);
    // ReikaChatHelper.writeBlockAtCoords(world, x0, y0, z0);
    world.spawnParticle("hugeexplosion", x0, y0, z0, 0, 0, 0);
    for (int i = -3; i <= 3; i++) {
      for (int j = -3; j <= 3; j++) {
        for (int k = -3; k <= 3; k++) {
          if (i * j * k < 9 && i * j * k > -9) {
            if (ConfigRegistry.BLOCKDAMAGE.getState()) {
              int id = world.getBlockId(x0 + i, y0 + j, z0 + k);
              if (ReikaWorldHelper.softBlocks(id)
                  && !ReikaWorldHelper.isLiquidSourceBlock(worldObj, x0 + i, y0 + j, z0 + k))
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world, x0 + i, y0 + j, z0 + k, id, -1, x0 + i, y0 + j, z0 + k, 5);
              if (power >= 1) {
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.leaves.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.plantRed.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.plantYellow.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.reed.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.waterlily.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.mushroomBrown.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.mushroomRed.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.sapling.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.web.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.cactus.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.flowerPot.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
              }
              if (power >= 2) {
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.glass.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.thinGlass.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.glowStone.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.mushroomCapRed.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.mushroomCapBrown.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.ladder.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.signPost.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.signWall.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
              }
              if (power >= 3) {
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.wood.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.planks.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.fence.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.cloth.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.workbench.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.doorWood.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.netherrack.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
              }
              if (power >= 4) {
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.sand.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.gravel.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.blockClay.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
                ReikaWorldHelper.recursiveBreakWithinSphere(
                    world,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    Block.slowSand.blockID,
                    -1,
                    x0 + i,
                    y0 + j,
                    z0 + k,
                    5);
              }
              if (power >= 3) {
                // ReikaWorldHelper.recursiveBreakWithinSphere(world, x0+i, y0+j, z0+k,
                // Block.grass.blockID, -1, x0+i, y0+j, z0+k, 5);
                // ReikaWorldHelper.recursiveFillWithinSphere(world, x0+i, y0+j-7, z0+k,
                // Block.grass.blockID, -1, Block.dirt.blockID, 0, x0+i, y0+j-7, z0+k, 5);
                if (id == Block.grass.blockID) {
                  if (power >= 5) {
                    Block.blocksList[id].dropBlockAsItem(world, x0 + i, y0 + j, z0 + k, 0, 0);
                    ReikaWorldHelper.legacySetBlockWithNotify(world, x0 + i, y0 + j, z0 + k, 0);
                  } else
                    ReikaWorldHelper.legacySetBlockWithNotify(
                        world, x0 + i, y0 + j, z0 + k, Block.dirt.blockID);
                }
                world.markBlockForUpdate(x0 + i, y0 + j, z0 + k);
                if (id == Block.dirt.blockID) {
                  int meta = world.getBlockMetadata(x0 + i, y0 + j, z0 + k);
                  if (meta >= 3 || (meta > 3 - (power - 6) && power > 6)) {
                    Block.blocksList[id].dropBlockAsItem(world, x0 + i, y0 + j, z0 + k, 0, 0);
                    ReikaWorldHelper.legacySetBlockWithNotify(world, x0 + i, y0 + j, z0 + k, 0);
                  } else
                    ReikaWorldHelper.legacySetBlockMetadataWithNotify(
                        world, x0 + i, y0 + j, z0 + k, meta + 1);
                }
              }
              if (power >= 5) {
                if (id == Block.stone.blockID) {
                  int meta = world.getBlockMetadata(x0 + i, y0 + j, z0 + k);
                  if (meta >= 2 || (meta > 2 - (power - 8) && power > 8)) {
                    if (power <= 12)
                      ReikaWorldHelper.legacySetBlockWithNotify(
                          world, x0 + i, y0 + j, z0 + k, Block.cobblestone.blockID);
                    else {
                      Block.blocksList[id].dropBlockAsItem(world, x0 + i, y0 + j, z0 + k, 0, 0);
                      ReikaWorldHelper.legacySetBlockWithNotify(world, x0 + i, y0 + j, z0 + k, 0);
                    }
                  } else
                    ReikaWorldHelper.legacySetBlockMetadataWithNotify(
                        world, x0 + i, y0 + j, z0 + k, meta + 1);
                }
                if (id == Block.cobblestone.blockID
                    || id == Block.cobblestoneWall.blockID
                    || id == Block.cobblestoneMossy.blockID) {
                  int meta = world.getBlockMetadata(x0 + i, y0 + j, z0 + k);
                  if (meta >= 3 || (meta > 3 - (power - 8) && power > 8)) {
                    Block.blocksList[id].dropBlockAsItem(world, x0 + i, y0 + j, z0 + k, 0, 0);
                    ReikaWorldHelper.legacySetBlockWithNotify(world, x0 + i, y0 + j, z0 + k, 0);
                  } else
                    ReikaWorldHelper.legacySetBlockMetadataWithNotify(
                        world, x0 + i, y0 + j, z0 + k, meta + 1);
                }
              }
              if (power == 14) {
                for (int n = 1; n < Block.blocksList.length; n++) {
                  if (Block.blocksList[n] != null
                      && n != MachineRegistry.RAILGUN.getBlockID()
                      && ReikaMathLibrary.isValueOutsideBounds(7, 11, n)) {
                    ReikaWorldHelper.recursiveBreakWithinSphere(
                        world, x0 + i, y0 + j, z0 + k, n, -1, x0 + i, y0 + j, z0 + k, 3);
                  }
                }
              }
              if (power == 15) {
                for (int n = 1; n < Block.blocksList.length; n++) {
                  if (Block.blocksList[n] != null
                      && n != MachineRegistry.RAILGUN.getBlockID()
                      && ReikaMathLibrary.isValueOutsideBounds(7, 11, n)) {
                    ReikaWorldHelper.recursiveBreakWithinSphere(
                        world, x0 + i, y0 + j, z0 + k, n, -1, x0 + i, y0 + j, z0 + k, 6);
                  }
                }
              }
            }

            AxisAlignedBB splash = AxisAlignedBB.getBoundingBox(x, y, z, x, y, z).expand(3, 3, 3);
            // world.createExplosion(this, x, y, z, 3F, false);
            List dmgd = world.getEntitiesWithinAABB(Entity.class, splash);
            for (int l = 0; l < dmgd.size(); l++) {
              ent = (Entity) dmgd.get(l);
              if (ent instanceof EntityLiving) {
                el = (EntityLiving) ent;
                this.applyAttackEffectsToEntity(world, el);
              } else if (ent instanceof EntityEnderCrystal
                  || ent instanceof EntityPainting
                  || ent instanceof EntityItemFrame) // Will not target but will destroy
              ent.attackEntityFrom(DamageSource.generic, this.getAttackDamage());
            }
          }
          for (int m = 0; m < 2; m++) {
            world.spawnParticle(
                "lava",
                x - 1 + 2 * rand.nextFloat() + i,
                y - 1.5 + rand.nextFloat() + j,
                z - 1 + 2 * rand.nextFloat() + k,
                0,
                0,
                0);
          }
        }
      }
    }
    this.setDead();
    // ent.attackEntityFrom(DamageSource.outOfWorld, el.getHealth()*(1+el.getTotalArmorValue()));
  }
Ejemplo n.º 14
0
 @SubscribeEvent
 public void burnLubricantHose(BlockConsumedByFireEvent evt) {
   if (MachineRegistry.getMachine(evt.world, evt.x, evt.y, evt.z) == MachineRegistry.HOSE) {
     ((TileEntityHose) evt.world.getTileEntity(evt.x, evt.y, evt.z)).burn();
   }
 }