Exemple #1
0
 public static StatBase func_151176_b(EntityList.EntityEggInfo p_151176_0_) {
   String var1 = EntityList.getStringFromID(p_151176_0_.spawnedID);
   return var1 == null
       ? null
       : (new StatBase(
               "stat.entityKilledBy." + var1,
               new ChatComponentTranslation(
                   "stat.entityKilledBy",
                   new Object[] {
                     new ChatComponentTranslation("entity." + var1 + ".name", new Object[0])
                   })))
           .registerStat();
 }
 public TemplateRuleVanillaEntity(World world, Entity entity, int turns, int x, int y, int z) {
   this.mobID = EntityList.getStringFromID(EntityList.getEntityID(entity));
   rotation = (entity.rotationYaw + 90.f * turns) % 360.f;
   float x1, z1;
   x1 = (float) (entity.posX % 1.d);
   z1 = (float) (entity.posZ % 1.d);
   if (x1 < 0) {
     x1++;
   }
   if (z1 < 0) {
     z1++;
   }
   xOffset = BlockTools.rotateFloatX(x1, z1, turns);
   zOffset = BlockTools.rotateFloatZ(x1, z1, turns);
   yOffset = (float) (entity.posY % 1.d);
 }
    protected void drawSlot(
        int p_180791_1_,
        int p_180791_2_,
        int p_180791_3_,
        int p_180791_4_,
        int p_180791_5_,
        int p_180791_6_) {
      EntityList.EntityEggInfo var7 =
          (EntityList.EntityEggInfo) this.field_148222_l.get(p_180791_1_);
      String var8 =
          Translator.format(
              "entity." + EntityList.getStringFromID(var7.spawnedID) + ".name", new Object[0]);
      int var9 = GuiStats.this.field_146546_t.writeStat(var7.field_151512_d);
      int var10 = GuiStats.this.field_146546_t.writeStat(var7.field_151513_e);
      String var11 =
          Translator.format("stat.entityKills", new Object[] {Integer.valueOf(var9), var8});
      String var12 =
          Translator.format("stat.entityKilledBy", new Object[] {var8, Integer.valueOf(var10)});

      if (var9 == 0) {
        var11 = Translator.format("stat.entityKills.none", new Object[] {var8});
      }

      if (var10 == 0) {
        var12 = Translator.format("stat.entityKilledBy.none", new Object[] {var8});
      }

      GuiStats.this.drawString(
          GuiStats.this.fontRenderer, var8, p_180791_2_ + 2 - 10, p_180791_3_ + 1, 16777215);
      GuiStats.this.drawString(
          GuiStats.this.fontRenderer,
          var11,
          p_180791_2_ + 2,
          p_180791_3_ + 1 + GuiStats.this.fontRenderer.FONT_HEIGHT,
          var9 == 0 ? 6316128 : 9474192);
      GuiStats.this.drawString(
          GuiStats.this.fontRenderer,
          var12,
          p_180791_2_ + 2,
          p_180791_3_ + 1 + GuiStats.this.fontRenderer.FONT_HEIGHT * 2,
          var10 == 0 ? 6316128 : 9474192);
    }
 // Mob Generation
 public static int getUniqueEntityId() {
   do {
     startEntityId++;
   } while (EntityList.getStringFromID(startEntityId) != null);
   return startEntityId++;
 }
  @Override
  public NBTTagCompound getExample() {
    NBTTagCompound root = new NBTTagCompound();
    NBTTagList shapesList = new NBTTagList();

    // Sphere
    {
      NBTTagCompound shapeNbt =
          Shapes.storeShape(new Sphere(10).setHollow(true).setReplaceableOnly(true));

      NBTTagList blockDataNbt = new NBTTagList();
      {
        NBTTagCompound compound = new NBTTagCompound();
        compound.setInteger(BLOCKID_KEY, 35);
        compound.setInteger(WEIGHT_KEY, 5);
        blockDataNbt.appendTag(compound);
      }
      {
        NBTTagCompound compound = new NBTTagCompound();
        compound.setInteger(BLOCKID_KEY, 35);
        compound.setInteger(META_KEY, 5);
        blockDataNbt.appendTag(compound);
      }

      shapeNbt.setTag(BLOCKDATA_KEY, blockDataNbt);

      shapesList.appendTag(shapeNbt);
    }

    // Box
    {
      NBTTagCompound shapeNbt =
          Shapes.storeShape(new Box(new PointI(-2, -3, 5), 5, 2, 3).setReplaceableOnly(true));

      NBTTagList blockDataNbt = new NBTTagList();
      {
        NBTTagCompound compound = new NBTTagCompound();
        compound.setInteger(BLOCKID_KEY, 98);
        blockDataNbt.appendTag(compound);
      }
      {
        NBTTagCompound compound = new NBTTagCompound();
        compound.setInteger(BLOCKID_KEY, 98);
        compound.setInteger(META_KEY, 1);
        blockDataNbt.appendTag(compound);
      }
      {
        NBTTagCompound compound = new NBTTagCompound();
        compound.setInteger(BLOCKID_KEY, 98);
        compound.setInteger(META_KEY, 2);
        blockDataNbt.appendTag(compound);
      }
      {
        NBTTagCompound compound = new NBTTagCompound();
        compound.setInteger(BLOCKID_KEY, 98);
        compound.setInteger(META_KEY, 3);
        blockDataNbt.appendTag(compound);
      }
      shapeNbt.setTag(BLOCKDATA_KEY, blockDataNbt);

      shapesList.appendTag(shapeNbt);
    }

    // Cylinder
    {
      NBTTagCompound shapeNbt = Shapes.storeShape(new Cylinder(new PointI(0, 3, 0), 12));

      NBTTagList blockDataNbt = new NBTTagList();
      {
        NBTTagCompound compound = new NBTTagCompound();
        compound.setInteger(BLOCKID_KEY, 99);
        compound.setInteger(META_KEY, 14);
        blockDataNbt.appendTag(compound);
      }
      {
        NBTTagCompound compound = new NBTTagCompound();
        compound.setInteger(BLOCKID_KEY, 100);
        compound.setInteger(META_KEY, 14);
        blockDataNbt.appendTag(compound);
      }
      shapeNbt.setTag(BLOCKDATA_KEY, blockDataNbt);

      shapesList.appendTag(shapeNbt);
    }

    // Pillar
    {
      NBTTagCompound shapeNbt = Shapes.storeShape(new Pillar(new PointI(-2, 0, -6), 15));

      NBTTagList blockDataNbt = new NBTTagList();
      for (int meta = 0; meta < 16; meta++) {
        NBTTagCompound compound = new NBTTagCompound();
        compound.setInteger(BLOCKID_KEY, 159);
        compound.setInteger(META_KEY, meta);
        blockDataNbt.appendTag(compound);
      }
      shapeNbt.setTag(BLOCKDATA_KEY, blockDataNbt);

      shapesList.appendTag(shapeNbt);
    }

    // Point
    {
      NBTTagCompound shapeNbt = Shapes.storeShape(new PointI(0, 0, 0));

      NBTTagList blockDataNbt = new NBTTagList();
      {
        NBTTagCompound compound = new NBTTagCompound();
        compound.setInteger(BLOCKID_KEY, 54);

        TileEntityChest chest = new TileEntityChest();
        chest.setInventorySlotContents(13, new ItemStack(Items.golden_apple));
        NBTTagCompound chestNbt = new NBTTagCompound();
        chest.writeToNBT(chestNbt);
        compound.setTag(TEDATA_KEY, chestNbt);

        blockDataNbt.appendTag(compound);
      }
      shapeNbt.setTag(BLOCKDATA_KEY, blockDataNbt);

      shapesList.appendTag(shapeNbt);
    }

    // Point
    {
      NBTTagCompound shapeNbt = Shapes.storeShape(new PointI(-1, -2, -1));

      NBTTagList blockDataNbt = new NBTTagList();
      for (Object mob : EntityList.entityEggs.keySet()) {
        NBTTagCompound compound = new NBTTagCompound();
        compound.setInteger(BLOCKID_KEY, 52);

        TileEntityMobSpawner mobSpawner = new TileEntityMobSpawner();
        mobSpawner.func_145881_a().setEntityName(EntityList.getStringFromID((Integer) mob));
        NBTTagCompound spawnerNbt = new NBTTagCompound();
        mobSpawner.writeToNBT(spawnerNbt);

        // Removes some clutter, not really necessary though
        spawnerNbt.removeTag("x");
        spawnerNbt.removeTag("y");
        spawnerNbt.removeTag("z");

        compound.setTag(TEDATA_KEY, spawnerNbt);

        blockDataNbt.appendTag(compound);
      }
      shapeNbt.setTag(BLOCKDATA_KEY, blockDataNbt);

      shapesList.appendTag(shapeNbt);
    }

    root.setTag(SHAPES_KEY, shapesList);
    return root;
  }