diff --git a/energy.lua b/_exchangeclone_energy/init.lua similarity index 100% rename from energy.lua rename to _exchangeclone_energy/init.lua diff --git a/_exchangeclone_energy/mod.conf b/_exchangeclone_energy/mod.conf new file mode 100644 index 0000000..0595018 --- /dev/null +++ b/_exchangeclone_energy/mod.conf @@ -0,0 +1,4 @@ +name = _exchangeclone_energy +title = ExchangeClone Energy +depends = exchangeclone, zzzz_exchangeclone_crafthook +optional_depends = 3d_armor, mcl_item_id, mcl_core, default, moreswords, mcl_stairs, meat_blocks, sticky_things, fake_liquids, sound_machine, stairs, mcl_dispensers, farming, mobs_mc, screwdriver \ No newline at end of file diff --git a/armor.lua b/exchangeclone/armor.lua similarity index 100% rename from armor.lua rename to exchangeclone/armor.lua diff --git a/axes.lua b/exchangeclone/axes.lua similarity index 100% rename from axes.lua rename to exchangeclone/axes.lua diff --git a/constructor.lua b/exchangeclone/constructor.lua similarity index 100% rename from constructor.lua rename to exchangeclone/constructor.lua diff --git a/craftitems.lua b/exchangeclone/craftitems.lua similarity index 100% rename from craftitems.lua rename to exchangeclone/craftitems.lua diff --git a/deconstructor.lua b/exchangeclone/deconstructor.lua similarity index 99% rename from deconstructor.lua rename to exchangeclone/deconstructor.lua index 9aecbfb..e8cbd05 100644 --- a/deconstructor.lua +++ b/exchangeclone/deconstructor.lua @@ -62,7 +62,7 @@ local function deconstructor_action(pos) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() if inv:get_stack("fuel", 1):get_name() ~= "exchangeclone:exchange_orb" then - limit = 2147483647 + limit = exchangeclone.limit using_orb = false player = minetest.get_player_by_name(meta:get_string("exchangeclone_placer")) if not (player and player ~= "") then return end diff --git a/exchangeclone/energy.lua b/exchangeclone/energy.lua new file mode 100644 index 0000000..7c87735 --- /dev/null +++ b/exchangeclone/energy.lua @@ -0,0 +1,1981 @@ +exchangeclone.mtg_energy_values = { + ["exchangeclone"] = { + exchange_orb = 33792, + deconstructor = 67592, + constructor = 92168, + energy_collector_mk1 = 74499, + energy_collector_mk2 = (54*256)+(3*74499), + energy_collector_mk3 = (54*256)+(3*237321), + energy_collector_mk4 = (54*256)+(3*725787), + energy_collector_mk5 = (54*256)+(3*2191185), + philosophers_stone = 9984, + alchemical_coal = 512, + mobius_fuel = 2048, + aeternalis_fuel = 8192, + dark_matter = 139264, + dark_matter_block = 139264, + red_matter = 466944, + red_matter_block = 466944, + dark_matter_sword = 286720, + red_matter_sword = 892928, + dark_matter_shears = 147456, + red_matter_shears = 614400, + dark_matter_hoe = 294912, + red_matter_hoe = 1368064, + dark_matter_hoe_3x3 = 294912, + red_matter_hoe_3x3 = 1368064, + dark_matter_shovel = 155648, + red_matter_shovel = 761856, + dark_matter_hammer = 303104, + red_matter_hammer = 1515520, + dark_matter_hammer_3x3 = 303104, + red_matter_hammer_3x3 = 1515520, + dark_matter_pickaxe = 434176, + red_matter_pickaxe = 1974272, + dark_matter_pickaxe_3x1 = 434176, + red_matter_pickaxe_3x1 = 1974272, + dark_matter_axe = 434176, + red_matter_axe = 1974272, + red_katar = 7512064, + red_katar_3x3 = 7512064, + red_morningstar = 7053312, + red_morningstar_3x1 = 7053312, + red_morningstar_3x3 = 7053312, + helmet_dark_matter = 139264*5, + chestplate_dark_matter = 139264*8, + leggings_dark_matter = 139264*7, + boots_dark_matter = 139264*4, + helmet_red_matter = (139264+466944)*5, + chestplate_red_matter = (139264+466944)*8, + leggings_red_matter = (139264+466944)*7, + boots_red_matter = (139264+466944)*4, + pesa = 64, + transmutation_table = (64*4)+4, + transmutation_tablet = (64*4)+4+(139264*4)+4, + alchemical_tome = 0, + dark_matter_furnace = 8+(139264*8), + red_matter_furnace = 1114120+(466944*3) + }, + ["beds"] = { + bed_bottom = 168, + fancy_bed_bottom = 172, + }, + ["binoculars"] = { + binoculars = 796, + }, + ["boats"] = { + boat = 40, + }, + ["bones"] = { + bones = 4, + }, + ["bucket"] = { + bucket_empty = 768, + bucket_water = 768, + bucket_river_water = 768, + bucket_lava = 896, + }, + ["butterflies"] = { + butterfly_red = 0, + butterfly_violet = 0, + butterfly_white = 0, + }, + ["carts"] = { + brakerail = 93, + cart = 1280, + powerrail = 313, + rail = 86, + }, +-- Names listed are in the order shown in the minetest_game repo + ["default"] = { + --- Nodes + -- Stone + mossycobble = 32, + + sandstone = 4, + sandstonebrick = 4, + sandstone_block = 4, + desert_sandstone = 4, + desert_sandstone_brick = 4, + desert_sandstone_block = 4, + silver_sandstone = 4, + silver_sandstone_brick = 4, + silver_sandstone_block = 4, + + obsidian = 64, + obsidianbrick = 64, + obsidian_block = 64, + + -- Soft / Non-Stone, + clay = 16, + + -- Trees, + apple = 5, + emergent_jungle_sapling = 32, + + -- Ores, + stone_with_coal = 0, + coalblock = 128*9, + + stone_with_iron = 0, + steelblock = 256*9, + + stone_with_copper = 0, + copperblock = 320*9, + + stone_with_tin = 0, + tinblock = 384*9, + + bronzeblock = 327*9, + + stone_with_gold = 0, + goldblock = 2048*9, + + stone_with_mese = 4096, + mese = 4096*9, + + stone_with_diamond = 8192, + diamondblock = 8192*9, + + -- Plantlife, + cactus = 8, + large_cactus_seedling = 32, + + papyrus = 32, + + bush_stem = 8, + bush_leaves = 1, + bush_sapling = 32, + acacia_bush_stem = 8, + acacia_bush_leaves = 1, + acacia_bush_sapling = 32, + pine_bush_stem = 8, + pine_bush_needles = 1, + pine_bush_sapling = 32, + blueberry_bush_leaves_with_berries = 9, + blueberry_bush_leaves = 1, + blueberry_bush_sapling = 32, + + sand_with_kelp = 32, + + -- Corals, + coral_green = 8, + coral_pink = 8, + coral_cyan = 8, + coral_brown = 8, + coral_orange = 8, + coral_skeleton = 8, + + -- Tools / "Advanced" crafting / Non-"natural", + bookshelf = 336, + + fence_rail_wood = 2, + fence_rail_pine_wood = 2, + fence_rail_junglewood = 2, + fence_rail_aspen_wood = 2, + fence_rail_acacia_wood = 2, + + snow = 0.5, + snowblock = 5, + + sign_wall_wood = 17, + sign_wall_steel = 513, + + ladder_wood = 5.5, + ladder_steel = 119, + + obsidian_glass = 7, + + brick = 16, + + meselamp = 4097, + mese_post_light = 3074, + mese_post_light_acacia_wood = 3074, + mese_post_light_junglewood = 3074, + mese_post_light_pine_wood = 3074, + mese_post_light_aspen_wood = 3074, + + --- Craft Items + blueberries = 8, + book = 96, + book_written = 96, + bronze_ingot = 327, + clay_brick = 4, + clay_lump = 4, + coal_lump = 128, + copper_ingot = 320, + copper_lump = 320, + diamond = 8192, + flint = 4, + gold_ingot = 2048, + gold_lump = 2048, + iron_lump = 256, + mese_crystal = 4096, + mese_crystal_fragment = 455, + obsidian_shard = 7, + paper = 32, + steel_ingot = 256, + stick = 4, + tin_ingot = 384, + tin_lump = 384, + + --- Furnace + furnace = 8, + + --- Tools + -- Picks + shovel_stone = 9, + sword_stone = 6, + pick_stone = 11, + axe_stone = 11, + shovel_wood = 16, + sword_wood = 20, + pick_wood = 32, + axe_wood = 32, + shovel_gold = 2056, + sword_gold = 5000, + pick_gold = 6152, + axe_gold = 6152, + shovel_steel = 264, + sword_steel = 516, + pick_steel = 796, + axe_steel = 796, + shovel_bronze = 335, + sword_bronze = 662, + pick_bronze = 989, + axe_bronze = 989, + shovel_diamond = 8200, + sword_diamond = 16392, + pick_diamond = 24584, + axe_diamond = 24584, + shovel_mese = 4104, + sword_mese = 8200, + pick_mese = 12296, + axe_mese = 12296, + + water_source = 0, + lava_source = 0, + river_water_source = 0, + + --- Torch + torch = 129, + + --- Chest + chest = 64, + chest_locked = 320, + }, + ["doors"] = { + door_glass = 6, + door_obsidian_glass = 42, + door_steel = 1536, + door_wood = 48, + + gate_wood_closed = 32, + gate_pine_wood_closed = 32, + gate_junglewood_closed = 32, + gate_aspen_wood_closed = 32, + gate_acacia_wood_closed = 32, + + trapdoor = 24, + trapdoor_steel = 1024, + }, + ["farming"] = { + seed_wheat = 16, + wheat = 24, + flour = 96, + bread = 96, + straw = 72, + cotton = 12, + string = 12, + cotton_wild = 12, + seed_cotton = 10, + hoe_steel = 520, + hoe_wood = 24, + hoe_stone = 10, + }, + ["fire"] = { + flint_and_steel = 260, + permanent_flame = 0, + }, + ["fireflies"] = { + bug_net = 52, + firefly = 0, --you don't get to kill them :D + firefly_bottle = 0, + }, + ["keys"] = { + skeleton_key = 2048, + }, + ["mapping_kit"] = { + mapping_kit = 629, + }, + ["screwdriver"] = { + screwdriver = 260, + }, + ["moreswords"] = { + sword_ice = 16394, + sword_lava = 18184, + sword_pick = 40976, + sword_smoke = 16483, + sword_teleport = 16520, + sword_water = 1556, + }, + ["tnt"] = { + gunpowder = 25, + tnt_stick = 91, + tnt = 819, + }, + ["vessels"] = { + drinking_glass = 0.5, + glass_bottle = 0.5, + glass_fragments = 1, + shelf = 49.5, + steel_bottle = 256, + }, + ["xpanes"] = { + bar_flat = 96, + door_steel_bar = 576, + obsidian_pane_flat = 2.5, + pane_flat = 0.5, + trapdoor_steel_bar = 384, + }, + ["sound_machine"] = { + sound_machine = 2608, + portable_sound_machine = 2608, + }, + ["fake_liquids"] = { + solid_water_source = 3, + solid_useless_bean_liquid_source = 0, + solid_useful_green_potato_liquid_source = 3, + solid_glue_source = 35, + solid_river_water_source = 3, + solid_lava_source = 131, + bucket_fake_lava = 4864, + bucket_fake_water = 4992, + solid_fake_lava_source = 4099, + solid_fake_water_source = 4227, + }, + ["sticky_things"] = { + bucket_glue = 800, + glue_source = 0, + glue_flowing = 0, + }, + ["ghost_blocks"] = { + ghostifier = 8200, + }, + ["small_why_things"] = { + craftable_barrier = 72, + }, + ["useful_green_potatoes"] = { + useful_green_potato = 256, + useful_green_potato_ingot = 256, + useful_green_potato_block = 256*9, + useful_green_potato_ingot_block = 256*9, + axe_useful_green_potato = 256*3+8, + pick_useful_green_potato = 256*3+8, + sword_useful_green_potato = 256*2+4, + shovel_useful_green_potato = 256+8, + hoe_useful_green_potato = 256*2+8, + helmet_useful_green_potato = 256*5, + chestplate_useful_green_potato = 256*8, + shield_useful_green_potato = 256*7, + leggings_useful_green_potato = 256*7, + boots_useful_green_potato = 256*4, + bucket_useful_green_potato_liquid = 768, -- renewable + useful_green_potato_gold = 2048*8+256 + } +} + + + + +local copper_amount = (exchangeclone.mineclonia and 9) or 4 + + + +--[[Some energy values taken from https://technicpack.fandom.com/wiki/Alchemical_Math +I had to change some since they weren't as "equivalent" as they were supposed to be. +I also didn't type out the ones with a value of 1, since that's the default.]] +exchangeclone.mcl_energy_values = { + ["exchangeclone"] = { + exchange_orb = 33792, + deconstructor = 67592, + constructor = 92168, + energy_collector_mk1 = 74499, + energy_collector_mk2 = (54*256)+(3*74499), + energy_collector_mk3 = (54*256)+(3*237321), + energy_collector_mk4 = (54*256)+(3*725787), + energy_collector_mk5 = (54*256)+(3*2191185), + philosophers_stone = 9984, + alchemical_coal = 512, + mobius_fuel = 2048, + aeternalis_fuel = 8192, + dark_matter = 139264, + dark_matter_block = 139264, + red_matter = 466944, + red_matter_block = 466944, + dark_matter_sword = 286720, + red_matter_sword = 892928, + dark_matter_shears = 147456, + red_matter_shears = 614400, + dark_matter_hoe = 294912, + red_matter_hoe = 1368064, + dark_matter_hoe_3x3 = 294912, + red_matter_hoe_3x3 = 1368064, + dark_matter_shovel = 155648, + red_matter_shovel = 761856, + dark_matter_hammer = 303104, + red_matter_hammer = 1515520, + dark_matter_hammer_3x3 = 303104, + red_matter_hammer_3x3 = 1515520, + dark_matter_pickaxe = 434176, + red_matter_pickaxe = 1974272, + dark_matter_pickaxe_3x1 = 434176, + red_matter_pickaxe_3x1 = 1974272, + dark_matter_axe = 434176, + red_matter_axe = 1974272, + red_katar = 7512064, + red_katar_3x3 = 7512064, + red_morningstar = 7053312, + red_morningstar_3x1 = 7053312, + red_morningstar_3x3 = 7053312, + helmet_dark_matter = 139264*5, + chestplate_dark_matter = 139264*8, + leggings_dark_matter = 139264*7, + boots_dark_matter = 139264*4, + helmet_red_matter = (139264+466944)*5, + chestplate_red_matter = (139264+466944)*8, + leggings_red_matter = (139264+466944)*7, + boots_red_matter = (139264+466944)*4, + pesa = 64, + transmutation_table = (64*4)+4, + transmutation_tablet = (64*4)+4+(139264*4)+4, + alchemical_tome = 0, + dark_matter_furnace = 8+(139264*8), + red_matter_furnace = 1114120+(466944*3), + blank_upgrade = 344, + fire_aspect_1_upgrade = 344 + (139264*4) + (4*4), + fire_aspect_2_upgrade = 557416 + (139264*4) + (4*4), + fortune_1_upgrade = 344 + (139264*4) + (8192*4), + fortune_2_upgrade = 590168 + (139264*4) + (8192*4), + fortune_3_upgrade = 1179992 + (139264*4) + (8192*4), + frost_walker_1_upgrade = 344 + (139264*4) + (9*4), + frost_walker_2_upgrade = 557436 + (139264*4) + (9*4), + looting_1_upgrade = 344 + (139264*4) + (1536*4), + looting_2_upgrade = 563544 + (139264*4) + (1536*4), + looting_3_upgrade = 1126744 + (139264*4) + (1536*4), + silk_touch_upgrade = 344 + (139264*4) + (12*4), + curse_of_vanishing_upgrade = 344 + (139264*4) + 2, + thorns_1_upgrade = 344 + (139264*4) + (8*4), + thorns_2_upgrade = 557432 + (139264*4) + (8*4), + thorns_3_upgrade = 1114520 + (139264*4) + (8*4), + depth_strider_1_upgrade = 344 + (139264*4) + (48*4), + depth_strider_2_upgrade = 557592 + (139264*4) + (48*4), + depth_strider_3_upgrade = 1114840 + (139264*4) + (48*4), + knockback_1_upgrade = 344 + (139264*4) + (216*4), + knockback_2_upgrade = 558264 + (139264*4) + (216*4), + soul_speed_1_upgrade = 344 + (139264*4) + (49*4), + soul_speed_2_upgrade = 557596 + (139264*4) + (49*4), + soul_speed_3_upgrade = 1114844 + (139264*4) + (49*4), + upgrader = (139264*2) + (466944*2) + 4, + }, + ["mcl_core"] = { + light_0 = 0, + light_1 = 0, + light_2 = 0, + light_3 = 0, + light_4 = 0, + light_5 = 0, + light_6 = 0, + light_7 = 0, + light_8 = 0, + light_9 = 0, + light_10 = 0, + light_11 = 0, + light_12 = 0, + light_13 = 0, + light_14 = 0, + stonebrickmossy = 9, + bedrock = 0, + deadbush = 4, + mossycobble = 9, + stick = 4, + flint = 4, + cactus = 8, + vine = 8, + cobweb = 12, + ladder = 9, + clay_lump = 4, + brick = 4, + charcoal_lump = 32, + reeds = 32, + paper = 32, + sugar = 32, + obsidian = 64, + stone_with_redstone = 0, --ores are worth 0, because the amount sometimes varies (Fortune) + crying_obsidian = 1000, + clay = 16, + brick_block = 16, + coal_lump = 128, + stone_with_coal = 0, + apple = 128, + gold_nugget = 227, + iron_ingot = 256, + stone_with_iron = 0, + lapis = 864, + stone_with_lapis = 0, + emerald = 4096, + stone_with_emerald = 0, + gold_ingot = 2048, + stone_with_gold = 0, + ironblock = 2304, + diamond = 8192, + stone_with_diamond = 0, + apple_gold = 16512, + apple_gold_enchanted = 147584, + bone_block = 432, + bowl = 24, + coalblock = 1152, + dead_bush = 4, + diamondblock = 73728, + goldblock = 18432, + iron_nugget = 28, + lapisblock = 7776, + packed_ice = 9, + slimeblock = 216, + snow = 0.5, + glass = 1, + emeraldblock = 4096*9, + }, + ["mcl_droppers"] = { + dropper = 71, + }, + ["mcl_blast_furnace"] = { + blast_furnace = 1291, + }, + ["doc_identifier"] = { + identifier_solid = 5, + identifier_liquid = 5, + }, + ["mcl_beds"] = { + respawn_anchor = 10608, + }, + ["mcl_bells"] = { + bell = 8192, + }, + ["mcl_enchanting"] = { + table = 16790, + }, + ["mcl_armor"] = { + boots_leather = 256, + helmet_leather = 320, + leggings_leather = 448, + chestplate_leather = 512, + boots_chain = 768, + helmet_chain = 1024, + leggings_chain = 1536, + chestplate_chain = 1792, + boots_iron = 1024, + helmet_iron = 1280, + leggings_iron = 1792, + chestplate_iron = 2048, + boots_gold = 8192, + helmet_gold = 10240, + leggings_gold = 14336, + chestplate_gold = 16384, + boots_diamond = 32768, + helmet_diamond = 40960, + leggings_diamond = 57344, + chestplate_diamond = 65536, + boots_netherite = 106496, + helmet_netherite = 114688, + leggings_netherite = 131072, + chestplate_netherite = 139264, + boots_leather_enchanted = 256, + helmet_leather_enchanted = 320, + leggings_leather_enchanted = 448, + chestplate_leather_enchanted = 512, + boots_chain_enchanted = 768, + helmet_chain_enchanted = 1024, + leggings_chain_enchanted = 1536, + chestplate_chain_enchanted = 1792, + boots_iron_enchanted = 1024, + helmet_iron_enchanted = 1280, + leggings_iron_enchanted = 1792, + chestplate_iron_enchanted = 2048, + boots_gold_enchanted = 8192, + helmet_gold_enchanted = 10240, + leggings_gold_enchanted = 14336, + chestplate_gold_enchanted = 16384, + boots_diamond_enchanted = 32768, + helmet_diamond_enchanted = 40960, + leggings_diamond_enchanted = 57344, + chestplate_diamond_enchanted = 65536, + boots_netherite_enchanted = 106496, + helmet_netherite_enchanted = 114688, + leggings_netherite_enchanted = 131072, + chestplate_netherite_enchanted = 139264, + elytra = 297216, + }, + ["mcl_anvils"] = { + anvil = 7936, + anvil_damage_1 = 5632, + anvil_damage_2 = 3328, + }, + ["mcl_crafting_table"] = { + crafting_table = 32, + }, + ["mcl_bows"] = { + arrow = 3, + bow = 48, + crossbow = 295, + crossbow_loaded = 298, + rocket = 451, + }, + ["mcl_campfires"] = { + campfire_lit = 140, + soul_campfire_lit = 157, + campfire = 140, + soul_campfire = 157, + }, + ["mcl_amethyst"] = { + amethyst_shard = 256, + small_amethyst_bud = 256, + medium_amethyst_bud = 341, + large_amethyst_bud = 426, + amethyst_cluster = 512, + budding_amethyst_block = 0, --not obtainable in survival + amethyst_block = 1024, + tinted_glass = 1025, + calcite = 128, + }, + ["mcl_fireworks"] = { + rocket_1 = 224, + rocket_2 = 416, + rocket_3 = 608, + }, + ["mcl_fire"] = { + fire_charge = 331, + flint_and_steel = 260, + }, + ["mcl_fletching_table"] = { + fletching_table = 72, + }, + ["mcl_flowerpots"] = { + flower_pot = 12, + }, + ["mcl_fishing"] = { + fishing_rod = 36, + fishing_rod_enchanted = 7, + clownfish_raw = 64, + fish_cooked = 40, + fish_raw = 40, + pufferfish_raw = 64, + salmon_cooked = 48, + salmon_raw = 48, + }, + ["mcl_throwing"] = { + snowball = 0.25, + egg = 32, + ender_pearl = 1024, --I hate typing "ender" in Lua; it thinks I'm typing "end" and unindents. + }, + ["mcl_bamboo"] = { + bamboo = 2, + scaffolding = 4, + bamboo_block = 16, + bamboo_block_stripped = 16, + bamboo_plank = 8, + bamboo_mosaic = 8, + bamboo_door = 16, + }, + ["mcl_doors"] = { + acacia_door = 16, + birch_door = 16, + cherry_blossom_door = 16, + dark_oak_door = 16, + iron_door = 512, + jungle_door = 16, + spruce_door = 16, + wooden_door = 16, + door_acacia = 16, + door_bamboo = 16, + door_birch = 16, + door_cherry_blossom = 16, + door_crimson = 16, + door_dark_oak = 16, + door_jungle = 16, + door_mangrove = 16, + door_oak = 16, + door_spruce = 16, + door_warped = 16, + iron_trapdoor = 768 + }, + ["mcl_lanterns"] = { + chain = 298, + lantern_floor = 177, + soul_lantern_floor = 189, + }, + ["mcl_lectern"] = { + lectern = 514, + }, + ["mcl_lightning_rods"] = { + rod = 255, + }, + ["mcl_loom"] = { + loom = 40, + }, + ["mcl_maps"] = { + empty_map = 1120, + filled_map = 1120, + filled_map_mcl_skins_base_1B47A57FF_male_crea = 1120, + filled_map_mcl_skins_base_1EEB592FF_male_crea = 1120, + filled_map_mcl_skins_base_18D471DFF_male_crea = 1120, + filled_map_mcl_skins_base_1B47A57FF_female_crea = 1120, + filled_map_mcl_skins_base_1EEB592FF_female_crea = 1120, + filled_map_mcl_skins_base_18D471DFF_female_crea = 1120, + filled_map_mcl_skins_base_1B47A57FF_male_surv = 1120, + filled_map_mcl_skins_base_1EEB592FF_male_surv = 1120, + filled_map_mcl_skins_base_18D471DFF_male_surv = 1120, + filled_map_mcl_skins_base_1B47A57FF_female_surv = 1120, + filled_map_mcl_skins_base_1EEB592FF_female_surv = 1120, + filled_map_mcl_skins_base_18D471DFF_female_surv = 1120, + }, + ["mcl_minecarts"] = { + activator_rail = 268, + detector_rail = 267, + golden_rail = 2059, + minecart = 1280, + furnace_minecart = 1288, + chest_minecart = 1312, + hopper_minecart = 2624, + tnt_minecart = 2244, + rail = 96 + }, + ["mcl_tnt"] = { + tnt = 964, + }, + ["mcl_furnaces"] = { + furnace = 8 + }, + ["mcl_farming"] = { + soil = 0, + hoe_stone = 10, + hoe_wood = 24, + hoe_iron = 520, + hoe_gold = 4104, + hoe_diamond = 16380, + hoe_netherite = 90108, + hoe_stone_enchanted = 10, + hoe_wood_enchanted = 24, + hoe_iron_enchanted = 520, + hoe_gold_enchanted = 4104, + hoe_diamond_enchanted = 16380, + hoe_netherite_enchanted = 90108, + wheat_seeds = 16, + beetroot_seeds = 16, + beetroot_item = 24, + beetroot_soup = 144, + carrot_item = 24, + carrot_item_gold = 1840, + hay_block = 216, + potato_item = 24, + potato_item_baked = 24, + potato_item_poison = 24, + melon_seeds = 36, + melon = 144, + melon_item = 36, + cookie = 22, + pumpkin_seeds = 36, + wheat_item = 24, + bread = 72, + pumpkin = 144, + pumpkin_face = 144, + pumpkin_face_light = 153, + pumpkin_pie = 208, + sweet_berry = 16, + }, + ["mcl_cake"] = { + cake = 411, + }, + ["mcl_cocoas"] = { + cocoa_beans = 128, + }, + ["mcl_beacons"] = { + beacon = 73925, + }, + ["mcl_heads"] = { + creeper = 256, + skeleton = 256, + steve = 256, + zombie = 256, + wither_skeleton = 50000, + }, + ["mcl_hamburger"] = { + hamburger = 150, + }, + ["mcl_barrels"] = { + barrel_closed = 56, + }, + ["mcl_flowers"] = { + waterlily = 16, + wither_rose = 128, + }, + ["mcl_mangrove"] = { + mangrove_door = 16, + mangrove_mud_roots = 2, + }, + ["mcl_comparators"] = { + comparator_off_comp = 335, + }, + ["mcl_nether"] = { + nether_brick = 4, + red_nether_brick = 50, + nether_wart_item = 24, + soul_sand = 49, + glowstone_dust = 384, + glowstone = 1536, + ancient_debris = 16384, + netherite_scrap = 16384, + netherite_ingot = 73728, + quartz = 128, + quartz_ore = 128, + quartz_block = 512, + quartz_chiseled = 256, + quartz_pillar = 512, + quartz_smooth = 512, + magma = 4, + netheriteblock = 663552, + }, + ["mcl_observers"] = { + observer_off = 262, + }, + ["mcl_ocean"] = { + brain_coral = 8, + brain_coral_block = 8, + brain_coral_fan = 8, + bubble_coral = 8, + bubble_coral_block = 8, + bubble_coral_fan = 8, + fire_coral = 8, + fire_coral_block = 8, + fire_coral_fan = 8, + horn_coral = 8, + horn_coral_block = 8, + horn_coral_fan = 8, + tube_coral = 8, + tube_coral_block = 8, + tube_coral_fan = 8, + --dead coral worth 1. + kelp = 32, + dried_kelp = 32, + dried_kelp_block = 288, + prismarine_shard = 2, --crafted with cyan glass + prismarine = 8, + prismarine_brick = 18, + prismarine_dark = 24, + prismarine_crystals = 2054, + sea_lantern = 10278, + + -- TODO Add more sea pickles once MineClone does. + sea_pickle_1_dead_brain_coral_block = 8, + seagrass = 1, + }, + ["mcl_portals"] = { + end_portal_frame = 0, + }, + ["mcl_fences"] = { + nether_brick_fence = 3, + nether_brick_fence_gate = 6, + red_nether_brick_fence = 34, --technically energy duplication is possible, but only 2 per craft... + red_nether_brick_fence_gate = 150, + }, + ["mcl_walls"] = { + brick = 16, + mossycobble = 9, + netherbrick = 4, + rednetherbrick = 50, + redsandstone = 4, + sandstone = 4, + stonebrickmossy = 9, + }, + ["mcl_end"] = { + chorus_flower = 32, + chorus_fruit = 16, + chorus_plant = 0, + chorus_fruit_popped = 16, + crystal = 4293, + ender_eye = 1792, + dragon_egg = 139264, + end_rod = 388, + purpur_block = 64, + purpur_pillar = 64, + }, + ["mcl_experience"] = { + bottle = 2048, + }, + ["mcl_raw_ores"] = { + raw_gold = 2048, + raw_gold_block = 2048*9, + raw_iron = 256, + raw_iron_block = 256*9, + }, + ["mcl_shields"] = { + shield = 304, + shield_black = 596, + shield_blue = 596, + shield_brown = 596, + shield_cyan = 596, + shield_green = 596, + shield_grey = 596, + shield_light_blue = 596, + shield_lime = 596, + shield_magenta = 596, + shield_orange = 596, + shield_pink = 596, + shield_purple = 596, + shield_red = 596, + shield_silver = 596, + shield_white = 596, + shield_yellow = 596, + }, + ["mcl_smithing_table"] = { + table = 544, + }, + ["mcl_smoker"] = { + smoker = 72, + }, + ["mcl_sponges"] = { + sponge = 1024, + sponge_wet = 1024, + sponge_wet_river_water = 1024, + }, + ["screwdriver"] = { + screwdriver = 260, + }, + ["mcl_spyglass"] = { + spyglass = 426, + }, + ["mcl_copper"] = { + copper_ingot = 85, + raw_copper = 85, + block_raw = 85*9, + stone_with_copper = 0, + block = 85*copper_amount, + block_exposed = 85*copper_amount, + block_oxidized = 85*copper_amount, + block_weathered = 85*copper_amount, + block_cut = 85*copper_amount, + block_exposed_cut = 85*copper_amount, + block_oxidized_cut = 85*copper_amount, + block_weathered_cut = 85*copper_amount, + waxed_block = 85*copper_amount+32, + block_preserved = 85*copper_amount+32, + waxed_block_exposed = 85*copper_amount+32, + block_exposed_preserved = 85*copper_amount+32, + waxed_block_oxidized = 85*copper_amount+32, + block_oxidized_preserved = 85*copper_amount+32, + waxed_block_weathered = 85*copper_amount+32, + block_weathered_preserved = 85*copper_amount+32, + waxed_block_cut = 85*copper_amount+32, + block_cut_preserved = 85*copper_amount+32, + waxed_block_exposed_cut = 85*copper_amount+32, + block_exposed_cut_preserved = 85*copper_amount+32, + waxed_block_oxidized_cut = 85*copper_amount+32, + block_oxidized_cut_preserved = 85*copper_amount+32, + waxed_block_weathered_cut = 85*copper_amount+32, + block_weathered_cut_preserved = 85*copper_amount+32, + }, + ["mcl_deepslate"] = { + infested_deepslate = 0, + deepslate_reinforced = 0, + deepslate_with_coal = 0, + deepslate_with_copper = 0, + deepslate_with_diamond = 0, + deepslate_with_emerald = 0, + deepslate_with_gold = 0, + deepslate_with_iron = 0, + deepslate_with_redstone = 0, + deepslate_with_lapis = 0, + }, + ["xpanes"] = { + bar_flat = 96, + }, + ["mcl_brewing"] = { + stand_000 = 1539 + }, + ["mcl_cauldrons"] = { + cauldron = 1792, + }, + ["mesecons_button"] = { + button_stone_off = 1, + }, + ["mesecons"] = { + wire_00000000_off = 64, + }, + ["mesecons_commandblock"] = { + commandblock_off = 0, + }, + ["mesecons_lightstone"] = { + lightstone_off = 1792, + }, + ["mesecons_pistons"] = { + piston_normal_off = 348, + piston_sticky_off = 372 + }, + ["mesecons_solarpanel"] = { + solar_panel_off = 399, + }, + ["mesecons_torch"] = { + mesecon_torch_on = 68, + redstoneblock = 576, + }, + ["mcl_armor_stand"] = { + armor_stand = 24.5, + }, + ["mesecons_pressureplates"] = { + pressure_plate_stone_off = 2, + }, + ["mesecons_walllever"] = { + wall_lever_off = 5 + }, + ["mesecons_noteblock"] = { + noteblock = 128, + }, + ["mesecons_delayer"] = { + delayer_off_1 = 203, + }, + ["mclx_fences"] = { + nether_brick_fence_gate = 6, + red_nether_brick_fence = 33, + red_nether_brick_fence_gate = 150, + }, + ["mcl_totems"] = { + totem = 106496, + }, + ["mcl_tools"] = { + shears = 512, + shovel_stone = 9, + sword_stone = 6, + pick_stone = 11, + axe_stone = 11, + shovel_wood = 16, + sword_wood = 20, + pick_wood = 32, + axe_wood = 32, + shovel_gold = 2056, + sword_gold = 5000, + pick_gold = 6152, + axe_gold = 6152, + shovel_iron = 264, + sword_iron = 516, + pick_iron = 796, + axe_iron = 796, + shovel_diamond = 8200, + sword_diamond = 16392, + pick_diamond = 24584, + axe_diamond = 24584, + shovel_netherite = 81928, + sword_netherite = 90120, + pick_netherite = 98312, + axe_netherite = 98312, + shovel_stone_enchanted = 9, + sword_stone_enchanted = 6, + pick_stone_enchanted = 11, + axe_stone_enchanted = 11, + shovel_wood_enchanted = 16, + sword_wood_enchanted = 20, + pick_wood_enchanted = 32, + axe_wood_enchanted = 32, + shovel_gold_enchanted = 2056, + sword_gold_enchanted = 5000, + pick_gold_enchanted = 6152, + axe_gold_enchanted = 6152, + shovel_iron_enchanted = 264, + sword_iron_enchanted = 516, + pick_iron_enchanted = 796, + axe_iron_enchanted = 796, + shovel_diamond_enchanted = 8200, + sword_diamond_enchanted = 16392, + pick_diamond_enchanted = 24584, + axe_diamond_enchanted = 24584, + shovel_netherite_enchanted = 81928, + sword_netherite_enchanted = 90120, + pick_netherite_enchanted = 98312, + axe_netherite_enchanted = 98312, + }, + ["mcl_potions"] = { + fermented_spider_eye = 192, + speckled_melon = 1852, + --TODO: Fix dragon's breath (& lingering potions/arrows) once it works like MC. + dragon_breath = 8.5, + }, + ["mcl_hoppers"] = { + hopper = 1344, + }, + ["mcl_itemframes"] = { + item_frame = 96, + glow_item_frame = 352, + }, + ["mcl_mobitems"] = { + string = 12, + rotten_flesh = 24, + slimeball = 24, + feather = 48, + porkchop = 64, + cooked_porkchop = 64, + beef = 64, + cooked_beef = 64, + chicken = 48, + cooked_chicken = 48, + rabbit = 40, + cooked_rabbit = 40, + mutton = 48, + cooked_mutton = 48, + diamond_horse_armor = 73728, + gold_horse_armor = 18432, + iron_horse_armor = 2304, + heart_of_the_sea = 50000, + nautilus_shell = 10000, + leather = 64, + spider_eye = 128, + bone = 144, + gunpowder = 192, + milk_bucket = 832, + saddle = 192, + blaze_powder = 768, + magma_cream = 768, + blaze_rod = 1536, + ghast_tear = 4096, + nether_star = 73728, + shulker_shell = 2048, + ink_sac = 32, + glow_ink_sac = 256, + carrot_on_a_stick = 60, + rabbit_foot = 64, + rabbit_hide = 16, + rabbit_stew = 144, + warped_fungus_on_a_stick = 68, + nametag = 128, + }, + ["mcl_mobs"] = { + nametag = 128, + }, + ["mcl_mobspawners"] = { + spawner = 0, + }, + ["mcl_jukebox"] = { + jukebox = 8156, + }, + ["mcl_honey"] = { + honeycomb = 32, + honey_bottle = 33, + honey_block = 128, + honeycomb_block = 128, + }, + ["mcl_beehives"] = { + bee_nest = 144, + beehive = 144, + }, + ["mcl_blackstone"] = { + soul_soil = 49, + soul_torch = 21, + nether_gold = 2048, + blackstone_gilded = 2048, + quartz_brick = 512, + }, + ["mcl_torches"] = { + torch = 9, --would be more, but charcoal kind of ruins it. + }, + ["mcl_mushrooms"] = { + mushroom_stew = 88, + }, + ["mcl_signs"] = { + wall_sign = 17, + wall_sign_acaciawood = 17, + wall_sign_bamboo = 17, + wall_sign_birchwood = 17, + wall_sign_cherrywood = 17, + wall_sign_crimson_hyphae_wood = 17, + wall_sign_darkwood = 17, + wall_sign_junglewood = 17, + wall_sign_mangrove_wood = 17, + wall_sign_sprucewood = 17, + wall_sign_warped_hyphae_wood = 17, + wall_sign_oak = 17, + wall_sign_acacia = 17, + wall_sign_birch = 17, + wall_sign_cherry_blossom = 17, + wall_sign_crimson= 17, + wall_sign_dark_oak = 17, + wall_sign_jungle = 17, + wall_sign_mangrove = 17, + wall_sign_spruce = 17, + wall_sign_warped = 17, + }, + ["mcl_crimson"] = { + crimson_door = 16, + warped_door = 16, + twisting_vines = 8, + weeping_vines = 8, + shroomlight = 64, + }, + ["mcl_chests"] = { + chest = 64, + ender_chest = 2304, + trapped_chest = 332, + }, + ["mcl_paintings"] = { + painting = 96, + }, + ["mcl_cartography_table"] = { + cartography_table = 96, + }, + ["mcl_books"] = { + book = 150, + bookshelf = 498, + writable_book = 206, + written_book = 206, + }, + ["mcl_dispensers"] = { + dispenser = 119, + }, + ["mcl_buckets"] = { + bucket_empty = 768, + bucket_water = 768, + bucket_river_water = 768, + bucket_lava = 896, + bucket_cod = 896, + bucket_salmon = 896, + bucket_tropical_fish = 896, + bucket_axolotl = 1024, + }, + ["mcl_boats"] = { + boat = 40, + boat_acacia = 40, + boat_birch = 40, + boat_dark_oak = 40, + boat_jungle = 40, + boat_mangrove = 40, + boat_obsidian = 320, + boat_spruce = 40, + chest_boat = 104, + chest_boat_acacia = 104, + chest_boat_birch = 104, + chest_boat_cherry = 104, + chest_boat_dark_oak = 104, + chest_boat_jungle = 104, + chest_boat_mangrove = 104, + chest_boat_spruce = 104, + boat_acacia_chest = 104, + boat_bamboo_chest = 104, + boat_birch_chest = 104, + boat_cherry_blossom_chest = 104, + boat_dark_oak_chest = 104, + boat_jungle_chest = 104, + boat_mangrove_chest = 104, + boat_oak_chest = 104, + boat_spruce_chest = 104, + }, + ["mcl_sus_nodes"] = { + brush = 137, + gravel = 0, + sand = 0, + }, + ["mcl_dyes"] = { + black = 8, + blue = 8, + brown = 8, + cyan = 8, + green = 8, + grey = 8, + light_blue = 8, + lime = 8, + magenta = 8, + orange = 8, + pink = 8, + purple = 8, + red = 8, + silver = 8, -- why + white = 8, + yellow = 8, + }, + ["mcl_compass"] = { + lodestone = 73736, + }, + ["mcl_composters"] = { + composter = 28, + }, + ["mcl_grindstone"] = { + grindstone = 24.5, + }, + ["mcl_stonecutter"] = { + stonecutter = 259, + }, + ["mcl_target"] = { + target_off = 280, + }, + ["mcl_cherry_blossom"] = { + cherry_door = 16 + }, + ["mcl_trees"] = { + bark_acacia = 43, + bark_birch = 43, + bark_cherry_blossom = 43, + bark_crimson = 43, + bark_dark_oak = 43, + bark_jungle = 43, + bark_mangrove = 43, + bark_oak = 43, + bark_spruce = 43, + bark_warped = 43, + bark_stripped_acacia = 43, + bark_stripped_birch = 43, + bark_stripped_cherry_blossom = 43, + bark_stripped_crimson = 43, + bark_stripped_dark_oak = 43, + bark_stripped_jungle = 43, + bark_stripped_mangrove = 43, + bark_stripped_oak = 43, + bark_stripped_spruce = 43, + bark_stripped_warped = 43, + }, + ["mcl_lush_caves"] = { + cave_vines = 8, + cave_vines_lit = 0, + glow_berry = 36, + moss_carpet = 0.5, + spore_blossom = 32, + }, + ["mcl_pottery_sherds"] = { + pot = 16 + }, + ["mcl_sculk"] = exchangeclone.mineclonia and { + sculk = 64, + sculk_vein = 32, + sculk_catalyst = 8192, + }, + ["mcl_stairs"] = { + slab_acaciatree_bark = 16, + slab_birchtree_bark = 16, + slab_darktree_bark = 16, + slab_jungletree_bark = 16, + slab_sprucetree_bark = 16, + slab_tree_bark = 16, + slab_bamboo_stripped = 8, + slab_acacia_bark= 21.5, + slab_birch_bark= 21.5, + slab_cherry_blossom_bark= 21.5, + slab_crimson_bark= 21.5, + slab_dark_oak_bark= 21.5, + slab_jungle_bark= 21.5, + slab_mangrove_bark= 21.5, + slab_oak_bark= 21.5, + slab_spruce_bark= 21.5, + slab_warped_bark= 21.5, + slab_copper_cut = 337, + slab_copper_exposed_cut = 337, + slab_copper_oxidized_cut = 337, + slab_copper_weathered_cut = 337, + slab_waxed_copper_cut = 398, + slab_copper_cut_preserved = 398, + slab_waxed_copper_exposed_cut = 398, + slab_copper_exposed_cut_preserved = 398, + slab_waxed_copper_oxidized_cut = 398, + slab_copper_oxidized_cut_preserved = 398, + slab_waxed_copper_weathered_cut = 398, + slab_copper_weathered_cut_preserved = 398, + slab_mud_brick = 0.5, + slab_quartzblock = 256, + slab_redsandstone = 2, + slab_sandstone = 2, + slab_stone_rough = 0.5, + stair_acaciatree_bark = 16*3, + stair_birchtree_bark = 16*3, + stair_darktree_bark = 16*3, + stair_jungletree_bark = 16*3, + stair_sprucetree_bark = 16*3, + stair_tree_bark = 16*3, + stair_bamboo_stripped = 8*3, + stair_acacia_bark= 64, + stair_birch_bark= 64, + stair_cherry_blossom_bark= 64, + stair_crimson_bark= 64, + stair_dark_oak_bark= 64, + stair_jungle_bark= 64, + stair_mangrove_bark= 64, + stair_oak_bark= 64, + stair_spruce_bark= 64, + stair_warped_bark= 64, + stair_copper_cut = 337*3, + stair_copper_exposed_cut = 337*3, + stair_copper_oxidized_cut = 337*3, + stair_copper_weathered_cut = 337*3, + stair_waxed_copper_cut = 398*3, + stair_copper_cut_preserved = 398*3, + stair_waxed_copper_exposed_cut = 398*3, + stair_copper_exposed_cut_preserved = 398*3, + stair_waxed_copper_oxidized_cut = 398*3, + stair_copper_oxidized_cut_preserved = 398*3, + stair_waxed_copper_weathered_cut = 398*3, + stair_copper_weathered_cut_preserved = 398*3, + stair_mud_brick = 0.5*3, + stair_quartzblock = 256*3, + stair_redsandstone = 2*3, + stair_sandstone = 2*3, + stairs_stone_rough = 1.5, + }, + ["meat_blocks"] = { + sausage = 64, + cooked_sausage = 64, + burnt_sausage = 64, + meatball = 64, + cooked_meatball = 64, + burnt_meatball = 64, + burnt_porkchop = 64, + burnt_beef = 64, + burnt_chicken = 48, + burnt_rabbit = 40, + burnt_mutton = 48, + burnt_fish = 40, + burnt_salmon = 48, + raw_block_sausage = 576, + raw_block_meatball = 576, + raw_block_porkchop = 576, + raw_block_beef = 576, + raw_block_chicken = 432, + raw_block_mutton = 432, + raw_block_salmon = 432, + raw_block_rabbit = 360, + raw_block_fish = 360, + cooked_block_sausage = 576, + cooked_block_meatball = 576, + cooked_block_porkchop = 576, + cooked_block_beef = 576, + cooked_block_chicken = 432, + cooked_block_mutton = 432, + cooked_block_salmon = 432, + cooked_block_rabbit = 360, + cooked_block_fish = 360, + burnt_block_sausage = 576, + burnt_block_meatball = 576, + burnt_block_porkchop = 576, + burnt_block_beef = 576, + burnt_block_chicken = 432, + burnt_block_mutton = 432, + burnt_block_salmon = 432, + burnt_block_rabbit = 360, + burnt_block_fish = 360, + }, + ["sound_machine"] = { + sound_machine = 681, + portable_sound_machine = 681, + }, + ["fake_liquids"] = { + solid_water_source = 3, + solid_milk_source = 67, + solid_useless_bean_liquid_source = 0, + solid_useful_green_potato_liquid_source = 3, + solid_glue_source = 11, + solid_river_water_source = 3, + solid_fake_lava_source = 67, + solid_lava_source = 131, + solid_fake_water_source = 195, + bucket_fake_lava = 832, + bucket_fake_water = 960, + }, + ["falling_block_tool"] = { + falling_block_tool = 11, + }, + ["flying_sausage"] = { + cooked_elytra = 297216, + burnt_elytra = 297216, + flying_sausage = 297216 + (576*8), + flight_stomach = 128, + }, + ["sticky_things"] = { + bucket_glue = 776, + glue_source = 0, + glue_flowing = 0, + sticky_block = 100, + }, + ["ghost_blocks"] = { + ghostifier = 4104, + }, + ["lava_sponge"] = { + lava_sponge = 1032, + lava_sponge_wet = 1160, + }, + ["slime_things"] = { + pressure_plate_slimeblock_off = 432, + button_slimeblock_off = 24, + }, + ["small_why_things"] = { + craftable_barrier = 72, + blue_feather = 0, + }, + ["mcl_colorblocks"] = { + glazed_terracotta_black = 16, + glazed_terracotta_blue = 16, + glazed_terracotta_brown = 16, + glazed_terracotta_cyan = 16, + glazed_terracotta_green = 16, + glazed_terracotta_grey = 16, + glazed_terracotta_light_blue = 16, + glazed_terracotta_lime = 16, + glazed_terracotta_magenta = 16, + glazed_terracotta_orange = 16, + glazed_terracotta_pink = 16, + glazed_terracotta_purple = 16, + glazed_terracotta_red = 16, + glazed_terracotta_silver = 16, + glazed_terracotta_white = 16, + glazed_terracotta_yellow = 16 + }, + ["mcl_banners"] = { + pattern_bricks = 32+64, + pattern_creeper = 32+256, + pattern_curly_border = 32+8, + pattern_flower = 32+8, + pattern_skull = 32+50000, + pattern_thing = 32+147584, + pattern_globe = 360, + pattern_piglin = 300 + }, + ["useful_green_potatoes"] = { + useful_green_potato = 256, + useful_green_potato_ingot = 256, + useful_green_potato_block = 256*9, + useful_green_potato_ingot_block = 256*9, + axe_useful_green_potato = 256*3+8, + pick_useful_green_potato = 256*3+8, + sword_useful_green_potato = 256*2+4, + shovel_useful_green_potato = 256+8, + hoe_useful_green_potato = 256*2+8, + helmet_useful_green_potato = 256*5, + chestplate_useful_green_potato = 256*8, + leggings_useful_green_potato = 256*7, + boots_useful_green_potato = 256*4, + bucket_useful_green_potato_liquid = 768, + useful_green_potato_gold = 2048*8+256 + }, + ["portability"] = { + crafting_table = 8192 + 4, + ender_chest = 8192 + 2304, + enchanting_table_1 = 8192 + 16790, + enchanting_table_2 = 8192 + 16790 + 498, + enchanting_table_3 = 8192 + 16790 + 498*2, + enchanting_table_4 = 8192 + 16790 + 498*3, + enchanting_table_5 = 8192 + 16790 + 498*4, + enchanting_table_6 = 8192 + 16790 + 498*5, + enchanting_table_7 = 8192 + 16790 + 498*6, + enchanting_table_8 = 8192 + 16790 + 498*7, + enchanting_table_9 = 8192 + 16790 + 498*8, + enchanting_table_10 = 8192 + 16790 + 498*9, + enchanting_table_11 = 8192 + 16790 + 498*10, + enchanting_table_12 = 8192 + 16790 + 498*11, + enchanting_table_13 = 8192 + 16790 + 498*12, + enchanting_table_14 = 8192 + 16790 + 498*13, + enchanting_table_15 = 8192 + 16790 + 498*14, + } +} + +--[[ Groups are organized like this so that order matters. Groups that are lower on the +list will have their energies applied later, making them higher priority. It's +unnecessary for single items because order doesn't matter for them. The NO_GROUP +value is for values that are not in any other group. Only items that match a group +in the list will have values applied, meaning that NO_GROUP is basically mandatory. + +]] + +exchangeclone.mtg_group_values = { + {"NO_GROUP", 1}, + {"tree", 16}, + {"wood", 8}, + {"sapling", 32}, + {"fence", 10}, + {"wool", 48}, + {"dye", 8}, + {"flower", 32}, + {"useless", 0}, +} + +local slabs_and_stairs = {} + +exchangeclone.mcl_group_values = { + {"not_in_creative_inventory", 0}, + {"banner", 292}, + {"sandstone", 4}, + {"wood", 8}, + {"button", 8}, + {"dye", 8}, + {"fence_wood", 13}, + {"flower", 8}, + {"pane", 0.5}, + {"pressure_plate", 16}, + {"trapdoor", 24}, + {"door", 16}, + {"fence_gate", 32}, + {"sapling", 32}, + {"mushroom", 32}, + {"tree", 32}, + {"boat", 40}, + {"wool", 48}, + {"bed", 168}, + {"shulker_box", 4198}, + {"bark", 43}, + {"glass", 2}, --undyed glass is 1 + {"huge_mushroom", 0}, --if you want energy, break it into mushrooms; doesn't always drop. + {"carpet", 32}, + {"spawn_egg", 0}, + {"hardened_clay", 16}, + {"wood_slab", 4}, + {"wood_stairs", 12}, + {"smithing_template", 8192*7+1792*2}, + {"concrete", 2}, + {"concrete_powder", 2}, + {"useless", 0}, + {"decorated_pot_recipe", 4}, -- has to be 4 because of brick. + {"NO_GROUP", 1}, +} + +exchangeclone.mcl_potion_data = { -- automatically assumes base cost is awkward potion + {name = "water", ingredient_cost = 0, custom_base_cost = 0, no_arrow = true}, + {name = "awkward", ingredient_cost = 0, no_arrow = true}, + {name = "fire_resistance", ingredient_cost = 768, plus = true}, + {name = "poison", ingredient_cost = 128, plus = true, two = true}, + {name = "harming", ingredient_cost = 192, custom_base_cost = 52, two = true}, + {name = "healing", ingredient_cost = 1852, two = true}, + {name = "leaping", ingredient_cost = 64, plus = true, two = true}, + {name = "mundane", ingredient_cost = 32, no_arrow = true, custom_base_cost = 0}, + {name = "night_vision", ingredient_cost = 1840, plus = true}, + {name = "regeneration", ingredient_cost = 4096, plus = true, two = true}, + {name = "slowness", ingredient_cost = 192, custom_base_cost = 20, plus = true, two = true}, + {name = "swiftness", ingredient_cost = 32, plus = true, two = true}, + {name = "thick", ingredient_cost = 384, no_arrow = true, custom_base_cost = 0}, + {name = "water_breathing", ingredient_cost = 64, plus = true}, + {name = "invisibility", ingredient_cost = 192, custom_base_cost = 623, plus = true}, + {name = "withering", ingredient_cost = 128, plus = true, two = true} +} + +exchangeclone.whitelisted_mods = { + exchangeclone = true, + beds = true, + binoculars = true, + boats = true, + bones = true, + bucket = true, + butterflies = true, + carts = true, + default = true, + doors = true, + dye = true, + farming = true, + fire = true, + fireflies = true, + flowers = true, + keys = true, + mapping_kit = true, + moreswords = true, + stairs = true, + tnt = true, + vessels = true, + walls = true, + wool = true, + xpanes = true, + doc_identifier = true, + fake_liquids = true, + ghost_blocks = true, + lava_sponge = true, + mcl_amethyst = true, + mcl_anvils = true, + mcl_armor = true, + mcl_armor_stand = true, + mcl_bamboo = true, + mcl_banners = true, + mcl_barrels = true, + mcl_beacons = true, + mcl_beds = true, + mcl_beehives = true, + mcl_bells = true, + mcl_blackstone = true, + mcl_blast_furnace = true, + mcl_boats = true, + mcl_bone_meal = true, + mcl_books = true, + mcl_bows = true, + mcl_buckets = true, + mcl_brewing = true, + mcl_cake = true, + mcl_campfires = true, + mcl_cartography_table = true, + mcl_cauldrons = true, + mcl_cherry_blossom = true, + mcl_chests = true, + mcl_clock = true, + mcl_cocoas = true, + mcl_colorblocks = true, + mcl_colors = true, + mcl_comparators = true, + mcl_compass = true, + mcl_composters = true, + mcl_copper = true, + mcl_core = true, + mcl_crafting_table = true, + mcl_crimson = true, + mcl_deepslate = true, + mcl_dispensers = true, + mcl_doors = true, + mcl_droppers = true, + mcl_dye = true, + mcl_dyes = true, -- Why, MineClonia? (unless MineClonia did it first, in which case, "Why, MineClone2?") + mcl_enchanting = true, + mcl_end = true, + mcl_experience = true, + mcl_farming = true, + mcl_fences = true, + mcl_fire = true, + mcl_fireworks = true, + mcl_fishing = true, + mcl_fletching_table = true, + mcl_flowerpots = true, + mcl_flowers = true, + mcl_furnaces = true, + mcl_grindstone = true, + mcl_hamburger = true, + mcl_heads = true, + mcl_honey = true, + mcl_hoppers = true, + mcl_itemframes = true, + mcl_jukebox = true, + mcl_lanterns = true, + mcl_lectern = true, + mcl_lightning_rods = true, + mcl_loom = true, + mcl_lush_caves = true, + mcl_mangrove = true, + mcl_maps = true, + mcl_minecarts = true, + mcl_mobs = true, + mcl_mobitems = true, + mcl_mud = true, + mcl_mushrooms = true, + mcl_nether = true, + mcl_observers = true, + mcl_ocean = true, + mcl_paintings = true, + mcl_potions = true, + mcl_pottery_sherds = true, + mcl_raw_ores = true, + mcl_sculk = exchangeclone.mineclonia and true, + mcl_shields = true, + mcl_signs = true, + mcl_smithing_table = true, + mcl_smoker = true, + mcl_sponges = true, + mcl_spyglass = true, + mcl_stairs = true, + mcl_stonecutter = true, + mcl_sus_nodes = true, + mcl_sus_stew = true, + mcl_target = true, + mcl_throwing = true, + mcl_tnt = true, + mcl_tools = true, + mcl_torches = true, + mcl_totems = true, + mcl_trees = true, + mcl_villages = true, + mcl_walls = true, + mcl_wool = true, + mclx_core = true, + mclx_fences = true, + mclx_stairs = true, + portability = true, + meat_blocks = true, + flying_sausage = true, + useful_green_potatoes = true, + screwdriver = true, + slime_things = true, + small_why_things = true, + sound_machine = true, + sticky_things = true, +} + + +--only allow Mesecons in MineClone +if exchangeclone.mcl then + for _, mod in ipairs({ + "mesecons", + "mesecons_button", + "mesecons_delayer", + "mesecons_lightstone", + "mesecons_noteblock", + "mesecons_pistons", + "mesecons_pressureplates", + "mesecons_solarpanel", + "mesecons_torch", + "mesecons_walllever", + "mesecons_wires", + }) do + exchangeclone.whitelisted_mods[mod] = true + end +end + +local function set_item_energy(itemstring, energy_value) + itemstring = minetest.registered_aliases[itemstring] or itemstring + local def = minetest.registered_items[itemstring] + if not def then return end + if not def.groups then return end + if not def.description or def.description == "" then return end + local _, _, mod_name, item_name = itemstring:find("([%d_%l]+):([%d_%l]+)") + if not (item_name and mod_name) then return end + if exchangeclone.whitelisted_mods[mod_name] then + if mod_name == "ghost_blocks" then + energy_value = 0 + end + if exchangeclone.mcl then + if exchangeclone.mcl_energy_values[mod_name] then + energy_value = exchangeclone.mcl_energy_values[mod_name][item_name] or energy_value --override if possible + end + else + if exchangeclone.mtg_energy_values[mod_name] then + energy_value = exchangeclone.mtg_energy_values[mod_name][item_name] or energy_value --override if possible + end + end + else + energy_value = 0 -- if not a whitelisted mod, make it useless. + end + local description = def.description + local groups = table.copy(def.groups) + description = description:gsub("Energy Value: ([%d%.]+)", "") + local existing_energy_value = description:find("Energy Value: ([%d%.]+)") + if existing_energy_value then + description = description:gsub("Energy Value: ([%d%.]+)", "Energy Value: "..energy_value) + else + if description[#description] ~= "\n" then + description = description.."\n" + end + description = description.."Energy Value: "..(energy_value) + end + if def.exchangeclone_custom_energy then + energy_value = def.exchangeclone_custom_energy + end + minetest.override_item(itemstring, { + description = description, + energy_value = energy_value, + groups = groups + }) + --minetest.log(itemstring.." "..energy_value.." "..reason) + if mod_name ~= "ghost_blocks" and mod_name ~= "mcl_stairs" and mod_name ~= "stairs" then + local other_itemstrings + if exchangeclone.mcl then + other_itemstrings = { + {"mcl_stairs:slab_"..item_name, energy_value/2}, + {"mcl_stairs:stair_"..item_name, energy_value*1.5}, + } + else + other_itemstrings = { + {"stairs:slab_"..item_name, energy_value/2}, + {"stairs:stair_"..item_name, energy_value*1.5}, + {"stairs:stair_inner_"..item_name, energy_value*1.5}, + {"stairs:stair_outer_"..item_name, energy_value*1.5}, + } + end + + for _, info in pairs(other_itemstrings) do + if minetest.registered_items[info[1]] then + slabs_and_stairs[#slabs_and_stairs+1] = info + end + end + end +end + +local function add_potion_energy(info) + local base_cost = 1 --cost of water bottle + --TODO: Change dragon's breath when MineClone does. + local dragon_breath_cost = 8.5 + base_cost = math.floor(base_cost + (info.ingredient_cost / 3)) --/3 because 3 potions/ingredient + base_cost = base_cost + (info.custom_base_cost or 8) --8 = 1/3 of nether wart. + local splash_cost = base_cost + 64 + local lingering_cost = math.floor(base_cost + (dragon_breath_cost / 3)) + set_item_energy("mcl_potions:"..info.name, base_cost) + set_item_energy("mcl_potions:"..info.name.."_splash", splash_cost) + set_item_energy("mcl_potions:"..info.name.."_lingering", lingering_cost) + if not info.no_arrow then + local arrow_cost = math.floor(lingering_cost / 8 + 3) + set_item_energy("mcl_potions:"..info.name.."_arrow", arrow_cost) + end + if info.plus then + local plus_base_cost = base_cost + 21 + local plus_splash_cost = splash_cost + 21 + local plus_lingering_cost = lingering_cost + 21 + local plus_arrow_cost = math.floor(plus_lingering_cost / 8 + 3) + set_item_energy("mcl_potions:"..info.name.."_plus", plus_base_cost) + set_item_energy("mcl_potions:"..info.name.."_plus_splash", plus_splash_cost) + set_item_energy("mcl_potions:"..info.name.."_plus_lingering", plus_lingering_cost) + set_item_energy("mcl_potions:"..info.name.."_plus_arrow", plus_arrow_cost) + end + if info.two then + local two_base_cost = base_cost + 21 + local two_splash_cost = splash_cost + 21 + local two_lingering_cost = lingering_cost + 21 + local two_arrow_cost = math.floor(two_lingering_cost / 8 + 3) + set_item_energy("mcl_potions:"..info.name.."_2", two_base_cost) + set_item_energy("mcl_potions:"..info.name.."_2_splash", two_splash_cost) + set_item_energy("mcl_potions:"..info.name.."_2_lingering", two_lingering_cost) + set_item_energy("mcl_potions:"..info.name.."_2_arrow", two_arrow_cost) + end +end + +--Wait until all mods are loaded (to make sure all nodes have been registered) +--This is much easier than making it depend on every single MineClone mod. +minetest.register_on_mods_loaded(function() + if exchangeclone.mcl then --Set all items to MineClone values + local groupnames = {} + for index, group in ipairs(exchangeclone.mcl_group_values) do + groupnames[#groupnames + 1] = group[1] --Get list of group names + end + local grouped_items = exchangeclone.get_group_items(groupnames, true, true) + for index, group in ipairs(exchangeclone.mcl_group_values) do + for i, item in pairs(grouped_items[group[1]]) do + set_item_energy(item, group[2]) + end + end + for i = 0, 31 do + set_item_energy("mcl_compass:"..i.."_recovery", 443456) + end + for i = 0, 31 do + set_item_energy("mcl_compass:"..i, 1088) + end + set_item_energy("mcl_compass:compass", 1088) + for i = 0, 63 do + set_item_energy("mcl_clock:clock_"..i, 8256) + end + set_item_energy("mcl_clock:clock", 8256) + --It's almost like the "compass" and "clock" groups don't exist. I tried using them, but it just didn't work. + set_item_energy("mcl_bone_meal:bone_meal", 48) + --Bone meal just doesn't work either, for some reason. + for i = 1, 8 do --faster than doing everything individually. + set_item_energy("mcl_jukebox:record_"..i, 8192) + end + for _, info in ipairs(exchangeclone.mcl_potion_data) do + add_potion_energy(info) + end + + else --Set all items to Minetest Game values + local groupnames = {} + for index, group in ipairs(exchangeclone.mtg_group_values) do + groupnames[#groupnames + 1] = group[1] --Get list of group names + end + local grouped_items = exchangeclone.get_group_items(groupnames, true, true) + for index, group in ipairs(exchangeclone.mtg_group_values) do + for i, item in pairs(grouped_items[group[1]]) do + set_item_energy(item, group[2]) + end + end + end + + for _, item in ipairs(slabs_and_stairs) do + set_item_energy(item[1], item[2]) + end +end +) \ No newline at end of file diff --git a/energy_collector.lua b/exchangeclone/energy_collector.lua similarity index 100% rename from energy_collector.lua rename to exchangeclone/energy_collector.lua diff --git a/furnaces.lua b/exchangeclone/furnaces.lua similarity index 100% rename from furnaces.lua rename to exchangeclone/furnaces.lua diff --git a/hammers.lua b/exchangeclone/hammers.lua similarity index 100% rename from hammers.lua rename to exchangeclone/hammers.lua diff --git a/hoes.lua b/exchangeclone/hoes.lua similarity index 100% rename from hoes.lua rename to exchangeclone/hoes.lua diff --git a/init.lua b/exchangeclone/init.lua similarity index 94% rename from init.lua rename to exchangeclone/init.lua index a795149..e939927 100644 --- a/init.lua +++ b/exchangeclone/init.lua @@ -1,6 +1,3 @@ -exchangeclone = {} - - if (not minetest.get_modpath("mcl_core")) and (not minetest.get_modpath("default")) then error("ExchangeClone requires 'default' or 'mcl_core,' but Minetest doesn't let me mark one or the other as a dependency.") else @@ -43,5 +40,4 @@ end dofile(modpath.."/philosophers_stone.lua") dofile(modpath.."/pesa.lua") dofile(modpath.."/transmutation_table.lua") -dofile(modpath.."/furnaces.lua") -dofile(modpath.."/energy.lua") \ No newline at end of file +dofile(modpath.."/furnaces.lua") \ No newline at end of file diff --git a/exchangeclone/lib.lua b/exchangeclone/lib.lua new file mode 100644 index 0000000..d7a70e0 --- /dev/null +++ b/exchangeclone/lib.lua @@ -0,0 +1,493 @@ +-- Just a collection of a whole bunch of functions used here. There's very little order. + +function exchangeclone.get_inventory_drops(pos, inventory, drops) --removes default dependency + local inv = minetest.get_meta(pos):get_inventory() + local n = #drops + for i = 1, inv:get_size(inventory) do + local stack = inv:get_stack(inventory, i) + if stack:get_count() > 0 then + drops[n+1] = stack:to_table() + n = n + 1 + end + end +end + +function exchangeclone.get_item_energy(name) + return minetest.registered_items[name].energy_value or -1 +end + +function exchangeclone.round(num) + if num % 1 < 0.5 then + return math.floor(num) + else + return math.ceil(num) + end +end + +-- https://forum.unity.com/threads/re-map-a-number-from-one-range-to-another.119437/ +function exchangeclone.map(input, min1, max1, min2, max2) + return (input - min1) / (max1 - min1) * (max2 - min2) + min2 +end + +function exchangeclone.get_orb_itemstack_energy(itemstack) + if not itemstack then return -1 end + if itemstack:get_name() ~= "exchangeclone:exchange_orb" then return -1 end + return itemstack:get_meta():get_float("stored_energy") or 0 +end + +function exchangeclone.get_orb_energy(inventory, listname, index) + if not inventory then return -1 end + if not listname then listname = "main" end + if not index then index = 1 end + local itemstack = inventory:get_stack(listname, index) + return exchangeclone.get_orb_itemstack_energy(itemstack) +end + +if default then exchangeclone.sound_mod = default else exchangeclone.sound_mod = mcl_sounds end + +function exchangeclone.set_orb_energy(inventory, listname, index, amount) + if not inventory or amount < 0 then return end + if not listname then listname = "main" end + if not index then index = 1 end + local itemstack = inventory:get_stack(listname, index) + if not itemstack then return end + if not (itemstack:get_name() and itemstack:get_name() == "exchangeclone:exchange_orb") then return end + local old_energy = exchangeclone.get_orb_itemstack_energy(itemstack) + if amount > old_energy and old_energy > exchangeclone.orb_max then return end -- don't allow more energy to be put into an over-filled orb + + -- Square roots will hopefully make it less linear + -- And if they don't, I don't really care and I don't want to think about math anymore. + local sqrt_amount = math.sqrt(amount) + local sqrt_max = math.sqrt(exchangeclone.orb_max) + + local r, g, b = 0, 0, 0 + if amount == 0 then + -- do nothing + elseif sqrt_amount < (sqrt_max/4) then + r = exchangeclone.map(sqrt_amount, 0, sqrt_max/4, 0, 255) + elseif sqrt_amount < (sqrt_max/2) then + g = exchangeclone.map(sqrt_amount, sqrt_max/4, sqrt_max/2, 0, 255) + r = 255 - g + elseif sqrt_amount < (3*sqrt_max/4) then + b = exchangeclone.map(sqrt_amount, sqrt_max/2, 3*sqrt_max/4, 0, 255) + g = 255 - b + else + r = math.min(exchangeclone.map(sqrt_amount, 3*sqrt_max/4, sqrt_max, 0, 255), 255) + b = 255 + end + + local colorstring = minetest.rgba(r,g,b) + + local meta = itemstack:get_meta() + meta:set_float("stored_energy", amount) + meta:set_string("description", "Exchange Orb\nCurrent Charge: "..amount) + meta:set_string("color", colorstring) + inventory:set_stack(listname, index, itemstack) +end + +local hud_elements = {} + +function exchangeclone.update_hud(player) + local hud_text = hud_elements[player:get_player_name()] + player:hud_change(hud_text, "text", "Personal Energy: "..tostring(exchangeclone.get_player_energy(player))) +end + +minetest.register_on_joinplayer(function(player, last_login) + hud_elements[player:get_player_name()] = player:hud_add({ + hud_elem_type = "text", + position = {x = 1, y = 1}, + offset = {x = 0, y = 0}, + text = "Personal Energy: 0", + alignment = {x = -1, y = -1}, + scale = {x = 100, y = 100}, + number = 0xDDDDDD + }) + exchangeclone.update_hud(player) +end) + +minetest.register_on_leaveplayer(function(player, timed_out) + hud_elements[player:get_player_name()] = nil +end) + +minetest.register_on_joinplayer(function(player, last_login) + local meta = player:get_meta() + local energy = meta:get_int("exchangeclone_stored_energy") + if energy > 0 then + -- Not sure at all whether this is necessary + meta:set_int("exchangeclone_stored_energy", energy) + meta:set_string("exchangeclone_stored_energy", string.format("%.16e", energy)) + end +end) + +function exchangeclone.get_player_energy(player) + return tonumber(player:get_meta():get_string("exchangeclone_stored_energy")) or 0 +end + +function exchangeclone.set_player_energy(player, amount) + player:get_meta():set_string("exchangeclone_stored_energy", string.format("%.16e", amount)) + exchangeclone.update_hud(player) +end + +-- copied from http://lua-users.org/wiki/IntegerDomain +-- get highest power of 2 which Lua can still handle as integer +local step = 2 +while true do + local nextstep = step*2 + if nextstep - (nextstep-1) == 1 and nextstep > 0 then + step = nextstep + else + break + end +end + +-- now get the highest number which Lua can still handle as integer +exchangeclone.limit, step = step, math.floor(step/2) +while step > 0 do + local nextlimit = exchangeclone.limit + step + if nextlimit - (nextlimit-1) == 1 and nextlimit > 0 then + exchangeclone.limit = nextlimit + end + step = math.floor(step/2) +end + +function exchangeclone.get_group_items(groups, allow_duplicates, include_no_group) + if type(groups) ~= "table" then + return nil + end + + allow_duplicates = allow_duplicates or false + include_no_group = include_no_group or false + + local g_cnt = #groups + + local result = {} + for i = 1, g_cnt do + result[groups[i]] = {} + end + if include_no_group then + result["NO_GROUP"] = {} + end + local in_group + + for name, def in pairs(minetest.registered_items) do + in_group = false + for i = 1, g_cnt do + local grp = groups[i] + if def.groups[grp] ~= nil then + result[grp][#result[grp]+1] = name + in_group = true + if allow_duplicates == false then + break + end + end + end + if include_no_group and in_group == false then + result["NO_GROUP"][#result["NO_GROUP"]+1] = name + end + end + + return result +end + +function exchangeclone.play_ability_sound(player, base_pitch) + if not player then return end + if not base_pitch then base_pitch = 1 end + local new_pitch = base_pitch + (math.random(-100, 100) / 500) + minetest.sound_play("exchangeclone_ability", {pitch = new_pitch, pos = player:get_pos(), max_hear_distance = 20, }) +end + +function exchangeclone.check_on_rightclick(itemstack, player, pointed_thing) + if pointed_thing.type ~= "node" then return false end + if player:get_player_control().sneak then return false end + local node = minetest.get_node(pointed_thing.under) + if player and not player:get_player_control().sneak then + if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then + return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, player, itemstack) or itemstack + end + end + return false +end + +function exchangeclone.range_update(itemstack, player, max) + if not max then max = 4 end + local range = tonumber(itemstack:get_meta():get_int("exchangeclone_item_range")) + if player:get_player_control().sneak then + if range == 0 then + range = max + else + range = range - 1 + end + else + if range == max then + range = 0 + else + range = range + 1 + end + end + minetest.chat_send_player(player:get_player_name(), "Current Range: "..range) + itemstack:get_meta():set_int("exchangeclone_item_range", range) + return itemstack +end + + +exchangeclone.wield_scale = {x=1,y=1,z=1} +if exchangeclone.mcl then + exchangeclone.wield_scale = mcl_vars.tool_wield_scale +end + +exchangeclone.wield_scale = vector.multiply(exchangeclone.wield_scale, 1.5) + +exchangeclone.diamond_itemstring = "default:diamond" +if exchangeclone.mcl then + exchangeclone.diamond_itemstring = "mcl_core:diamond" +end + +local doTileDrops = minetest.settings:get_bool("mcl_doTileDrops", true) + +local function get_fortune_drops(fortune_drops, fortune_level) + local drop + local i = fortune_level + repeat + drop = fortune_drops[i] + i = i - 1 + until drop or i < 1 + return drop or {} +end + +function exchangeclone.inventory_formspec(x,y) + local formspec + if exchangeclone.mcl then + formspec = "list[current_player;main;"..tostring(x)..","..tostring(y)..";9,3;9]".. + mcl_formspec.get_itemslot_bg(x,y,9,3).. + "list[current_player;main;"..tostring(x)..","..tostring(y+3.25)..";9,1]".. + mcl_formspec.get_itemslot_bg(x,y+3.25,9,1) + else + formspec = "list[current_player;main;"..tostring(x)..","..tostring(y)..";8,1]".. + "list[current_player;main;"..tostring(x)..","..tostring(y+1.25)..";8,3;8]" + end + return formspec +end + +local function discrete_uniform_distribution(drops, min_count, max_count, cap) + local new_drops = table.copy(drops) + for i, item in ipairs(drops) do + local new_item = ItemStack(item) + local multiplier = math.random(min_count, max_count) + if cap then + multiplier = math.min(cap, multiplier) + end + new_item:set_count(multiplier * new_item:get_count()) + new_drops[i] = new_item + end + return new_drops +end + +local tmp_id = 0 + +local function get_drops(drop, toolname, param2, paramtype2) + tmp_id = tmp_id + 1 + local tmp_node_name = "mcl_item_entity:" .. tmp_id + minetest.registered_nodes[tmp_node_name] = { + name = tmp_node_name, + drop = drop, + paramtype2 = paramtype2 + } + local drops = minetest.get_node_drops({ name = tmp_node_name, param2 = param2 }, toolname) + minetest.registered_nodes[tmp_node_name] = nil + return drops +end + +function exchangeclone.drop_items_on_player(pos, drops, player) --copied from MineClone's code + if not exchangeclone.mcl then + return minetest.handle_node_drops(pos, drops, player) + end + -- NOTE: This function override allows player to be nil. + -- This means there is no player. This is a special case which allows this function to be called + -- by hand. Creative Mode is intentionally ignored in this case. + if player and player:is_player() and minetest.is_creative_enabled(player:get_player_name()) then + local inv = player:get_inventory() + if inv then + for _, item in ipairs(drops) do + if not inv:contains_item("main", item, true) then + inv:add_item("main", item) + end + end + end + return + elseif not doTileDrops then return end + + -- Check if node will yield its useful drop by the player's tool + local dug_node = minetest.get_node(pos) + local tooldef + local tool + if player then + tool = player:get_wielded_item() + tooldef = minetest.registered_items[tool:get_name()] + + if not mcl_autogroup.can_harvest(dug_node.name, tool:get_name(), player) then + return + end + end + + local diggroups = tooldef and tooldef._mcl_diggroups + local shearsy_level = diggroups and diggroups.shearsy and diggroups.shearsy.level + + --[[ Special node drops when dug by shears by reading _mcl_shears_drop or with a silk touch tool reading _mcl_silk_touch_drop + from the node definition. + Definition of _mcl_shears_drop / _mcl_silk_touch_drop: + * true: Drop itself when dug by shears / silk touch tool + * table: Drop every itemstring in this table when dug by shears _mcl_silk_touch_drop + ]] + + local enchantments = tool and mcl_enchanting.get_enchantments(tool) + + local silk_touch_drop = false + local nodedef = minetest.registered_nodes[dug_node.name] + if not nodedef then return end + + if shearsy_level and shearsy_level > 0 and nodedef._mcl_shears_drop then + if nodedef._mcl_shears_drop == true then + drops = { dug_node.name } + else + drops = nodedef._mcl_shears_drop + end + elseif tool and enchantments.silk_touch and nodedef._mcl_silk_touch_drop then + silk_touch_drop = true + if nodedef._mcl_silk_touch_drop == true then + drops = { dug_node.name } + else + drops = nodedef._mcl_silk_touch_drop + end + end + +--[[]] if tool and nodedef._mcl_fortune_drop and enchantments.fortune then + local fortune_level = enchantments.fortune + local fortune_drop = nodedef._mcl_fortune_drop + if fortune_drop.discrete_uniform_distribution then + local min_count = fortune_drop.min_count + local max_count = fortune_drop.max_count + fortune_level * (fortune_drop.factor or 1) + local chance = fortune_drop.chance or fortune_drop.get_chance and fortune_drop.get_chance(fortune_level) + if not chance or math.random() < chance then + drops = discrete_uniform_distribution(fortune_drop.multiply and drops or fortune_drop.items, min_count, max_count, + fortune_drop.cap) + elseif fortune_drop.override then + drops = {} + end + else + -- Fixed Behavior + local drop = get_fortune_drops(fortune_drop, fortune_level) + drops = get_drops(drop, tool:get_name(), dug_node.param2, nodedef.paramtype2) + end + end +--]] + + if player and mcl_experience.throw_xp and not silk_touch_drop then + local experience_amount = minetest.get_item_group(dug_node.name, "xp") + if experience_amount > 0 then + mcl_experience.throw_xp(player:get_pos(), experience_amount) + end + end + + for _, item in ipairs(drops) do + local count + if type(item) == "string" then + count = ItemStack(item):get_count() + else + count = item:get_count() + end + local drop_item = ItemStack(item) + drop_item:set_count(1) + for i = 1, count do + -- Spawn item + local obj = minetest.add_item(player:get_pos(), drop_item) + if obj then + -- set the velocity multiplier to the stored amount or if the game dug this node, apply a bigger velocity + obj:get_luaentity().age = 0.65 + obj:get_luaentity()._insta_collect = true + end + end + end +end + +function exchangeclone.get_face_direction(player) + local h_look = player:get_look_horizontal() + local v_look = player:get_look_vertical() + + local result = {x = 0, y = 0, z = 0} + + if h_look <= math.pi / 4 or h_look >= (7*math.pi)/4 then + result.z = 1 + elseif h_look > math.pi / 4 and h_look <= (3*math.pi)/4 then + result.x = -1 + elseif h_look > (3*math.pi)/4 and h_look <= (5*math.pi)/4 then + result.z = -1 + else + result.x = 1 + end + + if v_look < -1 then + result.y = 1 + elseif v_look > 1 then + result.y = -1 + end + + return result +end + +function exchangeclone.node_radius_action(player, center, range, functions, extra_info) + if not functions.action then return end + local data + local stop = false + if functions.start_action then + data = functions.start_action(player, center, range, extra_info) + if not data then return end + end + if not center then center = player:get_pos() end + center.x = exchangeclone.round(center.x) + center.y = math.floor(center.y) --make sure y is node BELOW player's feet + center.z = exchangeclone.round(center.z) + for x = center.x-range,center.x+range do + for y = center.y-range,center.y+range do + for z = center.z-range,center.z+range do + local pos = {x=x,y=y,z=z} + local node = minetest.get_node(pos) + local result = functions.action(player, pos, node, data) + if not result then stop = true break end + if result ~= true then data = result end + end + if stop then break end + end + if stop then break end + end + if functions.end_action then + data = functions.end_action(player, center, range, data) + end + return data +end + +exchangeclone.cooldowns = {} + +minetest.register_on_joinplayer(function(player, last_login) + exchangeclone.cooldowns[player:get_player_name()] = {} +end) + +minetest.register_on_leaveplayer(function(player, timed_out) + exchangeclone.cooldowns[player:get_player_name()] = nil +end) + +function exchangeclone.start_cooldown(player, name, time) + local player_name = player:get_player_name() + exchangeclone.cooldowns[player_name][name] = time + minetest.after(time, function() + if exchangeclone.cooldowns[player_name] then + exchangeclone.cooldowns[player_name][name] = nil + end + end) +end + +function exchangeclone.check_cooldown(player, name) + local player_name = player:get_player_name() + if exchangeclone.cooldowns[player_name] then + return exchangeclone.cooldowns[player_name][name] + end +end \ No newline at end of file diff --git a/mod.conf b/exchangeclone/mod.conf similarity index 56% rename from mod.conf rename to exchangeclone/mod.conf index f9305e7..8378356 100644 --- a/mod.conf +++ b/exchangeclone/mod.conf @@ -1,6 +1,7 @@ name = exchangeclone title = ExchangeClone -description = Equivalent Exchange for Minetest Game and MineClone! Turn items into energy and energy into items, transmute nodes into other nodes, and craft Dark and Red Matter tools! +description = The main part of the modpack (depends on both the other mods) min_minetest_version = 5.5 +depends = zzzz_exchangeclone_crafthook optional_depends = 3d_armor, mcl_item_id, mcl_core, default, moreswords, mcl_stairs, meat_blocks, sticky_things, fake_liquids, sound_machine, stairs, mcl_dispensers, farming, mobs_mc, screwdriver author = ThePython10110 \ No newline at end of file diff --git a/multidig.lua b/exchangeclone/multidig.lua similarity index 100% rename from multidig.lua rename to exchangeclone/multidig.lua diff --git a/orb.lua b/exchangeclone/orb.lua similarity index 100% rename from orb.lua rename to exchangeclone/orb.lua diff --git a/pesa.lua b/exchangeclone/pesa.lua similarity index 100% rename from pesa.lua rename to exchangeclone/pesa.lua diff --git a/philosophers_stone.lua b/exchangeclone/philosophers_stone.lua similarity index 100% rename from philosophers_stone.lua rename to exchangeclone/philosophers_stone.lua diff --git a/pickaxes.lua b/exchangeclone/pickaxes.lua similarity index 100% rename from pickaxes.lua rename to exchangeclone/pickaxes.lua diff --git a/red_matter_multitools.lua b/exchangeclone/red_matter_multitools.lua similarity index 100% rename from red_matter_multitools.lua rename to exchangeclone/red_matter_multitools.lua diff --git a/shears.lua b/exchangeclone/shears.lua similarity index 100% rename from shears.lua rename to exchangeclone/shears.lua diff --git a/shovels.lua b/exchangeclone/shovels.lua similarity index 100% rename from shovels.lua rename to exchangeclone/shovels.lua diff --git a/sounds/exchangeclone_ability.ogg b/exchangeclone/sounds/exchangeclone_ability.ogg similarity index 100% rename from sounds/exchangeclone_ability.ogg rename to exchangeclone/sounds/exchangeclone_ability.ogg diff --git a/swords.lua b/exchangeclone/swords.lua similarity index 100% rename from swords.lua rename to exchangeclone/swords.lua diff --git a/textures/blank.png b/exchangeclone/textures/blank.png similarity index 100% rename from textures/blank.png rename to exchangeclone/textures/blank.png diff --git a/textures/exchangeclone_aeternalis_fuel.png b/exchangeclone/textures/exchangeclone_aeternalis_fuel.png similarity index 100% rename from textures/exchangeclone_aeternalis_fuel.png rename to exchangeclone/textures/exchangeclone_aeternalis_fuel.png diff --git a/textures/exchangeclone_alchemical_coal.png b/exchangeclone/textures/exchangeclone_alchemical_coal.png similarity index 100% rename from textures/exchangeclone_alchemical_coal.png rename to exchangeclone/textures/exchangeclone_alchemical_coal.png diff --git a/textures/exchangeclone_alchemical_tome.png b/exchangeclone/textures/exchangeclone_alchemical_tome.png similarity index 100% rename from textures/exchangeclone_alchemical_tome.png rename to exchangeclone/textures/exchangeclone_alchemical_tome.png diff --git a/textures/exchangeclone_constructor_down.png b/exchangeclone/textures/exchangeclone_constructor_down.png similarity index 100% rename from textures/exchangeclone_constructor_down.png rename to exchangeclone/textures/exchangeclone_constructor_down.png diff --git a/textures/exchangeclone_constructor_right.png b/exchangeclone/textures/exchangeclone_constructor_right.png similarity index 100% rename from textures/exchangeclone_constructor_right.png rename to exchangeclone/textures/exchangeclone_constructor_right.png diff --git a/textures/exchangeclone_constructor_up.png b/exchangeclone/textures/exchangeclone_constructor_up.png similarity index 100% rename from textures/exchangeclone_constructor_up.png rename to exchangeclone/textures/exchangeclone_constructor_up.png diff --git a/textures/exchangeclone_dark_matter.png b/exchangeclone/textures/exchangeclone_dark_matter.png similarity index 100% rename from textures/exchangeclone_dark_matter.png rename to exchangeclone/textures/exchangeclone_dark_matter.png diff --git a/textures/exchangeclone_dark_matter_axe.png b/exchangeclone/textures/exchangeclone_dark_matter_axe.png similarity index 100% rename from textures/exchangeclone_dark_matter_axe.png rename to exchangeclone/textures/exchangeclone_dark_matter_axe.png diff --git a/textures/exchangeclone_dark_matter_block.png b/exchangeclone/textures/exchangeclone_dark_matter_block.png similarity index 100% rename from textures/exchangeclone_dark_matter_block.png rename to exchangeclone/textures/exchangeclone_dark_matter_block.png diff --git a/textures/exchangeclone_dark_matter_furnace.png b/exchangeclone/textures/exchangeclone_dark_matter_furnace.png similarity index 100% rename from textures/exchangeclone_dark_matter_furnace.png rename to exchangeclone/textures/exchangeclone_dark_matter_furnace.png diff --git a/textures/exchangeclone_dark_matter_hammer.png b/exchangeclone/textures/exchangeclone_dark_matter_hammer.png similarity index 100% rename from textures/exchangeclone_dark_matter_hammer.png rename to exchangeclone/textures/exchangeclone_dark_matter_hammer.png diff --git a/textures/exchangeclone_dark_matter_hoe.png b/exchangeclone/textures/exchangeclone_dark_matter_hoe.png similarity index 100% rename from textures/exchangeclone_dark_matter_hoe.png rename to exchangeclone/textures/exchangeclone_dark_matter_hoe.png diff --git a/textures/exchangeclone_dark_matter_pickaxe.png b/exchangeclone/textures/exchangeclone_dark_matter_pickaxe.png similarity index 100% rename from textures/exchangeclone_dark_matter_pickaxe.png rename to exchangeclone/textures/exchangeclone_dark_matter_pickaxe.png diff --git a/textures/exchangeclone_dark_matter_shears.png b/exchangeclone/textures/exchangeclone_dark_matter_shears.png similarity index 100% rename from textures/exchangeclone_dark_matter_shears.png rename to exchangeclone/textures/exchangeclone_dark_matter_shears.png diff --git a/textures/exchangeclone_dark_matter_shovel.png b/exchangeclone/textures/exchangeclone_dark_matter_shovel.png similarity index 100% rename from textures/exchangeclone_dark_matter_shovel.png rename to exchangeclone/textures/exchangeclone_dark_matter_shovel.png diff --git a/textures/exchangeclone_dark_matter_sword.png b/exchangeclone/textures/exchangeclone_dark_matter_sword.png similarity index 100% rename from textures/exchangeclone_dark_matter_sword.png rename to exchangeclone/textures/exchangeclone_dark_matter_sword.png diff --git a/textures/exchangeclone_deconstructor_down.png b/exchangeclone/textures/exchangeclone_deconstructor_down.png similarity index 100% rename from textures/exchangeclone_deconstructor_down.png rename to exchangeclone/textures/exchangeclone_deconstructor_down.png diff --git a/textures/exchangeclone_deconstructor_right.png b/exchangeclone/textures/exchangeclone_deconstructor_right.png similarity index 100% rename from textures/exchangeclone_deconstructor_right.png rename to exchangeclone/textures/exchangeclone_deconstructor_right.png diff --git a/textures/exchangeclone_deconstructor_up.png b/exchangeclone/textures/exchangeclone_deconstructor_up.png similarity index 100% rename from textures/exchangeclone_deconstructor_up.png rename to exchangeclone/textures/exchangeclone_deconstructor_up.png diff --git a/textures/exchangeclone_energy_collector_down.png b/exchangeclone/textures/exchangeclone_energy_collector_down.png similarity index 100% rename from textures/exchangeclone_energy_collector_down.png rename to exchangeclone/textures/exchangeclone_energy_collector_down.png diff --git a/textures/exchangeclone_energy_collector_right.png b/exchangeclone/textures/exchangeclone_energy_collector_right.png similarity index 100% rename from textures/exchangeclone_energy_collector_right.png rename to exchangeclone/textures/exchangeclone_energy_collector_right.png diff --git a/textures/exchangeclone_energy_collector_up.png b/exchangeclone/textures/exchangeclone_energy_collector_up.png similarity index 100% rename from textures/exchangeclone_energy_collector_up.png rename to exchangeclone/textures/exchangeclone_energy_collector_up.png diff --git a/textures/exchangeclone_exchange_orb.png b/exchangeclone/textures/exchangeclone_exchange_orb.png similarity index 100% rename from textures/exchangeclone_exchange_orb.png rename to exchangeclone/textures/exchangeclone_exchange_orb.png diff --git a/textures/exchangeclone_mcl_boots_base.png b/exchangeclone/textures/exchangeclone_mcl_boots_base.png similarity index 100% rename from textures/exchangeclone_mcl_boots_base.png rename to exchangeclone/textures/exchangeclone_mcl_boots_base.png diff --git a/textures/exchangeclone_mcl_chestplate_base.png b/exchangeclone/textures/exchangeclone_mcl_chestplate_base.png similarity index 100% rename from textures/exchangeclone_mcl_chestplate_base.png rename to exchangeclone/textures/exchangeclone_mcl_chestplate_base.png diff --git a/textures/exchangeclone_mcl_helmet_base.png b/exchangeclone/textures/exchangeclone_mcl_helmet_base.png similarity index 100% rename from textures/exchangeclone_mcl_helmet_base.png rename to exchangeclone/textures/exchangeclone_mcl_helmet_base.png diff --git a/textures/exchangeclone_mcl_inv_boots_base.png b/exchangeclone/textures/exchangeclone_mcl_inv_boots_base.png similarity index 100% rename from textures/exchangeclone_mcl_inv_boots_base.png rename to exchangeclone/textures/exchangeclone_mcl_inv_boots_base.png diff --git a/textures/exchangeclone_mcl_inv_chestplate_base.png b/exchangeclone/textures/exchangeclone_mcl_inv_chestplate_base.png similarity index 100% rename from textures/exchangeclone_mcl_inv_chestplate_base.png rename to exchangeclone/textures/exchangeclone_mcl_inv_chestplate_base.png diff --git a/textures/exchangeclone_mcl_inv_helmet_base.png b/exchangeclone/textures/exchangeclone_mcl_inv_helmet_base.png similarity index 100% rename from textures/exchangeclone_mcl_inv_helmet_base.png rename to exchangeclone/textures/exchangeclone_mcl_inv_helmet_base.png diff --git a/textures/exchangeclone_mcl_inv_leggings_base.png b/exchangeclone/textures/exchangeclone_mcl_inv_leggings_base.png similarity index 100% rename from textures/exchangeclone_mcl_inv_leggings_base.png rename to exchangeclone/textures/exchangeclone_mcl_inv_leggings_base.png diff --git a/textures/exchangeclone_mcl_leggings_base.png b/exchangeclone/textures/exchangeclone_mcl_leggings_base.png similarity index 100% rename from textures/exchangeclone_mcl_leggings_base.png rename to exchangeclone/textures/exchangeclone_mcl_leggings_base.png diff --git a/textures/exchangeclone_mobius_fuel.png b/exchangeclone/textures/exchangeclone_mobius_fuel.png similarity index 100% rename from textures/exchangeclone_mobius_fuel.png rename to exchangeclone/textures/exchangeclone_mobius_fuel.png diff --git a/textures/exchangeclone_mtg_boots_base.png b/exchangeclone/textures/exchangeclone_mtg_boots_base.png similarity index 100% rename from textures/exchangeclone_mtg_boots_base.png rename to exchangeclone/textures/exchangeclone_mtg_boots_base.png diff --git a/textures/exchangeclone_mtg_boots_base_preview.png b/exchangeclone/textures/exchangeclone_mtg_boots_base_preview.png similarity index 100% rename from textures/exchangeclone_mtg_boots_base_preview.png rename to exchangeclone/textures/exchangeclone_mtg_boots_base_preview.png diff --git a/textures/exchangeclone_mtg_chestplate_base.png b/exchangeclone/textures/exchangeclone_mtg_chestplate_base.png similarity index 100% rename from textures/exchangeclone_mtg_chestplate_base.png rename to exchangeclone/textures/exchangeclone_mtg_chestplate_base.png diff --git a/textures/exchangeclone_mtg_chestplate_base_preview.png b/exchangeclone/textures/exchangeclone_mtg_chestplate_base_preview.png similarity index 100% rename from textures/exchangeclone_mtg_chestplate_base_preview.png rename to exchangeclone/textures/exchangeclone_mtg_chestplate_base_preview.png diff --git a/textures/exchangeclone_mtg_helmet_base.png b/exchangeclone/textures/exchangeclone_mtg_helmet_base.png similarity index 100% rename from textures/exchangeclone_mtg_helmet_base.png rename to exchangeclone/textures/exchangeclone_mtg_helmet_base.png diff --git a/textures/exchangeclone_mtg_helmet_base_preview.png b/exchangeclone/textures/exchangeclone_mtg_helmet_base_preview.png similarity index 100% rename from textures/exchangeclone_mtg_helmet_base_preview.png rename to exchangeclone/textures/exchangeclone_mtg_helmet_base_preview.png diff --git a/textures/exchangeclone_mtg_inv_boots_base.png b/exchangeclone/textures/exchangeclone_mtg_inv_boots_base.png similarity index 100% rename from textures/exchangeclone_mtg_inv_boots_base.png rename to exchangeclone/textures/exchangeclone_mtg_inv_boots_base.png diff --git a/textures/exchangeclone_mtg_inv_chestplate_base.png b/exchangeclone/textures/exchangeclone_mtg_inv_chestplate_base.png similarity index 100% rename from textures/exchangeclone_mtg_inv_chestplate_base.png rename to exchangeclone/textures/exchangeclone_mtg_inv_chestplate_base.png diff --git a/textures/exchangeclone_mtg_inv_helmet_base.png b/exchangeclone/textures/exchangeclone_mtg_inv_helmet_base.png similarity index 100% rename from textures/exchangeclone_mtg_inv_helmet_base.png rename to exchangeclone/textures/exchangeclone_mtg_inv_helmet_base.png diff --git a/textures/exchangeclone_mtg_inv_leggings_base.png b/exchangeclone/textures/exchangeclone_mtg_inv_leggings_base.png similarity index 100% rename from textures/exchangeclone_mtg_inv_leggings_base.png rename to exchangeclone/textures/exchangeclone_mtg_inv_leggings_base.png diff --git a/textures/exchangeclone_mtg_inv_shield_base.png b/exchangeclone/textures/exchangeclone_mtg_inv_shield_base.png similarity index 100% rename from textures/exchangeclone_mtg_inv_shield_base.png rename to exchangeclone/textures/exchangeclone_mtg_inv_shield_base.png diff --git a/textures/exchangeclone_mtg_leggings_base.png b/exchangeclone/textures/exchangeclone_mtg_leggings_base.png similarity index 100% rename from textures/exchangeclone_mtg_leggings_base.png rename to exchangeclone/textures/exchangeclone_mtg_leggings_base.png diff --git a/textures/exchangeclone_mtg_leggings_base_preview.png b/exchangeclone/textures/exchangeclone_mtg_leggings_base_preview.png similarity index 100% rename from textures/exchangeclone_mtg_leggings_base_preview.png rename to exchangeclone/textures/exchangeclone_mtg_leggings_base_preview.png diff --git a/textures/exchangeclone_mtg_shield_base.png b/exchangeclone/textures/exchangeclone_mtg_shield_base.png similarity index 100% rename from textures/exchangeclone_mtg_shield_base.png rename to exchangeclone/textures/exchangeclone_mtg_shield_base.png diff --git a/textures/exchangeclone_mtg_shield_base_preview.png b/exchangeclone/textures/exchangeclone_mtg_shield_base_preview.png similarity index 100% rename from textures/exchangeclone_mtg_shield_base_preview.png rename to exchangeclone/textures/exchangeclone_mtg_shield_base_preview.png diff --git a/textures/exchangeclone_pesa.png b/exchangeclone/textures/exchangeclone_pesa.png similarity index 100% rename from textures/exchangeclone_pesa.png rename to exchangeclone/textures/exchangeclone_pesa.png diff --git a/textures/exchangeclone_philosophers_stone.png b/exchangeclone/textures/exchangeclone_philosophers_stone.png similarity index 100% rename from textures/exchangeclone_philosophers_stone.png rename to exchangeclone/textures/exchangeclone_philosophers_stone.png diff --git a/textures/exchangeclone_red_katar.png b/exchangeclone/textures/exchangeclone_red_katar.png similarity index 100% rename from textures/exchangeclone_red_katar.png rename to exchangeclone/textures/exchangeclone_red_katar.png diff --git a/textures/exchangeclone_red_matter.png b/exchangeclone/textures/exchangeclone_red_matter.png similarity index 100% rename from textures/exchangeclone_red_matter.png rename to exchangeclone/textures/exchangeclone_red_matter.png diff --git a/textures/exchangeclone_red_matter_axe.png b/exchangeclone/textures/exchangeclone_red_matter_axe.png similarity index 100% rename from textures/exchangeclone_red_matter_axe.png rename to exchangeclone/textures/exchangeclone_red_matter_axe.png diff --git a/textures/exchangeclone_red_matter_block.png b/exchangeclone/textures/exchangeclone_red_matter_block.png similarity index 100% rename from textures/exchangeclone_red_matter_block.png rename to exchangeclone/textures/exchangeclone_red_matter_block.png diff --git a/textures/exchangeclone_red_matter_furnace.png b/exchangeclone/textures/exchangeclone_red_matter_furnace.png similarity index 100% rename from textures/exchangeclone_red_matter_furnace.png rename to exchangeclone/textures/exchangeclone_red_matter_furnace.png diff --git a/textures/exchangeclone_red_matter_hammer.png b/exchangeclone/textures/exchangeclone_red_matter_hammer.png similarity index 100% rename from textures/exchangeclone_red_matter_hammer.png rename to exchangeclone/textures/exchangeclone_red_matter_hammer.png diff --git a/textures/exchangeclone_red_matter_hoe.png b/exchangeclone/textures/exchangeclone_red_matter_hoe.png similarity index 100% rename from textures/exchangeclone_red_matter_hoe.png rename to exchangeclone/textures/exchangeclone_red_matter_hoe.png diff --git a/textures/exchangeclone_red_matter_pickaxe.png b/exchangeclone/textures/exchangeclone_red_matter_pickaxe.png similarity index 100% rename from textures/exchangeclone_red_matter_pickaxe.png rename to exchangeclone/textures/exchangeclone_red_matter_pickaxe.png diff --git a/textures/exchangeclone_red_matter_shears.png b/exchangeclone/textures/exchangeclone_red_matter_shears.png similarity index 100% rename from textures/exchangeclone_red_matter_shears.png rename to exchangeclone/textures/exchangeclone_red_matter_shears.png diff --git a/textures/exchangeclone_red_matter_shovel.png b/exchangeclone/textures/exchangeclone_red_matter_shovel.png similarity index 100% rename from textures/exchangeclone_red_matter_shovel.png rename to exchangeclone/textures/exchangeclone_red_matter_shovel.png diff --git a/textures/exchangeclone_red_matter_sword.png b/exchangeclone/textures/exchangeclone_red_matter_sword.png similarity index 100% rename from textures/exchangeclone_red_matter_sword.png rename to exchangeclone/textures/exchangeclone_red_matter_sword.png diff --git a/textures/exchangeclone_red_morningstar.png b/exchangeclone/textures/exchangeclone_red_morningstar.png similarity index 100% rename from textures/exchangeclone_red_morningstar.png rename to exchangeclone/textures/exchangeclone_red_morningstar.png diff --git a/textures/exchangeclone_transmutation_table.png b/exchangeclone/textures/exchangeclone_transmutation_table.png similarity index 100% rename from textures/exchangeclone_transmutation_table.png rename to exchangeclone/textures/exchangeclone_transmutation_table.png diff --git a/textures/exchangeclone_transmutation_table_side.png b/exchangeclone/textures/exchangeclone_transmutation_table_side.png similarity index 100% rename from textures/exchangeclone_transmutation_table_side.png rename to exchangeclone/textures/exchangeclone_transmutation_table_side.png diff --git a/textures/exchangeclone_upgrade.png b/exchangeclone/textures/exchangeclone_upgrade.png similarity index 100% rename from textures/exchangeclone_upgrade.png rename to exchangeclone/textures/exchangeclone_upgrade.png diff --git a/textures/exchangeclone_upgrader_bottom.png b/exchangeclone/textures/exchangeclone_upgrader_bottom.png similarity index 100% rename from textures/exchangeclone_upgrader_bottom.png rename to exchangeclone/textures/exchangeclone_upgrader_bottom.png diff --git a/textures/exchangeclone_upgrader_side.png b/exchangeclone/textures/exchangeclone_upgrader_side.png similarity index 100% rename from textures/exchangeclone_upgrader_side.png rename to exchangeclone/textures/exchangeclone_upgrader_side.png diff --git a/textures/exchangeclone_upgrader_top.png b/exchangeclone/textures/exchangeclone_upgrader_top.png similarity index 100% rename from textures/exchangeclone_upgrader_top.png rename to exchangeclone/textures/exchangeclone_upgrader_top.png diff --git a/tool_upgrades.lua b/exchangeclone/tool_upgrades.lua similarity index 100% rename from tool_upgrades.lua rename to exchangeclone/tool_upgrades.lua diff --git a/transmutation_table.lua b/exchangeclone/transmutation_table.lua similarity index 99% rename from transmutation_table.lua rename to exchangeclone/transmutation_table.lua index 6962b1c..e0de461 100644 --- a/transmutation_table.lua +++ b/exchangeclone/transmutation_table.lua @@ -108,11 +108,11 @@ local function handle_inventory(player, inventory, to_list) individual_energy_value = individual_energy_value + exchangeclone.get_orb_itemstack_energy(stack) end local player_energy = exchangeclone.get_player_energy(player) - local max_count = math.floor((2147483647 - player_energy)/individual_energy_value) + local max_count = math.floor((exchangeclone.limit - player_energy)/individual_energy_value) local add_count = math.min(max_count, stack:get_count()) local energy_value = individual_energy_value * add_count local result = player_energy + energy_value - if result < 0 or result > 2147483647 then return end + if result < 0 or result > exchangeclone.limit then return end exchangeclone.set_player_energy(player, result) local item_index = table.indexof(list, stack:get_name()) if item_index == -1 then diff --git a/lib.lua b/lib.lua deleted file mode 100644 index d9832d1..0000000 --- a/lib.lua +++ /dev/null @@ -1,461 +0,0 @@ --- Just a collection of a whole bunch of functions used here. There's very little order. - -function exchangeclone.get_inventory_drops(pos, inventory, drops) --removes default dependency - local inv = minetest.get_meta(pos):get_inventory() - local n = #drops - for i = 1, inv:get_size(inventory) do - local stack = inv:get_stack(inventory, i) - if stack:get_count() > 0 then - drops[n+1] = stack:to_table() - n = n + 1 - end - end -end - -function exchangeclone.get_item_energy(name) - return minetest.registered_items[name].energy_value or -1 -end - -function exchangeclone.round(num) - if num % 1 < 0.5 then - return math.floor(num) - else - return math.ceil(num) - end -end - --- https://forum.unity.com/threads/re-map-a-number-from-one-range-to-another.119437/ -function exchangeclone.map(input, min1, max1, min2, max2) - return (input - min1) / (max1 - min1) * (max2 - min2) + min2 -end - -function exchangeclone.get_orb_itemstack_energy(itemstack) - if not itemstack then return -1 end - if itemstack:get_name() ~= "exchangeclone:exchange_orb" then return -1 end - return itemstack:get_meta():get_float("stored_energy") or 0 -end - -function exchangeclone.get_orb_energy(inventory, listname, index) - if not inventory then return -1 end - if not listname then listname = "main" end - if not index then index = 1 end - local itemstack = inventory:get_stack(listname, index) - return exchangeclone.get_orb_itemstack_energy(itemstack) -end - -if default then exchangeclone.sound_mod = default else exchangeclone.sound_mod = mcl_sounds end - -function exchangeclone.set_orb_energy(inventory, listname, index, amount) - if not inventory or amount < 0 then return end - if not listname then listname = "main" end - if not index then index = 1 end - local itemstack = inventory:get_stack(listname, index) - if not itemstack then return end - if not (itemstack:get_name() and itemstack:get_name() == "exchangeclone:exchange_orb") then return end - local old_energy = exchangeclone.get_orb_itemstack_energy(itemstack) - if amount > old_energy and old_energy > exchangeclone.orb_max then return end -- don't allow more energy to be put into an over-filled orb - - -- Square roots will hopefully make it less linear - -- And if they don't, I don't really care and I don't want to think about math anymore. - local sqrt_amount = math.sqrt(amount) - local sqrt_max = math.sqrt(exchangeclone.orb_max) - - local r, g, b = 0, 0, 0 - if amount == 0 then - -- do nothing - elseif sqrt_amount < (sqrt_max/4) then - r = exchangeclone.map(sqrt_amount, 0, sqrt_max/4, 0, 255) - elseif sqrt_amount < (sqrt_max/2) then - g = exchangeclone.map(sqrt_amount, sqrt_max/4, sqrt_max/2, 0, 255) - r = 255 - g - elseif sqrt_amount < (3*sqrt_max/4) then - b = exchangeclone.map(sqrt_amount, sqrt_max/2, 3*sqrt_max/4, 0, 255) - g = 255 - b - else - r = math.min(exchangeclone.map(sqrt_amount, 3*sqrt_max/4, sqrt_max, 0, 255), 255) - b = 255 - end - - local colorstring = minetest.rgba(r,g,b) - - local meta = itemstack:get_meta() - meta:set_float("stored_energy", amount) - meta:set_string("description", "Exchange Orb\nCurrent Charge: "..amount) - meta:set_string("color", colorstring) - inventory:set_stack(listname, index, itemstack) -end - -local hud_elements = {} - -function exchangeclone.update_hud(player) - local hud_text = hud_elements[player:get_player_name()] - player:hud_change(hud_text, "text", "Personal Energy: "..tostring(exchangeclone.get_player_energy(player))) -end - -minetest.register_on_joinplayer(function(player, last_login) - hud_elements[player:get_player_name()] = player:hud_add({ - hud_elem_type = "text", - position = {x = 1, y = 1}, - offset = {x = 0, y = 0}, - text = "Personal Energy: 0", - alignment = {x = -1, y = -1}, - scale = {x = 100, y = 100}, - number = 0xDDDDDD - }) - exchangeclone.update_hud(player) -end) - -minetest.register_on_leaveplayer(function(player, timed_out) - hud_elements[player:get_player_name()] = nil -end) - -function exchangeclone.get_player_energy(player) - return player:get_meta():get_int("exchangeclone_stored_energy") or 0 -end - -function exchangeclone.set_player_energy(player, amount) - player:get_meta():set_int("exchangeclone_stored_energy", amount) - exchangeclone.update_hud(player) -end - -function exchangeclone.get_group_items(groups, allow_duplicates, include_no_group) - if type(groups) ~= "table" then - return nil - end - - allow_duplicates = allow_duplicates or false - include_no_group = include_no_group or false - - local g_cnt = #groups - - local result = {} - for i = 1, g_cnt do - result[groups[i]] = {} - end - if include_no_group then - result["NO_GROUP"] = {} - end - local in_group - - for name, def in pairs(minetest.registered_items) do - in_group = false - for i = 1, g_cnt do - local grp = groups[i] - if def.groups[grp] ~= nil then - result[grp][#result[grp]+1] = name - in_group = true - if allow_duplicates == false then - break - end - end - end - if include_no_group and in_group == false then - result["NO_GROUP"][#result["NO_GROUP"]+1] = name - end - end - - return result -end - -function exchangeclone.play_ability_sound(player, base_pitch) - if not player then return end - if not base_pitch then base_pitch = 1 end - local new_pitch = base_pitch + (math.random(-100, 100) / 500) - minetest.sound_play("exchangeclone_ability", {pitch = new_pitch, pos = player:get_pos(), max_hear_distance = 20, }) -end - -function exchangeclone.check_on_rightclick(itemstack, player, pointed_thing) - if pointed_thing.type ~= "node" then return false end - if player:get_player_control().sneak then return false end - local node = minetest.get_node(pointed_thing.under) - if player and not player:get_player_control().sneak then - if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then - return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, player, itemstack) or itemstack - end - end - return false -end - -function exchangeclone.range_update(itemstack, player, max) - if not max then max = 4 end - local range = tonumber(itemstack:get_meta():get_int("exchangeclone_item_range")) - if player:get_player_control().sneak then - if range == 0 then - range = max - else - range = range - 1 - end - else - if range == max then - range = 0 - else - range = range + 1 - end - end - minetest.chat_send_player(player:get_player_name(), "Current Range: "..range) - itemstack:get_meta():set_int("exchangeclone_item_range", range) - return itemstack -end - - -exchangeclone.wield_scale = {x=1,y=1,z=1} -if exchangeclone.mcl then - exchangeclone.wield_scale = mcl_vars.tool_wield_scale -end - -exchangeclone.wield_scale = vector.multiply(exchangeclone.wield_scale, 1.5) - -exchangeclone.diamond_itemstring = "default:diamond" -if exchangeclone.mcl then - exchangeclone.diamond_itemstring = "mcl_core:diamond" -end - -local doTileDrops = minetest.settings:get_bool("mcl_doTileDrops", true) - -local function get_fortune_drops(fortune_drops, fortune_level) - local drop - local i = fortune_level - repeat - drop = fortune_drops[i] - i = i - 1 - until drop or i < 1 - return drop or {} -end - -function exchangeclone.inventory_formspec(x,y) - local formspec - if exchangeclone.mcl then - formspec = "list[current_player;main;"..tostring(x)..","..tostring(y)..";9,3;9]".. - mcl_formspec.get_itemslot_bg(x,y,9,3).. - "list[current_player;main;"..tostring(x)..","..tostring(y+3.25)..";9,1]".. - mcl_formspec.get_itemslot_bg(x,y+3.25,9,1) - else - formspec = "list[current_player;main;"..tostring(x)..","..tostring(y)..";8,1]".. - "list[current_player;main;"..tostring(x)..","..tostring(y+1.25)..";8,3;8]" - end - return formspec -end - -local function discrete_uniform_distribution(drops, min_count, max_count, cap) - local new_drops = table.copy(drops) - for i, item in ipairs(drops) do - local new_item = ItemStack(item) - local multiplier = math.random(min_count, max_count) - if cap then - multiplier = math.min(cap, multiplier) - end - new_item:set_count(multiplier * new_item:get_count()) - new_drops[i] = new_item - end - return new_drops -end - -local tmp_id = 0 - -local function get_drops(drop, toolname, param2, paramtype2) - tmp_id = tmp_id + 1 - local tmp_node_name = "mcl_item_entity:" .. tmp_id - minetest.registered_nodes[tmp_node_name] = { - name = tmp_node_name, - drop = drop, - paramtype2 = paramtype2 - } - local drops = minetest.get_node_drops({ name = tmp_node_name, param2 = param2 }, toolname) - minetest.registered_nodes[tmp_node_name] = nil - return drops -end - -function exchangeclone.drop_items_on_player(pos, drops, player) --copied from MineClone's code - if not exchangeclone.mcl then - return minetest.handle_node_drops(pos, drops, player) - end - -- NOTE: This function override allows player to be nil. - -- This means there is no player. This is a special case which allows this function to be called - -- by hand. Creative Mode is intentionally ignored in this case. - if player and player:is_player() and minetest.is_creative_enabled(player:get_player_name()) then - local inv = player:get_inventory() - if inv then - for _, item in ipairs(drops) do - if not inv:contains_item("main", item, true) then - inv:add_item("main", item) - end - end - end - return - elseif not doTileDrops then return end - - -- Check if node will yield its useful drop by the player's tool - local dug_node = minetest.get_node(pos) - local tooldef - local tool - if player then - tool = player:get_wielded_item() - tooldef = minetest.registered_items[tool:get_name()] - - if not mcl_autogroup.can_harvest(dug_node.name, tool:get_name(), player) then - return - end - end - - local diggroups = tooldef and tooldef._mcl_diggroups - local shearsy_level = diggroups and diggroups.shearsy and diggroups.shearsy.level - - --[[ Special node drops when dug by shears by reading _mcl_shears_drop or with a silk touch tool reading _mcl_silk_touch_drop - from the node definition. - Definition of _mcl_shears_drop / _mcl_silk_touch_drop: - * true: Drop itself when dug by shears / silk touch tool - * table: Drop every itemstring in this table when dug by shears _mcl_silk_touch_drop - ]] - - local enchantments = tool and mcl_enchanting.get_enchantments(tool) - - local silk_touch_drop = false - local nodedef = minetest.registered_nodes[dug_node.name] - if not nodedef then return end - - if shearsy_level and shearsy_level > 0 and nodedef._mcl_shears_drop then - if nodedef._mcl_shears_drop == true then - drops = { dug_node.name } - else - drops = nodedef._mcl_shears_drop - end - elseif tool and enchantments.silk_touch and nodedef._mcl_silk_touch_drop then - silk_touch_drop = true - if nodedef._mcl_silk_touch_drop == true then - drops = { dug_node.name } - else - drops = nodedef._mcl_silk_touch_drop - end - end - ---[[]] if tool and nodedef._mcl_fortune_drop and enchantments.fortune then - local fortune_level = enchantments.fortune - local fortune_drop = nodedef._mcl_fortune_drop - if fortune_drop.discrete_uniform_distribution then - local min_count = fortune_drop.min_count - local max_count = fortune_drop.max_count + fortune_level * (fortune_drop.factor or 1) - local chance = fortune_drop.chance or fortune_drop.get_chance and fortune_drop.get_chance(fortune_level) - if not chance or math.random() < chance then - drops = discrete_uniform_distribution(fortune_drop.multiply and drops or fortune_drop.items, min_count, max_count, - fortune_drop.cap) - elseif fortune_drop.override then - drops = {} - end - else - -- Fixed Behavior - local drop = get_fortune_drops(fortune_drop, fortune_level) - drops = get_drops(drop, tool:get_name(), dug_node.param2, nodedef.paramtype2) - end - end ---]] - - if player and mcl_experience.throw_xp and not silk_touch_drop then - local experience_amount = minetest.get_item_group(dug_node.name, "xp") - if experience_amount > 0 then - mcl_experience.throw_xp(player:get_pos(), experience_amount) - end - end - - for _, item in ipairs(drops) do - local count - if type(item) == "string" then - count = ItemStack(item):get_count() - else - count = item:get_count() - end - local drop_item = ItemStack(item) - drop_item:set_count(1) - for i = 1, count do - -- Spawn item - local obj = minetest.add_item(player:get_pos(), drop_item) - if obj then - -- set the velocity multiplier to the stored amount or if the game dug this node, apply a bigger velocity - obj:get_luaentity().age = 0.65 - obj:get_luaentity()._insta_collect = true - end - end - end -end - -function exchangeclone.get_face_direction(player) - local h_look = player:get_look_horizontal() - local v_look = player:get_look_vertical() - - local result = {x = 0, y = 0, z = 0} - - if h_look <= math.pi / 4 or h_look >= (7*math.pi)/4 then - result.z = 1 - elseif h_look > math.pi / 4 and h_look <= (3*math.pi)/4 then - result.x = -1 - elseif h_look > (3*math.pi)/4 and h_look <= (5*math.pi)/4 then - result.z = -1 - else - result.x = 1 - end - - if v_look < -1 then - result.y = 1 - elseif v_look > 1 then - result.y = -1 - end - - return result -end - -function exchangeclone.node_radius_action(player, center, range, functions, extra_info) - if not functions.action then return end - local data - local stop = false - if functions.start_action then - data = functions.start_action(player, center, range, extra_info) - if not data then return end - end - if not center then center = player:get_pos() end - center.x = exchangeclone.round(center.x) - center.y = math.floor(center.y) --make sure y is node BELOW player's feet - center.z = exchangeclone.round(center.z) - for x = center.x-range,center.x+range do - for y = center.y-range,center.y+range do - for z = center.z-range,center.z+range do - local pos = {x=x,y=y,z=z} - local node = minetest.get_node(pos) - local result = functions.action(player, pos, node, data) - if not result then stop = true break end - if result ~= true then data = result end - end - if stop then break end - end - if stop then break end - end - if functions.end_action then - data = functions.end_action(player, center, range, data) - end - return data -end - -exchangeclone.cooldowns = {} - -minetest.register_on_joinplayer(function(player, last_login) - exchangeclone.cooldowns[player:get_player_name()] = {} -end) - -minetest.register_on_leaveplayer(function(player, timed_out) - exchangeclone.cooldowns[player:get_player_name()] = nil -end) - -function exchangeclone.start_cooldown(player, name, time) - local player_name = player:get_player_name() - exchangeclone.cooldowns[player_name][name] = time - minetest.after(time, function() - if exchangeclone.cooldowns[player_name] then - exchangeclone.cooldowns[player_name][name] = nil - end - end) -end - -function exchangeclone.check_cooldown(player, name) - local player_name = player:get_player_name() - if exchangeclone.cooldowns[player_name] then - return exchangeclone.cooldowns[player_name][name] - end -end \ No newline at end of file diff --git a/modpack.conf b/modpack.conf new file mode 100644 index 0000000..b3ab905 --- /dev/null +++ b/modpack.conf @@ -0,0 +1,3 @@ +name = exchangeclone +title = ExchangeClone +description = Equivalent Exchange/ProjectE for Minetest Game and MineClone! Turn items into energy and energy into items, craft OP tools and armor, and more! \ No newline at end of file diff --git a/zzzz_exchangeclone_crafthook/init.lua b/zzzz_exchangeclone_crafthook/init.lua new file mode 100644 index 0000000..27db9a3 --- /dev/null +++ b/zzzz_exchangeclone_crafthook/init.lua @@ -0,0 +1,10 @@ +exchangeclone = {} + +local old_func = minetest.register_craft +function minetest.register_craft(...) + local arg = {...} + if arg.replacements then + table.insert(exchangeclone.recipes, table.copy(arg)) + end + old_func(...) +end \ No newline at end of file diff --git a/zzzz_exchangeclone_crafthook/mod.conf b/zzzz_exchangeclone_crafthook/mod.conf new file mode 100644 index 0000000..2ed2c28 --- /dev/null +++ b/zzzz_exchangeclone_crafthook/mod.conf @@ -0,0 +1,3 @@ +name = zzzz_exchangeclone_crafthook +title = ExchangeClone craft hook +description = Wraps the "minetest.register_craft" function to get data (annoying...) \ No newline at end of file