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

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

The newest version!
package net.minecraft.server;

import java.util.Random;

public abstract class BlockDoubleStepAbstract extends BlockStepAbstract {

  public static final BlockStateBoolean SEAMLESS = BlockStateBoolean.of("seamless");
  public static final BlockStateEnum VARIANT = BlockStateEnum.of("variant", EnumStoneSlabVariant.class);

  public BlockDoubleStepAbstract() {
    super(Material.STONE);
    IBlockData iblockdata = this.blockStateList.getBlockData();

    if (this.l()) {
      iblockdata = iblockdata.set(BlockDoubleStepAbstract.SEAMLESS, Boolean.valueOf(false));
    } else {
      iblockdata = iblockdata.set(BlockDoubleStepAbstract.HALF, EnumSlabHalf.BOTTOM);
    }

    this.j(iblockdata.set(BlockDoubleStepAbstract.VARIANT, EnumStoneSlabVariant.STONE));
    this.a(CreativeModeTab.b);
  }

  public Item getDropType(IBlockData iblockdata, Random random, int i) {
    return Item.getItemOf(Blocks.STONE_SLAB);
  }

  public String b(int i) {
    return super.a() + "." + EnumStoneSlabVariant.a(i).d();
  }

  public IBlockState n() {
    return BlockDoubleStepAbstract.VARIANT;
  }

  public Object a(ItemStack itemstack) {
    return EnumStoneSlabVariant.a(itemstack.getData() & 7);
  }

  public IBlockData fromLegacyData(int i) {
    IBlockData iblockdata = this.getBlockData().set(BlockDoubleStepAbstract.VARIANT, EnumStoneSlabVariant.a(i & 7));

    if (this.l()) {
      iblockdata = iblockdata.set(BlockDoubleStepAbstract.SEAMLESS, Boolean.valueOf((i & 8) != 0));
    } else {
      iblockdata = iblockdata.set(BlockDoubleStepAbstract.HALF, (i & 8) == 0 ? EnumSlabHalf.BOTTOM : EnumSlabHalf.TOP);
    }

    return iblockdata;
  }

  public int toLegacyData(IBlockData iblockdata) {
    byte b0 = 0;
    int i = b0 | iblockdata.get(BlockDoubleStepAbstract.VARIANT).a();

    if (this.l()) {
      if (iblockdata.get(BlockDoubleStepAbstract.SEAMLESS).booleanValue()) {
        i |= 8;
      }
    } else if (iblockdata.get(BlockDoubleStepAbstract.HALF) == EnumSlabHalf.TOP) {
      i |= 8;
    }

    return i;
  }

  protected BlockStateList getStateList() {
    return this.l() ? new BlockStateList(this, BlockDoubleStepAbstract.SEAMLESS, BlockDoubleStepAbstract.VARIANT) : new BlockStateList(this, BlockDoubleStepAbstract.HALF, BlockDoubleStepAbstract.VARIANT);
  }

  public int getDropData(IBlockData iblockdata) {
    return iblockdata.get(BlockDoubleStepAbstract.VARIANT).a();
  }

  public MaterialMapColor g(IBlockData iblockdata) {
    return iblockdata.get(BlockDoubleStepAbstract.VARIANT).c();
  }

  public enum EnumStoneSlabVariant implements INamable {

    STONE(0, MaterialMapColor.m, "stone"), SAND(1, MaterialMapColor.d, "sandstone", "sand"), WOOD(2, MaterialMapColor.o, "wood_old", "wood"), COBBLESTONE(3, MaterialMapColor.m, "cobblestone", "cobble"), BRICK(4, MaterialMapColor.D, "brick"), SMOOTHBRICK(5, MaterialMapColor.m, "stone_brick", "smoothStoneBrick"), NETHERBRICK(6, MaterialMapColor.K, "nether_brick", "netherBrick"), QUARTZ(7, MaterialMapColor.p, "quartz");

    private static final EnumStoneSlabVariant[] i = new EnumStoneSlabVariant[values().length];

    static {
      EnumStoneSlabVariant[] ablockdoublestepabstract_enumstoneslabvariant = values();
      int i = ablockdoublestepabstract_enumstoneslabvariant.length;

      for (int j = 0; j < i; ++j) {
        EnumStoneSlabVariant blockdoublestepabstract_enumstoneslabvariant = ablockdoublestepabstract_enumstoneslabvariant[j];

        EnumStoneSlabVariant.i[blockdoublestepabstract_enumstoneslabvariant.a()] = blockdoublestepabstract_enumstoneslabvariant;
      }

    }

    private final int j;
    private final MaterialMapColor k;
    private final String l;
    private final String m;

    EnumStoneSlabVariant(int i, MaterialMapColor materialmapcolor, String s) {
      this(i, materialmapcolor, s, s);
    }

    EnumStoneSlabVariant(int i, MaterialMapColor materialmapcolor, String s, String s1) {
      this.j = i;
      this.k = materialmapcolor;
      this.l = s;
      this.m = s1;
    }

    public static EnumStoneSlabVariant a(int i) {
      if (i < 0 || i >= EnumStoneSlabVariant.i.length) {
        i = 0;
      }

      return EnumStoneSlabVariant.i[i];
    }

    public int a() {
      return this.j;
    }

    public MaterialMapColor c() {
      return this.k;
    }

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy