Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add crafting-recipe to tiers #50

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.willfp.eco.core.config.interfaces.Config
import com.willfp.eco.core.display.Display
import com.willfp.eco.core.items.CustomItem
import com.willfp.eco.core.items.Items
import com.willfp.eco.core.recipe.Recipes
import com.willfp.eco.core.recipe.recipes.ShapedCraftingRecipe
import com.willfp.eco.core.registry.Registrable
import com.willfp.eco.util.StringUtils
Expand Down Expand Up @@ -43,11 +44,6 @@ class Tier(
*/
val crystal: ItemStack

/**
* The crafting recipe to make the crystal.
*/
val crystalRecipe: ShapedCraftingRecipe?

/**
* Item properties.
*/
Expand Down Expand Up @@ -98,28 +94,17 @@ class Tier(
).register()

if (this.craftable) {
val recipeOut = out.clone()
recipeOut.amount = this.config.getInt("crystal.giveAmount")
val builder = ShapedCraftingRecipe.builder(plugin, "upgrade_crystal_$id")
.setOutput(recipeOut)
val recipeStrings: List<String> = this.config.getStrings("crystal.recipe")
CustomItem(plugin.namespacedKeyFactory.create("upgrade_crystal_$id"), { test: ItemStack? ->
if (test == null) {
return@CustomItem false
}
if (getCrystalTier(test) == null) {
return@CustomItem false
}
this == getCrystalTier(test)
}, out).register()
for (i in 0..8) {
builder.setRecipePart(i, Items.lookup(recipeStrings[i]))
val recipeOut = out.clone().apply {
amount = config.getInt("crystal.giveAmount")
}
crystalRecipe = builder.build()
crystalRecipe.register()
} else {
crystalRecipe = null
}
Recipes.createAndRegisterRecipe(
plugin,
"upgrade_crystal_$id",
recipeOut,
config.getStrings("crystal.recipe"),
config.getStringOrNull("crystal.crafting-permission")
)
} else null
}

/**
Expand Down
137 changes: 86 additions & 51 deletions eco-core/core-plugin/src/main/resources/sets/_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
# including in subfolders if you want to organize your set configs
# _example.yml is not loaded.

conditions: []
# The effects of the set (i.e. the functionality)
# See here: https://plugins.auxilor.io/effects/configuring-an-effect
effects:
- id: damage_multiplier
args:
Expand All @@ -13,6 +14,9 @@ effects:
- melee_attack
- bow_attack
- trident_attack
-
# The effects of the set (i.e. the functionality)
# See here: https://plugins.auxilor.io/effects/configuring-an-effect
advancedEffects:
- id: damage_multiplier
args:
Expand All @@ -26,81 +30,97 @@ advancedEffects:
multiplier: 0.9
triggers:
- take_damage

sounds:
equip:
enabled: false
sound: ""
enabled: false # If a sound should play when armor is equipped.
sound: "" # The sound to play, sounds: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Sound.html
volume: 1
pitch: 1
advancedEquip:
enabled: false
sound: ""
enabled: false # If a sound should play when advanced armor is equipped.
sound: "" # The sound to play, sounds: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Sound.html
volume: 1
pitch: 1
unequip:
enabled: false
sound: ""
enabled: false # If a sound should play when armor is unequipped.
sound: "" # The sound to play, sounds: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Sound.html
volume: 1
pitch: 1
advancedLore:

advancedLore: # Lore to be added to the armor piece when it has been advanced.
- ''
- "<gradient:f12711>&lADVANCED BONUS</gradient:f5af19>"
- "&8» &6Take 10% less damage"
- "&8&oRequires full set to be worn"

shard:
item: prismarine_shard unbreaking:1 hide_enchants
name: "<GRADIENT:f12711>Advancement Shard:</GRADIENT:f5af19> &cReaper"
lore:
item: prismarine_shard unbreaking:1 hide_enchants # The shard item, read more here: https://plugins.auxilor.io/all-plugins/the-item-lookup-system
name: "<GRADIENT:f12711>Advancement Shard:</GRADIENT:f5af19> &cReaper" # The in-game name of the shard.
lore: # The lore shown in-game on the shard. Set to `lore: []` to remove lore.
- "&8Drop this onto &cReaper Armor"
- "&8to make it <GRADIENT:f12711>Advanced</GRADIENT:f5af19>."
craftable: false
crafting-permission: "permission" # (Optional: Require a permission to craft this item)
recipe:
craftable: false # If the shard is craftable
crafting-permission: "permission" # (Optional) The permission required to craft this recipe.
recipe: # The recipe, read here for more: https://plugins.auxilor.io/all-plugins/the-item-lookup-system#crafting-recipes
- prismarine_shard
- ecoarmor:set_reaper_helmet
- prismarine_shard

- ecoarmor:set_reaper_chestplate
- nether_star
- ecoarmor:set_reaper_leggings

- prismarine_shard
- ecoarmor:set_reaper_boots
- prismarine_shard

helmet:
item: leather_helmet color:#303030 hide_dye
name: "&cReaper Helmet"
advancedName: "<GRADIENT:f12711>Advanced</GRADIENT:f5af19>&c Reaper Helmet"
effectiveDurability: 2048
effects: []
advancedEffects: []
conditions: []
lore:
item: leather_helmet color:#303030 hide_dye # https://plugins.auxilor.io/all-plugins/the-item-lookup-system
name: "&cReaper Helmet" # The name shown in-game.
advancedName: "<GRADIENT:f12711>Advanced</GRADIENT:f5af19>&c Reaper Helmet" # The advanced name shown in-game.
lore: # The lore shown in-game. Set to `lore: []` to remove lore.
- "&c&lREAPER SET BONUS"
- "&8» &cDeal 25% more damage"
- "&8&oRequires full set to be worn"
- ''
- "&fTier: %tier%"
- "&8&oUpgrade with an Upgrade Crystal"
craftable: true
crafting-permission: "permission" # (Optional: Require a permission to craft this item)
defaultTier: default
recipe:
craftable: true # If the armor piece is craftable
crafting-permission: "permission" # (Optional) The permission required to craft this recipe.
recipe: # The recipe, read here for more: https://plugins.auxilor.io/all-plugins/the-item-lookup-system#crafting-recipes
- ecoitems:armor_core ? air
- nether_star
- ecoitems:armor_core ? air

- nether_star
- netherite_helmet
- nether_star

- air
- nether_star
- air
defaultTier: default # The default tier of the armor

# The actual item durability isn't set (because it can't be changed), but instead
# this scales how quickly the item wears to act as if it had this durability.
# For example, let's say the actual durability is 350, but you set this to 700,
# it will wear at half the normal rate.

effectiveDurability: 2048 # Optional, set the durability

# The effects of the item (i.e. the functionality)
# See here: https://plugins.auxilor.io/effects/configuring-an-effect
effects: []
advancedEffects: []

# The conditions required for the effects to activate
conditions: [] # The conditions for the effects to be ru

chestplate:
item: leather_chestplate color:#303030 hide_dye
name: "&cReaper Chestplate"
advancedName: "<GRADIENT:f12711>Advanced</GRADIENT:f5af19>&c Reaper Chestplate"
effectiveDurability: 2048
effects: []
advancedEffects: []
conditions: []
lore:
- "&c&lREAPER SET BONUS"
- "&8» &cDeal 25% more damage"
Expand All @@ -109,27 +129,29 @@ chestplate:
- "&fTier: %tier%"
- "&8&oUpgrade with an Upgrade Crystal"
craftable: true
crafting-permission: "permission" # (Optional: Require a permission to craft this item) # (Optional: Require a permission to craft this item)
defaultTier: default
crafting-permission: "permission"
recipe:
- ecoitems:armor_core ? air
- nether_star
- ecoitems:armor_core ? air

- nether_star
- netherite_chestplate
- nether_star

- air
- nether_star
- air
elytra:
item: elytra
name: "&cReaper Elytra"
advancedName: "<GRADIENT:f12711>Advanced</GRADIENT:f5af19>&c Reaper Elytra"
defaultTier: default
effectiveDurability: 2048
effects: []
advancedEffects: []
crafting-permission: "permission" # (Optional: Require a permission to craft this item)
conditions: []

elytra:
item: elytra
name: "&cReaper Elytra"
advancedName: "<GRADIENT:f12711>Advanced</GRADIENT:f5af19>&c Reaper Elytra"
lore:
- "&c&lREAPER SET BONUS"
- "&8» &cDeal 25% more damage"
Expand All @@ -138,25 +160,29 @@ elytra:
- "&fTier: %tier%"
- "&8&oUpgrade with an Upgrade Crystal"
craftable: true
defaultTier: default
crafting-permission: "permission"
recipe:
- ecoitems:armor_core ? air
- nether_star
- ecoitems:armor_core ? air

- nether_star
- elytra
- nether_star

- air
- nether_star
- air
leggings:
item: leather_leggings color:#303030 hide_dye
name: "&cReaper Leggings"
advancedName: "<GRADIENT:f12711>Advanced</GRADIENT:f5af19>&c Reaper Leggings"
defaultTier: default
effectiveDurability: 2048
effects: []
advancedEffects: []
conditions: []

leggings:
item: leather_leggings color:#303030 hide_dye
name: "&cReaper Leggings"
advancedName: "<GRADIENT:f12711>Advanced</GRADIENT:f5af19>&c Reaper Leggings"
lore:
- "&c&lREAPER SET BONUS"
- "&8» &cDeal 25% more damage"
Expand All @@ -165,26 +191,29 @@ leggings:
- "&fTier: %tier%"
- "&8&oUpgrade with an Upgrade Crystal"
craftable: true
crafting-permission: "permission" # (Optional: Require a permission to craft this item)
defaultTier: default
crafting-permission: "permission"
recipe:
- ecoitems:armor_core ? air
- nether_star
- ecoitems:armor_core ? air

- nether_star
- netherite_leggings
- nether_star

- air
- nether_star
- air
boots:
item: leather_boots color:#303030 hide_dye
name: "&cReaper Boots"
advancedName: "<GRADIENT:f12711>Advanced</GRADIENT:f5af19>&c Reaper Boots"
defaultTier: default
effectiveDurability: 2048
effects: []
advancedEffects: []
conditions: []

boots:
item: leather_boots color:#303030 hide_dye
name: "&cReaper Boots"
advancedName: "<GRADIENT:f12711>Advanced</GRADIENT:f5af19>&c Reaper Boots"
lore:
- "&c&lREAPER SET BONUS"
- "&8» &cDeal 25% more damage"
Expand All @@ -193,15 +222,21 @@ boots:
- "&fTier: %tier%"
- "&8&oUpgrade with an Upgrade Crystal"
craftable: true
crafting-permission: "permission" # (Optional: Require a permission to craft this item)
defaultTier: default
crafting-permission: "permission"
recipe:
- ecoitems:armor_core ? air
- nether_star
- ecoitems:armor_core ? air

- nether_star
- netherite_boots
- nether_star

- air
- nether_star
- air
- air
defaultTier: default
effectiveDurability: 2048
effects: []
advancedEffects: []
conditions: []
Loading