Ejemplo n.º 1
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);
 }
 @Override
 public void writeEntityToNBT(NBTTagCompound tag) {
   tag.setCompoundTag("ammoSource", _ammoSource.writeToNBT(new NBTTagCompound()));
   tag.setDouble("distance", distance);
   tag.setBoolean("falling", _falling);
   if (_owner != null) tag.setString("owner", _owner);
 }
 public NBTTagCompound func_92030_a() {
   NBTTagCompound var1 = new NBTTagCompound();
   var1.setCompoundTag("Properties", this.field_92032_b);
   var1.setString("Type", this.field_92033_c);
   var1.setInteger("Weight", this.itemWeight);
   return var1;
 }
Ejemplo n.º 4
0
  @Override
  public void processCommand(ICommandSender sender, String[] par2ArrayOfStr) {
    EntityPlayer player = getCommandSenderAsPlayer(sender);
    EntityPlayerMP other = func_82359_c(sender, par2ArrayOfStr[0]);

    if (par2ArrayOfStr.length != 1) {
      player.addChatMessage(getCommandUsage(sender));
      return;
    }

    NBTTagCompound playerdata =
        NecessitiesMain.instance.necessities_data.getCompoundTag(other.username);
    NecessitiesMain.instance.necessities_data.setCompoundTag(other.username, playerdata);
    NBTTagCompound tpa = playerdata.getCompoundTag("[Tpa]");
    playerdata.setCompoundTag("[Tpa]", tpa);

    if (tpa.hasKey("DenyAll")) {
      player.addChatMessage("Player " + other.username + " has blocked all teleport requests.");
      return;
    }
    tpa.setString("Command", "TPA");
    tpa.setString("Who", player.username);
    player.addChatMessage("Sending teleport request to player " + other.username);
    other.addChatMessage(
        player.username
            + " has requested to teleport to you.  Use /tpaccept to accept or /tpreject to refuse.");
  }
 public void spawnFirecode(Vector3f pos, int flightTime, Object func) {
   final IFunction explodeFunc = JSScriptingManager.getInstance().getFunction(func);
   final EntityPlayer owner = _player;
   ItemStack stk = new ItemStack(Item.firework);
   NBTTagCompound baseComp = new NBTTagCompound();
   baseComp.setCompoundTag("Fireworks", new NBTTagCompound("Fireworks"));
   baseComp.getCompoundTag("Fireworks").setByte("Flight", (byte) flightTime);
   stk.setTagCompound(baseComp);
   EntityFireworkRocket fireWork =
       new EntityFireworkRocket(
           _world, (int) pos.getX(), (int) pos.getY(), (int) pos.getZ(), stk) {
         @Override
         public void onUpdate() {
           super.onUpdate();
           if (this.isDead) {
             if (explodeFunc != null && !worldObj.isRemote) {
               try {
                 JSScriptingManager.getInstance()
                     .runFunction(
                         new ScriptRunnerPlayer(owner),
                         explodeFunc,
                         new Vector3f(this.posX, this.posY, this.posZ));
               } catch (InternalScriptingException e) {
                 owner.sendChatToPlayer("Error in firecode: " + e.getMessage());
               }
             }
           }
         }
       };
   _world.spawnEntityInWorld(fireWork);
 }
Ejemplo n.º 6
0
 @Override
 public void readSpawnData(ByteArrayDataInput data) {
   returnStack = new ItemStack(data.readShort(), 1, 0);
   rotationYaw = data.readFloat();
   NBTTagCompound compound = new NBTTagCompound();
   NBTTagCompound toolTag = new NBTTagCompound();
   toolTag.setInteger("RenderHandle", data.readInt());
   toolTag.setInteger("RenderHead", data.readInt());
   toolTag.setInteger("RenderAccessory", data.readInt());
   switch (data.readInt()) {
     case 6:
       toolTag.setInteger("Effect6", data.readInt());
     case 5:
       toolTag.setInteger("Effect5", data.readInt());
     case 4:
       toolTag.setInteger("Effect4", data.readInt());
     case 3:
       toolTag.setInteger("Effect3", data.readInt());
     case 2:
       toolTag.setInteger("Effect2", data.readInt());
     case 1:
       toolTag.setInteger("Effect1", data.readInt());
   }
   compound.setCompoundTag("InfiTool", toolTag);
   returnStack.setTagCompound(compound);
 }
Ejemplo n.º 7
0
 /** (abstract) Protected helper method to write subclass entity data to NBT. */
 @Override
 public void writeEntityToNBT(NBTTagCompound var1) {
   super.writeEntityToNBT(var1);
   if (this.buyingList != null) {
     var1.setCompoundTag("Offers", this.buyingList.getRecipiesAsTags());
   }
 }
	@Override
	public void writeToNBT(NBTTagCompound tag)
	{
		super.writeToNBT(tag);
		NBTTagList nbttaglist;
		if (_inventory.length > 0)
		{
			nbttaglist = new NBTTagList();
			for(int i = 0; i < _inventory.length; i++)
			{
				if (_inventory[i] != null && _inventory[i].stackSize > 0)
				{
					NBTTagCompound slot = new NBTTagCompound();
					slot.setByte("Slot", (byte)i);
					_inventory[i].writeToNBT(slot);
					nbttaglist.appendTag(slot);
				}
			}
			tag.setTag("Items", nbttaglist);
		}
		
		IFluidTank[] _tanks = getTanks();
		if (_tanks.length > 0)
		{
			NBTTagList tanks = new NBTTagList();
			for(int i = 0, n = _tanks.length; i < n; i++)
			{
				if(_tanks[i].getFluid() != null)
				{
					NBTTagCompound nbttagcompound1 = new NBTTagCompound();
					nbttagcompound1.setByte("Tank", (byte)i);
					
					FluidStack l = _tanks[i].getFluid();
					l.writeToNBT(nbttagcompound1);
					tanks.appendTag(nbttagcompound1);
				}
			}
			tag.setTag("mTanks", tanks);
		}
		
		if (this.isInvNameLocalized())
		{
			NBTTagCompound display = new NBTTagCompound();
			display.setString("Name", getInvName());
			tag.setCompoundTag("display", display);
		}
		
		if (failedDrops != null)
		{
			nbttaglist = new NBTTagList();
			for (ItemStack item : failedDrops)
			{
				NBTTagCompound nbttagcompound1 = new NBTTagCompound();
				item.writeToNBT(nbttagcompound1);
				nbttaglist.appendTag(nbttagcompound1);
			}
			tag.setTag("DropItems", nbttaglist);
		}
	}
Ejemplo n.º 9
0
 public void writeToNBT(NBTTagCompound n) {
   for (int i = 0; i < storageBoxes.length; i++) {
     ComputerBox c = storageBoxes[i];
     NBTTagCompound cTag = new NBTTagCompound();
     c.save(cTag);
     n.setCompoundTag("" + c.position, cTag);
   }
 }
Ejemplo n.º 10
0
 public void writeEntityToNBT(NBTTagCompound tags) {
   tags.setCompoundTag("Throwable", this.returnStack.writeToNBT(new NBTTagCompound()));
   tags.setShort("xTile", (short) xTile);
   tags.setShort("yTile", (short) yTile);
   tags.setShort("zTile", (short) zTile);
   tags.setByte("inTile", (byte) inTile);
   tags.setByte("shake", (byte) arrowShake);
   tags.setByte("onGround", (byte) (onGround ? 1 : 0));
 }
Ejemplo n.º 11
0
  /** (abstract) Protected helper method to write subclass entity data to NBT. */
  public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) {
    super.writeEntityToNBT(par1NBTTagCompound);
    par1NBTTagCompound.setInteger("Profession", this.getProfession());
    par1NBTTagCompound.setInteger("Riches", this.wealth);

    if (this.buyingList != null) {
      par1NBTTagCompound.setCompoundTag("Offers", this.buyingList.getRecipiesAsTags());
    }
  }
Ejemplo n.º 12
0
  /** (abstract) Protected helper method to write subclass entity data to NBT. */
  public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) {
    par1NBTTagCompound.setShort("Health", (short) ((byte) this.health));
    par1NBTTagCompound.setShort("Age", (short) this.age);

    if (this.func_92014_d() != null) {
      par1NBTTagCompound.setCompoundTag(
          "Item", this.func_92014_d().writeToNBT(new NBTTagCompound()));
    }
  }
Ejemplo n.º 13
0
  @Override
  public void writeToNBT(NBTTagCompound data) {
    super.writeToNBT(data);

    NBTTagList itemList = new NBTTagList();
    NBTTagList sideItemList = new NBTTagList();
    NBTTagCompound configData;

    data.setBoolean("shareRS", isRSShared);

    for (int i = 0; i < 3; i++) {

      if (inventory.getStackInSlot(i) != null) {
        NBTTagCompound itemCompound = new NBTTagCompound();
        itemCompound.setInteger("slot", i);
        inventory.getStackInSlot(i).writeToNBT(itemCompound);
        itemList.appendTag(itemCompound);
      }

      if (tanks[i].getFluid() != null) {
        data.setInteger("tankCap" + i, tanks[i].getCapacity());
        data.setTag("Fluid" + i, tanks[i].getFluid().writeToNBT(new NBTTagCompound()));
      }

      data.setBoolean("rsControl" + i, rsControl[i]);
      data.setBoolean("rsLatch" + i, rsLatch[i]);
    }

    data.setTag("items", itemList);

    for (int i = 0; i < 6; i++) {
      data.setInteger("side" + i, sides[i]);
      configData = new NBTTagCompound();
      configs[i].writeToNBT(configData);
      data.setCompoundTag("config" + i, configData);
      data.setBoolean("rs" + i, sideRS[i]);
      data.setBoolean("lock" + i, sideLocked[i]);
      data.setInteger("facID" + i, facID[i]);
      data.setInteger("facMeta" + i, facMeta[i]);

      if (sideInventory.getStackInSlot(i) != null) {
        NBTTagCompound itemCompound = new NBTTagCompound();
        itemCompound.setInteger("slot", i);
        sideInventory.getStackInSlot(i).writeToNBT(itemCompound);
        sideItemList.appendTag(itemCompound);
      }
    }

    data.setTag("sideItems", sideItemList);

    if (capacitor != null) {
      data.setInteger("realPower", capacitor.getEnergyStored());
      capacitor.writeToNBT(data);
      data.setInteger("powerCap2", capacitor.getMaxEnergyStored());
    }
  }
Ejemplo n.º 14
0
  private NBTTagCompound getCraftData() {
    NBTTagCompound result = getData();

    if (result != null) {
      if (!result.hasKey("bukkit")) {
        result.setCompoundTag("bukkit", new NBTTagCompound());
      }
      result = result.getCompoundTag("bukkit");
    }

    return result;
  }
Ejemplo n.º 15
0
  /** Writes a tile entity to NBT. */
  public void writeToNBT(NBTTagCompound par1NBTTagCompound) {
    super.writeToNBT(par1NBTTagCompound);
    par1NBTTagCompound.setShort("CookingTime", (short) this.cookingTime);
    par1NBTTagCompound.setBoolean("FinishedCooking", this.finishedCooking);
    par1NBTTagCompound.setShort("ReadyTime", (short) this.readyTime);
    par1NBTTagCompound.setBoolean("TooLate", this.tooLate);

    if (this.setItemstack() != null) {
      par1NBTTagCompound.setCompoundTag(
          "CookingItem", this.setItemstack().writeToNBT(new NBTTagCompound()));
    }
  }
Ejemplo n.º 16
0
 @Override
 public void writeToNBT(NBTTagCompound tag) {
   super.writeToNBT(tag);
   NBTTagCompound innerTag = new NBTTagCompound();
   if (modules != null) {
     for (int i = 0; i < modules.size(); i++) {
       innerTag.setString(Alphabet.values()[i].toString(), modules.get(i).toString());
     }
     tag.setCompoundTag(NBT_TAG_MODULE_COMPUND, innerTag);
   }
   super.writeEntityToNBT(tag);
 }
Ejemplo n.º 17
0
  public void addToParty(EntityPixelmon p) {
    if (mode == PokeballManagerMode.Player && pokedex != null) {
      pokedex.set(Pokedex.nameToID(p.getName()), DexRegisterStatus.caught);
      pokedex.sendToPlayer(pokedex.owner);
    }
    if (p.moveset.size() == 0) p.loadMoveset();
    if (!hasSpace()) {
      ChatHandler.sendChat(
          p.getOwner(), "Your party is full, " + p.getName() + " is sent to your computer!");
      PixelmonStorage.ComputerManager.getPlayerStorage(player).addToComputer(p);
      return;
    }
    if (p.caughtBall == null) p.caughtBall = EnumPokeballs.PokeBall;
    if (mode == PokeballManagerMode.Player) p.setOwner(player.username);
    else if (mode == PokeballManagerMode.Trainer) p.setTrainer(trainer);
    NBTTagCompound n = new NBTTagCompound();
    int id = 0;
    if (mode == PokeballManagerMode.Player) id = new Random().nextInt(32000);
    else if (mode == PokeballManagerMode.Trainer) id = new Random().nextInt(32000) * -1 - 1;
    boolean isUsed = false;
    do {
      isUsed = false;
      for (int i = 0; i < partyPokemon.length; i++) {
        NBTTagCompound nbt = partyPokemon[i];
        if (nbt != null) {
          if (mode == PokeballManagerMode.Player) {
            id = new Random().nextInt(32000);
          } else if (mode == PokeballManagerMode.Trainer) {
            id = new Random().nextInt(32000) * -1 - 1;
          }
        }
      }
    } while (contains(id));

    p.setPokemonId(id);
    p.writeEntityToStorageNBT(n);
    p.writeToNBT(n);
    n.setString("id", "Pixelmon");
    n.setName(p.getName());
    n.setBoolean("IsInBall", true);
    n.setBoolean("IsShiny", p.getIsShiny());
    n.setInteger("PixelmonOrder", getNextOpen());
    if (p.getHeldItem() != null) {
      n.setCompoundTag("Held Item", p.getHeldItem().writeToNBT(new NBTTagCompound()));
    }
    partyPokemon[getNextOpen()] = n;
    if (p.getHealth() > 0) n.setBoolean("IsFainted", false);
    if (mode == PokeballManagerMode.Player)
      ((EntityPlayerMP) player)
          .playerNetServerHandler.sendPacketToPlayer(
              new PixelmonDataPacket(n, EnumPackets.AddToStorage).getPacket());
  }
 @Override
 public void writeToNBT(NBTTagCompound nbt) {
   super.writeToNBT(nbt);
   int index = 0;
   for (Node node : nodes) {
     // See readFromNBT() regarding host check.
     if (node != null && node.host() == this) {
       final NBTTagCompound nodeNbt = new NBTTagCompound();
       node.save(nodeNbt);
       nbt.setCompoundTag("oc:node" + index, nodeNbt);
     }
     ++index;
   }
 }
Ejemplo n.º 19
0
 public void writeToNBT(NBTTagCompound var1) {
   var1.setInteger("pixelDollars", pokeDollars);
   for (int i = 0; i < partyPokemon.length; i++) {
     NBTTagCompound e = partyPokemon[i];
     if (e != null) {
       if (EntityAlreadyExists(e.getInteger("pixelmonID"), player.worldObj)) {
         EntityPixelmon pixelmon = getAlreadyExists(e.getInteger("pixelmonID"), player.worldObj);
         updateNBT(pixelmon);
       }
       e.setInteger("PixelmonOrder", i);
       var1.setCompoundTag("" + e.getInteger("pixelmonID"), e);
     }
   }
   if (pokedex != null) pokedex.writeToNBT(var1);
 }
Ejemplo n.º 20
0
  @Override
  public void save(NBTTagCompound nbt) {
    super.save(nbt);

    nbt.setBoolean("suck", input);
    nbt.setInteger("dyeID", dyeID);

    if (getLink() != null && getLink().world() != null) {
      nbt.setCompoundTag(
          "link",
          new VectorWorld(getLink().world(), getLink().x(), getLink().y(), getLink().z())
              .writeToNBT(new NBTTagCompound()));
      nbt.setByte("linkSide", (byte) getLink().placementSide.ordinal());
    }
  }
Ejemplo n.º 21
0
  public void setExtraData(NBTTagCompound nbttagcompound) {
    if (!nbttagcompound.hasKey("bukkit")) {
      nbttagcompound.setCompoundTag("bukkit", new NBTTagCompound());
    }

    NBTTagCompound data = nbttagcompound.getCompoundTag("bukkit");
    EntityPlayerMP handle = getHandle();
    data.setInteger("newExp", handle.experienceValue);
    data.setInteger("newTotalExp", handle.experienceTotal);
    data.setInteger("newLevel", handle.experienceLevel);
    // data.setInt("expToDrop", handle.expToDrop);
    // data.setBoolean("keepLevel", handle.keepLevel);
    data.setLong("firstPlayed", getFirstPlayed());
    data.setLong("lastPlayed", System.currentTimeMillis());
  }
Ejemplo n.º 22
0
  /** (abstract) Protected helper method to write subclass entity data to NBT. */
  public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) {
    par1NBTTagCompound.setShort("xTile", (short) this.xTile);
    par1NBTTagCompound.setShort("yTile", (short) this.yTile);
    par1NBTTagCompound.setShort("zTile", (short) this.zTile);
    par1NBTTagCompound.setByte("inTile", (byte) this.inTile);
    par1NBTTagCompound.setByte("inData", (byte) this.inData);
    par1NBTTagCompound.setByte("shake", (byte) this.arrowShake);
    par1NBTTagCompound.setByte("inGround", (byte) (this.inGround ? 1 : 0));
    par1NBTTagCompound.setByte("pickup", (byte) this.canBePickedUp);
    par1NBTTagCompound.setDouble("damage", this.damage);

    NBTTagCompound stackTag = new NBTTagCompound();
    stack.writeToNBT(stackTag);

    par1NBTTagCompound.setCompoundTag("itemstack", stackTag);
  }
Ejemplo n.º 23
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.");
    }
  }
Ejemplo n.º 24
0
  @Override
  public void save(NBTTagCompound nbtTags) {
    super.save(nbtTags);

    if (getTransmitterNetwork().fluidStored != null) {
      int remain =
          getTransmitterNetwork().fluidStored.amount % getTransmitterNetwork().transmitters.size();
      int toSave =
          getTransmitterNetwork().fluidStored.amount / getTransmitterNetwork().transmitters.size();

      if (getTransmitterNetwork().isFirst((IGridTransmitter<FluidNetwork>) tile())) {
        toSave += remain;
      }

      if (toSave > 0) {
        FluidStack stack = new FluidStack(getTransmitterNetwork().fluidStored.getFluid(), toSave);
        lastWrite = stack;
        nbtTags.setCompoundTag("cacheFluid", stack.writeToNBT(new NBTTagCompound()));
      }
    }
  }
Ejemplo n.º 25
0
  @Override
  public void processCommand(ICommandSender sender, String[] par2ArrayOfStr) {
    MinecraftServer server = ModLoader.getMinecraftServerInstance();
    EntityPlayer player = getCommandSenderAsPlayer(sender);
    EntityPlayerMP playerMP = (EntityPlayerMP) sender;
    String ho = "";

    if (par2ArrayOfStr.length == 0) {
      ho = "[Default]";
    } else {
      ho = par2ArrayOfStr[0];
    }

    setBackLocation(player);

    NBTTagCompound playerdata =
        NecessitiesMain.instance.necessities_data.getCompoundTag(player.username);
    NecessitiesMain.instance.necessities_data.setCompoundTag(player.username, playerdata);
    NBTTagCompound homes = playerdata.getCompoundTag("Homes");
    playerdata.setCompoundTag("Homes", homes);

    // Go to the specified home
    if (!homes.hasKey(ho)) {
      sender.sendChatToPlayer("Unknown home.");
      return;
    }

    NBTTagCompound h = homes.getCompoundTag(ho);
    double posX = h.getDouble("PosX");
    double posY = h.getDouble("PosY");
    double posZ = h.getDouble("PosZ");
    float yaw = h.getFloat("Yaw");
    float pitch = h.getFloat("Pitch");
    int dim = h.getInteger("Dim");

    if (player.dimension != dim)
      server.getConfigurationManager().transferPlayerToDimension(((EntityPlayerMP) player), dim);

    playerMP.playerNetServerHandler.setPlayerLocation(posX, posY, posZ, yaw, pitch);
  } // public voice processCommand(...)
 // happy new years
 public void spawnFirework(Vector3f pos, int color, int type, int flightTime, int explodeCount) {
   Random rand = new Random(_world.rand.nextLong());
   ItemStack stk = new ItemStack(Item.firework);
   NBTTagCompound baseComp = new NBTTagCompound();
   baseComp.setCompoundTag("Fireworks", new NBTTagCompound("Fireworks"));
   baseComp.getCompoundTag("Fireworks").setByte("Flight", (byte) flightTime);
   NBTTagList lst = baseComp.getCompoundTag("Fireworks").getTagList("Explosions");
   for (int i = 0; i < explodeCount; i++) {
     NBTTagCompound explosion = new NBTTagCompound();
     explosion.setByte("Type", (byte) type);
     explosion.setBoolean("Trail", true);
     explosion.setBoolean("Flicker", rand.nextBoolean());
     explosion.setIntArray("Colors", new int[] {color + (rand.nextInt(400) - 200)});
     explosion.setIntArray("FadeColors", new int[] {color + (rand.nextInt(400) - 200)});
     lst.appendTag(explosion);
   }
   baseComp.getCompoundTag("Fireworks").setTag("Explosions", lst);
   stk.setTagCompound(baseComp);
   EntityFireworkRocket fireWork =
       new EntityFireworkRocket(_world, (int) pos.getX(), (int) pos.getY(), (int) pos.getZ(), stk);
   _world.spawnEntityInWorld(fireWork);
 }
Ejemplo n.º 27
0
  public ItemStack compact(EntityLiving entity) {
    int id = EntityList.getEntityID(entity);
    ItemStack holder = new ItemStack(CompactMobsItems.fullMobHolder, 1);
    NBTTagCompound nbttag = holder.stackTagCompound;
    if (nbttag == null) {
      nbttag = new NBTTagCompound();
    }
    nbttag.setInteger("entityId", id);

    if (entity instanceof EntityAgeable) {
      EntityAgeable entityAge = (EntityAgeable) entity;
      nbttag.setInteger("entityGrowingAge", entityAge.getGrowingAge());
    }

    if (entity instanceof EntitySheep) {
      EntitySheep entitySheep = (EntitySheep) entity;
      nbttag.setBoolean("entitySheared", entitySheep.getSheared());
      nbttag.setInteger("entityColor", entitySheep.getFleeceColor());
    }

    if (CompactMobsCore.instance.useFullTagCompound) {
      NBTTagCompound entityTags = new NBTTagCompound();

      NBTTagCompound var2 = new NBTTagCompound();
      entity.writeToNBT(var2);

      nbttag.setCompoundTag("entityTags", var2);
      CompactMobsCore.instance.cmLog.info(var2.toString());
    }

    String name = entity.getEntityName();
    nbttag.setString("name", name);
    holder.setItemDamage(id);

    holder.setTagCompound(nbttag);
    entity.worldObj.removeEntity(entity);
    return holder;
  }
Ejemplo n.º 28
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.º 29
0
  // 18-1
  public NBTSave(String nick) {
    OskarStart.debug("PacketSaveData - ReadServre");

    EntityPlayerMP player =
        FMLCommonHandler.instance()
            .getMinecraftServerInstance()
            .getConfigurationManager()
            .getPlayerForUsername(nick);
    NBTTagCompound oldNBT = player.getEntityData();
    NBTTagCompound nbt = oldNBT.getCompoundTag("Characters");

    if (!oldNBT.hasKey("Characters")) {
      oldNBT.setCompoundTag("Characters", nbt);
    }

    Stats stat = Characters.getPlayer(nick).getStats();

    nbt.setInteger("str", stat.str);
    nbt.setInteger("dex", stat.dex);
    nbt.setInteger("def", stat.def);
    nbt.setInteger("hp", stat.hp);
    nbt.setInteger("mp", stat.mp);
    nbt.setString("modelName", stat.modelName);
  }
Ejemplo n.º 30
0
 public void writeToNBT(NBTTagCompound nbt) {
   super.writeToNBT(nbt);
   nbt.setCompoundTag("idea", matrix.getStackAsNBT(idea.getStackInSlot(0)));
   nbt.setCompoundTag("matrix", matrix.saveMatrix());
 }