|
1 | 1 | package me.voper.slimeframe.implementation.items.components; |
2 | 2 |
|
3 | 3 | import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack; |
4 | | -import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType; |
5 | | -import io.github.thebusybiscuit.slimefun4.implementation.items.blocks.UnplaceableBlock; |
6 | | -import io.github.thebusybiscuit.slimefun4.libraries.dough.items.CustomItemStack; |
7 | 4 | import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; |
8 | 5 | import lombok.Getter; |
9 | 6 | import lombok.Setter; |
10 | 7 | import lombok.experimental.Accessors; |
11 | 8 | import me.voper.slimeframe.SlimeFrame; |
12 | 9 | import me.voper.slimeframe.implementation.SFrameStacks; |
13 | 10 | import me.voper.slimeframe.implementation.SFrameTheme; |
14 | | -import me.voper.slimeframe.implementation.groups.Groups; |
15 | 11 | import me.voper.slimeframe.implementation.items.relics.RelicItemStack; |
16 | 12 | import me.voper.slimeframe.utils.Colors; |
17 | 13 | import me.voper.slimeframe.utils.HeadTextures; |
18 | | -import me.voper.slimeframe.utils.Keys; |
19 | | -import me.voper.slimeframe.utils.Utils; |
20 | 14 | import net.md_5.bungee.api.ChatColor; |
21 | | -import org.bukkit.Material; |
22 | 15 | import org.bukkit.inventory.ItemStack; |
23 | 16 |
|
24 | 17 | import javax.annotation.Nonnull; |
|
35 | 28 | @ParametersAreNonnullByDefault |
36 | 29 | public class PrimeComponents { |
37 | 30 |
|
38 | | - public static final RecipeType RECIPE_TYPE = new RecipeType(Keys.createKey("prime_component_reward"), new CustomItemStack(Material.DIAMOND, ChatColor.AQUA + "This item is dropped by the following relics:")); |
39 | 31 | public static final Map<SlimefunItemStack, PrimeComponents> COMPONENTS_MAP = new HashMap<>(); |
40 | 32 |
|
41 | 33 | // Machines & Generators components |
@@ -152,36 +144,36 @@ public static void registerAll(SlimeFrame plugin) { |
152 | 144 | } |
153 | 145 |
|
154 | 146 | private static void register(PrimeComponents components, SlimeFrame plugin) throws IllegalAccessException { |
155 | | - UnplaceableBlock coreModuleSF = new UnplaceableBlock(Groups.PRIME_COMPONENTS, components.getCoreModule(), RECIPE_TYPE, Utils.NULL_ITEMS_ARRAY); |
156 | | - UnplaceableBlock powerCellSF = new UnplaceableBlock(Groups.PRIME_COMPONENTS, components.getPowerCell(), RECIPE_TYPE, Utils.NULL_ITEMS_ARRAY); |
157 | | - UnplaceableBlock controlUnitSF = new UnplaceableBlock(Groups.PRIME_COMPONENTS, components.getControlUnit(), RECIPE_TYPE, Utils.NULL_ITEMS_ARRAY); |
| 147 | + Component coreModuleSF = new Component(components.getCoreModule()); |
| 148 | + Component powerCellSF = new Component(components.getPowerCell()); |
| 149 | + Component controlUnitSF = new Component(components.getControlUnit()); |
158 | 150 |
|
159 | | - List<ItemStack> recipeCoreModule = new ArrayList<>(9); |
160 | | - List<ItemStack> recipePowerCell = new ArrayList<>(9); |
161 | | - List<ItemStack> recipeControlUnit = new ArrayList<>(9); |
| 151 | + List<ItemStack> relicsCoreModule = new ArrayList<>(); |
| 152 | + List<ItemStack> relicsPowerCell = new ArrayList<>(); |
| 153 | + List<ItemStack> relicsControlUnit = new ArrayList<>(); |
162 | 154 |
|
163 | 155 | for (Field field: SFrameStacks.class.getDeclaredFields()) { |
164 | 156 | if (field.getType() != RelicItemStack.class) continue; |
165 | 157 | RelicItemStack relic = (RelicItemStack) field.get(null); |
166 | 158 |
|
167 | 159 | for (SlimefunItemStack common: relic.getCommonDrops()) { |
168 | 160 | if (!SlimefunUtils.isItemSimilar(components.getControlUnit(), common, true)) continue; |
169 | | - recipeControlUnit.add(relic); |
| 161 | + relicsControlUnit.add(relic); |
170 | 162 | } |
171 | 163 |
|
172 | 164 | for (SlimefunItemStack uncommon: relic.getUncommonDrops()) { |
173 | 165 | if (!SlimefunUtils.isItemSimilar(components.getPowerCell(), uncommon, true)) continue; |
174 | | - recipePowerCell.add(relic); |
| 166 | + relicsPowerCell.add(relic); |
175 | 167 | } |
176 | 168 |
|
177 | 169 | if (SlimefunUtils.isItemSimilar(components.getCoreModule(), relic.getRareDrop(), true)) { |
178 | | - recipeCoreModule.add(relic); |
| 170 | + relicsCoreModule.add(relic); |
179 | 171 | } |
180 | 172 | } |
181 | 173 |
|
182 | | - coreModuleSF.setRecipe(recipeCoreModule.toArray(new ItemStack[9])); |
183 | | - powerCellSF.setRecipe(recipePowerCell.toArray(new ItemStack[9])); |
184 | | - controlUnitSF.setRecipe(recipeControlUnit.toArray(new ItemStack[9])); |
| 174 | + coreModuleSF.setRelics(relicsCoreModule); |
| 175 | + powerCellSF.setRelics(relicsPowerCell); |
| 176 | + controlUnitSF.setRelics(relicsControlUnit); |
185 | 177 |
|
186 | 178 | coreModuleSF.register(plugin); |
187 | 179 | powerCellSF.register(plugin); |
|
0 commit comments