@Override
 public void writeCustomNBT(NBTTagCompound nbt, boolean descPacket) {
   nbt.setInteger("facing", facing);
   // nbt.setFloat("prevRotation", prevRotation);
   nbt.setFloat("rotation", rotation);
   nbt.setFloat("turnSpeed", turnSpeed);
 }
 @Override
 public void writeRuleData(NBTTagCompound tag) {
   tag.setString("mobID", mobID);
   tag.setFloat("xOffset", xOffset);
   tag.setFloat("zOffset", zOffset);
   tag.setFloat("yOffset", yOffset);
   tag.setFloat("rotation", rotation);
 }
 @Override
 public void writeLosely(NBTTagCompound compound) {
   compound.setBoolean("hasLens", this.hasLens.getValue());
   compound.setInteger("color", this.color.getValue());
   compound.setFloat("brightness", this.brightness.getValueDirect());
   compound.setFloat("focus", this.focus.getValue());
   compound.setBoolean("beat", this.beat.getValue());
 }
Ejemplo n.º 4
0
  public void writeToNBT(NBTTagCompound nbt) {
    nbt.setByte("type", getDataTypeID());
    nbt.setShort("flags", (short) getDataFlags());
    nbt.setByte("outputs", (byte) getDataSides());

    nbt.setFloat("x", dX);
    nbt.setFloat("y", dY);
    nbt.setFloat("z", dZ);
  }
 @Override
 public void writeToNBT(NBTTagCompound compound) {
   compound.setBoolean("hasLens", this.hasLens.getValue());
   compound.setInteger("color", this.color.getValue());
   compound.setFloat("brightness", this.brightness.getValueDirect());
   compound.setFloat("pitch", this.pitch.getValue());
   compound.setFloat("rotation", this.rotation.getValue());
   compound.setFloat("focus", this.focus.getValue());
   compound.setBoolean("beat", this.beat.getValue());
 }
Ejemplo n.º 6
0
  public static ItemStack createTag(ItemStack is, float weight) {
    NBTTagCompound nbt = is.getTagCompound();
    if (nbt == null) nbt = new NBTTagCompound();
    nbt.setFloat("foodWeight", weight);
    nbt.setFloat("foodDecay", 0);
    nbt.setInteger("decayTimer", (int) TFC_Time.getTotalHours() + 1);

    is.setTagCompound(nbt);
    return is;
  }
 @Override
 public void writeRestorableToNBT(NBTTagCompound tagCompound) {
   super.writeRestorableToNBT(tagCompound);
   tagCompound.setFloat("strength", strength);
   tagCompound.setFloat("power", power);
   tagCompound.setFloat("efficiency", efficiency);
   tagCompound.setFloat("purity", purity);
   tagCompound.setBoolean("glowing", glowing);
   tagCompound.setByte("version", (byte) 2); // Legacy support to support older crystals.
 }
Ejemplo n.º 8
0
 @Override
 public void writeEntityToNBT(NBTTagCompound compound) {
   super.writeEntityToNBT(compound);
   compound.setFloat("hitPosX", dataWatcher.getWatchableObjectFloat(HIT_POS_X));
   compound.setFloat("hitPosY", dataWatcher.getWatchableObjectFloat(HIT_POS_Y));
   compound.setFloat("hitPosZ", dataWatcher.getWatchableObjectFloat(HIT_POS_Z));
   compound.setInteger("hitX", hitX);
   compound.setInteger("hitY", hitY);
   compound.setInteger("hitZ", hitZ);
   compound.setByte("customInGround", (byte) (isInGround() ? 1 : 0));
   compound.setInteger("whipType", getType().ordinal());
 }
 public void writeToNBT(NBTTagCompound nbt) {
   nbt.setBoolean("doSpinning", this.doSpinning);
   nbt.setFloat("omegaRad", this.angularVelocityRadians);
   nbt.setFloat("omegaSky", this.skyAngularVelocity);
   nbt.setFloat("omegaTarget", this.angularVelocityTarget);
   nbt.setFloat("omegaAcc", this.angularVelocityAccel);
   if (this.oneSSBlock != null) {
     NBTTagCompound oneBlock = new NBTTagCompound();
     this.oneSSBlock.writeToNBT(oneBlock);
     nbt.setTag("oneBlock", oneBlock);
   }
 }
Ejemplo n.º 10
0
 @Override
 public void writeEntityToNBT(NBTTagCompound nbt) {
   super.writeEntityToNBT(nbt);
   nbt.setTag("SlimelingInventory", this.slimelingInventory.writeToNBT(new NBTTagList()));
   nbt.setFloat("SlimeRed", this.colorRed);
   nbt.setFloat("SlimeGreen", this.colorGreen);
   nbt.setFloat("SlimeBlue", this.colorBlue);
   nbt.setInteger("SlimelingAge", this.age);
   nbt.setString("SlimelingName", this.slimelingName);
   nbt.setInteger("FavFoodID", this.favFoodID);
   nbt.setFloat("SlimelingDamage", this.attackDamage);
   nbt.setInteger("SlimelingKills", this.kills);
 }
 @Override
 public void writeToNBT(NBTTagCompound compound) {
   super.writeToNBT(compound);
   compound.setString("SpellScript", Strings.join(script.getChant(), " "));
   compound.setFloat("MagicEnergy", energy);
   NBTUtils.convertFacingToTag(compound, this.direction);
 }
Ejemplo n.º 12
0
  public NBTTagCompound writeCrucibleToNBT(TECrucible te) {
    NBTTagCompound nbt = new NBTTagCompound();

    nbt.setInteger("temp", te.temperature);

    NBTTagList nbttaglist = new NBTTagList();
    Iterator iter = te.metals.values().iterator();
    while (iter.hasNext()) {
      MetalPair m = (MetalPair) iter.next();
      if (m != null) {
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        nbttagcompound1.setInteger("ID", m.type.IngotID);
        nbttagcompound1.setFloat("AmountF", m.amount);
        nbttaglist.appendTag(nbttagcompound1);
      }
    }
    nbt.setTag("Metals", nbttaglist);

    nbttaglist = new NBTTagList();
    for (int i = 0; i < te.storage.length; i++) {
      if (te.storage[i] != null) {
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        nbttagcompound1.setByte("Slot", (byte) i);
        te.storage[i].writeToNBT(nbttagcompound1);
        nbttaglist.appendTag(nbttagcompound1);
      }
    }

    nbt.setTag("Items", nbttaglist);

    return nbt;
  }
  @Override
  public void setScaleFactor(float parScaleFactor) {
    syncDataCompound.setFloat("scaleFactor", Math.abs(parScaleFactor));

    // don't forget to sync client and server
    sendEntitySyncPacket();
  }
 @Override
 public void writeEntityToNBT(NBTTagCompound tag) {
   super.writeEntityToNBT(tag);
   tag.setInteger("phase", this.getCurrentPhase());
   tag.setBoolean("phaseChange", this.phaseChange);
   tag.setFloat("phaseDamage", this.phaseDamage);
   tag.setInteger("phaseTicks", this.getPhaseTicks());
 }
Ejemplo n.º 15
0
 public void writeToNBT(NBTTagCompound compound) {
   super.writeToNBT(compound);
   compound.setInteger("blockId", Block.getIdFromBlock(this.field_174932_a.getBlock()));
   compound.setInteger(
       "blockData", this.field_174932_a.getBlock().getMetaFromState(this.field_174932_a));
   compound.setInteger("facing", this.field_174931_f.getIndex());
   compound.setFloat("progress", this.lastProgress);
   compound.setBoolean("extending", this.extending);
 }
Ejemplo n.º 16
0
  @Override
  public void writeToNBT(NBTTagCompound nbttagcompound) {
    super.writeToNBT(nbttagcompound);

    nbttagcompound.setInteger("Charge", charge);
    nbttagcompound.setFloat("Progress", progress);
    nbttagcompound.setInteger("Stage", stage);
    nbttagcompound.setInteger("Duration", duration);
    nbttagcompound.setBoolean("Reverse", reverse);
  }
Ejemplo n.º 17
0
  public void onUpdate(ItemStack item, World world, Entity heldEnt, int meta, boolean held) {
    ItemUtils.checkCompound(item);

    if (!item.stackTagCompound.hasKey("colourData")) {
      NBTTagCompound colours = new NBTTagCompound();
      colours.setFloat("r", 0.8F);
      colours.setFloat("g", 0.0F);
      colours.setFloat("b", 0.8F);
    }

    float rgb[] = null;

    NBTTagCompound colours = item.stackTagCompound.getCompoundTag("colourData");

    if (item.stackTagCompound.hasKey("focus")) {
      ISceptreFocus focus = getFocus(item);

      if (focus != null) {
        focus.onItemTick(item);
        rgb = focus.getRGB();
      } else item.stackTagCompound.removeTag("focus");
    }

    if (rgb == null) rgb = new float[] {0.8F, 0F, 0.8F};

    float oR = colours.getFloat("r");
    float oG = colours.getFloat("g");
    float oB = colours.getFloat("b");

    if (oR > rgb[0] + step) oR -= step;
    else if (oR < rgb[0] - step) oR += step;
    if (oG > rgb[1] + step) oG -= step;
    else if (oG < rgb[1] - step) oG += step;
    if (oB > rgb[2] + step) oB -= step;
    else if (oB < rgb[2] - step) oB += step;

    colours.setFloat("r", oR);
    colours.setFloat("g", oG);
    colours.setFloat("b", oB);

    item.stackTagCompound.setTag("colourData", colours);
  }
Ejemplo n.º 18
0
 public static void registerTransparentBlock(Block block, float transparency, int meta) {
   if (block != null) {
     NBTTagCompound tag = new NBTTagCompound();
     ResourceLocation b1 = block.delegate.name();
     tag.setString("blockName", b1.getResourcePath());
     tag.setString("modid", b1.getResourceDomain());
     tag.setFloat("t", transparency);
     tag.setInteger("m", meta);
     TomsModRecipeHelper.sendMessage(tag, "glass", 2);
   }
 }
Ejemplo n.º 19
0
 // region Read - Write
 @Override
 public void writeToNBT(NBTTagCompound tagCompound) {
   super.writeToNBT(tagCompound);
   tagCompound.setFloat("X", x);
   tagCompound.setFloat("Y", y);
   tagCompound.setFloat("Z", z);
   tagCompound.setFloat("Size", size);
   tagCompound.setFloat("Mass", mass);
   tagCompound.setByte("Type", type);
   tagCompound.setInteger("Temperature", temperature);
   tagCompound.setInteger("Color", color);
   tagCompound.setInteger("Seed", seed);
   tagCompound.setBoolean("Generated", generated);
   NBTTagList planetList = new NBTTagList();
   for (Planet planet : getPlanets()) {
     NBTTagCompound quadrantNBT = new NBTTagCompound();
     planet.writeToNBT(quadrantNBT);
     planetList.appendTag(quadrantNBT);
   }
   tagCompound.setTag("Planets", planetList);
 }
Ejemplo n.º 20
0
  @Override
  public void writeToNBT(NBTTagCompound nbttagcompound) {
    super.writeToNBT(nbttagcompound);
    nbttagcompound.setFloat("temperature", fireTemperature);
    nbttagcompound.setFloat("fuelTimeLeft", fuelTimeLeft);
    nbttagcompound.setFloat("fuelBurnTemp", fuelBurnTemp);
    nbttagcompound.setInteger("charcoalCounter", charcoalCounter);
    nbttagcompound.setFloat("airFromBellowsTime", airFromBellowsTime);
    nbttagcompound.setFloat("airFromBellows", airFromBellows);
    nbttagcompound.setBoolean("isValid", isValid);

    NBTTagList nbttaglist = new NBTTagList();
    for (int i = 0; i < fireItemStacks.length; i++) {
      if (fireItemStacks[i] != null) {
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        nbttagcompound1.setByte("Slot", (byte) i);
        fireItemStacks[i].writeToNBT(nbttagcompound1);
        nbttaglist.appendTag(nbttagcompound1);
      }
    }
    nbttagcompound.setTag("Items", nbttaglist);
  }
Ejemplo n.º 21
0
 @Override
 public void writeToNBT(NBTTagCompound nbttc) {
   super.writeToNBT(nbttc);
   nbttc.setBoolean("silktouch", this.silktouch);
   nbttc.setByte("fortune", this.fortune);
   nbttc.setByte("efficiency", this.efficiency);
   nbttc.setByte("unbreaking", this.unbreaking);
   this.pp.writeToNBT(nbttc);
   if (this.src1 != null) nbttc.setCompoundTag("src1", this.src1.writeToNBT(new NBTTagCompound()));
   if (this.src2 != null) nbttc.setCompoundTag("src2", this.src2.writeToNBT(new NBTTagCompound()));
   if (this.res != null) nbttc.setCompoundTag("res", this.res.writeToNBT(new NBTTagCompound()));
   nbttc.setFloat("animationSpeed", this.animationSpeed);
   nbttc.setInteger("animationStage", this.animationStage);
 }
Ejemplo n.º 22
0
  /** (abstract) Protected helper method to write subclass entity data to NBT. */
  @Override
  public void writeEntityToNBT(NBTTagCompound nbt) {
    super.writeEntityToNBT(nbt);
    nbt.setInteger("Sex", sex);
    nbt.setFloat("Size Modifier", size_mod);

    nbt.setFloat("Strength Modifier", strength_mod);
    nbt.setFloat("Aggression Modifier", aggression_mod);
    nbt.setFloat("Obedience Modifier", obedience_mod);
    nbt.setFloat("Colour Modifier", colour_mod);
    nbt.setFloat("Climate Adaptation Modifier", climate_mod);
    nbt.setFloat("Hardiness Modifier", hard_mod);

    nbt.setInteger("Hunger", hunger);
    nbt.setFloat("MateSize", mateSizeMod);
    nbt.setInteger("Age", getBirthDay());
    nbt.setLong("nextEgg", nextEgg);
  }
  public static ItemStack setContainedMagic(ItemStack output, MagicAmounts amounts) {
    if (output == null) {
      return null;
    }

    if (output.stackSize != 1) {
      return null;
    }

    if (isInfiniteContainer(output)) return output;

    if (amounts != null) {
      if (amounts.isEmpty()) {
        amounts = null;
      }
    }

    if (amounts != null) {
      output = identifyQuality(output);

      NBTTagCompound nbt = output.getTagCompound();
      if (nbt == null) {
        nbt = new NBTTagCompound();
        output.setTagCompound(nbt);
      }

      for (int i = 0; i < MagicAmounts.ELEMENTS; i++) {
        nbt.setFloat("" + i, amounts.amounts[i]);
      }

      return output;
    } else {
      NBTTagCompound nbt = output.getTagCompound();

      if (nbt != null) {
        for (int i = 0; i < MagicAmounts.ELEMENTS; i++) {
          nbt.removeTag("" + i);
        }

        if (nbt.getKeySet().size() == 0) output.setTagCompound(null);
      }

      return output;
    }
  }
Ejemplo n.º 24
0
  private void writeFieldToTag(NBTTagCompound tag, SavedField field) {
    if (field == null || field.type == null || field.value == null) {
      // ignore.
    } else if (field.type.equals(Integer.class)) {
      tag.setInteger(field.name, (Integer) field.value);
    } else if (field.type.equals(int[].class)) {
      tag.setIntArray(field.name, (int[]) field.value);
    } else if (field.type.equals(Float.class)) {
      tag.setFloat(field.name, (Float) field.value);
    } else if (field.type.equals(Double.class)) {
      tag.setDouble(field.name, (Double) field.value);
    } else if (field.type.equals(double[].class)) {
      NBTTagList list = new NBTTagList();
      double[] array = (double[]) field.value;
      for (int i = 0; i < array.length; i++)
        list.appendTag(new NBTTagDouble(field.name + "_" + i, array[i]));

      tag.setTag(field.name, list);
    } else if (field.type.equals(Boolean.class)) {
      tag.setBoolean(field.name, (Boolean) field.value);
    } else if (field.type.equals(boolean[].class)) {
      NBTTagList list = new NBTTagList();
      boolean[] array = (boolean[]) field.value;
      for (int i = 0; i < array.length; i++)
        list.appendTag(new NBTTagByte(field.name + "_" + i, (byte) (array[i] ? 1 : 0)));

      tag.setTag(field.name, list);
    } else if (field.type.equals(String.class)) {
      tag.setString(field.name, (String) field.value);
    } else if (field.type.equals(String[].class)) {
      NBTTagList list = new NBTTagList();
      String[] array = (String[]) field.value;
      for (int i = 0; i < array.length; i++)
        list.appendTag(new NBTTagString(field.name + "_" + i, array[i]));

      tag.setTag(field.name, list);
    } else if (field.type.equals(TaggedClass.class)) {
      NBTTagCompound compound = new NBTTagCompound();
      writeClassToTag(compound, (TaggedClass) field.value);
      tag.setCompoundTag(field.name, compound);
    } else {
      throw new IllegalArgumentException("Cannot save object type.");
    }
  }
 @Override
 public void writeToNBT(NBTTagCompound tag) {
   super.writeToNBT(tag);
   tag.setString("sensorSetting", sensorSetting);
   tag.setBoolean("invertedRedstone", invertedRedstone);
   tag.setFloat("dishSpeed", dishSpeed);
   tag.setString("sensorText", sensorGuiText);
   // Write the ItemStacks in the inventory to NBT
   NBTTagList tagList = new NBTTagList();
   for (int currentIndex = 0; currentIndex < inventory.length; ++currentIndex) {
     if (inventory[currentIndex] != null) {
       NBTTagCompound tagCompound = new NBTTagCompound();
       tagCompound.setByte("Slot", (byte) currentIndex);
       inventory[currentIndex].writeToNBT(tagCompound);
       tagList.appendTag(tagCompound);
     }
   }
   tag.setTag("Items", tagList);
 }
  /** Writes a tile entity to NBT. */
  public void writeToNBT(NBTTagCompound nbt) {
    super.writeToNBT(nbt);
    nbt.setFloat("Time", time);
    if (requiredUtensil != null) {
      nbt.setString("Tool", requiredUtensil);
    }
    nbt.setInteger("Dir", direction);
    NBTTagList var2 = new NBTTagList();

    for (int var3 = 0; var3 < this.inv.length; ++var3) {
      if (this.inv[var3] != null) {
        NBTTagCompound var4 = new NBTTagCompound();
        var4.setByte("Slot", (byte) var3);
        this.inv[var3].writeToNBT(var4);
        var2.appendTag(var4);
      }
    }

    nbt.setTag("Items", var2);
  }
Ejemplo n.º 27
0
  public ItemStack getDefaultItem() {
    ItemStack gear = new ItemStack(this, 1, 0);
    NBTTagCompound itemTag = new NBTTagCompound();

    int baseDurability = 500;

    itemTag.setInteger("Damage", 0); // Damage is damage to the tool
    itemTag.setInteger("TotalDurability", baseDurability);
    itemTag.setInteger("BaseDurability", baseDurability);
    itemTag.setInteger("BonusDurability", 0); // Modifier
    itemTag.setFloat("ModDurability", 0f); // Modifier
    itemTag.setInteger("Modifiers", 5);
    itemTag.setBoolean("Broken", false);
    itemTag.setBoolean("Built", true);

    NBTTagCompound baseTag = new NBTTagCompound();
    baseTag.setTag(getBaseTagName(), itemTag);
    gear.setTagCompound(baseTag);
    return gear;
  }
Ejemplo n.º 28
0
 public EntityPixelmon sendOut(int id, World world) {
   for (int i = 0; i < partyPokemon.length; i++) {
     NBTTagCompound n = partyPokemon[i];
     if (n != null) {
       if (n.getInteger("pixelmonID") == id) {
         n.setFloat("FallDistance", 0);
         n.setBoolean("IsInBall", false);
         EntityPixelmon e = (EntityPixelmon) PixelmonEntityList.createEntityFromNBT(n, world);
         if (mode == PokeballManagerMode.Player) {
           e.setOwner(player.username);
           e.playerOwned = true;
         } else e.setTrainer(trainer);
         e.motionX = e.motionY = e.motionZ = 0;
         e.isDead = false;
         return e;
       }
     }
   }
   return null;
 }
Ejemplo n.º 29
0
  @Override
  public void saveNBTData(NBTTagCompound nbtPlayer) {
    NBTTagCompound nbt = new NBTTagCompound();

    nbt.setFloat("karma", karma);
    nbt.setShort("flyTime", (short) flyTime);
    nbt.setShort("invisCooldown", (short) invisibilityCooldown);

    NBTTagList eventList = new NBTTagList();
    for (int i = 0; i < eventAmounts.length; i++) {
      NBTTagCompound evtInfo = new NBTTagCompound();
      evtInfo.setByte("id", (byte) i);
      evtInfo.setByte("value", eventAmounts[i]);
      eventList.appendTag(evtInfo);
    }
    nbt.setTag("events", eventList);

    nbt.setByteArray("enderBook", enderbookRecipes);

    nbt.setTag("quests", Quest.writeQuests(activeQuests));

    nbtPlayer.setCompoundTag(IDENTIFIER, nbt);
  }
Ejemplo n.º 30
0
  @Override
  public void writeToNBT(NBTTagCompound nbt) {
    super.writeToNBT(nbt);

    nbt.setInteger("temp", temperature);

    NBTTagList nbttaglist = new NBTTagList();
    Iterator iter = metals.values().iterator();
    while (iter.hasNext()) {
      MetalPair m = (MetalPair) iter.next();
      if (m != null) {
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        nbttagcompound1.setInteger("ID", m.type.IngotID);
        nbttagcompound1.setFloat("AmountF", m.amount);
        nbttaglist.appendTag(nbttagcompound1);
      }
    }
    nbt.setTag("Metals", nbttaglist);

    nbttaglist = new NBTTagList();
    for (int i = 0; i < storage.length; i++) {
      if (storage[i] != null) {
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        nbttagcompound1.setByte("Slot", (byte) i);
        storage[i].writeToNBT(nbttagcompound1);
        nbttaglist.appendTag(nbttagcompound1);
      }
    }

    nbt.setTag("Items", nbttaglist);

    if (currentAlloy != null) {
      nbt.setInteger("outputAmount", currentAlloy.outputAmount);
    } else {
      nbt.setInteger("outputAmount", 0);
    }
  }