neoLegacy/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp
2026-05-24 22:29:54 -04:00

1508 lines
55 KiB
C++

#include "stdafx.h"
#include "IUIScene_CreativeMenu.h"
#include "UI.h"
#include "../../Minecraft.h"
#include "../../MultiPlayerLocalPlayer.h"
#include "../../../Minecraft.World/net.minecraft.world.inventory.h"
#include "../../../Minecraft.World/net.minecraft.world.level.tile.h"
#include "../../../Minecraft.World/net.minecraft.world.level.tile.entity.h"
#include "../../../Minecraft.World/net.minecraft.world.item.h"
#include "../../../Minecraft.World/net.minecraft.world.item.enchantment.h"
#include "../../../Minecraft.World/net.minecraft.world.entity.h"
#include "../../../Minecraft.World/net.minecraft.world.entity.animal.h"
#include "../../../Minecraft.World/JavaMath.h"
// 4J JEV - Images for each tab.
IUIScene_CreativeMenu::TabSpec **IUIScene_CreativeMenu::specs = nullptr;
vector< shared_ptr<ItemInstance> > IUIScene_CreativeMenu::categoryGroups[eCreativeInventoryGroupsCount];
#define ITEM(id) list->push_back( shared_ptr<ItemInstance>(new ItemInstance(id, 1, 0)) );
#define ITEM_AUX(id, aux) list->push_back( shared_ptr<ItemInstance>(new ItemInstance(id, 1, aux)) );
#define DEF(index) list = &categoryGroups[index];
void IUIScene_CreativeMenu::staticCtor()
{
vector< shared_ptr<ItemInstance> > *list;
// Building Blocks
DEF(eCreativeInventory_BuildingBlocks)
ITEM(Tile::stone_Id)
ITEM(Tile::grass_Id)
ITEM_AUX(Tile::dirt_Id, 0)
ITEM(Tile::cobblestone_Id)
ITEM(Tile::sand_Id)
ITEM(Tile::sandstone_Id)
ITEM_AUX(Tile::sandstone_Id, SandStoneTile::TYPE_SMOOTHSIDE)
ITEM_AUX(Tile::sandstone_Id, SandStoneTile::TYPE_HEIROGLYPHS)
ITEM_AUX(Tile::sand_Id, SandTile::RED_SAND)
ITEM(Tile::red_sandstone_Id)
ITEM_AUX(Tile::red_sandstone_Id, RedSandStoneTile::TYPE_SMOOTHSIDE)
ITEM_AUX(Tile::red_sandstone_Id, RedSandStoneTile::TYPE_HEIROGLYPHS)
ITEM_AUX(Tile::stone_Id, StoneTile::GRANITE)
ITEM_AUX(Tile::stone_Id, StoneTile::POLISHED_GRANITE)
ITEM_AUX(Tile::stone_Id, StoneTile::ANDESITE)
ITEM_AUX(Tile::stone_Id, StoneTile::POLISHED_ANDESITE)
ITEM_AUX(Tile::stone_Id, StoneTile::DIORITE)
ITEM_AUX(Tile::stone_Id, StoneTile::POLISHED_DIORITE)
ITEM(Tile::coal_block_Id)
ITEM(Tile::gold_block_Id)
ITEM(Tile::iron_block_Id)
ITEM(Tile::lapis_block_Id)
ITEM(Tile::diamond_block_Id)
ITEM(Tile::emerald_block_Id)
ITEM_AUX(Tile::quartz_block_Id,QuartzBlockTile::TYPE_DEFAULT)
ITEM(Tile::coal_ore_Id)
ITEM(Tile::lapis_ore_Id)
ITEM(Tile::diamond_ore_Id)
ITEM(Tile::redstone_ore_Id)
ITEM(Tile::iron_ore_Id)
ITEM(Tile::gold_ore_Id)
ITEM(Tile::emerald_ore_Id)
ITEM(Tile::quartz_ore_Id)
ITEM(Tile::bedrock_Id)
ITEM_AUX(Tile::planks_Id,0)
ITEM_AUX(Tile::planks_Id,TreeTile::SPRUCE_TRUNK)
ITEM_AUX(Tile::planks_Id,TreeTile::BIRCH_TRUNK)
ITEM_AUX(Tile::planks_Id,TreeTile::JUNGLE_TRUNK)
ITEM_AUX(Tile::planks_Id, TreeTile::ACACIA_TRUNK)
ITEM_AUX(Tile::planks_Id, TreeTile::DARK_TRUNK)
ITEM_AUX(Tile::log_Id, 0)
ITEM_AUX(Tile::log_Id, TreeTile::SPRUCE_TRUNK)
ITEM_AUX(Tile::log_Id, TreeTile::BIRCH_TRUNK)
ITEM_AUX(Tile::log_Id, TreeTile::JUNGLE_TRUNK)
ITEM_AUX(Tile::log2_Id, TreeTile2::ACACIA_TRUNK)
ITEM_AUX(Tile::log2_Id, TreeTile2::DARK_TRUNK)
ITEM(Tile::gravel_Id)
ITEM(Tile::brick_block_Id)
ITEM(Tile::mossy_cobblestone_Id)
ITEM(Tile::obsidian_Id)
ITEM(Tile::clay)
ITEM(Tile::ice_Id)
ITEM(Tile::packed_ice_Id)
ITEM(Tile::snow_Id)
ITEM(Tile::netherrack_Id)
ITEM(Tile::soul_sand_Id)
ITEM(Tile::glowstone_Id)
ITEM(Tile::sea_lantern_Id)
ITEM_AUX(Tile::prismarine_Id, PrismarineTile::TYPE_DEFAULT)
ITEM_AUX(Tile::prismarine_Id, PrismarineTile::TYPE_BRICKS)
ITEM_AUX(Tile::prismarine_Id, PrismarineTile::TYPE_DARK)
ITEM(Tile::slime_Id)
ITEM(Tile::fence_Id)
// TU25
ITEM(Tile::spruce_fence_Id)
ITEM(Tile::birch_fence_Id)
ITEM(Tile::jungle_fence_Id)
ITEM(Tile::acacia_fence_Id)
ITEM(Tile::dark_oak_fence_Id)
ITEM(Tile::nether_brick_fence_Id)
ITEM(Tile::iron_bars_Id)
ITEM_AUX(Tile::cobblestone_wall_Id, WallTile::TYPE_NORMAL)
ITEM_AUX(Tile::cobblestone_wall_Id, WallTile::TYPE_MOSSY)
ITEM_AUX(Tile::stonebrick_Id,SmoothStoneBrickTile::TYPE_DEFAULT)
ITEM_AUX(Tile::stonebrick_Id,SmoothStoneBrickTile::TYPE_MOSSY)
ITEM_AUX(Tile::stonebrick_Id,SmoothStoneBrickTile::TYPE_CRACKED)
ITEM_AUX(Tile::stonebrick_Id,SmoothStoneBrickTile::TYPE_DETAIL)
ITEM_AUX(Tile::monster_egg_Id,StoneMonsterTile::HOST_ROCK)
ITEM_AUX(Tile::monster_egg_Id,StoneMonsterTile::HOST_COBBLE)
ITEM_AUX(Tile::monster_egg_Id,StoneMonsterTile::HOST_STONEBRICK)
ITEM(Tile::mycelium_Id)
ITEM_AUX(Tile::dirt_Id, DirtTile::COARSE_DIRT)
ITEM_AUX(Tile::dirt_Id, DirtTile::PODZOL)
ITEM(Tile::nether_brick_Id)
ITEM(Tile::end_stone_Id)
ITEM_AUX(Tile::quartz_block_Id,QuartzBlockTile::TYPE_CHISELED)
ITEM_AUX(Tile::quartz_block_Id,QuartzBlockTile::TYPE_LINES_Y)
ITEM(Tile::trapdoor_Id)
ITEM(Tile::iron_trapdoor_Id)
ITEM(Tile::fence_gate_Id)
// TU25
ITEM(Tile::spruce_fence_gate_Id)
ITEM(Tile::birch_fence_gate_Id)
ITEM(Tile::jungle_fence_gate_Id)
ITEM(Tile::acacia_fence_gate_Id)
ITEM(Tile::dark_oak_fence_gate_Id)
ITEM(Item::wooden_door_Id)
ITEM(Item::iron_door_Id)
// TU25
ITEM(Item::spruce_door_Id)
ITEM(Item::birch_door_Id)
ITEM(Item::jungle_door_Id)
ITEM(Item::acacia_door_Id)
ITEM(Item::dark_oak_door_Id)
ITEM_AUX(Tile::stone_slab_Id,StoneSlabTile::STONE_SLAB)
ITEM_AUX(Tile::stone_slab_Id,StoneSlabTile::SAND_SLAB)
// AP - changed oak slab to be wood because it wouldn't burn
// ITEM_AUX(Tile::stone_slab_Id,StoneSlabTile::WOOD_SLAB)
ITEM_AUX(Tile::wooden_slab_Id,0)
ITEM_AUX(Tile::wooden_slab_Id, TreeTile::SPRUCE_TRUNK)
ITEM_AUX(Tile::wooden_slab_Id,TreeTile::BIRCH_TRUNK)
ITEM_AUX(Tile::wooden_slab_Id,TreeTile::JUNGLE_TRUNK)
// TU25 -- added acacia and dark oak
ITEM_AUX(Tile::wooden_slab_Id, TreeTile::ACACIA_TRUNK)
ITEM_AUX(Tile::wooden_slab_Id, TreeTile::DARK_TRUNK)
ITEM_AUX(Tile::stone_slab_Id,StoneSlabTile::COBBLESTONE_SLAB)
ITEM_AUX(Tile::stone_slab_Id,StoneSlabTile::BRICK_SLAB)
ITEM_AUX(Tile::stone_slab_Id,StoneSlabTile::SMOOTHBRICK_SLAB)
ITEM_AUX(Tile::stone_slab_Id,StoneSlabTile::NETHERBRICK_SLAB)
ITEM_AUX(Tile::stone_slab_Id,StoneSlabTile::QUARTZ_SLAB)
ITEM_AUX(Tile::stone_slab2_Id ,StoneSlabTile2::RED_SANDSTONE_SLAB)
ITEM(Tile::oak_stairs_Id)
ITEM(Tile::birch_stairs_Id)
ITEM(Tile::spruce_stairs_Id)
ITEM(Tile::jungle_stairs_Id)
ITEM(Tile::acacia_stairs_Id)
ITEM(Tile::dark_oak_stairs_Id)
ITEM(Tile::stone_stairs_Id)
ITEM(Tile::brick_stairs_Id)
ITEM(Tile::stone_brick_stairs_Id)
ITEM(Tile::nether_brick_stairs_Id)
ITEM(Tile::sandstone_stairs_Id)
ITEM(Tile::stairs_red_sandstone)
ITEM(Tile::quartz_stairs_Id)
ITEM(Tile::hardened_clay_Id)
ITEM_AUX(Tile::stained_hardened_clay_Id,14) // Red
ITEM_AUX(Tile::stained_hardened_clay_Id,1) // Orange
ITEM_AUX(Tile::stained_hardened_clay_Id,4) // Yellow
ITEM_AUX(Tile::stained_hardened_clay_Id,5) // Lime
ITEM_AUX(Tile::stained_hardened_clay_Id,3) // Light Blue
ITEM_AUX(Tile::stained_hardened_clay_Id,9) // Cyan
ITEM_AUX(Tile::stained_hardened_clay_Id,11) // Blue
ITEM_AUX(Tile::stained_hardened_clay_Id,10) // Purple
ITEM_AUX(Tile::stained_hardened_clay_Id,2) // Magenta
ITEM_AUX(Tile::stained_hardened_clay_Id,6) // Pink
ITEM_AUX(Tile::stained_hardened_clay_Id,0) // White
ITEM_AUX(Tile::stained_hardened_clay_Id,8) // Light Gray
ITEM_AUX(Tile::stained_hardened_clay_Id,7) // Gray
ITEM_AUX(Tile::stained_hardened_clay_Id,15) // Black
ITEM_AUX(Tile::stained_hardened_clay_Id,13) // Green
ITEM_AUX(Tile::stained_hardened_clay_Id,12) // Brown
// Decoration
DEF(eCreativeInventory_Decoration)
ITEM_AUX(Item::skull_Id,SkullTileEntity::TYPE_SKELETON)
ITEM_AUX(Item::skull_Id,SkullTileEntity::TYPE_WITHER)
ITEM_AUX(Item::skull_Id,SkullTileEntity::TYPE_ZOMBIE)
ITEM_AUX(Item::skull_Id,SkullTileEntity::TYPE_CHAR)
ITEM_AUX(Item::skull_Id,SkullTileEntity::TYPE_CREEPER)
ITEM_AUX(Tile::sponge_Id, 0) // dry sponge
ITEM_AUX(Tile::sponge_Id, 1) // wet sponge
ITEM(Tile::melon_block_Id)
ITEM(Tile::pumpkin_Id)
ITEM(Tile::lit_pumpkin_Id)
ITEM_AUX(Tile::sapling_Id, Sapling::TYPE_DEFAULT)
ITEM_AUX(Tile::sapling_Id, Sapling::TYPE_EVERGREEN)
ITEM_AUX(Tile::sapling_Id, Sapling::TYPE_BIRCH)
ITEM_AUX(Tile::sapling_Id, Sapling::TYPE_JUNGLE)
ITEM_AUX(Tile::sapling_Id, Sapling::TYPE_ACACIA)
ITEM_AUX(Tile::sapling_Id, Sapling::TYPE_DARK_OAK)
ITEM_AUX(Tile::leaves_Id, LeafTile::NORMAL_LEAF)
ITEM_AUX(Tile::leaves_Id, LeafTile::EVERGREEN_LEAF)
ITEM_AUX(Tile::leaves_Id, LeafTile::BIRCH_LEAF)
ITEM_AUX(Tile::leaves_Id, LeafTile::JUNGLE_LEAF)
ITEM_AUX(Tile::leaves2_Id, LeafTile2::ACACIA_LEAF)
ITEM_AUX(Tile::leaves2_Id, LeafTile2::DARK_OAK_LEAF)
ITEM(Tile::vine)
ITEM(Tile::waterlily_Id)
ITEM(Tile::torch_Id)
ITEM_AUX(Tile::tallgrass_Id, TallGrass::DEAD_SHRUB)
ITEM_AUX(Tile::tallgrass_Id, TallGrass::TALL_GRASS)
ITEM_AUX(Tile::tallgrass_Id, TallGrass::FERN)
ITEM(Tile::deadbush_Id)
ITEM(Tile::yellow_flower_Id)
ITEM(Tile::red_flower_Id)
ITEM_AUX(Tile::red_flower_Id, Rose::BLUE_ORCHID)
ITEM_AUX(Tile::red_flower_Id, Rose::ALLIUM)
ITEM_AUX(Tile::red_flower_Id, Rose::AZURE_BLUET)
ITEM_AUX(Tile::red_flower_Id, Rose::RED_TULIP)
ITEM_AUX(Tile::red_flower_Id, Rose::ORANGE_TULIP)
ITEM_AUX(Tile::red_flower_Id, Rose::WHITE_TULIP)
ITEM_AUX(Tile::red_flower_Id, Rose::PINK_TULIP)
ITEM_AUX(Tile::red_flower_Id, Rose::OXEYE_DAISY)
ITEM(Tile::tallgrass2_Id)
ITEM_AUX(Tile::double_plant_Id, TallGrass2::LILAC)
ITEM_AUX(Tile::double_plant_Id, TallGrass2::TALL_GRASS)
ITEM_AUX(Tile::double_plant_Id, TallGrass2::LARGE_FERN)
ITEM_AUX(Tile::double_plant_Id, TallGrass2::ROSE_BUSH)
ITEM_AUX(Tile::double_plant_Id, TallGrass2::PEONY)
ITEM(Tile::mushroom_brown_Id)
ITEM(Tile::mushroom_red_Id)
ITEM(Tile::cactus_Id)
ITEM(Tile::snow_layer_Id)
// 4J-PB - Already got sugar cane in Materials ITEM_11(Tile::reeds_Id)
ITEM(Tile::web_Id)
ITEM(Tile::glass_pane_Id)
ITEM(Tile::glass_Id)
ITEM(Item::painting_Id)
ITEM(Item::item_frame_Id)
ITEM(Item::standing_sign_Id)
ITEM(Tile::bookshelf_Id)
ITEM(Item::flower_pot_Id)
ITEM(Tile::hay_block_Id)
ITEM_AUX(Tile::wool_Id,14) // Red
ITEM_AUX(Tile::wool_Id,1) // Orange
ITEM_AUX(Tile::wool_Id,4) // Yellow
ITEM_AUX(Tile::wool_Id,5) // Lime
ITEM_AUX(Tile::wool_Id,3) // Light Blue
ITEM_AUX(Tile::wool_Id,9) // Cyan
ITEM_AUX(Tile::wool_Id,11) // Blue
ITEM_AUX(Tile::wool_Id,10) // Purple
ITEM_AUX(Tile::wool_Id,2) // Magenta
ITEM_AUX(Tile::wool_Id,6) // Pink
ITEM_AUX(Tile::wool_Id,0) // White
ITEM_AUX(Tile::wool_Id,8) // Light Gray
ITEM_AUX(Tile::wool_Id,7) // Gray
ITEM_AUX(Tile::wool_Id,15) // Black
ITEM_AUX(Tile::wool_Id,13) // Green
ITEM_AUX(Tile::wool_Id,12) // Brown
ITEM_AUX(Tile::carpet_Id,14) // Red
ITEM_AUX(Tile::carpet_Id,1) // Orange
ITEM_AUX(Tile::carpet_Id,4) // Yellow
ITEM_AUX(Tile::carpet_Id,5) // Lime
ITEM_AUX(Tile::carpet_Id,3) // Light Blue
ITEM_AUX(Tile::carpet_Id,9) // Cyan
ITEM_AUX(Tile::carpet_Id,11) // Blue
ITEM_AUX(Tile::carpet_Id,10) // Purple
ITEM_AUX(Tile::carpet_Id,2) // Magenta
ITEM_AUX(Tile::carpet_Id,6) // Pink
ITEM_AUX(Tile::carpet_Id,0) // White
ITEM_AUX(Tile::carpet_Id,8) // Light Gray
ITEM_AUX(Tile::carpet_Id,7) // Gray
ITEM_AUX(Tile::carpet_Id,15) // Black
ITEM_AUX(Tile::carpet_Id,13) // Green
ITEM_AUX(Tile::carpet_Id,12) // Brown
ITEM_AUX(Tile::stained_glass_Id,14) // Red
ITEM_AUX(Tile::stained_glass_Id,1) // Orange
ITEM_AUX(Tile::stained_glass_Id,4) // Yellow
ITEM_AUX(Tile::stained_glass_Id,5) // Lime
ITEM_AUX(Tile::stained_glass_Id,3) // Light Blue
ITEM_AUX(Tile::stained_glass_Id,9) // Cyan
ITEM_AUX(Tile::stained_glass_Id,11) // Blue
ITEM_AUX(Tile::stained_glass_Id,10) // Purple
ITEM_AUX(Tile::stained_glass_Id,2) // Magenta
ITEM_AUX(Tile::stained_glass_Id,6) // Pink
ITEM_AUX(Tile::stained_glass_Id,0) // White
ITEM_AUX(Tile::stained_glass_Id,8) // Light Gray
ITEM_AUX(Tile::stained_glass_Id,7) // Gray
ITEM_AUX(Tile::stained_glass_Id,15) // Black
ITEM_AUX(Tile::stained_glass_Id,13) // Green
ITEM_AUX(Tile::stained_glass_Id,12) // Brown
ITEM_AUX(Tile::stained_glass_pane_Id,14) // Red
ITEM_AUX(Tile::stained_glass_pane_Id,1) // Orange
ITEM_AUX(Tile::stained_glass_pane_Id,4) // Yellow
ITEM_AUX(Tile::stained_glass_pane_Id,5) // Lime
ITEM_AUX(Tile::stained_glass_pane_Id,3) // Light Blue
ITEM_AUX(Tile::stained_glass_pane_Id,9) // Cyan
ITEM_AUX(Tile::stained_glass_pane_Id,11) // Blue
ITEM_AUX(Tile::stained_glass_pane_Id,10) // Purple
ITEM_AUX(Tile::stained_glass_pane_Id,2) // Magenta
ITEM_AUX(Tile::stained_glass_pane_Id,6) // Pink
ITEM_AUX(Tile::stained_glass_pane_Id,0) // White
ITEM_AUX(Tile::stained_glass_pane_Id,8) // Light Gray
ITEM_AUX(Tile::stained_glass_pane_Id,7) // Gray
ITEM_AUX(Tile::stained_glass_pane_Id,15) // Black
ITEM_AUX(Tile::stained_glass_pane_Id,13) // Green
ITEM_AUX(Tile::stained_glass_pane_Id,12) // Brown
#ifndef _CONTENT_PACKAGE
DEF(eCreativeInventory_ArtToolsDecorations)
if(app.DebugSettingsOn())
{
for(unsigned int i = 0; i < Painting::LAST_VALUE; ++i)
{
ITEM_AUX(Item::painting_Id, i + 1)
}
BuildFirework(list, FireworksItem::TYPE_BIG, DyePowderItem::PURPLE, 1, false, false);
BuildFirework(list, FireworksItem::TYPE_SMALL, DyePowderItem::RED, 1, false, false);
BuildFirework(list, FireworksItem::TYPE_SMALL, DyePowderItem::RED, 2, false, false);
BuildFirework(list, FireworksItem::TYPE_SMALL, DyePowderItem::RED, 3, false, false);
BuildFirework(list, FireworksItem::TYPE_BURST, DyePowderItem::GREEN, 1, false, true);
BuildFirework(list, FireworksItem::TYPE_CREEPER, DyePowderItem::BLUE, 1, true, false);
BuildFirework(list, FireworksItem::TYPE_STAR, DyePowderItem::YELLOW, 1, false, false);
BuildFirework(list, FireworksItem::TYPE_BIG, DyePowderItem::WHITE, 1, true, true);
}
#endif
// Redstone
DEF(eCreativeInventory_Redstone)
ITEM(Tile::dispenser_Id)
ITEM(Tile::noteblock_Id)
ITEM(Tile::piston_Id)
ITEM(Tile::sticky_piston_Id)
ITEM(Tile::tnt_Id)
ITEM(Tile::lever_Id)
ITEM(Tile::stone_button_Id)
ITEM(Tile::wooden_button_Id)
ITEM(Tile::stone_pressure_plate_Id)
ITEM(Tile::wooden_pressure_plate_Id)
ITEM(Item::redstone_Id)
ITEM(Tile::redstone_block_Id)
ITEM(Tile::redstone_torch_Id)
ITEM(Item::repeater_Id)
ITEM(Tile::redstone_lamp_Id)
ITEM(Tile::tripwire_hook_Id)
ITEM(Tile::daylight_detector_Id)
ITEM(Tile::dropper_Id)
ITEM(Tile::hopper_Id)
ITEM(Item::comparator_Id)
ITEM(Tile::chest_trap_Id)
ITEM(Tile::heavy_weighted_pressure_plate_Id)
ITEM(Tile::light_weighted_pressure_plate_Id)
// Transport
DEF(eCreativeInventory_Transport)
ITEM(Tile::rail_Id)
ITEM(Tile::golden_rail_Id)
ITEM(Tile::detector_rail_Id)
ITEM(Tile::activator_rail_Id)
ITEM(Tile::ladder_Id)
ITEM(Item::minecart_Id)
ITEM(Item::chest_minecart_Id)
ITEM(Item::furnace_minecart_Id)
ITEM(Item::hopper_minecart_Id)
ITEM(Item::tnt_minecart_Id)
ITEM(Item::saddle_Id)
ITEM(Item::boat_Id)
ITEM(Item::elytra_Id)
// Miscellaneous
DEF(eCreativeInventory_Misc)
ITEM(Tile::chest_Id)
ITEM(Tile::ender_chest_Id)
ITEM(Tile::crafting_table_Id)
ITEM(Tile::furnace_Id)
ITEM(Item::brewing_stand_Id)
ITEM(Tile::enchanting_table_Id)
ITEM(Tile::beacon_Id)
ITEM(Tile::end_portal_frame_Id)
ITEM(Tile::jukebox_Id)
ITEM(Tile::anvil_Id);
ITEM(Item::bed_Id)
ITEM(Item::bucket_Id)
ITEM(Item::lava_bucket_Id)
ITEM(Item::water_bucket_Id)
ITEM(Item::milk_bucket_Id)
ITEM(Item::cauldron_Id)
ITEM(Item::snowball_Id)
ITEM(Item::paper_Id)
ITEM(Item::book_Id)
//TU25
ITEM(Item::writable_book_Id)
ITEM(Item::ender_pearl_Id)
ITEM(Item::eye_of_ender_Id)
ITEM(Item::name_tag_Id)
ITEM(Item::nether_star_Id)
ITEM_AUX(Item::spawn_egg_Id, 50); // Creeper
ITEM_AUX(Item::spawn_egg_Id, 51); // Skeleton
ITEM_AUX(Item::spawn_egg_Id, 52); // Spider
ITEM_AUX(Item::spawn_egg_Id, 54); // Zombie
ITEM_AUX(Item::spawn_egg_Id, 55); // Slime
ITEM_AUX(Item::spawn_egg_Id, 56); // Ghast
ITEM_AUX(Item::spawn_egg_Id, 57); // Zombie Pigman
ITEM_AUX(Item::spawn_egg_Id, 58); // Enderman
ITEM_AUX(Item::spawn_egg_Id, 59); // Cave Spider
ITEM_AUX(Item::spawn_egg_Id, 60); // Silverfish
ITEM_AUX(Item::spawn_egg_Id, 61); // Blaze
ITEM_AUX(Item::spawn_egg_Id, 62); // Magma Cube
ITEM_AUX(Item::spawn_egg_Id, 65); // Bat
ITEM_AUX(Item::spawn_egg_Id, 66); // Witch
ITEM_AUX(Item::spawn_egg_Id, 67); // Endermite
ITEM_AUX(Item::spawn_egg_Id, 68); // Guardian
ITEM_AUX(Item::spawn_egg_Id, 4); // Elder Guardian
ITEM_AUX(Item::spawn_egg_Id, 90); // Pig
ITEM_AUX(Item::spawn_egg_Id, 91); // Sheep
ITEM_AUX(Item::spawn_egg_Id, 92); // Cow
ITEM_AUX(Item::spawn_egg_Id, 93); // Chicken
ITEM_AUX(Item::spawn_egg_Id, 94); // Squid
ITEM_AUX(Item::spawn_egg_Id, 95); // Wolf
ITEM_AUX(Item::spawn_egg_Id, 96); // Mooshroom
ITEM_AUX(Item::spawn_egg_Id, 98); // Ozelot
ITEM_AUX(Item::spawn_egg_Id, 100); // Horse
ITEM_AUX(Item::spawn_egg_Id, 100 | ((EntityHorse::TYPE_DONKEY + 1) << 12) ); // Donkey
ITEM_AUX(Item::spawn_egg_Id, 100 | ((EntityHorse::TYPE_MULE + 1) << 12)); // Mule
ITEM_AUX(Item::spawn_egg_Id, 120); // Villager
ITEM_AUX(Item::spawn_egg_Id, 101); // Rabbit Brown
ITEM(Item::record_13_Id)
ITEM(Item::record_cat_Id)
ITEM(Item::record_blocks_Id)
ITEM(Item::record_chirp_Id)
ITEM(Item::record_far_Id)
ITEM(Item::record_mall_Id)
ITEM(Item::record_mellohi_Id)
ITEM(Item::record_stal_Id)
ITEM(Item::record_strad_Id)
ITEM(Item::record_ward_Id)
ITEM(Item::record_11_Id)
ITEM(Item::record_wait_Id)
BuildFirework(list, FireworksItem::TYPE_SMALL, DyePowderItem::LIGHT_BLUE, 1, true, false);
BuildFirework(list, FireworksItem::TYPE_CREEPER, DyePowderItem::GREEN, 2, false, false);
BuildFirework(list, FireworksItem::TYPE_MAX, DyePowderItem::RED, 2, false, false, DyePowderItem::ORANGE);
BuildFirework(list, FireworksItem::TYPE_BURST, DyePowderItem::MAGENTA, 3, true, false, DyePowderItem::BLUE);
BuildFirework(list, FireworksItem::TYPE_STAR, DyePowderItem::YELLOW, 2, false, true, DyePowderItem::ORANGE);
DEF(eCreativeInventory_ArtToolsMisc)
if(app.DebugSettingsOn())
{
ITEM_AUX(Item::spawn_egg_Id, 100 | ((EntityHorse::TYPE_SKELETON + 1) << 12)); // Skeleton
ITEM_AUX(Item::spawn_egg_Id, 100 | ((EntityHorse::TYPE_UNDEAD + 1) << 12)); // Zombie
ITEM_AUX(Item::spawn_egg_Id, 98 | ((Ocelot::TYPE_BLACK + 1) << 12));
ITEM_AUX(Item::spawn_egg_Id, 98 | ((Ocelot::TYPE_RED + 1) << 12));
ITEM_AUX(Item::spawn_egg_Id, 98 | ((Ocelot::TYPE_SIAMESE + 1) << 12));
ITEM_AUX(Item::spawn_egg_Id, 52 | (2 << 12)); // Spider-Jockey
ITEM_AUX(Item::spawn_egg_Id, 63); // Enderdragon
}
// Food
DEF(eCreativeInventory_Food)
ITEM(Item::apple_Id)
ITEM(Item::golden_apple_Id)
ITEM_AUX(Item::golden_apple_Id,1) // Enchanted
ITEM(Item::melon_block_Id)
ITEM(Item::mushroom_stew_Id)
ITEM(Item::rabbit_stew_Id)
ITEM(Item::bread_Id)
ITEM(Item::cake_Id)
ITEM(Item::cookie_Id)
ITEM(Item::cooked_fish_Id)
ITEM(Item::fish_Id)
ITEM_AUX(Item::cooked_fish_Id, 1)
ITEM_AUX(Item::fish_Id, 1)
ITEM_AUX(Item::fish_Id, 2)
ITEM_AUX(Item::fish_Id, 3)
ITEM(Item::cooked_porkchop_Id)
ITEM(Item::porkchop_Id)
ITEM(Item::cooked_beef_Id)
ITEM(Item::beef_Id)
ITEM(Item::chicken_Id)
ITEM(Item::cooked_chicken_Id)
ITEM(Item::mutton_Id)
ITEM(Item::cooked_mutton_Id)
ITEM(Item::rabbit_Id)
ITEM(Item::cooked_rabbit_Id)
ITEM(Item::rotten_flesh_Id)
ITEM(Item::spider_eye_Id)
ITEM(Item::potato_Id)
ITEM(Item::baked_potato_Id)
ITEM(Item::poisonous_potato_Id)
ITEM(Item::carrot_Id)
ITEM(Item::golden_carrot_Id)
ITEM(Item::pumpkin_pie_Id)
// Tools, Armour and Weapons (Complete)
DEF(eCreativeInventory_ToolsArmourWeapons)
ITEM(Item::compass_Id)
ITEM(Item::leather_helmet_Id)
ITEM(Item::leather_chestplate_Id)
ITEM(Item::leather_leggings_Id)
ITEM(Item::leather_boots_Id)
ITEM(Item::wooden_sword_Id)
ITEM(Item::wooden_shovel_Id)
ITEM(Item::wooden_pickaxe_Id)
ITEM(Item::wooden_axe_Id)
ITEM(Item::wooden_hoe_Id)
ITEM(Item::map_Id)
ITEM(Item::chainmail_helmet_Id)
ITEM(Item::chainmail_chestplate_Id)
ITEM(Item::chainmail_leggings_Id)
ITEM(Item::chainmail_boots_Id)
ITEM(Item::stone_sword_Id)
ITEM(Item::stone_shovel_Id)
ITEM(Item::stone_pickaxe_Id)
ITEM(Item::stone_axe_Id)
ITEM(Item::stone_hoe_Id)
ITEM(Item::bow_Id)
ITEM(Item::iron_helmet_Id)
ITEM(Item::iron_chestplate_Id)
ITEM(Item::iron_leggings_Id)
ITEM(Item::iron_boots_Id)
ITEM(Item::iron_sword_Id)
ITEM(Item::iron_shovel_Id)
ITEM(Item::iron_pickaxe_Id)
ITEM(Item::iron_axe_Id)
ITEM(Item::iron_hoe_Id)
ITEM(Item::arrow_Id)
ITEM(Item::golden_helmet_Id)
ITEM(Item::golden_chestplate_Id)
ITEM(Item::golden_leggings_Id)
ITEM(Item::golden_boots_Id)
ITEM(Item::golden_sword_Id)
ITEM(Item::golden_shovel_Id)
ITEM(Item::golden_pickaxe_Id)
ITEM(Item::golden_axe_Id)
ITEM(Item::golden_hoe_Id)
ITEM(Item::flint_and_steel_Id)
ITEM(Item::diamond_helmet_Id)
ITEM(Item::diamond_chestplate_Id)
ITEM(Item::diamond_leggings_Id)
ITEM(Item::diamond_boots_Id)
ITEM(Item::diamond_sword_Id)
ITEM(Item::diamond_shovel_Id)
ITEM(Item::diamond_pickaxe_Id)
ITEM(Item::diamond_axe_Id)
ITEM(Item::diamond_hoe_Id)
ITEM(Item::fire_charge_Id)
ITEM(Item::clock_Id)
ITEM(Item::shears_Id)
ITEM(Item::fishing_rod_Id)
ITEM(Item::carrot_on_a_stick_Id)
ITEM(Item::lead_Id)
ITEM(Item::diamond_horse_armor_Id)
ITEM(Item::golden_horse_armor_Id)
ITEM(Item::iron_horse_armor_Id)
ITEM(Item::armor_stand_Id)
for(unsigned int i = 0; i < Enchantment::enchantments.length; ++i)
{
Enchantment *enchantment = Enchantment::enchantments[i];
if (enchantment == nullptr || enchantment->category == nullptr) continue;
list->push_back(Item::enchanted_book->createForEnchantment(new EnchantmentInstance(enchantment, enchantment->getMaxLevel())));
}
#ifndef _CONTENT_PACKAGE
if(app.DebugSettingsOn())
{
shared_ptr<ItemInstance> debugSword = std::make_shared<ItemInstance>(Item::diamond_sword_Id, 1, 0);
debugSword->enchant( Enchantment::damageBonus, 50 );
debugSword->setHoverName(L"Sword of Debug");
list->push_back(debugSword);
}
#endif
// Materials
DEF(eCreativeInventory_Materials)
ITEM(Item::coal_Id)
ITEM_AUX(Item::coal_Id,1)
ITEM(Item::diamond_Id)
ITEM(Item::emerald_Id)
ITEM(Item::iron_ingot_Id)
ITEM(Item::gold_ingot_Id)
ITEM(Item::quartz_Id)
ITEM(Item::brick_Id)
ITEM(Item::nether_brick_Id)
ITEM(Item::stick_Id)
ITEM(Item::bowl_Id)
ITEM(Item::bone_Id)
ITEM(Item::string_Id)
ITEM(Item::feather_Id)
ITEM(Item::flint_Id)
ITEM(Item::leather_Id)
ITEM(Item::rabbit_hide_Id)
ITEM(Item::gunpowder_Id)
ITEM(Item::clay_Id)
ITEM(Item::glowstone_dust_Id)
ITEM(Item::prismarine_crystals_Id)
ITEM(Item::prismarine_shard_Id)
ITEM(Item::wheat_seeds_Id)
ITEM(Item::melon_seeds_Id)
ITEM(Item::pumpkin_seeds_Id)
ITEM(Item::wheat_Id)
ITEM(Item::reeds_Id)
ITEM(Item::egg_Id)
ITEM(Item::sugar_Id)
ITEM(Item::slime_ball_Id)
ITEM(Item::blaze_rod_Id)
ITEM(Item::gold_nugget_Id)
ITEM(Item::netherwart_seeds_Id)
ITEM_AUX(Item::dye_Id,1) // Red
ITEM_AUX(Item::dye_Id,14) // Orange
ITEM_AUX(Item::dye_Id,11) // Yellow
ITEM_AUX(Item::dye_Id,10) // Lime
ITEM_AUX(Item::dye_Id,12) // Light Blue
ITEM_AUX(Item::dye_Id,6) // Cyan
ITEM_AUX(Item::dye_Id,4) // Blue
ITEM_AUX(Item::dye_Id,5) // Purple
ITEM_AUX(Item::dye_Id,13) // Magenta
ITEM_AUX(Item::dye_Id,9) // Pink
ITEM_AUX(Item::dye_Id,15) // Bone Meal
ITEM_AUX(Item::dye_Id,7) // Light gray
ITEM_AUX(Item::dye_Id,8) // Gray
ITEM_AUX(Item::dye_Id,0) // black (ink sac)
ITEM_AUX(Item::dye_Id,2) // Green
ITEM_AUX(Item::dye_Id,3) // Brown
// Brewing (TODO)
DEF(eCreativeInventory_Brewing)
ITEM(Item::experience_bottle_Id)
// 4J Stu - Anything else added here also needs to be added to the key handler below
ITEM(Item::ghast_tear_Id)
ITEM(Item::fermented_spider_eye_Id)
ITEM(Item::blaze_powder_Id)
ITEM(Item::magma_cream_Id)
ITEM(Item::speckled_melon_block_Id)
ITEM(Item::rabbit_foot_Id)
ITEM(Item::glass_bottle_Id)
ITEM_AUX(Item::potion_Id,0) // Water bottle
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_TYPE_AWKWARD)) // Awkward Potion
DEF(eCreativeInventory_Potions_Basic)
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_REGENERATION))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_SPEED))
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_FIRE_RESISTANCE))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_POISON))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_INSTANTHEALTH))
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_WEAKNESS))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_STRENGTH))
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_SLOWNESS))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_INSTANTDAMAGE))
// tu31 potions
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_WATERBREATHING))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_JUMPBOOST))
// end of tu31 potions
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, 0, MASK_REGENERATION))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, 0, MASK_SPEED))
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, 0, MASK_FIRE_RESISTANCE))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, 0, MASK_POISON))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, 0, MASK_INSTANTHEALTH))
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, 0, MASK_WEAKNESS))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, 0, MASK_STRENGTH))
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, 0, MASK_SLOWNESS))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, 0, MASK_INSTANTDAMAGE))
// tu31 potions
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, 0, MASK_WATERBREATHING))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, 0, MASK_JUMPBOOST))
// end of tu31 potions
DEF(eCreativeInventory_Potions_Level2)
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_REGENERATION))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_SPEED))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_FIRE_RESISTANCE))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_POISON))
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_INSTANTHEALTH))
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_NIGHTVISION))
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_INVISIBILITY))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_WEAKNESS))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_STRENGTH))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_SLOWNESS))
// tu31 potions
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_WATERBREATHING)) // i have no idea why water breathing had a level 2 version in the creative menu
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_JUMPBOOST))
// end of tu31 potions
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_INSTANTDAMAGE))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_LEVEL2, MASK_REGENERATION))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_LEVEL2, MASK_SPEED))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, 0, MASK_FIRE_RESISTANCE))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_LEVEL2, MASK_POISON))
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_LEVEL2, MASK_INSTANTHEALTH))
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_LEVEL2, MASK_NIGHTVISION))
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_LEVEL2, MASK_INVISIBILITY))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, 0, MASK_WEAKNESS))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_LEVEL2, MASK_STRENGTH))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, 0, MASK_SLOWNESS))
// tu31 potions
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_LEVEL2, MASK_WATERBREATHING)) // i have no idea why water breathing had a level 2 version in the creative menu
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_LEVEL2, MASK_JUMPBOOST))
// end of tu31 potions
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_LEVEL2, MASK_INSTANTDAMAGE))
DEF(eCreativeInventory_Potions_Extended)
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_EXTENDED, MASK_REGENERATION))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_EXTENDED, MASK_SPEED))
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_EXTENDED, MASK_FIRE_RESISTANCE))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_EXTENDED, MASK_POISON))
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_INSTANTHEALTH))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_NIGHTVISION)) // 4J- Moved here as there isn't a weak variant of this potion.
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_INVISIBILITY)) // 4J- Moved here as there isn't a weak variant of this potion.
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_EXTENDED, MASK_WEAKNESS))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_EXTENDED, MASK_STRENGTH))
// tu31 potions
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_EXTENDED, MASK_WATERBREATHING))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_EXTENDED, MASK_JUMPBOOST))
// end of tu31 potions
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_EXTENDED, MASK_SLOWNESS))
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_INSTANTDAMAGE))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_EXTENDED, MASK_REGENERATION))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_EXTENDED, MASK_SPEED))
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_EXTENDED, MASK_FIRE_RESISTANCE))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_EXTENDED, MASK_POISON))
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_LEVEL2, MASK_INSTANTHEALTH))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, 0, MASK_NIGHTVISION)) // 4J- Moved here as there isn't a weak variant of this potion.
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, 0, MASK_INVISIBILITY)) // 4J- Moved here as there isn't a weak variant of this potion.
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_EXTENDED, MASK_WEAKNESS))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_EXTENDED, MASK_STRENGTH))
// tu31 potions
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_EXTENDED, MASK_WATERBREATHING))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_EXTENDED, MASK_JUMPBOOST))
// end of tu31 potions
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_EXTENDED, MASK_SLOWNESS))
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_LEVEL2, MASK_INSTANTDAMAGE))
DEF(eCreativeInventory_Potions_Level2_Extended)
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2EXTENDED, MASK_REGENERATION))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2EXTENDED, MASK_SPEED))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_EXTENDED, MASK_FIRE_RESISTANCE))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2EXTENDED, MASK_POISON))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_INSTANTHEALTH))
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2EXTENDED, MASK_NIGHTVISION))
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2EXTENDED, MASK_INVISIBILITY))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_EXTENDED, MASK_NIGHTVISION)) // 4J- Moved here as there isn't a weak variant of this potion.
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_EXTENDED, MASK_INVISIBILITY)) // 4J- Moved here as there isn't a weak variant of this potion.
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_EXTENDED, MASK_WEAKNESS))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2EXTENDED, MASK_STRENGTH))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_EXTENDED, MASK_SLOWNESS))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_INSTANTDAMAGE))
// tu31 potions
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2EXTENDED, MASK_WATERBREATHING)) // i have
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2EXTENDED, MASK_JUMPBOOST))
// end of tu31 potions
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_LEVEL2EXTENDED, MASK_REGENERATION))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_LEVEL2EXTENDED, MASK_SPEED))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_EXTENDED, MASK_FIRE_RESISTANCE))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_LEVEL2EXTENDED, MASK_POISON))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_LEVEL2, MASK_INSTANTHEALTH))
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_LEVEL2EXTENDED, MASK_NIGHTVISION))
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_LEVEL2EXTENDED, MASK_INVISIBILITY))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_EXTENDED, MASK_NIGHTVISION)) // 4J- Moved here as there isn't a weak variant of this potion.
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_EXTENDED, MASK_INVISIBILITY)) // 4J- Moved here as there isn't a weak variant of this potion.
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_EXTENDED, MASK_WEAKNESS))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_LEVEL2EXTENDED, MASK_STRENGTH))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_EXTENDED, MASK_SLOWNESS))
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_LEVEL2, MASK_INSTANTDAMAGE))
// tu31 potions
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_LEVEL2EXTENDED, MASK_WATERBREATHING)) // i have no idea why water breathing had a level 2 version in the creative menu
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_LEVEL2EXTENDED, MASK_JUMPBOOST))
// end of tu31 potions
specs = new TabSpec*[eCreativeInventoryTab_COUNT];
// Top Row
ECreative_Inventory_Groups blocksGroup[] = {eCreativeInventory_BuildingBlocks};
specs[eCreativeInventoryTab_BuildingBlocks] = new TabSpec(L"Structures", IDS_GROUPNAME_BUILDING_BLOCKS, 1, blocksGroup);
#ifndef _CONTENT_PACKAGE
ECreative_Inventory_Groups decorationsGroup[] = {eCreativeInventory_Decoration};
ECreative_Inventory_Groups debugDecorationsGroup[] = {eCreativeInventory_ArtToolsDecorations};
specs[eCreativeInventoryTab_Decorations] = new TabSpec(L"Decoration", IDS_GROUPNAME_DECORATIONS, 1, decorationsGroup, 0, nullptr, 1, debugDecorationsGroup);
#else
ECreative_Inventory_Groups decorationsGroup[] = {eCreativeInventory_Decoration};
specs[eCreativeInventoryTab_Decorations] = new TabSpec(L"Decoration", IDS_GROUPNAME_DECORATIONS, 1, decorationsGroup);
#endif
ECreative_Inventory_Groups redAndTranGroup[] = {eCreativeInventory_Transport, eCreativeInventory_Redstone};
specs[eCreativeInventoryTab_RedstoneAndTransport] = new TabSpec(L"RedstoneAndTransport", IDS_GROUPNAME_REDSTONE_AND_TRANSPORT, 2, redAndTranGroup);
ECreative_Inventory_Groups materialsGroup[] = {eCreativeInventory_Materials};
specs[eCreativeInventoryTab_Materials] = new TabSpec(L"Materials", IDS_GROUPNAME_MATERIALS, 1, materialsGroup);
ECreative_Inventory_Groups foodGroup[] = {eCreativeInventory_Food};
specs[eCreativeInventoryTab_Food] = new TabSpec(L"Food", IDS_GROUPNAME_FOOD, 1, foodGroup);
ECreative_Inventory_Groups toolsGroup[] = {eCreativeInventory_ToolsArmourWeapons};
specs[eCreativeInventoryTab_ToolsWeaponsArmor] = new TabSpec(L"Tools", IDS_GROUPNAME_TOOLS_WEAPONS_ARMOR, 1, toolsGroup);
ECreative_Inventory_Groups brewingGroup[] = {eCreativeInventory_Brewing, eCreativeInventory_Potions_Level2_Extended, eCreativeInventory_Potions_Extended, eCreativeInventory_Potions_Level2, eCreativeInventory_Potions_Basic};
// Just use the text LT - the graphic doesn't fit in splitscreen either
// In 480p there's not enough room for the LT button, so use text instead
//if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen())
{
specs[eCreativeInventoryTab_Brewing] = new TabSpec(L"Brewing", IDS_GROUPNAME_POTIONS_480, 5, brewingGroup);
}
// else
// {
// specs[eCreativeInventoryTab_Brewing] = new TabSpec(L"icon_brewing.png", IDS_GROUPNAME_POTIONS, 1, brewingGroup, 4, potionsGroup);
// }
#ifndef _CONTENT_PACKAGE
ECreative_Inventory_Groups miscGroup[] = {eCreativeInventory_Misc};
ECreative_Inventory_Groups debugMiscGroup[] = {eCreativeInventory_ArtToolsMisc};
specs[eCreativeInventoryTab_Misc] = new TabSpec(L"Misc", IDS_GROUPNAME_MISCELLANEOUS, 1, miscGroup, 0, nullptr, 1, debugMiscGroup);
#else
ECreative_Inventory_Groups miscGroup[] = {eCreativeInventory_Misc};
specs[eCreativeInventoryTab_Misc] = new TabSpec(L"Misc", IDS_GROUPNAME_MISCELLANEOUS, 1, miscGroup);
#endif
}
IUIScene_CreativeMenu::IUIScene_CreativeMenu()
{
m_bCarryingCreativeItem = false;
m_creativeSlotX = m_creativeSlotY = m_inventorySlotX = m_inventorySlotY = 0;
// 4J JEV - Settup Tabs
for (int i = 0; i < eCreativeInventoryTab_COUNT; i++)
{
m_tabDynamicPos[i] = 0;
m_tabPage[i] = 0;
}
}
/* 4J JEV - Switches between tabs.
*/
void IUIScene_CreativeMenu::switchTab(ECreativeInventoryTabs tab)
{
// Could just be changing page on the current tab
if(tab != m_curTab) updateTabHighlightAndText(tab);
m_curTab = tab;
updateScrollCurrentPage(m_tabPage[m_curTab] + 1, specs[m_curTab]->getPageCount());
specs[tab]->populateMenu(itemPickerMenu,m_tabDynamicPos[m_curTab], m_tabPage[m_curTab]);
}
void IUIScene_CreativeMenu::ScrollBar(UIVec2D pointerPos)
{
UIVec2D pos;
UIVec2D size;
GetItemScreenData(eSectionInventoryCreativeSlider, 0, &pos, &size);
float fPosition = ((float)pointerPos.y - pos.y) / size.y;
// clamp
if(fPosition > 1)
fPosition = 1.0f;
else if(fPosition < 0)
fPosition = 0.0f;
// calculate page position according to page count
int iCurrentPage = Math::round(fPosition * (specs[m_curTab]->getPageCount() - 1));
// set tab page
m_tabPage[m_curTab] = iCurrentPage;
// update tab
switchTab(m_curTab);
}
// 4J JEV - Tab Spec Struct
IUIScene_CreativeMenu::TabSpec::TabSpec(LPCWSTR icon, int descriptionId, int staticGroupsCount, ECreative_Inventory_Groups *staticGroups, int dynamicGroupsCount, ECreative_Inventory_Groups *dynamicGroups, int debugGroupsCount /*= 0*/, ECreative_Inventory_Groups *debugGroups /*= nullptr*/)
: m_icon(icon), m_descriptionId(descriptionId), m_staticGroupsCount(staticGroupsCount), m_dynamicGroupsCount(dynamicGroupsCount), m_debugGroupsCount(debugGroupsCount)
{
m_pages = 0;
m_staticGroupsA = nullptr;
unsigned int dynamicItems = 0;
m_staticItems = 0;
if(staticGroupsCount > 0)
{
m_staticGroupsA = new ECreative_Inventory_Groups[staticGroupsCount];
for(int i = 0; i < staticGroupsCount; ++i)
{
m_staticGroupsA[i] = staticGroups[i];
m_staticItems += categoryGroups[m_staticGroupsA[i]].size();
}
}
m_debugGroupsA = nullptr;
m_debugItems = 0;
if(debugGroupsCount > 0)
{
m_debugGroupsA = new ECreative_Inventory_Groups[debugGroupsCount];
for(int i = 0; i < debugGroupsCount; ++i)
{
m_debugGroupsA[i] = debugGroups[i];
m_debugItems += categoryGroups[m_debugGroupsA[i]].size();
}
}
m_dynamicGroupsA = nullptr;
if(dynamicGroupsCount > 0 && dynamicGroups != nullptr)
{
m_dynamicGroupsA = new ECreative_Inventory_Groups[dynamicGroupsCount];
for(int i = 0; i < dynamicGroupsCount; ++i)
{
m_dynamicGroupsA[i] = dynamicGroups[i];
dynamicItems += categoryGroups[m_dynamicGroupsA[i]].size();
}
}
m_staticPerPage = columns;
const int totalRows = (m_staticItems + columns - 1) / columns;
m_pages = std::max<int>(1, totalRows - 5 + 1);
}
IUIScene_CreativeMenu::TabSpec::~TabSpec()
{
if(m_staticGroupsA != nullptr) delete [] m_staticGroupsA;
if(m_dynamicGroupsA != nullptr) delete [] m_dynamicGroupsA;
if(m_debugGroupsA != nullptr) delete [] m_debugGroupsA;
}
void IUIScene_CreativeMenu::TabSpec::populateMenu(AbstractContainerMenu *menu, int dynamicIndex, unsigned int page)
{
int lastSlotIndex = 0;
// Fill the dynamic group
if(m_dynamicGroupsCount > 0 && m_dynamicGroupsA != nullptr)
{
for (auto it = categoryGroups[m_dynamicGroupsA[dynamicIndex]].rbegin(); it != categoryGroups[m_dynamicGroupsA[dynamicIndex]].rend() && lastSlotIndex < MAX_SIZE; ++it)
{
Slot *slot = menu->getSlot(++lastSlotIndex);
slot->set( *it );
}
}
// Fill from the static groups
unsigned int startIndex = page * m_staticPerPage;
// Work out the first group with an item the want to display, and which item in that group
unsigned int currentIndex = 0;
unsigned int currentGroup = 0;
unsigned int currentItem = 0;
bool displayStatic = false;
for(; currentGroup < m_staticGroupsCount; ++currentGroup)
{
int size = categoryGroups[m_staticGroupsA[currentGroup]].size();
if( currentIndex + size <= startIndex)
{
currentIndex += size;
continue;
}
displayStatic = true;
currentItem = size - ((currentIndex + size) - startIndex);
break;
}
int lastStaticPageCount = currentIndex;
while(lastStaticPageCount > m_staticPerPage) lastStaticPageCount -= m_staticPerPage;
if(displayStatic)
{
for(; lastSlotIndex < MAX_SIZE;)
{
Slot *slot = menu->getSlot(lastSlotIndex++);
slot->set(categoryGroups[m_staticGroupsA[currentGroup]][currentItem]);
++currentItem;
if(currentItem >= categoryGroups[m_staticGroupsA[currentGroup]].size())
{
currentItem = 0;
++currentGroup;
if(currentGroup >= m_staticGroupsCount)
{
break;
}
}
}
}
#ifndef _CONTENT_PACKAGE
if(app.DebugArtToolsOn())
{
if(m_debugGroupsCount > 0)
{
startIndex = 0;
if(lastStaticPageCount != 0)
{
startIndex = m_staticPerPage - lastStaticPageCount;
}
currentIndex = 0;
currentGroup = 0;
currentItem = 0;
bool showDebug = false;
for(; currentGroup < m_debugGroupsCount; ++currentGroup)
{
int size = categoryGroups[m_debugGroupsA[currentGroup]].size();
if( currentIndex + size <= startIndex)
{
currentIndex += size;
continue;
}
currentItem = size - ((currentIndex + size) - startIndex);
break;
}
for(; lastSlotIndex < MAX_SIZE;)
{
Slot *slot = menu->getSlot(lastSlotIndex++);
slot->set(categoryGroups[m_debugGroupsA[currentGroup]][currentItem]);
++currentItem;
if(currentItem >= categoryGroups[m_debugGroupsA[currentGroup]].size())
{
currentItem = 0;
++currentGroup;
if(currentGroup >= m_debugGroupsCount)
{
break;
}
}
}
}
}
#endif
for(; lastSlotIndex < MAX_SIZE; ++lastSlotIndex)
{
Slot *slot = menu->getSlot(lastSlotIndex);
slot->remove(1);
}
}
unsigned int IUIScene_CreativeMenu::TabSpec::getPageCount()
{
#ifndef _CONTENT_PACKAGE
if(app.DebugArtToolsOn())
{
int totalItems = m_staticItems + m_debugItems;
const int totalRows = (totalItems + columns - 1) / columns;
return std::max<int>(1, totalRows - rows + 1);
}
else
#endif
{
return m_pages;
}
}
// 4J JEV - Item Picker Menu
IUIScene_CreativeMenu::ItemPickerMenu::ItemPickerMenu( shared_ptr<SimpleContainer> smp, shared_ptr<Inventory> inv ) : AbstractContainerMenu()
{
inventory = inv;
creativeContainer = smp;
//int startLength = slots->size();
Slot *slot = nullptr;
for (int i = 0; i < TabSpec::MAX_SIZE; i++)
{
// 4J JEV - These values get set by addSlot anyway.
slot = new Slot( creativeContainer, i, -1, -1);
ItemPickerMenu::addSlot( slot );
}
for (int i = 0; i < 9; i++)
{
slot = new Slot( inventory, i, -1, -1 );
ItemPickerMenu::addSlot( slot );
}
// 4J Stu - Give the creative menu a unique container id
containerId = CONTAINER_ID_CREATIVE;
}
bool IUIScene_CreativeMenu::ItemPickerMenu::stillValid(shared_ptr<Player> player)
{
return true;
}
bool IUIScene_CreativeMenu::ItemPickerMenu::isOverrideResultClick(int slotNum, int buttonNum)
{
return slotNum >= 0 && slotNum < 9 && buttonNum == 0;
}
IUIScene_AbstractContainerMenu::ESceneSection IUIScene_CreativeMenu::GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY )
{
ESceneSection newSection = eSection;
// Find the new section if there is one
switch( eSection )
{
case eSectionInventoryCreativeSelector:
if (eTapDirection == eTapStateDown || eTapDirection == eTapStateUp)
{
newSection = eSectionInventoryCreativeUsing;
}
break;
case eSectionInventoryCreativeUsing:
if (eTapDirection == eTapStateDown || eTapDirection == eTapStateUp)
{
newSection = eSectionInventoryCreativeSelector;
}
break;
case eSectionInventoryCreativeTab_0:
case eSectionInventoryCreativeTab_1:
case eSectionInventoryCreativeTab_2:
case eSectionInventoryCreativeTab_3:
case eSectionInventoryCreativeTab_4:
case eSectionInventoryCreativeTab_5:
case eSectionInventoryCreativeTab_6:
case eSectionInventoryCreativeTab_7:
case eSectionInventoryCreativeSlider:
/* do nothing */
break;
default:
assert( false );
break;
}
updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, piTargetY, 0);
return newSection;
}
bool IUIScene_CreativeMenu::handleValidKeyPress(int iPad, int buttonNum, BOOL quickKeyHeld)
{
// 4J Added - Make pressing the X button clear the hotbar
if(buttonNum == 1)
{
Minecraft *pMinecraft = Minecraft::GetInstance();
for(unsigned int i = TabSpec::MAX_SIZE; i < TabSpec::MAX_SIZE + 9; ++i)
{
shared_ptr<ItemInstance> newItem = m_menu->getSlot(i)->getItem();
if(newItem != nullptr)
{
m_menu->getSlot(i)->set(nullptr);
// call this function to synchronize multiplayer item bar
pMinecraft->localgameModes[iPad]->handleCreativeModeItemAdd(nullptr, i - static_cast<int>(m_menu->slots.size()) + 9 + InventoryMenu::USE_ROW_SLOT_START);
}
}
return true;
}
return false;
}
void IUIScene_CreativeMenu::handleOutsideClicked(int iPad, int buttonNum, BOOL quickKeyHeld)
{
// Drop items.
Minecraft *pMinecraft = Minecraft::GetInstance();
shared_ptr<Inventory> playerInventory = pMinecraft->localplayers[iPad]->inventory;
if (playerInventory->getCarried() != nullptr)
{
if (buttonNum == 0)
{
pMinecraft->localgameModes[iPad]->handleCreativeModeItemDrop(playerInventory->getCarried());
playerInventory->setCarried(nullptr);
}
if (buttonNum == 1)
{
shared_ptr<ItemInstance> removedItem = playerInventory->getCarried()->remove(1);
pMinecraft->localgameModes[iPad]->handleCreativeModeItemDrop(removedItem);
if (playerInventory->getCarried()->count == 0) playerInventory->setCarried(nullptr);
}
}
//pMinecraft->localgameModes[m_iPad]->handleInventoryMouseClick(menu->containerId, AbstractContainerMenu::CLICKED_OUTSIDE, buttonNum, quickKeyHeld?true:false, pMinecraft->localplayers[m_iPad] );
}
void IUIScene_CreativeMenu::handleAdditionalKeyPress(int iAction)
{
int dir = 1;
switch(iAction)
{
case ACTION_MENU_LEFT_SCROLL:
dir = -1;
// Fall through intentional
case ACTION_MENU_RIGHT_SCROLL:
{
ECreativeInventoryTabs tab = static_cast<ECreativeInventoryTabs>(m_curTab + dir);
if (tab < 0) tab = static_cast<ECreativeInventoryTabs>(eCreativeInventoryTab_COUNT - 1);
if (tab >= eCreativeInventoryTab_COUNT) tab = eCreativeInventoryTab_BuildingBlocks;
switchTab(tab);
ui.PlayUISFX(eSFX_Focus);
}
break;
case ACTION_MENU_PAGEUP:
// change the potion strength
{
++m_tabDynamicPos[m_curTab];
if(m_tabDynamicPos[m_curTab] >= specs[m_curTab]->m_dynamicGroupsCount) m_tabDynamicPos[m_curTab] = 0;
switchTab(m_curTab);
}
break;
case ACTION_MENU_OTHER_STICK_DOWN:
{
int pageStep = 1;
m_tabPage[m_curTab] += pageStep;
if(m_tabPage[m_curTab] >= specs[m_curTab]->getPageCount())
{
m_tabPage[m_curTab] = specs[m_curTab]->getPageCount() - 1;
}
else
{
switchTab(m_curTab);
}
}
break;
case ACTION_MENU_OTHER_STICK_UP:
{
int pageStep = 1;
m_tabPage[m_curTab] -= pageStep;
if(m_tabPage[m_curTab] < 0)
{
m_tabPage[m_curTab] = 0;
}
else
{
switchTab(m_curTab);
}
}
break;
}
}
void IUIScene_CreativeMenu::handleSlotListClicked(ESceneSection eSection, int buttonNum, BOOL quickKeyHeld)
{
int currentIndex = getCurrentIndex(eSection);
Minecraft *pMinecraft = Minecraft::GetInstance();
bool instantPlace = false;
if (eSection == eSectionInventoryCreativeSelector)
{
if (buttonNum == 0)
{
shared_ptr<Inventory> playerInventory = pMinecraft->localplayers[getPad()]->inventory;
shared_ptr<ItemInstance> carried = playerInventory->getCarried();
shared_ptr<ItemInstance> clicked = m_menu->getSlot(currentIndex)->getItem();
if (clicked != nullptr)
{
playerInventory->setCarried(ItemInstance::clone(clicked));
carried = playerInventory->getCarried();
if (quickKeyHeld == TRUE)
{
carried->count = carried->getMaxStackSize();
}
m_creativeSlotX = m_iCurrSlotX;
m_creativeSlotY = m_iCurrSlotY;
m_eCurrSection = eSectionInventoryCreativeUsing;
m_eCurrTapState = eTapStateJump;
instantPlace = getEmptyInventorySlot(carried, m_inventorySlotX);
m_iCurrSlotX = m_inventorySlotX;
m_iCurrSlotY = m_inventorySlotY;
m_bCarryingCreativeItem = true;
}
}
}
if(instantPlace || eSection == eSectionInventoryCreativeUsing)
{
if(instantPlace)
{
setSectionSelectedSlot(eSectionInventoryCreativeUsing,m_iCurrSlotX,m_iCurrSlotY);
currentIndex = getCurrentIndex(eSectionInventoryCreativeUsing);
buttonNum = 0;
quickKeyHeld = FALSE;
}
m_menu->clicked(currentIndex, buttonNum, quickKeyHeld?AbstractContainerMenu::CLICK_QUICK_MOVE:AbstractContainerMenu::CLICK_PICKUP, pMinecraft->localplayers[getPad()]);
shared_ptr<ItemInstance> newItem = m_menu->getSlot(currentIndex)->getItem();
// call this function to synchronize multiplayer item bar
pMinecraft->localgameModes[getPad()]->handleCreativeModeItemAdd(newItem, currentIndex - static_cast<int>(m_menu->slots.size()) + 9 + InventoryMenu::USE_ROW_SLOT_START);
if(m_bCarryingCreativeItem)
{
m_inventorySlotX = m_iCurrSlotX;
m_inventorySlotY = m_iCurrSlotY;
m_eCurrSection = eSectionInventoryCreativeSelector;
m_eCurrTapState = eTapStateJump;
m_iCurrSlotX = m_creativeSlotX;
m_iCurrSlotY = m_creativeSlotY;
shared_ptr<Inventory> playerInventory = pMinecraft->localplayers[getPad()]->inventory;
playerInventory->setCarried(nullptr);
m_bCarryingCreativeItem = false;
}
}
}
bool IUIScene_CreativeMenu::IsSectionSlotList( ESceneSection eSection )
{
switch( eSection )
{
case eSectionInventoryCreativeUsing:
case eSectionInventoryCreativeSelector:
return true;
}
return false;
}
bool IUIScene_CreativeMenu::CanHaveFocus( ESceneSection eSection )
{
switch( eSection )
{
case eSectionInventoryCreativeUsing:
case eSectionInventoryCreativeSelector:
return true;
}
return false;
}
bool IUIScene_CreativeMenu::getEmptyInventorySlot(shared_ptr<ItemInstance> item, int &slotX)
{
bool sameItemFound = false;
bool emptySlotFound = false;
// Jump to the slot with this item already on it, if we can stack more
for(unsigned int i = TabSpec::MAX_SIZE; i < TabSpec::MAX_SIZE + 9; ++i)
{
shared_ptr<ItemInstance> slotItem = m_menu->getSlot(i)->getItem();
if( slotItem != nullptr && slotItem->sameItemWithTags(item) && (slotItem->GetCount() + item->GetCount() <= item->getMaxStackSize() ))
{
sameItemFound = true;
slotX = i - TabSpec::MAX_SIZE;
break;
}
}
if(!sameItemFound)
{
// Find an empty slot
for(unsigned int i = TabSpec::MAX_SIZE; i < TabSpec::MAX_SIZE + 9; ++i)
{
if( m_menu->getSlot(i)->getItem() == nullptr )
{
slotX = i - TabSpec::MAX_SIZE;
emptySlotFound = true;
break;
}
}
}
return sameItemFound || emptySlotFound;
}
int IUIScene_CreativeMenu::getSectionStartOffset(ESceneSection eSection)
{
int offset = 0;
switch( eSection )
{
case eSectionInventoryCreativeSelector:
offset = 0;
break;
case eSectionInventoryCreativeUsing:
offset = TabSpec::MAX_SIZE;
break;
default:
assert( false );
break;
}
return offset;
}
bool IUIScene_CreativeMenu::overrideTooltips(ESceneSection sectionUnderPointer, shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT, EToolTipItem &buttonBack)
{
bool _override = false;
if(sectionUnderPointer == eSectionInventoryCreativeSelector)
{
if(bSlotHasItem)
{
buttonA = eToolTipPickUpGeneric;
if(itemUnderPointer->isStackable())
{
buttonY = eToolTipPickUpAll;
}
else
{
buttonY = eToolTipNone; //eToolTipPickUpGeneric;
}
}
}
else if(sectionUnderPointer == eSectionInventoryCreativeUsing)
{
buttonY = eToolTipNone;
}
buttonX = eToolTipClearQuickSelect;
_override = true;
return _override;
}
void IUIScene_CreativeMenu::BuildFirework(vector<shared_ptr<ItemInstance> > *list, byte type, int color, int sulphur, bool flicker, bool trail, int fadeColor/*= -1*/)
{
/////////////////////////////////
// Create firecharge
/////////////////////////////////
CompoundTag *expTag = new CompoundTag(FireworksItem::TAG_EXPLOSION);
vector<int> colors;
colors.push_back(DyePowderItem::COLOR_RGB[color]);
// glowstone dust gives flickering
if (flicker) expTag->putBoolean(FireworksItem::TAG_E_FLICKER, true);
// diamonds give trails
if (trail) expTag->putBoolean(FireworksItem::TAG_E_TRAIL, true);
intArray colorArray(static_cast<unsigned int>(colors.size()));
for (int i = 0; i < colorArray.length; i++)
{
colorArray[i] = colors.at(i);
}
expTag->putIntArray(FireworksItem::TAG_E_COLORS, colorArray);
// delete colorArray.data;
expTag->putByte(FireworksItem::TAG_E_TYPE, type);
if (fadeColor != -1)
{
////////////////////////////////////
// Apply fade colors to firecharge
////////////////////////////////////
vector<int> colors;
colors.push_back(DyePowderItem::COLOR_RGB[fadeColor]);
intArray colorArray(static_cast<unsigned int>(colors.size()));
for (int i = 0; i < colorArray.length; i++)
{
colorArray[i] = colors.at(i);
}
expTag->putIntArray(FireworksItem::TAG_E_FADECOLORS, colorArray);
}
/////////////////////////////////
// Create fireworks
/////////////////////////////////
shared_ptr<ItemInstance> firework;
{
firework = std::make_shared<ItemInstance>(Item::fireworks);
CompoundTag *itemTag = new CompoundTag();
CompoundTag *fireTag = new CompoundTag(FireworksItem::TAG_FIREWORKS);
ListTag<CompoundTag> *expTags = new ListTag<CompoundTag>(FireworksItem::TAG_EXPLOSIONS);
expTags->add(expTag);
fireTag->put(FireworksItem::TAG_EXPLOSIONS, expTags);
fireTag->putByte(FireworksItem::TAG_FLIGHT, static_cast<byte>(sulphur));
itemTag->put(FireworksItem::TAG_FIREWORKS, fireTag);
firework->setTag(itemTag);
}
list->push_back(firework);
}