All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.minecraft.server.BlockFlowers Maven / Gradle / Ivy

The newest version!
package net.minecraft.server;

import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import com.google.common.collect.Lists;

import java.util.Collection;

public abstract class BlockFlowers extends BlockPlant {

  protected BlockStateEnum TYPE;

  protected BlockFlowers() {
    this.j(this.blockStateList.getBlockData().set(this.n(), this.l() == EnumFlowerType.RED ? EnumFlowerVarient.POPPY : EnumFlowerVarient.DANDELION));
  }

  public int getDropData(IBlockData iblockdata) {
    return iblockdata.get(this.n()).b();
  }

  public IBlockData fromLegacyData(int i) {
    return this.getBlockData().set(this.n(), EnumFlowerVarient.a(this.l(), i));
  }

  public abstract EnumFlowerType l();

  public IBlockState n() {
    if (this.TYPE == null) {
      this.TYPE = BlockStateEnum.a("type", EnumFlowerVarient.class, new Predicate() {
        public boolean a(EnumFlowerVarient blockflowers_enumflowervarient) {
          return blockflowers_enumflowervarient.a() == BlockFlowers.this.l();
        }

        public boolean apply(Object object) {
          return this.a((EnumFlowerVarient) object);
        }
      });
    }

    return this.TYPE;
  }

  public int toLegacyData(IBlockData iblockdata) {
    return iblockdata.get(this.n()).b();
  }

  protected BlockStateList getStateList() {
    return new BlockStateList(this, this.n());
  }

  public enum EnumFlowerVarient implements INamable {

    DANDELION(EnumFlowerType.YELLOW, 0, "dandelion"), POPPY(EnumFlowerType.RED, 0, "poppy"), BLUE_ORCHID(EnumFlowerType.RED, 1, "blue_orchid", "blueOrchid"), ALLIUM(EnumFlowerType.RED, 2, "allium"), HOUSTONIA(EnumFlowerType.RED, 3, "houstonia"), RED_TULIP(EnumFlowerType.RED, 4, "red_tulip", "tulipRed"), ORANGE_TULIP(EnumFlowerType.RED, 5, "orange_tulip", "tulipOrange"), WHITE_TULIP(EnumFlowerType.RED, 6, "white_tulip", "tulipWhite"), PINK_TULIP(EnumFlowerType.RED, 7, "pink_tulip", "tulipPink"), OXEYE_DAISY(EnumFlowerType.RED, 8, "oxeye_daisy", "oxeyeDaisy");

    private static final EnumFlowerVarient[][] k = new EnumFlowerVarient[EnumFlowerType.values().length][];

    static {
      EnumFlowerType[] ablockflowers_enumflowertype = EnumFlowerType.values();
      int i = ablockflowers_enumflowertype.length;

      for (int j = 0; j < i; ++j) {
        final EnumFlowerType blockflowers_enumflowertype = ablockflowers_enumflowertype[j];
        Collection collection = Collections2.filter(Lists.newArrayList(values()), new Predicate() {
          public boolean a(EnumFlowerVarient blockflowers_enumflowervarient) {
            return blockflowers_enumflowervarient.a() == blockflowers_enumflowertype;
          }

          public boolean apply(Object object) {
            return this.a((EnumFlowerVarient) object);
          }
        });

        EnumFlowerVarient.k[blockflowers_enumflowertype.ordinal()] = (EnumFlowerVarient[]) collection.toArray(new EnumFlowerVarient[collection.size()]);
      }

    }

    private final EnumFlowerType l;
    private final int m;
    private final String n;
    private final String o;

    EnumFlowerVarient(EnumFlowerType blockflowers_enumflowertype, int i, String s) {
      this(blockflowers_enumflowertype, i, s, s);
    }

    EnumFlowerVarient(EnumFlowerType blockflowers_enumflowertype, int i, String s, String s1) {
      this.l = blockflowers_enumflowertype;
      this.m = i;
      this.n = s;
      this.o = s1;
    }

    public static EnumFlowerVarient a(EnumFlowerType blockflowers_enumflowertype, int i) {
      EnumFlowerVarient[] ablockflowers_enumflowervarient = EnumFlowerVarient.k[blockflowers_enumflowertype.ordinal()];

      if (i < 0 || i >= ablockflowers_enumflowervarient.length) {
        i = 0;
      }

      return ablockflowers_enumflowervarient[i];
    }

    public EnumFlowerType a() {
      return this.l;
    }

    public int b() {
      return this.m;
    }

    public String toString() {
      return this.n;
    }

    public String getName() {
      return this.n;
    }

    public String d() {
      return this.o;
    }
  }

  public enum EnumFlowerType {

    YELLOW, RED;

    EnumFlowerType() {
    }

    public BlockFlowers a() {
      return this == EnumFlowerType.YELLOW ? Blocks.YELLOW_FLOWER : Blocks.RED_FLOWER;
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy