1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

Merge pull request #3192 from guizhanss/feature/raw-metals-luck-multiplier

Add Enhanced furnaces' luck multiplier for raw ores in 1.17, resolves #3190
This commit is contained in:
TheBusyBiscuit 2021-08-05 10:05:13 +02:00 committed by GitHub
commit 0df4694a63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 2 deletions

View File

@ -17,6 +17,7 @@ import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.items.blocks.EnhancedFurnace; import io.github.thebusybiscuit.slimefun4.implementation.items.blocks.EnhancedFurnace;
import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag;
import io.papermc.lib.PaperLib; import io.papermc.lib.PaperLib;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.api.BlockStorage; import me.mrCookieSlime.Slimefun.api.BlockStorage;
@ -67,7 +68,8 @@ public class EnhancedFurnaceListener implements Listener {
if (state instanceof Furnace) { if (state instanceof Furnace) {
FurnaceInventory inventory = ((Furnace) state).getInventory(); FurnaceInventory inventory = ((Furnace) state).getInventory();
int amount = inventory.getSmelting().getType().toString().endsWith("_ORE") ? ((EnhancedFurnace) sfItem).getRandomOutputAmount() : 1; boolean multiplier = SlimefunTag.ENHANCED_FURNACE_LUCK_MATERIALS.isTagged(inventory.getSmelting().getType());
int amount = multiplier ? ((EnhancedFurnace) sfItem).getRandomOutputAmount() : 1;
Optional<ItemStack> result = SlimefunPlugin.getMinecraftRecipeService().getFurnaceOutput(inventory.getSmelting()); Optional<ItemStack> result = SlimefunPlugin.getMinecraftRecipeService().getFurnaceOutput(inventory.getSmelting());
if (result.isPresent()) { if (result.isPresent()) {

View File

@ -21,6 +21,7 @@ import org.bukkit.block.data.Waterlogged;
import io.github.thebusybiscuit.slimefun4.api.exceptions.TagMisconfigurationException; import io.github.thebusybiscuit.slimefun4.api.exceptions.TagMisconfigurationException;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.items.blocks.BlockPlacer; import io.github.thebusybiscuit.slimefun4.implementation.items.blocks.BlockPlacer;
import io.github.thebusybiscuit.slimefun4.implementation.items.blocks.EnhancedFurnace;
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.accelerators.CropGrowthAccelerator; import io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.accelerators.CropGrowthAccelerator;
import io.github.thebusybiscuit.slimefun4.implementation.items.magical.talismans.Talisman; import io.github.thebusybiscuit.slimefun4.implementation.items.magical.talismans.Talisman;
import io.github.thebusybiscuit.slimefun4.implementation.items.multiblocks.miner.IndustrialMiner; import io.github.thebusybiscuit.slimefun4.implementation.items.multiblocks.miner.IndustrialMiner;
@ -64,6 +65,11 @@ public enum SlimefunTag implements Tag<Material> {
*/ */
NETHER_ORES, NETHER_ORES,
/**
* All raw metals in 1.17+
*/
RAW_METALS,
/** /**
* All Shulker boxes, normal and colored. * All Shulker boxes, normal and colored.
*/ */
@ -230,7 +236,12 @@ public enum SlimefunTag implements Tag<Material> {
/** /**
* All materials (ores) which trigger the Talisman of the Caveman. * All materials (ores) which trigger the Talisman of the Caveman.
*/ */
CAVEMAN_TALISMAN_TRIGGERS; CAVEMAN_TALISMAN_TRIGGERS,
/**
* All materials which benefit from the luck multiplier of {@link EnhancedFurnace}
*/
ENHANCED_FURNACE_LUCK_MATERIALS;
/** /**
* Lookup table for tag names. * Lookup table for tag names.

View File

@ -0,0 +1,6 @@
{
"values" : [
"#slimefun:ores",
"#slimefun:raw_metals"
]
}

View File

@ -0,0 +1,16 @@
{
"values" : [
{
"id" : "minecraft:raw_iron",
"required" : false
},
{
"id" : "minecraft:raw_gold",
"required" : false
},
{
"id" : "minecraft:raw_copper",
"required" : false
}
]
}