예제 #1
0
  @Override
  public void writeSpawnData(ByteBuf buffer) {
    buffer.writeInt(spiderType.getId());

    if (owner != null) {
      buffer.writeLong(owner.getMostSignificantBits());
      buffer.writeLong(owner.getLeastSignificantBits());
    }
  }
예제 #2
0
  @Override
  public void readSpawnData(ByteBuf buffer) {
    spiderType = EnumSpiderType.byId(buffer.readInt());

    try {
      owner = new UUID(buffer.readLong(), buffer.readLong());
    } catch (IndexOutOfBoundsException e) {
      // Ignore.
    }
  }
예제 #3
0
 @Override
 public void readEntityFromNBT(NBTTagCompound nbt) {
   super.readEntityFromNBT(nbt);
   spiderType = EnumSpiderType.byId(nbt.getInteger("spiderType"));
   abilityCounter = nbt.getInteger("abilityCounter");
   abilityThreshold = nbt.getInteger("abilityThreshold");
   killsUntilLevelUp = nbt.getInteger("killsUntilLevelUp");
   owner = new UUID(nbt.getLong("ownerMSB"), nbt.getLong("ownerLSB"));
   final NBTTagList tagList = nbt.getTagList("inventory", 10);
   inventory.loadInventoryFromNBT(tagList);
 }
예제 #4
0
 @Override
 public void writeEntityToNBT(NBTTagCompound nbt) {
   super.writeEntityToNBT(nbt);
   nbt.setInteger("spiderType", spiderType.getId());
   nbt.setInteger("abilityCounter", abilityCounter);
   nbt.setInteger("abilityThreshold", abilityThreshold);
   nbt.setInteger("killsUntilLevelUp", killsUntilLevelUp);
   nbt.setLong("ownerMSB", owner.getMostSignificantBits());
   nbt.setLong("ownerLSB", owner.getLeastSignificantBits());
   nbt.setTag("inventory", inventory.saveInventoryToNBT());
 }
예제 #5
0
 @Override
 public String getCommandSenderName() {
   return spiderType.getFriendlyName() + " Spider";
 }