2 local switched_to_totem = 0
3 local used_sneak = true
4 local totem_move_action = InventoryAction("move")
5 totem_move_action:to("current_player", "main", 9)
7 core.register_list_command("friend", "Configure Friend List (friends dont get attacked by Killaura or Forcefield)", "friendlist")
9 core.register_globalstep(function(dtime)
10 local player = core.localplayer
11 if not player then return end
12 local control = player:get_control()
13 local pointed = core.get_pointed_thing()
14 local item = player:get_wielded_item():get_name()
15 if core.settings:get_bool("killaura") or core.settings:get_bool("forcefield") and control.dig then
16 local friendlist = core.settings:get("friendlist"):split(",")
17 for _, obj in ipairs(core.get_objects_inside_radius(player:get_pos(), 5)) do
18 local do_attack = true
19 if obj:is_local_player() then
22 for _, friend in ipairs(friendlist) do
23 if obj:get_name() == friend or obj:get_nametag() == friend then
33 elseif core.settings:get_bool("crystal_pvp") then
34 if placed_crystal then
35 if core.switch_to_item("mobs_mc:totem") then
38 placed_crystal = false
39 elseif switched_to_totem > 0 then
40 if item ~= "mobs_mc:totem" then
42 elseif pointed and pointed.type == "object" then
46 switched_to_totem = switched_to_totem
48 elseif control.place and item == "mcl_end:crystal" then
50 elseif control.sneak then
51 if pointed and pointed.type == "node" and not used_sneak then
52 local pos = core.get_pointed_thing_position(pointed)
53 local node = core.get_node_or_nil(pos)
54 if node and (node.name == "mcl_core:obsidian" or node.name == "mcl_core:bedrock") then
55 core.switch_to_item("mcl_end:crystal")
66 if core.settings:get_bool("autototem") then
67 local totem_stack = core.get_inventory("current_player").main[9]
68 if totem_stack and totem_stack:get_name() ~= "mobs_mc:totem" then
69 local totem_index = core.find_item("mobs_mc:totem")
71 totem_move_action:from("current_player", "main", totem_index)
72 totem_move_action:apply()
73 player:set_wield_index(9)