EnchantmentLootBonus .java

net.minecraft.enchantment.EnchantmentLootBonus (class, 57 lines): members: canApplyTogether, getMaxEnchantability, getMinEnchantability, getMaxLevel.

net.minecraft.enchantmentclass57 linescommonextends Enchantment1.5 KB

API Surface (4)

int getMinEnchantability(int enchantmentLevel)
int getMaxEnchantability(int enchantmentLevel)
int getMaxLevel()
boolean canApplyTogether(Enchantment ench)

String literals (3)

"lootBonusDigger"
"lootBonusFishing"
"lootBonus"

Code Graph: Dependencies (3)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

EnchantmentLootBonus.java57 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.enchantment;
2
3
import net.minecraft.util.ResourceLocation;
4
5
public class EnchantmentLootBonus extends Enchantment
6
{
7
    protected EnchantmentLootBonus(int p_i45767_1_, ResourceLocation p_i45767_2_, int p_i45767_3_, EnumEnchantmentType p_i45767_4_)
8
    {
9
        super(p_i45767_1_, p_i45767_2_, p_i45767_3_, p_i45767_4_);
10
11
        if (p_i45767_4_ == EnumEnchantmentType.DIGGER)
12
        {
13
            this.setName("lootBonusDigger");
14
        }
15
        else if (p_i45767_4_ == EnumEnchantmentType.FISHING_ROD)
16
        {
17
            this.setName("lootBonusFishing");
18
        }
19
        else
20
        {
21
            this.setName("lootBonus");
22
        }
23
    }
24
25
    /**
26
     * Returns the minimal value of enchantability needed on the enchantment level passed.
27
     */
28
    public int getMinEnchantability(int enchantmentLevel)
29
    {
30
        return 15 + (enchantmentLevel - 1) * 9;
31
    }
32
33
    /**
34
     * Returns the maximum value of enchantability nedded on the enchantment level passed.
35
     */
36
    public int getMaxEnchantability(int enchantmentLevel)
37
    {
38
        return super.getMinEnchantability(enchantmentLevel) + 50;
39
    }
40
41
    /**
42
     * Returns the maximum level that the enchantment can have.
43
     */
44
    public int getMaxLevel()
45
    {
46
        return 3;
47
    }
48
49
    /**
50
     * Determines if the enchantment passed can be applyied together with this enchantment.
51
     */
52
    public boolean canApplyTogether(Enchantment ench)
53
    {
54
        return super.canApplyTogether(ench) && ench.effectId != silkTouch.effectId;
55
    }
56
}
57

Deobfuscated MCP 1.8.9 source of EnchantmentLootBonus from Marcelektro/MavenMCP-1.8.9 (net/minecraft/enchantment/EnchantmentLootBonus.java), stored verbatim.