コード例 #1
0
ファイル: ItemArmor.java プロジェクト: DaMarine/Alkazia
 public boolean c_(ItemStack itemstack) {
   return this.p != EnumArmorMaterial.CLOTH
       ? false
       : (!itemstack.hasTag()
           ? false
           : (!itemstack.getTag().hasKeyOfType("display", 10)
               ? false
               : itemstack.getTag().getCompound("display").hasKeyOfType("color", 3)));
 }
コード例 #2
0
ファイル: ItemBlock.java プロジェクト: CasperGrey/MineCraft
  public static boolean a(
      World world, EntityHuman entityhuman, BlockPosition blockposition, ItemStack itemstack) {
    MinecraftServer minecraftserver = MinecraftServer.getServer();

    if (minecraftserver == null) {
      return false;
    } else {
      if (itemstack.hasTag() && itemstack.getTag().hasKeyOfType("BlockEntityTag", 10)) {
        TileEntity tileentity = world.getTileEntity(blockposition);

        if (tileentity != null) {
          if (!world.isClientSide
              && tileentity.F()
              && !minecraftserver.getPlayerList().isOp(entityhuman.getProfile())) {
            return false;
          }

          NBTTagCompound nbttagcompound = new NBTTagCompound();
          NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttagcompound.clone();

          tileentity.b(nbttagcompound);
          NBTTagCompound nbttagcompound2 =
              (NBTTagCompound) itemstack.getTag().get("BlockEntityTag");

          nbttagcompound.a(nbttagcompound2);
          nbttagcompound.setInt("x", blockposition.getX());
          nbttagcompound.setInt("y", blockposition.getY());
          nbttagcompound.setInt("z", blockposition.getZ());
          if (!nbttagcompound.equals(nbttagcompound1)) {
            tileentity.a(nbttagcompound);
            tileentity.update();
            return true;
          }
        }
      }

      return false;
    }
  }
コード例 #3
0
  public EntityFireworks(World world, double d0, double d1, double d2, ItemStack itemstack) {
    super(world);
    this.ticksFlown = 0;
    this.setSize(0.25F, 0.25F);
    this.setPosition(d0, d1, d2);
    int i = 1;

    if (itemstack != null && itemstack.hasTag()) {
      this.datawatcher.watch(8, itemstack);
      NBTTagCompound nbttagcompound = itemstack.getTag();
      NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Fireworks");

      if (nbttagcompound1 != null) {
        i += nbttagcompound1.getByte("Flight");
      }
    }

    this.motX = this.random.nextGaussian() * 0.001D;
    this.motZ = this.random.nextGaussian() * 0.001D;
    this.motY = 0.05D;
    this.expectedLifespan = 10 * i + this.random.nextInt(6) + this.random.nextInt(7);
  }