public MaterialSlab(TMResource... resources) { VARIANT = PropertyInteger.create("type", 0, Math.max(Math.min(resources.length - 1, 7), 1)); half = new BlockMaterialSlab(); full = new BlockMaterialSlab() { @Override public boolean isDouble() { return true; } }; this.resources = new TMResource[Math.min(resources.length, 8)]; for (int i = 0;i < resources.length && i < 8;i++) { this.resources[i] = resources[i]; resources[i].setSlab(this); } itemBlock = new ItemSlab(half, half, full); }
@CustomRegistry public static void init() { rubber_slab = new BlockRubberSlab.Half(); double_rubber_slab = new BlockRubberSlab.Double(); RebornBlockRegistry.registerBlockNoItemBlock(rubber_slab); RebornBlockRegistry.registerBlockNoItemBlock(double_rubber_slab); GameRegistry.register(new ItemSlab(rubber_slab, rubber_slab, double_rubber_slab), rubber_slab.getRegistryName()); }
/** * Register a group of slab blocks * * @param slabGroup The slab group */ @SuppressWarnings("unchecked") private static < VARIANT extends Enum<VARIANT> & IStringSerializable, VARIANTS extends Iterable<VARIANT> & IStringSerializable, SLAB extends BlockSlabAquaRegia<VARIANT, VARIANTS, SLAB> > void registerSlabGroup(BlockSlabAquaRegia.SlabGroup<VARIANT, VARIANTS, SLAB> slabGroup) { registerBlock(slabGroup.singleSlab, slab -> new ItemSlab(slab, slabGroup.singleSlab, slabGroup.doubleSlab)); registerBlock(slabGroup.doubleSlab, null); // No item form for the double slab slabGroup.setItem((ItemSlab) Item.getItemFromBlock(slabGroup.singleSlab)); }
public ItemSlab getItem() { return item; }
public void setItem(ItemSlab item) { this.item = item; }
@EventHandler public void PostInit(FMLPostInitializationEvent event) { Item.itemsList[DirtSlab.blockID] = (new ItemSlab(DirtSlab.blockID - 256, (BlockHalfSlab)DirtSlab, (BlockHalfSlab)DirtDoubleSlab, false)); Item.itemsList[CherrySlab.blockID] = (new ItemSlab(CherrySlab.blockID - 256, (BlockHalfSlab)CherrySlab, (BlockHalfSlab)CherryDoubleSlab, false)); }
@EventHandler public static void postInit( FMLPostInitializationEvent event ) { Item.itemsList[blastsingle.blockID] = (new ItemSlab(blastsingle.blockID - 256, (BlockHalfSlab)blastsingle, (BlockHalfSlab)blastdouble, false)).setUnlocalizedName("rubyMod:decor"); }