コード例 #1
0
  @Override
  protected void writeSyncTag(NBTTagCompound NBT) {
    super.writeSyncTag(NBT);

    tank.writeToNBT(NBT);

    NBT.setLong("e", energy);
    NBT.setInteger("temp", temperature);
  }
コード例 #2
0
  @Override
  protected void readSyncTag(NBTTagCompound NBT) {
    super.readSyncTag(NBT);

    tank.readFromNBT(NBT);

    energy = NBT.getLong("e");
    temperature = NBT.getInteger("temp");
  }
コード例 #3
0
  @Override
  public void updateEntity(World world, int x, int y, int z, int meta) {
    super.updateTileEntity();
    this.getPowerBelow();

    timer.update();
    if (timer.checkCap()) this.updateTemperature(world, x, y, z, meta);
    if (temperature > this.getMeltingTemperature()) energy += power;
    else energy *= 0.85;

    // ReikaJavaLibrary.pConsole(this.getMeltingTemperature()+":"+energy/20F/MELT_ENERGY,
    // Side.SERVER);

    tickcount++;
    if (omega > 0 && power > 0) {
      if (tickcount > 98) {
        SoundRegistry.FRICTION.playSoundAtBlock(
            world, x, y, z, RotaryAux.isMuffled(this) ? 0.1F : 0.5F, 0.5F);
        tickcount = 0;
      }
      world.spawnParticle(
          "crit",
          x + rand.nextDouble(),
          y,
          z + rand.nextDouble(),
          -0.2 + 0.4 * rand.nextDouble(),
          0.4 * rand.nextDouble(),
          -0.2 + 0.4 * rand.nextDouble());
    }

    for (int i = 0; i < inv.length; i++) {
      ItemStack is = inv[i];
      if (is != null) {
        FluidStack fs = RecipesLavaMaker.getRecipes().getMelting(is);
        long melt_energy = RecipesLavaMaker.getRecipes().getMeltingEnergy(is);
        // ReikaJavaLibrary.pConsole(energy/20L+":"+melt_energy, Side.SERVER);
        if (fs != null) {
          if (this.canMake(fs) && energy >= melt_energy * 20) {
            tank.addLiquid(fs.amount, fs.getFluid());
            ReikaInventoryHelper.decrStack(i, inv);
            energy -= melt_energy * 20;
            return;
          }
        }
      }
    }
  }