Java Code Examples for net.minecraft.creativetab.CreativeTabs

The following are top voted examples for showing how to use net.minecraft.creativetab.CreativeTabs. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Backmemed   File: BlockPumpkin.java   View source code 7 votes vote down vote up
protected BlockPumpkin()
{
    super(Material.GOURD, MapColor.ADOBE);
    this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
    this.setTickRandomly(true);
    this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
}
 
Example 2
Project: DecompiledMinecraft   File: BlockStoneSlab.java   View source code 6 votes vote down vote up
public BlockStoneSlab()
{
    super(Material.rock);
    IBlockState iblockstate = this.blockState.getBaseState();

    if (this.isDouble())
    {
        iblockstate = iblockstate.withProperty(SEAMLESS, Boolean.valueOf(false));
    }
    else
    {
        iblockstate = iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM);
    }

    this.setDefaultState(iblockstate.withProperty(VARIANT, BlockStoneSlab.EnumType.STONE));
    this.setCreativeTab(CreativeTabs.tabBlock);
}
 
Example 3
Project: Adventurers-Toolbox   File: ItemATHandpick.java   View source code 6 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
	if(!Config.DISABLED_TOOLS.contains("handpick")) {
		ItemStack stack1 = new ItemStack(this);
		NBTTagCompound tag = new NBTTagCompound();
		tag.setString(HEAD_TAG, Materials.randomHead().getName());
		tag.setString(HAFT_TAG, Materials.randomHaft().getName());
		tag.setString(HANDLE_TAG, Materials.randomHandle().getName());
		tag.setString(ADORNMENT_TAG, Materials.randomAdornment().getName());
		stack1.setTagCompound(tag);
		if (isInCreativeTab(tab)) {
			subItems.add(stack1);
		}
	}
}
 
Example 4
Project: connor41-etfuturum2   File: EtFuturum.java   View source code 6 votes vote down vote up
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
	Items.blaze_rod.setFull3D();
	Blocks.trapped_chest.setCreativeTab(CreativeTabs.tabRedstone);

	if (enableUpdatedFoodValues) {
		setFinalField(ItemFood.class, Items.carrot, 3, "healAmount", "field_77853_b");
		setFinalField(ItemFood.class, Items.baked_potato, 5, "healAmount", "field_77853_b");
	}

	if (enableUpdatedHarvestLevels) {
		Blocks.packed_ice.setHarvestLevel("pickaxe", 0);
		Blocks.ladder.setHarvestLevel("axe", 0);
		Blocks.melon_block.setHarvestLevel("axe", 0);
	}
}
 
Example 5
Project: BaseClient   File: GuiContainerCreative.java   View source code 6 votes vote down vote up
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    if (this.mc.playerController.isInCreativeMode())
    {
        super.initGui();
        this.buttonList.clear();
        Keyboard.enableRepeatEvents(true);
        this.searchField = new GuiTextField(0, this.fontRendererObj, this.guiLeft + 82, this.guiTop + 6, 89, this.fontRendererObj.FONT_HEIGHT);
        this.searchField.setMaxStringLength(15);
        this.searchField.setEnableBackgroundDrawing(false);
        this.searchField.setVisible(false);
        this.searchField.setTextColor(16777215);
        int i = selectedTabIndex;
        selectedTabIndex = -1;
        this.setCurrentCreativeTab(CreativeTabs.creativeTabArray[i]);
        this.field_147059_E = new CreativeCrafting(this.mc);
        this.mc.thePlayer.inventoryContainer.onCraftGuiOpened(this.field_147059_E);
    }
    else
    {
        this.mc.displayGuiScreen(new GuiInventory(this.mc.thePlayer));
    }
}
 
Example 6
Project: CustomWorldGen   File: BlockStoneSlab.java   View source code 6 votes vote down vote up
public BlockStoneSlab()
{
    super(Material.ROCK);
    IBlockState iblockstate = this.blockState.getBaseState();

    if (this.isDouble())
    {
        iblockstate = iblockstate.withProperty(SEAMLESS, Boolean.valueOf(false));
    }
    else
    {
        iblockstate = iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM);
    }

    this.setDefaultState(iblockstate.withProperty(VARIANT, BlockStoneSlab.EnumType.STONE));
    this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
}
 
Example 7
Project: DecompiledMinecraft   File: GuiContainerCreative.java   View source code 6 votes vote down vote up
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    if (this.mc.playerController.isInCreativeMode())
    {
        super.initGui();
        this.buttonList.clear();
        Keyboard.enableRepeatEvents(true);
        this.searchField = new GuiTextField(0, this.fontRendererObj, this.guiLeft + 82, this.guiTop + 6, 89, this.fontRendererObj.FONT_HEIGHT);
        this.searchField.setMaxStringLength(15);
        this.searchField.setEnableBackgroundDrawing(false);
        this.searchField.setVisible(false);
        this.searchField.setTextColor(16777215);
        int i = selectedTabIndex;
        selectedTabIndex = -1;
        this.setCurrentCreativeTab(CreativeTabs.creativeTabArray[i]);
        this.field_147059_E = new CreativeCrafting(this.mc);
        this.mc.thePlayer.inventoryContainer.onCraftGuiOpened(this.field_147059_E);
    }
    else
    {
        this.mc.displayGuiScreen(new GuiInventory(this.mc.thePlayer));
    }
}
 
Example 8
Project: Backmemed   File: GuiContainerCreative.java   View source code 6 votes vote down vote up
/**
 * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton
 */
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException
{
    if (mouseButton == 0)
    {
        int i = mouseX - this.guiLeft;
        int j = mouseY - this.guiTop;

        for (CreativeTabs creativetabs : CreativeTabs.CREATIVE_TAB_ARRAY)
        {
            if (this.isMouseOverTab(creativetabs, i, j))
            {
                return;
            }
        }
    }

    super.mouseClicked(mouseX, mouseY, mouseButton);
}
 
Example 9
Project: customstuff4   File: ItemHelperTests.java   View source code 6 votes vote down vote up
@Test
public void test_createSubItems_sameTabs()
{
    HashMap<Integer, String> map = Maps.newHashMap();
    map.put(0, "tools");
    map.put(1, "tools");

    Attribute<String> tabLabels = Attribute.map(map);
    int[] subtypes = new int[] {0, 1};

    Item item = new Item();
    item.setHasSubtypes(true);

    NonNullList<ItemStack> subItems = ItemHelper.createSubItems(item, CreativeTabs.TOOLS, tabLabels, subtypes);

    assertSame(2, subItems.size());
    assertSame(0, subItems.get(0).getItemDamage());
    assertSame(1, subItems.get(1).getItemDamage());
}
 
Example 10
Project: CustomWorldGen   File: GuiContainerCreative.java   View source code 6 votes vote down vote up
private void updateCreativeSearch()
{
    GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots;
    guicontainercreative$containercreative.itemList.clear();

    CreativeTabs tab = CreativeTabs.CREATIVE_TAB_ARRAY[selectedTabIndex];
    if (tab.hasSearchBar() && tab != CreativeTabs.SEARCH)
    {
        tab.displayAllRelevantItems(guicontainercreative$containercreative.itemList);
        updateFilteredItems(guicontainercreative$containercreative);
        return;
    }

    for (Item item : Item.REGISTRY)
    {
        if (item != null && item.getCreativeTab() != null)
        {
            item.getSubItems(item, (CreativeTabs)null, guicontainercreative$containercreative.itemList);
        }
    }
    updateFilteredItems(guicontainercreative$containercreative);
}
 
Example 11
Project: BaseClient   File: ItemSword.java   View source code 5 votes vote down vote up
public ItemSword(Item.ToolMaterial material)
{
    this.material = material;
    this.maxStackSize = 1;
    this.setMaxDamage(material.getMaxUses());
    this.setCreativeTab(CreativeTabs.tabCombat);
    this.attackDamage = 4.0F + material.getDamageVsEntity();
}
 
Example 12
Project: Backmemed   File: BlockGrass.java   View source code 5 votes vote down vote up
protected BlockGrass()
{
    super(Material.GRASS);
    this.setDefaultState(this.blockState.getBaseState().withProperty(SNOWY, Boolean.valueOf(false)));
    this.setTickRandomly(true);
    this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
}
 
Example 13
Project: CustomWorldGen   File: BlockCrops.java   View source code 5 votes vote down vote up
protected BlockCrops()
{
    this.setDefaultState(this.blockState.getBaseState().withProperty(this.getAgeProperty(), Integer.valueOf(0)));
    this.setTickRandomly(true);
    this.setCreativeTab((CreativeTabs)null);
    this.setHardness(0.0F);
    this.setSoundType(SoundType.PLANT);
    this.disableStats();
}
 
Example 14
Project: DankNull   File: ItemDankNull.java   View source code 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> subItems) {
	for (int i = 0; i < 6; i++) {
		subItems.add(new ItemStack(itemIn, 1, i));
	}
}
 
Example 15
Project: Backmemed   File: BlockTripWireHook.java   View source code 5 votes vote down vote up
public BlockTripWireHook()
{
    super(Material.CIRCUITS);
    this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(POWERED, Boolean.valueOf(false)).withProperty(ATTACHED, Boolean.valueOf(false)));
    this.setCreativeTab(CreativeTabs.REDSTONE);
    this.setTickRandomly(true);
}
 
Example 16
Project: DecompiledMinecraft   File: BlockCarpet.java   View source code 5 votes vote down vote up
protected BlockCarpet()
{
    super(Material.carpet);
    this.setDefaultState(this.blockState.getBaseState().withProperty(COLOR, EnumDyeColor.WHITE));
    this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F);
    this.setTickRandomly(true);
    this.setCreativeTab(CreativeTabs.tabDecorations);
    this.setBlockBoundsFromMeta(0);
}
 
Example 17
Project: BaseClient   File: BlockPrismarine.java   View source code 5 votes vote down vote up
/**
 * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
 */
public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list)
{
    list.add(new ItemStack(itemIn, 1, ROUGH_META));
    list.add(new ItemStack(itemIn, 1, BRICKS_META));
    list.add(new ItemStack(itemIn, 1, DARK_META));
}
 
Example 18
Project: minecraft-territorialdealings   File: FactionLedger.java   View source code 5 votes vote down vote up
public FactionLedger()
{
	this.setMaxStackSize(1);	// Can hold a big stack of these
	this.setFull3D();
	this.setCreativeTab(CreativeTabs.TOOLS);

	this.setRegistryName("factionledger");
	this.setUnlocalizedName("territorychevsky_factionledger");
}
 
Example 19
Project: BaseClient   File: BlockTripWireHook.java   View source code 5 votes vote down vote up
public BlockTripWireHook()
{
    super(Material.circuits);
    this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(POWERED, Boolean.valueOf(false)).withProperty(ATTACHED, Boolean.valueOf(false)).withProperty(SUSPENDED, Boolean.valueOf(false)));
    this.setCreativeTab(CreativeTabs.tabRedstone);
    this.setTickRandomly(true);
}
 
Example 20
Project: BaseClient   File: ItemRecord.java   View source code 5 votes vote down vote up
protected ItemRecord(String name)
{
    this.recordName = name;
    this.maxStackSize = 1;
    this.setCreativeTab(CreativeTabs.tabMisc);
    RECORDS.put("records." + name, this);
}
 
Example 21
Project: BaseClient   File: BlockTrapDoor.java   View source code 5 votes vote down vote up
protected BlockTrapDoor(Material materialIn)
{
    super(materialIn);
    this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(OPEN, Boolean.valueOf(false)).withProperty(HALF, BlockTrapDoor.DoorHalf.BOTTOM));
    float f = 0.5F;
    float f1 = 1.0F;
    this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
    this.setCreativeTab(CreativeTabs.tabRedstone);
}
 
Example 22
Project: Backmemed   File: BlockSnow.java   View source code 5 votes vote down vote up
protected BlockSnow()
{
    super(Material.SNOW);
    this.setDefaultState(this.blockState.getBaseState().withProperty(LAYERS, Integer.valueOf(1)));
    this.setTickRandomly(true);
    this.setCreativeTab(CreativeTabs.DECORATIONS);
}
 
Example 23
Project: Infernum   File: ItemSpellPage.java   View source code 5 votes vote down vote up
@SideOnly(Side.CLIENT)
public void getSubItems(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> subItems) {
	for (Spell spell : Infernum.SPELL_REGISTRY.getValues()) {
		if (!spell.equals(Spell.EMPTY_SPELL)) {
			ItemStack stack = new ItemStack(this);
			setSpell(stack, spell);
			subItems.add(stack);
		}
	}
}
 
Example 24
Project: Backmemed   File: GuiContainerCreative.java   View source code 5 votes vote down vote up
/**
 * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of
 * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code)
 */
protected void keyTyped(char typedChar, int keyCode) throws IOException
{
    if (selectedTabIndex != CreativeTabs.SEARCH.getTabIndex())
    {
        if (GameSettings.isKeyDown(this.mc.gameSettings.keyBindChat))
        {
            this.setCurrentCreativeTab(CreativeTabs.SEARCH);
        }
        else
        {
            super.keyTyped(typedChar, keyCode);
        }
    }
    else
    {
        if (this.clearSearch)
        {
            this.clearSearch = false;
            this.searchField.setText("");
        }

        if (!this.checkHotbarKeys(keyCode))
        {
            if (this.searchField.textboxKeyTyped(typedChar, keyCode))
            {
                this.updateCreativeSearch();
            }
            else
            {
                super.keyTyped(typedChar, keyCode);
            }
        }
    }
}
 
Example 25
Project: CustomWorldGen   File: BlockSilverfish.java   View source code 5 votes vote down vote up
public BlockSilverfish()
{
    super(Material.CLAY);
    this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, BlockSilverfish.EnumType.STONE));
    this.setHardness(0.0F);
    this.setCreativeTab(CreativeTabs.DECORATIONS);
}
 
Example 26
Project: CustomWorldGen   File: BlockLog.java   View source code 5 votes vote down vote up
public BlockLog()
{
    super(Material.WOOD);
    this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
    this.setHardness(2.0F);
    this.setSoundType(SoundType.WOOD);
}
 
Example 27
Project: Mods   File: ItemTF2.java   View source code 5 votes vote down vote up
@Override
public void getSubItems(CreativeTabs par2CreativeTabs, NonNullList<ItemStack> par3List) {
	// System.out.println(this.getCreativeTab());
	if(!this.isInCreativeTab(par2CreativeTabs))
		return;
	for (int i = 0; i < 8; i++)
		par3List.add(new ItemStack(this, 1, i));
}
 
Example 28
Project: DecompiledMinecraft   File: BlockSapling.java   View source code 5 votes vote down vote up
protected BlockSapling()
{
    this.setDefaultState(this.blockState.getBaseState().withProperty(TYPE, BlockPlanks.EnumType.OAK).withProperty(STAGE, Integer.valueOf(0)));
    float f = 0.4F;
    this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
    this.setCreativeTab(CreativeTabs.tabDecorations);
}
 
Example 29
Project: uniquecrops   File: ItemPrecisionAxe.java   View source code 5 votes vote down vote up
@Override
  @SideOnly(Side.CLIENT)
  public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
  	
ItemStack precision = new ItemStack(item);
precision.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
list.add(precision);
  }
 
Example 30
Project: BaseClient   File: ItemFishFood.java   View source code 5 votes vote down vote up
/**
 * returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
 */
public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems)
{
    for (ItemFishFood.FishType itemfishfood$fishtype : ItemFishFood.FishType.values())
    {
        if (!this.cooked || itemfishfood$fishtype.canCook())
        {
            subItems.add(new ItemStack(this, 1, itemfishfood$fishtype.getMetadata()));
        }
    }
}
 
Example 31
Project: DecompiledMinecraft   File: ItemDye.java   View source code 5 votes vote down vote up
/**
 * returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
 */
public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems)
{
    for (int i = 0; i < 16; ++i)
    {
        subItems.add(new ItemStack(itemIn, 1, i));
    }
}
 
Example 32
Project: PrimalChests   File: BlockPrimalChest.java   View source code 5 votes vote down vote up
public BlockPrimalChest() {
    super(Material.WOOD);
    setUnlocalizedName("primal_chest");
    setCreativeTab(CreativeTabs.DECORATIONS);
    setHardness(2.5F);
    setSoundType(SoundType.WOOD);
}
 
Example 33
Project: minecraft-territorialdealings   File: TerritoryMap.java   View source code 5 votes vote down vote up
public TerritoryMap()
{
	this.setMaxStackSize(1);	// Can hold a big stack of these
	this.setCreativeTab(CreativeTabs.TOOLS);
	this.setHasSubtypes(true);

	this.setRegistryName("territorymap");
	this.setUnlocalizedName("territorychevsky_territorymap");
}
 
Example 34
Project: DecompiledMinecraft   File: BlockStairs.java   View source code 5 votes vote down vote up
protected BlockStairs(IBlockState modelState)
{
    super(modelState.getBlock().blockMaterial);
    this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(HALF, BlockStairs.EnumHalf.BOTTOM).withProperty(SHAPE, BlockStairs.EnumShape.STRAIGHT));
    this.modelBlock = modelState.getBlock();
    this.modelState = modelState;
    this.setHardness(this.modelBlock.blockHardness);
    this.setResistance(this.modelBlock.blockResistance / 3.0F);
    this.setStepSound(this.modelBlock.stepSound);
    this.setLightOpacity(255);
    this.setCreativeTab(CreativeTabs.tabBlock);
}
 
Example 35
Project: PurificatiMagicae   File: BlockCrystalSmall.java   View source code 5 votes vote down vote up
@Override
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list)
{
    for (Type t : Type.values())
    {
        list.add(new ItemStack(this, 1, t.ordinal()));
    }
}
 
Example 36
Project: CustomWorldGen   File: BlockDaylightDetector.java   View source code 5 votes vote down vote up
/**
 * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
 */
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list)
{
    if (!this.inverted)
    {
        super.getSubBlocks(itemIn, tab, list);
    }
}
 
Example 37
Project: Machines-and-Stuff   File: MBlocks.java   View source code 5 votes vote down vote up
private static void registerBlock(Block block, String key, String texture, Class tile, CreativeTabs tab) {
    block.setUnlocalizedName(key).setCreativeTab(TAB);
    if(DEVENV && FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
        writeFile(key, texture);
    renderMap.put(texture, block);
    GameRegistry.register(block, new ResourceLocation(Reference.MODID + ":" + key));
    GameRegistry.register(new ItemBlock(block), new ResourceLocation(Reference.MODID + ":" + key));
    if(tile != null) {
        GameRegistry.registerTileEntity(tile, key);
    }
}
 
Example 38
Project: Backmemed   File: BlockStem.java   View source code 5 votes vote down vote up
protected BlockStem(Block crop)
{
    this.setDefaultState(this.blockState.getBaseState().withProperty(AGE, Integer.valueOf(0)).withProperty(FACING, EnumFacing.UP));
    this.crop = crop;
    this.setTickRandomly(true);
    this.setCreativeTab((CreativeTabs)null);
}
 
Example 39
Project: WirelessCharger   File: CreativeTabCustom.java   View source code 5 votes vote down vote up
public static void registerTab(){

        customTab = new CreativeTabs("creativetab") {
            @Override
            @SideOnly(Side.CLIENT)
            public ItemStack getTabIconItem() {
                return new ItemStack(ItemRegistry.itemUpgradeRange);
            }
        };
    }
 
Example 40
Project: DecompiledMinecraft   File: BlockStem.java   View source code 5 votes vote down vote up
protected BlockStem(Block crop)
{
    this.setDefaultState(this.blockState.getBaseState().withProperty(AGE, Integer.valueOf(0)).withProperty(FACING, EnumFacing.UP));
    this.crop = crop;
    this.setTickRandomly(true);
    float f = 0.125F;
    this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
    this.setCreativeTab((CreativeTabs)null);
}