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

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

The newest version!
package net.minecraft.server;

import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Collections2;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

import java.util.Collection;
import java.util.Map;

public class BlockStateEnum & INamable> extends BlockState {

  private final ImmutableSet a;
  private final Map b = Maps.newHashMap();

  protected BlockStateEnum(String s, Class oclass, Collection collection) {
    super(s, oclass);
    this.a = ImmutableSet.copyOf(collection);

    for (T oenum : collection) {
      String s1 = oenum.getName();

      if (this.b.containsKey(s1)) {
        throw new IllegalArgumentException("Multiple values have the same name '" + s1 + "'");
      }

      this.b.put(s1, oenum);
    }

  }

  public static  & INamable> BlockStateEnum of(String s, Class oclass) {
    return a(s, oclass, Predicates.alwaysTrue());
  }

  public static  & INamable> BlockStateEnum a(String s, Class oclass, Predicate predicate) {
    return a(s, oclass, Collections2.filter(Lists.newArrayList(oclass.getEnumConstants()), predicate));
  }

  public static  & INamable> BlockStateEnum of(String s, Class oclass, T... at) {
    return a(s, oclass, Lists.newArrayList(at));
  }

  public static  & INamable> BlockStateEnum a(String s, Class oclass, Collection collection) {
    return new BlockStateEnum(s, oclass, collection);
  }

  public Collection c() {
    return this.a;
  }

  public String a(T t0) {
    return t0.getName();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy