protected BlockPumpkin() { super(Material.GOURD, MapColor.ADOBE); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); this.setTickRandomly(true); this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS); }
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); }
@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); } } }
@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); } }
/** * 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)); } }
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); }
/** * 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); }
@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()); }
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); }
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(); }
protected BlockGrass() { super(Material.GRASS); this.setDefaultState(this.blockState.getBaseState().withProperty(SNOWY, Boolean.valueOf(false))); this.setTickRandomly(true); this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS); }
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(); }
@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)); } }
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); }
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); }
/** * 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)); }
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"); }
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); }
protected ItemRecord(String name) { this.recordName = name; this.maxStackSize = 1; this.setCreativeTab(CreativeTabs.tabMisc); RECORDS.put("records." + name, this); }
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); }
protected BlockSnow() { super(Material.SNOW); this.setDefaultState(this.blockState.getBaseState().withProperty(LAYERS, Integer.valueOf(1))); this.setTickRandomly(true); this.setCreativeTab(CreativeTabs.DECORATIONS); }
@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); } } }
/** * 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); } } } }
public BlockSilverfish() { super(Material.CLAY); this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, BlockSilverfish.EnumType.STONE)); this.setHardness(0.0F); this.setCreativeTab(CreativeTabs.DECORATIONS); }
public BlockLog() { super(Material.WOOD); this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS); this.setHardness(2.0F); this.setSoundType(SoundType.WOOD); }
@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)); }
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); }
@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); }
/** * 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())); } } }
/** * 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)); } }
public BlockPrimalChest() { super(Material.WOOD); setUnlocalizedName("primal_chest"); setCreativeTab(CreativeTabs.DECORATIONS); setHardness(2.5F); setSoundType(SoundType.WOOD); }
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"); }
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); }
@Override public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) { for (Type t : Type.values()) { list.add(new ItemStack(this, 1, t.ordinal())); } }
/** * 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); } }
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); } }
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); }
public static void registerTab(){ customTab = new CreativeTabs("creativetab") { @Override @SideOnly(Side.CLIENT) public ItemStack getTabIconItem() { return new ItemStack(ItemRegistry.itemUpgradeRange); } }; }
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); }