Other available versions. Ordered by newest to oldest versions:
Just so you know, we don't know the file format for every file. If it's just a bunch of random characters, it's probably a .zip or .jar.
#©
#- Reselling/Reuploading while claiming that it is yours or made by you is disallowed
#- Do not edit it and upload it as your own
#- While using it in a video, please feature everything under "Video"
#©
#
#Video:
#Skript made by Zeldaboy111
#More content of the creator: https://forums.skunity.com/search/26443679/
options:
logo: &6&lBS&8:&7
tier1Furnace: "&8Furnace I"
tier2Furnace: "&8Furnace II"
permission: "blacksmith"
on disable:
if {furnace1.looping} is true:
set {furnace1.looping} to false
set {furnace1.loopStopped} to true
on enable:
set {blacksmith.cost.helmet} to 5
set {blacksmith.cost.chestplate} to 8
set {blacksmith.cost.leggings} to 7
set {blacksmith.cost.boots} to 4
set {blacksmith.anvilGui.inventoryName::*} to "Anvil Tier I", "Anvil Tier II" and "Anvil Tier III"
set {blacksmith.anvilGui.craftMaterialOrder::*} to "Chain", "Golden", "Iron" and "Diamond"
set {blacksmith.anvilGui.materialOrder::*} to iron nugget, golden ingot, iron ingot and diamond
set {blacksmith.anvilGui.materialColorList::*} to "&f", "&6", "&f" and "&b"
set {blacksmith.anvilGui.materialNameList::*} to "%{blacksmith.anvilGui.materialColorList::1}%Chain", "%{blacksmith.anvilGui.materialColorList::2}%Gold", "%{blacksmith.anvilGui.materialColorList::3}%Iron" and "%{blacksmith.anvilGui.materialColorList::4}%Diamond"
if {blacksmith.advancedMode} is not set:
set {blacksmith.advancedMode} to true
wait 1 second
if {furnace1.loopStopped} is true:
set {furnace1.looping} to true
loop_furnace1()
set {furnace1.loopStopped} to false
# ||=============================================================||
# || _____ ____ __ __ __ __ _ _ _____ ||
# || / ____/ __ \| \/ | \/ | /\ | \ | | __ \ ||
# || | | | | | | \ / | \ / | / \ | \| | | | | ||
# || | | | | | | |\/| | |\/| | / /\ \ | . ` | | | | ||
# || | |___| |__| | | | | | | |/ ____ \| |\ | |__| | ||
# || \_____\____/|_| |_|_| |_/_/ \_\_| \_|_____/ ||
# || ||
# ||=============================================================||
command /blacksmith [<text>] [<text>]:
aliases: /bs
trigger:
if player doesn't have permission {@permission}:
send "{@logo} You do not have enough permissions to do this!"
else:
if arg-1 is "advanced":
if arg-2 is "true" or "enable":
if {blacksmith.advancedMode} is true:
send "{@logo} The &eadvanced mode &7is already enabled."
else:
set {blacksmith.advancedMode} to true
send "{@logo} You have enabled the &eadvanced mode&7."
else if arg-2 is "false" or "disable":
if {blacksmith.advancedMode} is false:
send "{@logo} The &eadvanced mode &7is already disabled."
else:
set {blacksmith.advancedMode} to false
send "{@logo} You have disabled the &eadvanced mode&7."
else:
send "{@logo} Incorrect usage! &e/blacksmith advanced <true | false>&7."
else:
send "{@logo} Incorrect usage! &e/blacksmith advanced <true | false>&7."
#||==============================================================||
#|| _____ ______ _ _ ______ _____ _ ||
#|| / ____| ____| \ | | ____| __ \ /\ | | ||
#|| | | __| |__ | \| | |__ | |__) | / \ | | ||
#|| | | |_ | __| | . ` | __| | _ / / /\ \ | | ||
#|| | |__| | |____| |\ | |____| | \ \ / ____ \| |____ ||
#|| \_____|______|_| \_|______|_| \_\/_/ \_\______| ||
#|| ||
#||==============================================================||
function outlineGui(player: Player):
set {_size} to inventory size of {_player}'s current inventory
loop 9 times:
set slot loop-value - 1 of {_player}'s current inventory to gray stained glass pane named "&7"
set slot {_size} - loop-value of {_player}'s current inventory to gray stained glass pane named "&7"
loop {_size}/9 times:
set slot loop-value * 9 of {_player}'s current inventory to gray stained glass pane named "&7"
set slot loop-value * 9 -1 of {_player}'s current inventory to gray stained glass pane named "&7"
function openGuiWithOutline(player: Player, loc: Location, rows: Number, name: String):
open chest with {_rows} rows named {_name} to {_player}
set {inventory.%{_player}%.name} to uncolored {_name}
set {inventory.%{_player}%.current} to {_loc}
wait 2 ticks
outlineGui({_player})
function openAnvilGui(player: Player):
open chest with 5 rows named {blacksmith.anvilGui.inventoryName::%{anvil.current.%{_player}%}%} to {_player}
outlineGui({_player})
wait 2 ticks
set {_startAt} to 20 - {anvil.current.%{_player}%}
loop 1+{anvil.current.%{_player}%} times:
set slot {_startAt}+loop-value*2 of {_player}'s current inventory to {blacksmith.anvilGui.materialOrder::%loop-value%} named {blacksmith.anvilGui.materialNameList::%loop-value%}
function openAnvilCraftGui(player: Player, materialId: integer):
open chest with 5 rows named {blacksmith.anvilGui.inventoryName::%{anvil.current.%{_player}%}%} to {_player}
outlineGui({_player})
wait 2 ticks
setArmorInSlot({_player}, 20, {_materialId})
function setArmorInSlot(player: Player, slot: int, armorSetId: int):
# Set to variables to make the lines shorter and clearer.
set {_material} to {blacksmith.anvilGui.craftMaterialOrder::%{_armorSetId}%}
set {_color} to {blacksmith.anvilGui.materialColorList::%{_armorSetId}%}
set {_craftingMaterial} to {blacksmith.anvilGui.materialNameList::%{_armorSetId}%}
set {_helmet} to ("%{_material}% helmet" parsed as an item)
set slot {_slot} of {_player}'s current inventory to ("%{_material}% helmet" parsed as an item) named "%{_color}%%{_material}% Helmet" with lore "&8" and "&7Cost&8: %{_color}%5 %{_craftingMaterial}%" without any NBT
set slot {_slot}+1 of {_player}'s current inventory to ("%{_material}% chestplate" parsed as an item) named "%{_color}%%{_material}% Chestplate" with lore "&8" and "&7Cost&8: %{_color}%8 %{_craftingMaterial}%" without any NBT
set slot {_slot}+3 of {_player}'s current inventory to ("%{_material}% leggings" parsed as an item) named "%{_color}%%{_material}% Leggings" with lore "&8" and "&7Cost&8: %{_color}%7 %{_craftingMaterial}%" without any NBT
set slot {_slot}+4 of {_player}'s current inventory to ("%{_material}% boots" parsed as an item) named "%{_color}%%{_material}% Boots" with lore "&8" and "&7Cost&8: %{_color}%4 %{_craftingMaterial}%" without any NBT
# Add crafting recipies & click checks for these items
if {_material} is not "chain":
set slot {_slot}+9 of {_player}'s current inventory to ("%{_material}% sword" parsed as an item) named "%{_color}%%{_material}% Sword" with lore "&8" and "&7Cost&8: %{_color}%2 %{_craftingMaterial}% Sword"
set slot {_slot}+10 of {_player}'s current inventory to ("%{_material}% pickaxe" parsed as an item) named "%{_color}%%{_material}% Pickaxe" with lore "&8" and "&7Cost&8: %{_color}%2 %{_craftingMaterial}% Pickaxe"
set slot {_slot}+11 of {_player}'s current inventory to ("%{_material}% axe" parsed as an item) named "%{_color}%%{_material}% Axe" with lore "&8" and "&7Cost&8: %{_color}%2 %{_craftingMaterial}% Axe"
set slot {_slot}+12 of {_player}'s current inventory to ("%{_material}% shovel" parsed as an item) named "%{_color}%%{_material}% Shovel" with lore "&8" and "&7Cost&8: %{_color}%2 %{_craftingMaterial}% Shovel"
set slot {_slot}+13 of {_player}'s current inventory to ("%{_material}% hoe" parsed as an item) named "%{_color}%%{_material}% Hoe" with lore "&8" and "&7Cost&8: %{_color}%2 %{_craftingMaterial}% Hoe"
function openAnvilGui_1(player: Player):
open chest with 6 rows named "Anvil Tier I" to {_player}
wait 2 ticks
outlineGui({_player})
function openAnvilGui_2(player: Player):
open chest with 6 rows named "Anvil Tier II" to {_player}
wait 2 ticks
outlineGui({_player})
function openAnvilGui_3(player: Player):
open chest with 6 rows named "Anvil Tier III" to {_player}
wait 2 ticks
outlineGui({_player})
function removeItemFromPlayer(player: Player, item: Item, amount: Number):
if {_amount} > 0:
if {_item} is set:
if gamemode of {_player} is survival or adventure:
remove "%{_amount}% %{_item}%" parsed as an item from {_player}'s inventory
#||===============================================||
#|| _ ___ _______ _ ||
#|| /\ | \ | \ \ / /_ _| | ||
#|| / \ | \| |\ \ / / | | | | ||
#|| / /\ \ | . ` | \ \/ / | | | | ||
#|| / ____ \| |\ | \ / _| |_| |____ ||
#|| /_/ \_\_| \_| \/ |_____|______| ||
#|| ||
#||===============================================||
function getRecipeItemFromType(type: String) :: item:
if {_type} is "chain":
return "iron nugget" parsed as an item
else if {_type} is "diamond":
return "diamond" parsed as an item
return "%{_type}% ingot" parsed as an item
function tryCraftArmour(player: Player, type: String, piece: String):
if {_player}'s gamemode is spectator:
stop
set {_result} to "%{_type}% %{_piece}%" parsed as an item
set {_recipeItem} to getRecipeItemFromType({_type})
set {_recipeAmount} to {blacksmith.cost.%{_piece}%}
set {_recipeAmountFromPlayer} to amount of {_recipeItem} in {_player}'s inventory
if {_player}'s gamemode is survival or adventure:
if {_recipeAmountFromPlayer} < {_recipeAmount}:
play "ENTITY_ITEM_BREAK" to {_player} at volume 10
stop
if {blacksmith.advancedMode} is false:
give {_result} to {_player}
removeItemFromPlayer({_player}, {_recipeItem}, {_recipeAmount})
play sound "block.anvil.use" with volume 10 and pitch 1 to {_player}
else:
playBlacksmithMinigame({_player}, {_recipeItem}, {_recipeAmount}, {_result})
function playBlacksmithMinigame(player: Player, costItem: Item, cost: Number, result: Item):
set {blacksmith.smithing.%{_player}%.costItem} to {_costItem}
set {blacksmith.smithing.%{_player}%.cost} to {_cost}
set {blacksmith.smithing.%{_player}%.result} to {_result}
set {blacksmith.smithing.%{_player}%.chainmail} to false
set {blacksmith.smithing.%{_player}%.stage} to 0
open chest with 6 rows named "Smithing" to {_player}
outlineGui({_player})
set {_result1} to "%type of {_result}%"
if {_result1} contains "chain":
playMinigame_chain({_player})
else:
setSmithingGui({_player})
function playMinigame_chain(player: Player):
set {inventory.%{_player}%.name} to uncolored "Smithing"
set {blacksmith.smithing.%{_player}%.chainmail} to true
set {_random::*} to 39 and 41
set {_slot} to random element out of {_random::*}
remove {_slot} from {_random::*}
set {_slot1} to random element out of {_random::*}
set {_resultMaterial} to "%type of {blacksmith.smithing.%{_player}%.result}%"
set slot {_slot} of {_player}'s current inventory to iron nugget named "&fCreate Rings" without any NBT
set slot {_slot1} of {_player}'s current inventory to iron hoe named "&fJoin Rings" without any NBT
set slot 22 of {_player}'s current inventory to iron nugget named "&a&lCreate Rings" with lore "&7", "&7Click the corresponding item" and "&7to continue crafting."
set slot 13 of {_player}'s current inventory to {_result} named "&f&n%first character of {_resultMaterial} in upper case%%last (length of {_resultMaterial}-1) characters of {_resultMaterial} in lower case%" without any NBT
function setSmithingGui(player: Player):
set {blacksmith.smithing.%{_player}%.chainmail} to false
set {blacksmith.smithing.%{_player}%.stage} to 0
set {inventory.%{_player}%.name} to uncolored "Smithing II"
open chest with 6 rows named "Smithing" to {_player}
outlineGui({_player})
set {_result1} to "%type of {blacksmith.smithing.%{_player}%.result}%"
#set slot 22 of {_player}'s current inventory to iron ingot named "&a&lBend" with lore "&7", "&7Click the corresponding item" and "&7to continue crafting."
set slot 22 of {_player}'s current inventory to iron pressure plate named "&a&lDraw" with lore "&7", "&7Click the corresponding item" and "&7to continue crafting."
set slot 13 of {_player}'s current inventory to {blacksmith.smithing.%{_player}%.result} named "&f&n%first character of {_result1} in upper case%%last (length of {_result1}-1) characters of {_result1} in lower case%" without any NBT
set {_random::*} to 38, 39, 41 and 42
set {_slot} to random element out of {_random::*}
remove {_slot} from {_random::*}
set {_slot1} to random element out of {_random::*}
remove {_slot1} from {_random::*}
set {_slot2} to random element out of {_random::*}
remove {_slot2} from {_random::*}
set {_slot3} to random element out of {_random::*}
set slot {_slot} of {_player}'s current inventory to iron ingot named "&fBend" without any NBT
set slot {_slot1} of {_player}'s current inventory to iron axe named "&fHammer" without any NBT
set slot {_slot2} of {_player}'s current inventory to water bucket named "&fCool" without any NBT
set slot {_slot3} of {_player}'s current inventory to iron pressure plate named "&fDraw" without any NBT
#gui 1: choose material to work with
#gui 2: choose armour/tool to craft
# Note: disable crafting of tools :)
function userFailedMinigame(player: Player):
removeItemFromPlayer({_player}, {blacksmith.smithing.%{_player}%.costItem}, {blacksmith.smithing.%{_player}%.cost})
play sound "entity.item.break" with volume 10 and pitch 1 to {_player}
close {_player}'s inventory
#||=============================================================||
#|| ______ _ _ _____ _ _ _____ ______ ||
#|| | ____| | | | __ \| \ | | /\ / ____| ____| ||
#|| | |__ | | | | |__) | \| | / \ | | | |__ ||
#|| | __| | | | | _ /| . ` | / /\ \| | | __| ||
#|| | | | |__| | | \ \| |\ |/ ____ \ |____| |____ ||
#|| |_| \____/|_| \_\_| \_/_/ \_\_____|______| ||
#|| ||
#||=============================================================||
function getFuelingTime(type: item) :: integer:
if type of {_type} = lava bucket:
return 20000
else if type of {_type} = coal block:
return 16000
else if type of {_type} = dried kelp block:
return 4000
else if type of {_type} = blaze rod:
return 2400
else if type of {_type} = coal or charcoal:
return 1600
else if type of {_type} = any boat or scaffolding:
return 1200
else if type of {_type} = any log or any planks or any wood slab or oak wood stairs or spruce wood stairs or birch wood stairs or jungle wood stairs or acacia wood stairs or dark oak wood stairs or any wooden button or any wooden trapdoor or any fence gate or any fence or ladder or crafting table or cartography table or fletching table or smithing table or loom or bookshelf or lectern or composter or chest or trapped chest or barrel or daylight detector or jukebox or note block or red mushroom block or brown mushroom block or mushroom stem or banner or bow or fishing rod:
return 300
else if type of {_type} = any wooden door or any sign or wooden pickaxe or wooden shovel or wooden hoe or wooden axe or wooden sword:
return 200
else if type of {_type} = bowl or any sapling or stick or any wool:
return 100
else if type of {_type} = any carpet:
return 67
else if type of {_type} = bamboo:
return 50
return 0
# Returns if the item can be smelted in the furnace, every smelt takes 10 seconds in a normal furnace
function canSmelt(type: Item, tier: Integer) :: boolean:
if type of {_type} is iron ore or gold ore or lapis ore or redstone ore or coal ore:
return true
else if {_tier} is 2:
if type of {_type} is diamond ore or emerald ore or nether quartz ore:
return true
return false
function canSmeltInFurnace(p: Player, item: Item) :: boolean:
set {_furnaceId} to {inventory.%{_p}%.current}
if {furnace1.%{_furnaceId}%.contents.oreType} is set:
if "%type of {_item}%" is not "%{furnace1.%{_furnaceId}%.contents.oreType}%":
return false
if {furnace1.%{_furnaceId}%.contents.ingotType} is set:
if type of {_item} is coal ore:
if type of {furnace1.%{_furnaceId}%.contents.ingotType} is coal:
return true
set {_item} to "%type of {_item}%"
replace all " ore" in {_item} with " ingot"
if {_item} is not "%{furnace1.%{_furnaceId}%.contents.ingotType}%":
return false
return true
function isFurnace1(below: Location) :: boolean:
if block at {_below} is campfire:
set {_xAdjust::*} to 1, 1, 1, 0, 0, -1, -1 and -1
set {_zAdjust::*} to 1, 0, -1, 1, -1, 1, 0 and -1
loop 8 times:
set {_checkLoc} to location at x-coordinate of {_below}+{_xAdjust::%loop-value%}, y-coordinate of {_below}, z-coordinate of {_below}+{_zAdjust::%loop-value%} in world of {_below}
if block at {_checkLoc} is not red brick block:
return false
else:
return false
return true
function getStartDirection(loc: location, x: numbers, z: numbers, layer1: items) :: number:
set {_dirNumber} to 1
loop 4 times:
if block at location at x-coordinate of {_loc} + {_x::%{_dirNumber}%}, y-coordinate of {_loc}, z-coordinate of {_loc} + {_z::%{_dirNumber}%} in world of {_loc} is {_layer1::1}:
return ({_dirNumber} - 1)
add 2 to {_dirNumber}
return -2
function isFurnace2(loc: Location) :: boolean:
set {_layer1::*} to air, brick slab, red brick block, air, red brick block, air, red brick block and brick slab
set {_layer2::*} to air, red brick stair, eastward red brick stair and southward red brick stair
set {_x::*} to 1, 1, 0, -1, -1, -1, 0 and 1
set {_z::*} to 0, 1, 1, 1, 0, -1, -1 and -1
set {_startDirection} to getStartDirection({_loc}, {_x::*}, {_z::*}, {_layer1::*})
set {_size} to size of {_x::*}
if {_startDirection} is -2:
return false
loop 7 times:
set {_checkDirection} to getNextCheckingDirection({_startDirection}, loop-value, {_size})
if block at location at x-coordinate of {_loc} + {_x::%{_checkDirection}%}, y-coordinate of {_loc}, z-coordinate of {_loc} + {_z::%{_checkDirection}%} in world of {_loc} is not {_layer1::%loop-value%}:
return false
set {_facingAdjust::*} to 0, 4, 6 and 8
if checkIfBlockIsStair({_startDirection}, location 1 meters above {_loc}, "top "):
loop 4 times:
set {_value} to getNextCheckingDirection({_startDirection}, loop-value*2, {_size}) - 1
set {_check} to location at x-coordinate of {_loc} + {_x::%{_value}%}, y-coordinate of {_loc} + 1, z-coordinate of {_loc} + {_z::%{_value}%} in world of {_loc}
set {_facing} to {_startDirection}
if {_facing} - {_facingAdjust::%loop-value%} >= 2:
remove {_facingAdjust::%loop-value%} from {_facing}
else:
add {_facingAdjust::%loop-value%} to {_facing}
if loop-value is 1:
if block at {_check} is not {_layer2::%loop-value%}:
return false
else if checkIfBlockIsStair({_facing} - 2, {_check}, "") is false:
return false
if block at location 2 meters above {_loc} is not red brick block:
return false
else:
return false
return true
function getNextCheckingDirection(startDirection: Number, addToDefault: Number, max: Number) :: number:
set {_value} to {_startDirection}+{_addToDefault}
if {_value} > {_max}:
set {_value} to {_addToDefault} - ({_max}-{_startDirection})
return {_value}
function checkIfBlockIsStair(direction: Number, loc: Location, startValue: String) :: boolean:
set {_list::*} to "westward red brick stair", "red brick stair", "eastward red brick stair" and "southward red brick stair"
set {_dir} to {_direction}/2+1
if {_dir} > 4:
set {_dir} to ({_direction}/2)-3
if "%block at location of {_loc}%" is "%{_startValue}%%{_list::%{_dir}%}%":
return true
return false
function setSlotInInventory(p: Player, slot: Number, tierNumber: Integer, loc: Location, type: String):
set slot {_slot} of {_p}'s current inventory to lime stained glass pane named "&a&l%{_type}%"
set {_type} to {_type} in lower case
if {furnace%{_tierNumber}%.%{_loc}%.contents.%{_type}%} > 0:
set slot {_slot} of {_p}'s current inventory to ("%{furnace%{_tierNumber}%.%{_loc}%.contents.%{_type}%}% %{furnace%{_tierNumber}%.%{_loc}%.contents.%{_type}%Type}%" parsed as an item)
function guiFurnace(p: Player, loc: Location, name: String, tier: String):
openGuiWithOutline({_p}, {_loc}, 6, {_name})
set {_tierNumber} to getTierNumber({_tier})
add {_p} to {inventoryList.%{_loc}%.furnace %{_tier}%::*}
if {furnace%{_tierNumber}%.%{_loc}%.contents.ingotType} is not set:
set {furnace%{_tierNumber}%.%{_loc}%.contents.ingot} to 0
if {furnace%{_tierNumber}%.%{_loc}%.contents.oreType} is not set:
set {furnace%{_tierNumber}%.%{_loc}%.contents.ore} to 0
if {furnace%{_tierNumber}%.%{_loc}%.contents.fuelType} is not set:
set {furnace%{_tierNumber}%.%{_loc}%.contents.fuel} to 0
set {inventory.%{_p}%.tier} to {_tier}
set {inventory.%{_p}%.tierNumber} to {_tierNumber}
if {furnace%{_tierNumber}%.%{_loc}%.contents.fuelType} is set:
if {furnace%{_tierNumber}%.%{_loc}%.fuelingTimeMax} is not set:
set {furnace%{_tierNumber}%.%{_loc}%.fuelingTimeMax} to getFuelingTime({furnace%{_tierNumber}%.%{_loc}%.contents.fuelType}) / 20
if {_tier} is "II":
set {furnace%{_tierNumber}%.%{_loc}%.fuelingTimeMax} to {furnace%{_tierNumber}%.%{_loc}%.fuelingTimeMax}*1.05
setSlotInInventory({_p}, 38, {_tierNumber}, {_loc}, "Ore")
setSlotInInventory({_p}, 40, {_tierNumber}, {_loc}, "Fuel")
setSlotInInventory({_p}, 42, {_tierNumber}, {_loc}, "Ingot")
loop 5 times:
set slot 19 + loop-value of {_p}'s current inventory to gray stained glass pane named "&f%20*loop-value%%%"
updateInventoryFuelIndicator({_loc}, {furnace%{_tierNumber}%.%{_loc}%.smeltTime}, " %{_tier}%")
function guiFurnace1(p: Player, loc: Location):
guiFurnace({_p}, {_loc}, {@tier1Furnace}, "I")
function guiFurnace2(p: Player, loc: Location):
guiFurnace({_p}, {_loc}, {@tier2Furnace}, "II")
function getTierNumber(tier: String) :: Integer:
replace all " " in {_tier} with ""
if {_tier} is "I":
return 1
return 2
function updateItemInFurnace(player: Player, item: item, typeLower: String, leftClick: Boolean) :: item:
if {_leftClick} is false:
add 1 to {furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.contents.%{_typeLower}%}
set {furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.contents.%{_typeLower}%Type} to "%type of {_item}%"
set {_item} to "%item amount of {_item} - 1% %type of {_item}%" parsed as an item
else:
if {furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.contents.%{_typeLower}%} + item amount of {_item} > 64:
set {_item} to "%(item amount of {_item} - (64 - {furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.contents.%{_typeLower}%}))% %type of {_item}%"
set {furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.contents.%{_typeLower}%} to 64
set {_player}'s cursor to {_item}
else:
add item amount of {_item} to {furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.contents.%{_typeLower}%}
set {furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.contents.%{_typeLower}%Type} to "%type of {_item}%"
set {_item} to air
return {_item}
function setItemInSlot(player: Player, type: String, slot: Number, clickedItem: Item, item: Item, startLoop: Boolean, leftClick: Boolean):
if {_type} is not "Ore" or "Fuel" or "Ingot":
stop
set {_typeLower} to {_type} in lower case
if {furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.contents.%{_typeLower}%} >= 64:
stop
set {_item} to updateItemInFurnace({_player}, {_item}, {_typeLower}, {_leftClick})
set {_typeString} to " II"
if {inventory.%{_player}%.tierNumber} is 1:
set {_typeString} to " I"
set {_player}'s cursor to {_item}
updateItemInSlot({inventory.%{_player}%.current}, {_type}, {_slot}, {_typeString}, {inventory.%{_player}%.tierNumber})
set {furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.%{_typeLower}%} to item amount of {_clickedItem}
set {furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.%{_typeLower}%Type} to type of {_clickedItem}
if {_type} is "Fuel":
set {furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.fuelingTimeMax} to getFuelingTime({furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.contents.fuelType} parsed as an item) / 20
if {_typeString} is " II":
set {furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.fuelingTimeMax} to {furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.fuelingTimeMax}*1.05
if {_startLoop}:
if {furnace.%{inventory.%{_player}%.current}%.isAddedToLoop} is not true:
add {inventory.%{_player}%.current} to {furnace1.loopList::*}
set {_id} to size of {furnace1.loopList::*}
set {furnace.idList::%{_id}%} to {_typeString}
set {furnace.idBinds::%{inventory.%{_player}%.current}%} to {_id}
loop_furnace1()
function updateItemInSlot(furnaceId: Location, type: String, slot: Number, furnaceTier: String, typeId: integer):
set {_typeLower} to {_type} in lower case
loop {inventoryList.%{_furnaceId}%.furnace%{_furnaceTier}%::*}:
set slot {_slot} of loop-value's current inventory to ("%{furnace%{_typeId}%.%{_furnaceId}%.contents.%{_typeLower}%}% %{furnace%{_typeId}%.%{_furnaceId}%.contents.%{_typeLower}%Type}%" parsed as an item)
if {furnace%{_typeId}%.%{_furnaceId}%.contents.%{_typeLower}%} <= 0:
set slot {_slot} of loop-value's current inventory to lime stained glass pane named "&a&l%{_type}%"
function updateItemAndRemoveFromLoop(p: Player, item: Item, slot: Number, furnaceTier: Integer, furnaceTierString: String, itemName: String, leftClick: Boolean):
set {_nameLower} to {_itemName} in lower case
set {_amount} to {furnace%{inventory.%{_p}%.tierNumber}%.%{inventory.%{_p}%.current}%.contents.%{_nameLower}%}
set {_removedAmount} to {_amount}
if {_leftClick} is false:
set {_removedAmount} to getAmountToRemove({_amount}, {_amount} / 2)
set {_p}'s cursor slot to ("%{_removedAmount}% %{furnace%{inventory.%{_p}%.tierNumber}%.%{inventory.%{_p}%.current}%.contents.%{_nameLower}%Type}%" parsed as an item)
set {furnace%{inventory.%{_p}%.tierNumber}%.%{inventory.%{_p}%.current}%.contents.%{_nameLower}%} to {_amount}-{_removedAmount}
if {_amount}-{_removedAmount} <= 0:
delete {furnace%{inventory.%{_p}%.tierNumber}%.%{inventory.%{_p}%.current}%.contents.%{_nameLower}%Type}
set slot ({_slot}) of {_p}'s current inventory to lime stained glass pane named "&a&l%{_itemName}%"
if {_nameLower} is "ore" or "fuel":
resetFuelIndicator({inventory.%{_p}%.current}, {_furnaceTierString})
else:
set slot ({_slot}) of {_p}'s current inventory to "%{_amount}-{_removedAmount}% %{furnace%{inventory.%{_p}%.tierNumber}%.%{inventory.%{_p}%.current}%.contents.%{_nameLower}%Type}%" parsed as an item
function getAmountToRemove(total: Number, amount: Number) :: Number:
if {_amount} is {_total}:
set {_amount} to 1
add "%({_total}-1) / 2%" parsed as an integer to {_amount}
set {_item} to "%{_total} - {_amount} + 1% %type of {_item}%" parsed as an item
else:
set {_item} to "%{_total} - {_amount}% %type of {_item}%" parsed as an item
return {_amount}
function updateInventoryFuelIndicator(furnaceId: Location, progressBar: Integer, furnaceTier: String):
if {_progressBar} <= 4:
if {_progressBar} >= 0:
loop {inventoryList.%{_furnaceId}%.furnace%{_furnaceTier}%::*}:
loop {_progressBar} times:
set slot 19 + loop-value-2 of loop-value-1's current inventory to lime stained glass pane named "&f%20*loop-value-2%%%"
loop 5-{_progressBar} times:
set slot 25-loop-value-2 of loop-value-1's current inventory to dark gray stained glass pane named "&f%100 - 20*((loop-value-2)-1)%%%"
function resetFuelIndicator(furnaceId: Location, furnaceTier: String):
set {furnace1.%{_furnaceId}%.smeltTime} to 0
loop {inventoryList.%{_furnaceId}%.furnace%{_furnaceTier}%::*}:
loop 5 times:
set slot 19 + loop-value-2 of loop-value-1's current inventory to gray stained glass pane named "&f%20*loop-value-2%%%"
if {_furnaceTier} is " I":
removeFurnaceFromLoop({_furnaceId})
else:
removeFurnaceFromLoop({_furnaceId})
function setIngotType(furnaceId: Location, tier: Number):
if {furnace%{_tier}%.%{_furnaceId}%.contents.ingotType} is set:
stop
set {_type} to "%{furnace%{_tier}%.%{_furnaceId}%.contents.oreType}%"
if {_tier} is 2:
if {_type} is "diamond ore", "emerald ore" or "nether quartz ore":
replace all " ore" in {_type} with " ingot"
{furnace%{_tier}%.%{_furnaceId}%.contents.ingotType}
stop
if "%{_type}%" is "iron ore", "gold ore", "lapis ore" or "redstone ore":
replace "ore" in {_type} with "ingot"
set {furnace%{_tier}%.%{_furnaceId}%.contents.ingotType} to {_type} parsed as an item
else if {_type} is "coal ore":
set {furnace%{_tier}%.%{_furnaceId}%.contents.ingotType} to coal
function removeFurnaceFromLoop(furnaceId: Location):
delete {furnace.%{_furnaceId}%.isAddedToLoop}
delete {furnace.idList::%{furnace.idBinds::%{_furnaceId}%}%}
delete {furnace.idBinds::%{_furnaceId}%}
remove {_furnaceId} from {furnace1.loopList::*}
if size of {furnace1.loopList::*} is 0:
set {furnace1.looping} to false
function loop_furnace1():
if {furnace1.looping} is not true:
set {furnace1.looping} to true
while {furnace1.looping} is true:
if size of {furnace1.loopList::*} is 0:
set {furnace1.looping} to false
stop loop
else:
set {_current} to 0
loop {furnace1.loopList::*}:
add 1 to {_current}
set {_type} to {furnace.idList::%{_current}%}
set {_tier} to getTierNumber({_type})
if {furnace%{_tier}%.%loop-value%.contents.ore} < 1:
updateInventoryFuelIndicator(loop-value, 0, {_type})
removeFurnaceFromLoop(loop-value)
else:
if {furnace%{_tier}%.%loop-value%.fuelingTime} is not set:
remove 1 from {furnace%{_tier}%.%loop-value%.contents.fuel}
set {furnace%{_tier}%.%loop-value%.fuelingTime} to 0
updateItemInSlot(loop-value, "Fuel", 40, {_type}, {_tier})
add 1 to {furnace%{_tier}%.%loop-value%.smeltTime}
add 1 to {furnace%{_tier}%.%loop-value%.fuelingTime}
if "%{furnace%{_tier}%.%loop-value%.smeltTime}/2.0%" doesn't contain ".":
if {furnace%{_tier}%.%loop-value%.smeltTime}/2 > 4:
updateInventoryFuelIndicator(loop-value, 0, {_type})
else:
updateInventoryFuelIndicator(loop-value, "%{furnace%{_tier}%.%loop-value%.smeltTime}/2%" parsed as an integer, {_type})
if {furnace%{_tier}%.%loop-value%.smeltTime} > 9:
delete {furnace%{_tier}%.%loop-value%.smeltTime}
remove 1 from {furnace%{_tier}%.%loop-value%.contents.ore}
if {furnace%{_tier}%.%loop-value%.contents.ingot} is not set:
set {furnace%{_tier}%.%loop-value%.contents.ingot} to 0
add 1 to {furnace%{_tier}%.%loop-value%.contents.ingot}
setIngotType(loop-value, {_tier})
updateItemInSlot(loop-value, "Ore", 38, {_type}, {_tier})
updateItemInSlot(loop-value, "Ingot", 42, {_type}, {_tier})
updateInventoryFuelIndicator(loop-value, 0, {_type})
if {furnace%{_tier}%.%loop-value%.fuelingTime} >= {furnace%{_tier}%.%Loop-value%.fuelingTimeMax}:
if {furnace%{_tier}%.%loop-value%.contents.fuel} <= 0:
delete {furnace%{_tier}%.%loop-value%.smeltTime}
removeFurnaceFromLoop(loop-value)
updateInventoryFuelIndicator(loop-value, 0, {_type})
else:
delete {furnace%{_tier}%.%loop-value%.fuelingTime}
wait 1 second
#||======================================================||
#|| ________ ________ _ _ _______ _____ ||
#|| | ____\ \ / / ____| \ | |__ __/ ____| ||
#|| | |__ \ \ / /| |__ | \| | | | | (___ ||
#|| | __| \ \/ / | __| | . ` | | | \___ \ ||
#|| | |____ \ / | |____| |\ | | | ____) | ||
#|| |______| \/ |______|_| \_| |_| |_____/ ||
#|| ||
#||======================================================||
on rightclick on smooth stone:
if player is not sneaking:
if {anvil.%location of clicked block%} is true:
set {anvil.current.%player%} to 1
openAnvilGui(player)
cancel event
on rightclick on iron block:
if player is not sneaking:
if {anvil.%location of clicked block%} is true:
set {anvil.current.%player%} to 2
openAnvilGui(player)
cancel event
on rightclick on diamond block:
if player is not sneaking:
if {anvil.%location of clicked block%} is true:
set {anvil.current.%player%} to 3
openAnvilGui(player)
cancel event
on rightclick on cauldron:
if {furnace.%location of event-block%} is true:
if isFurnace1(location 1 meters below clicked block):
cancel event
guiFurnace1(player, location of clicked block)
else:
delete {furnace1.%location of clicked block%.contents.fuel}
delete {furnace1.%location of clicked block%.contents.ore}
delete {furnace1.%location of clicked block%.contents.ingot}
delete {furnace.%location of event-block%}
on rightclick on blast furnace:
if {furnace2.%location of event-block%} is true:
if isFurnace2(location of clicked block):
cancel event
guiFurnace2(player, location of clicked block)
else:
delete {furnace2.%location of event-block%}
on rightclick holding any axe:
if clicked block is smooth stone or iron block or diamond block:
if {anvil.%location of event-block%} is not true:
if held item of player is wooden axe:
send "{@logo} You cannot make an anvil using a wooden axe."
stop
set {anvil.%location of event-block%} to true
set {_tier} to "Tier I"
if clicked block is smooth stone:
set {anvil.%location of event-block%.tier} to 1
else if clicked block is iron block:
set {anvil.%location of event-block%.tier} to 2
set {_tier} to "Tier II"
else:
set {anvil.%location of event-block%.tier} to 3
set {_tier} to "Tier III"
set {_s} to 6
loop all players in radius 6 around event-block:
set {_v} to ({_s} - distance between loop-player and event-block)
play sound "block.anvil.place" with volume {_v} and pitch 0 to loop-player
send "{@logo} Successfully created an anvil of %{_tier}%."
summon armor stand at location 0.6 meters below event-block
set name of last spawned armor stand to "&7Anvil"
add "{Invisible:1b,NoGravity:1b,NoAI:1b,CustomNameVisible:1}" to NBT of last spawned armor stand
summon armor stand at location 0.9 meters below event-block
set name of last spawned armor stand to "&7%{_tier}%"
add "{Invisible:1b,NoGravity:1b,NoAI:1b,CustomNameVisible:1}" to NBT of last spawned armor stand
show 5 dust of anvil at location 0.0 meters above location of event-block
else if clicked block is cauldron:
if {furnace.%location of event-block%} is not true:
if held item of player is wooden axe:
send "{@logo} You cannot make a furnace using a wooden axe."
else if isFurnace1(location 1 meters below clicked block):
set {furnace.%location of event-block%} to true
show 5 dust of anvil at location 0.0 meters above location of event-block
cancel event
else if clicked block is blast furnace:
if {furnace.%location of event-block%} is not true:
if held item of player is wooden axe:
send "{@logo} You cannot make a furnace using a wooden axe."
else if isFurnace2(location of clicked block):
set {furnace2.%location of event-block%} to true
show 5 dust of anvil at location 0.0 meters above location of event-block
cancel event
on break of smooth stone or iron block or diamond block:
if {anvil.%location of event-block%} is true:
set {_s} to 6
loop all players in radius 6 around event-block:
set {_v} to ({_s} - distance between loop-player and event-block)
play sound "block.anvil.place" with volume {_v} and pitch 0 to loop-player
delete {anvil.%location of event-block%}
delete {anvil.%location of event-block%.tier}
loop entities in radius 1 around event-block:
if type of loop-entity is armor stand:
kill loop-entity
on inventory click:
if type of clicked inventory is chest inventory:
if inventory name of player's current inventory is {@tier1Furnace} or {@tier2Furnace}:
cancel event
if clicked slot is set:
if clicked item is not air:
set {_item} to player's cursor slot
set {_leftClick} to false
if click type is left mouse button:
set {_leftClick} to true
if {_item} is not air:
if name of clicked item is "&a&lOre":
if canSmelt({_item}, 1):
if canSmeltInFurnace(player, {_item}):
setItemInSlot(player, "Ore", clicked slot, clicked item, {_item}, true, {_leftClick})
else if name of clicked item is "&a&lFuel":
if getFuelingTime({_item}) > 0:
setItemInSlot(player, "Fuel", clicked slot, clicked item, {_item}, true, {_leftClick})
else if getFuelingTime(clicked item) > 0:
if getFuelingTime({_item}) > 0:
setItemInSlot(player, "Fuel", clicked slot, clicked item, {_item}, false, {_leftClick})
else if canSmelt(clicked item, 1) is true:
if canSmelt({_item}, 1):
if canSmeltInFurnace(player, {_item}):
setItemInSlot(player, "Ore", clicked slot, clicked item, {_item}, false, {_leftClick})
else if clicked slot is 42:
if type of clicked item is not lime stained glass pane:
updateItemAndRemoveFromLoop(player, clicked item, clicked slot, 1, " %{inventory.%player%.tier}%", "Ingot", {_leftClick})
else if getFuelingTime(clicked item) > 0:
updateItemAndRemoveFromLoop(player, clicked item, clicked slot, 1, " %{inventory.%player%.tier}%", "Fuel", {_leftClick})
else if canSmelt(clicked item, 1) is true:
updateItemAndRemoveFromLoop(player, clicked item, clicked slot, 1, " %{inventory.%player%.tier}%", "Ore", {_leftClick})
else if inventory name of player's current inventory starts with "Anvil Tier ":
cancel event
if clicked slot is set:
if clicked item is any helmet, any chestplate, any leggings or any boots:
set {_item::*} to ("%type of clicked item%") split at " "
tryCraftArmour(player, {_item::1}, {_item::2})
else:
loop {blacksmith.anvilGui.materialOrder::*}:
if {blacksmith.anvilGui.materialNameList::%loop-index%} is set:
if clicked item is {blacksmith.anvilGui.materialOrder::%loop-index%} named {blacksmith.anvilGui.materialNameList::%loop-index%}:
openAnvilCraftGui(player, loop-index parsed as an integer)
else if inventory name of player's current inventory is "Smithing":
cancel event
if clicked slot is set:
if {blacksmith.smithing.%player%.chainmail} is true:
if clicked item is iron nugget named "&fCreate Rings" without any NBT:
if {blacksmith.smithing.%player%.stage} is 0:
add 1 to {blacksmith.smithing.%player%.stage}
set slot 22 of player's current inventory to iron hoe named "&a&lJoin Rings" with lore "&7", "&7Click the corresponding item" and "&7to continue crafting." without any NBT
play sound "entity.item.pickup" with volume 12 and pitch 2 to player
else:
userFailedMinigame(player)
else if clicked item is iron hoe named "&fJoin Rings" without any NBT:
if {blacksmith.smithing.%player%.stage} is 1:
add 1 to {blacksmith.smithing.%player%.stage}
play sound "block.anvil.land" with volume 10 and pitch 1 to player
setSmithingGui(player)
else:
userFailedMinigame(player)
else:
if clicked item is iron pressure plate named "&fDraw" without any NBT:
if {blacksmith.smithing.%player%.stage} is 0:
play sound "block.anvil.use" with volume 12 and pitch 1 to player
if {blacksmith.smithing.%player%.stage} is 0:
set slot 22 of player's current inventory to iron ingot named "&a&lBend" with lore "&7", "&7Click the corresponding item" and "&7to continue crafting." without any NBT
add 1 to {blacksmith.smithing.%player%.stage}
else:
userFailedMinigame(player)
else if clicked item is iron ingot named "&fBend" without any NBT:
if {blacksmith.smithing.%player%.stage} is 1 or 3:
play sound "block.anvil.use" with volume 12 and pitch 2 to player
if {blacksmith.smithing.%player%.stage} is 1:
set slot 22 of player's current inventory to iron axe named "&a&lHammer" with lore "&7", "&7Click the corresponding item" and "&7to continue crafting." without any NBT
else:
set slot 22 of player's current inventory to water bucket named "&a&lCool" with lore "&7", "&7Click the corresponding item" and "&7to continue crafting."
add 1 to {blacksmith.smithing.%player%.stage}
else:
userFailedMinigame(player)
else if clicked item is iron axe named "&fHammer" without any NBT:
if {blacksmith.smithing.%player%.stage} is 2:
add 1 to {blacksmith.smithing.%player%.stage}
play sound "block.anvil.use" with volume 12 and pitch 2 to player
set slot 22 of player's current inventory to iron ingot named "&a&lBend" with lore "&7", "&7Click the corresponding item" and "&7to continue crafting."
else:
userFailedMinigame(player)
else if clicked item is water bucket named "&fCool" without any NBT:
if {blacksmith.smithing.%player%.stage} is 4:
play sound "block.anvil.land" with volume 12 and pitch 2 to player
give {blacksmith.smithing.%player%.result} to player
close player's inventory
else:
userFailedMinigame(player)
on inventory close:
if {inventory.%player%.name} is set:
remove player from {inventoryList.%{inventory.%player%.current}%.%{inventory.%player%.name}%::*}
delete {inventory.%player%.name}
delete {inventory.%player%.current}
else if {anvil.current.%player%} is set:
delete {anvil.current.%player%}
on inventory drag:
set {_tier1} to uncolored {@tier1Furnace}
if {inventory.%player%.name} is "Anvil" or "%{_tier1}%" or "Furnace II":
cancel event
else if {anvil.current.%player%} is set:
cancel event
on craft:
if event-item is any helmet, any chestplate, any leggings, any boots, any sword, any pickaxe, any axe, any shovel or any hoe:
set {_item::*} to ("%event-item%") split at " "
# Unoptimized code due to issues using '{_item::1} is not "leather", "wood" and "stone":'
if {_item::1} is not "leather":
if {_item::1} is not "wood":
if {_item::1} is not "stone":
send "{@logo} You cannot craft this item in a crafting table!"
cancel event
on right click on armor stand:
if name of event-entity contains "Anvil" or "Tier I":
cancel event