mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
Fix Smelting not recognizing the new 1.17 smeltables (like raw ores)
This commit is contained in:
parent
6ff37c8baa
commit
5f0cc2b09a
@ -66,8 +66,7 @@ public class InventoryListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile doesn't exist
|
//Profile doesn't exist
|
||||||
if(UserManager.getOfflinePlayer(offlinePlayer) == null)
|
if(UserManager.getOfflinePlayer(offlinePlayer) == null) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ public final class LocaleLoader {
|
|||||||
*
|
*
|
||||||
* @return The properly formatted text component
|
* @return The properly formatted text component
|
||||||
*/
|
*/
|
||||||
public static TextComponent getTextComponent(String key, Object... messageArguments) {
|
public static @NotNull TextComponent getTextComponent(@NotNull String key, Object... messageArguments) {
|
||||||
if (bundle == null) {
|
if (bundle == null) {
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
@ -113,7 +113,7 @@ public final class LocaleLoader {
|
|||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TextComponent formatComponent(String string, Object... messageArguments) {
|
public static @NotNull TextComponent formatComponent(@NotNull String string, Object... messageArguments) {
|
||||||
if (messageArguments != null) {
|
if (messageArguments != null) {
|
||||||
MessageFormat formatter = new MessageFormat("");
|
MessageFormat formatter = new MessageFormat("");
|
||||||
formatter.applyPattern(string.replace("'", "''"));
|
formatter.applyPattern(string.replace("'", "''"));
|
||||||
|
@ -4,10 +4,12 @@ import com.gmail.nossr50.config.experience.ExperienceConfig;
|
|||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class Smelting {
|
public class Smelting {
|
||||||
|
|
||||||
protected static int getResourceXp(ItemStack smelting) {
|
public static int getSmeltXP(@NotNull ItemStack smelting) {
|
||||||
return mcMMO.getModManager().isCustomOre(smelting.getType()) ? mcMMO.getModManager().getBlock(smelting.getType()).getSmeltingXpGain() : ExperienceConfig.getInstance().getXp(PrimarySkillType.SMELTING, smelting.getType());
|
return ExperienceConfig.getInstance().getXp(PrimarySkillType.SMELTING, smelting.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ public class SmeltingManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void smeltProcessing(@NotNull FurnaceSmeltEvent furnaceSmeltEvent, @NotNull Furnace furnace) {
|
public void smeltProcessing(@NotNull FurnaceSmeltEvent furnaceSmeltEvent, @NotNull Furnace furnace) {
|
||||||
applyXpGain(Smelting.getResourceXp(furnaceSmeltEvent.getSource()), XPGainReason.PVE, XPGainSource.PASSIVE); //Add XP
|
applyXpGain(Smelting.getSmeltXP(furnaceSmeltEvent.getSource()), XPGainReason.PVE, XPGainSource.PASSIVE); //Add XP
|
||||||
|
|
||||||
processDoubleSmelt(furnaceSmeltEvent, furnace);
|
processDoubleSmelt(furnaceSmeltEvent, furnace);
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import com.gmail.nossr50.datatypes.treasure.EnchantmentWrapper;
|
|||||||
import com.gmail.nossr50.datatypes.treasure.FishingTreasureBook;
|
import com.gmail.nossr50.datatypes.treasure.FishingTreasureBook;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.skills.smelting.Smelting;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
@ -340,7 +341,7 @@ public final class ItemUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isSmeltable(ItemStack item) {
|
public static boolean isSmeltable(ItemStack item) {
|
||||||
return item != null && item.getType().isBlock() && MaterialUtils.isOre(item.getType());
|
return item != null && Smelting.getSmeltXP(item) >= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isSmelted(ItemStack item) {
|
public static boolean isSmelted(ItemStack item) {
|
||||||
|
Loading…
Reference in New Issue
Block a user