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

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

package net.minecraft.server;

import java.util.Random;

public abstract class BlockDoubleStoneStepAbstract extends BlockStepAbstract {

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

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

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

    this.j(iblockdata.set(BlockDoubleStoneStepAbstract.VARIANT, EnumStoneSlab2Variant.RED_SANDSTONE));
    this.a(CreativeModeTab.b);
  }

  public String getName() {
    return LocaleI18n.get(this.a() + ".red_sandstone.name");
  }

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

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

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

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

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

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

    return iblockdata;
  }

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

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

    return i;
  }

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

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

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

  public enum EnumStoneSlab2Variant implements INamable {

    RED_SANDSTONE(0, "red_sandstone", BlockSand.EnumSandVariant.RED_SAND.c());

    private static final EnumStoneSlab2Variant[] b = new EnumStoneSlab2Variant[values().length];

    static {
      EnumStoneSlab2Variant[] ablockdoublestonestepabstract_enumstoneslab2variant = values();
      int i = ablockdoublestonestepabstract_enumstoneslab2variant.length;

      for (int j = 0; j < i; ++j) {
        EnumStoneSlab2Variant blockdoublestonestepabstract_enumstoneslab2variant = ablockdoublestonestepabstract_enumstoneslab2variant[j];

        EnumStoneSlab2Variant.b[blockdoublestonestepabstract_enumstoneslab2variant.a()] = blockdoublestonestepabstract_enumstoneslab2variant;
      }

    }

    private final int c;
    private final String d;
    private final MaterialMapColor e;

    EnumStoneSlab2Variant(int i, String s, MaterialMapColor materialmapcolor) {
      this.c = i;
      this.d = s;
      this.e = materialmapcolor;
    }

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

      return EnumStoneSlab2Variant.b[i];
    }

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

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy