コード例 #1
0
 public void validateStructure(World world, int x, int y, int z) {
   if (worldObj.isRemote) return;
   if (this.getBlockMetadata() == 15) {
     complete = true;
   } else {
     complete = ChromaStructures.getPortalStructure(world, x, y, z, false).matchInWorld();
     complete &= this.getEntities(world, x, y, z);
   }
   worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
 }
コード例 #2
0
    @Override
    public void updateEntity() {
      if (ticks == 0) this.onFirstTick();
      ticks++;

      if (DragonAPICore.debugtest) {
        ChromaStructures.getPortalStructure(worldObj, xCoord, yCoord, zCoord, false).place();
        DragonAPICore.debugtest = false;
      }

      if (complete) {
        if (charge < MINCHARGE || !ChunkProviderChroma.areStructuresReady()) {
          charge++;
          if (worldObj.isRemote) this.chargingParticles();
        }
      } else {
        charge = 0;
      }
      int pos = this.getPortalPosition();
      if (worldObj.isRemote) {
        if (pos == 5 && this.isFull9x9()) {
          if (worldObj.isRemote) this.idleParticles();
          if (complete) {
            if (charge >= MINCHARGE) {
              if (worldObj.isRemote) this.activeParticles();
            }
          }
        }
      }
      if (pos == 5 && this.isFull9x9()) {
        if (ticks % 20 == 0) this.validateStructure(worldObj, xCoord, yCoord, zCoord);
        if (complete && ticks % 90 == 0) {
          ChromaSounds.PORTAL.playSoundAtBlock(this);
        }
      }
    }
コード例 #3
0
  @Override
  public void updateEntity(World world, int x, int y, int z, int meta) {
    super.updateEntity(world, x, y, z, meta);

    if (DragonAPICore.debugtest) {
      if (!hasMultiblock) {
        CrystalElement e = CrystalElement.randomElement();
        FilledBlockArray b = ChromaStructures.getPylonStructure(world, x, y - 9, z, e);
        b.place();
        // world.setBlock(x, y+9, z, this.getTile().getBlock(), this.getTile().getBlockMetadata(),
        // 3);
        // TileEntityCrystalPylon te = (TileEntityCrystalPylon)world.getTileEntity(x, y+9, z);
        color = e;
        hasMultiblock = true;
        this.syncAllData(true);
      }
    }

    if (hasMultiblock) {
      // ReikaJavaLibrary.pConsole(energy, Side.SERVER, color == CrystalElement.BLUE);

      int max = this.getCapacity();
      if (world.getTotalWorldTime() != lastWorldTick) {
        this.charge(world, x, y, z, max);
        lastWorldTick = world.getTotalWorldTime();
      }
      energy = Math.min(energy, max);

      if (world.isRemote) {
        this.spawnParticle(world, x, y, z);
      }

      if (!world.isRemote && rand.nextInt(80) == 0) {
        int r = 8 + rand.nextInt(8);
        AxisAlignedBB box = ReikaAABBHelper.getBlockAABB(x, y, z).expand(r, r, r);
        List<EntityLivingBase> li = world.getEntitiesWithinAABB(EntityLivingBase.class, box);
        for (EntityLivingBase e : li) {
          boolean attack = !e.isDead && e.getHealth() > 0;
          if (e instanceof EntityPlayer) {
            EntityPlayer ep = (EntityPlayer) e;
            attack =
                attack && !ep.capabilities.isCreativeMode && !Chromabilities.PYLON.enabledOn(ep);
          } else if (e instanceof EntityBallLightning) {
            attack = ((EntityBallLightning) e).getElement() != color;
          }
          if (attack) {
            this.attackEntity(e);
            this.sendClientAttack(this, e);
          }
        }
      }

      float f = this.isEnhanced() ? 1.125F : 1;

      if (TileEntityCrystalPylon.TUNED_PYLONS)
        f *= CrystalMusicManager.instance.getDingPitchScale(color);

      if (this.getTicksExisted() % (int) (72 / f) == 0) {
        ChromaSounds.POWER.playSoundAtBlock(this, 1, f);
      }

      int n = this.isEnhanced() ? 24 : 36;
      if (world.isRemote && rand.nextInt(n) == 0) {
        this.spawnLightning(world, x, y, z);
      }

      if (!world.isRemote
          && ChromaOptions.BALLLIGHTNING.getState()
          && energy >= this.getCapacity() / 2
          && rand.nextInt(24000) == 0
          && this.isChunkLoaded()) {
        world.spawnEntityInWorld(
            new EntityBallLightning(world, color, x + 0.5, y + 0.5, z + 0.5)
                .setPylon()
                .setNoDrops());
      }
    }
  }
コード例 #4
0
 @Override
 protected boolean checkForStructure() {
   return ChromaStructures.getBroadcastStructure(worldObj, xCoord, yCoord, zCoord).matchInWorld();
 }