Fix enchantments, item lore handlers, add mob egg drop chance to lore text. Fix mob egg drop rates. Fix player head drop rates
This commit is contained in:
parent
7e1f4eea48
commit
afb21dd2c8
25 changed files with 121 additions and 558 deletions
|
@ -7,6 +7,8 @@ import net.minecraft.world.item.ItemStack;
|
|||
import net.minecraft.world.item.enchantment.Enchantment;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentCategory;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class MobEggEnchantment extends Enchantment
|
||||
{
|
||||
public static final String TAG_BIAS = "mob_egging_bias";
|
||||
|
@ -59,17 +61,27 @@ public class MobEggEnchantment extends Enchantment
|
|||
|
||||
public static boolean givesEgg(int level, int bias)
|
||||
{
|
||||
double CHANCE = ServerConfig.drops.mobEggingChance * 100;
|
||||
int CHANCE = ServerConfig.drops.mobEggingChance;
|
||||
|
||||
CHANCE *= (level / 0.5);
|
||||
CHANCE += level;
|
||||
CHANCE += bias;
|
||||
|
||||
double rng = Math.random()*100000;
|
||||
|
||||
if(ServerConfig.general.debug)
|
||||
{
|
||||
OTEMod.LOGGER.info("Spawn Egg Chance (" + CHANCE + ") [" + rng + "]");
|
||||
OTEMod.LOGGER.info("Spawn Egg Chance (" + CHANCE + ")");
|
||||
}
|
||||
return (rng <= CHANCE);
|
||||
return rollChance((int)CHANCE);
|
||||
}
|
||||
|
||||
public static boolean rollChance(int percent)
|
||||
{
|
||||
Random rng = new Random();
|
||||
int test = rng.nextInt(100) + 1;
|
||||
if(ServerConfig.general.debug)
|
||||
{
|
||||
OTEMod.LOGGER.info("Spawn Egg Dice Roll (" + test + " / " + percent + ")");
|
||||
}
|
||||
|
||||
return test <= percent;
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue