mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-28 07:55:41 +00:00
Add config option for killer joe to give one level of the PLAYER'S xp
This commit is contained in:
1 parent
c7ff631195
commit
7c669c1833
2 files changed
+44
-9
No files matched your search
@@ -252,6 +252,7 @@ public final class Config {
|
||||
public static double killerJoeAttackHeight = 2;
|
||||
public static double killerJoeAttackWidth = 2;
|
||||
public static double killerJoeAttackLength = 4;
|
||||
public static boolean killerJoeGivePlayerLevelXP = true;
|
||||
|
||||
public static boolean allowTileEntitiesAsPaintSource = true;
|
||||
|
||||
@@ -689,6 +690,7 @@ public final class Config {
|
||||
"The reach of attacks to each side of Joe.").getDouble(killerJoeAttackWidth);
|
||||
killerJoeAttackLength = config.get(sectionKiller.name, "killerJoeAttackLength", killerJoeAttackLength,
|
||||
"The reach of attacks in front of Joe.").getDouble(killerJoeAttackLength);
|
||||
killerJoeGivePlayerLevelXP = config.get(sectionKiller.name, "killerJoeGivePlayerLevelXP", killerJoeGivePlayerLevelXP, "If true, will give the player one xp of HIS current level. If false, will give the player one level of the killer joe's xp.").getBoolean();
|
||||
|
||||
isGasConduitEnabled = config.getString("isGasConduitEnabled", sectionItems.name, isGasConduitEnabled,
|
||||
"Can be set to 'auto', 'true' or 'false'. When set to auto the gas conduit will only be enabled when Mekanism is installed.");
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.google.common.collect.Multimap;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
import buildcraft.api.power.PowerHandler.Type;
|
||||
import net.minecraft.command.IEntitySelector;
|
||||
@@ -23,6 +22,7 @@ import net.minecraft.entity.boss.EntityDragonPart;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.item.EntityXPOrb;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -191,7 +191,7 @@ public class TileKillerJoe extends AbstractMachineEntity implements IFluidHandle
|
||||
}
|
||||
|
||||
private int getXpBarCapacity(int level) {
|
||||
return level >= 30 ? 62 + (level - 30) * 7 : (level >= 15 ? 17 + (level - 15) * 3 : 17);
|
||||
return getExperienceForLevel(level);
|
||||
}
|
||||
|
||||
private int getXpBarCapacity() {
|
||||
@@ -205,14 +205,47 @@ public class TileKillerJoe extends AbstractMachineEntity implements IFluidHandle
|
||||
}
|
||||
|
||||
public void givePlayerXp(EntityPlayer player) {
|
||||
int takeXp = Math.min(getXpBarCapacity(), experienceTotal);
|
||||
player.addExperience(takeXp);
|
||||
if(Config.killerJoeGivePlayerLevelXP) {
|
||||
int currentXP = getPlayerXP(player);
|
||||
int nextLevelXP = getExperienceForLevel(player.experienceLevel + 1) + 1;
|
||||
int requiredXP = nextLevelXP - currentXP;
|
||||
|
||||
int newXp = experienceTotal - takeXp;
|
||||
experience = 0;
|
||||
experienceLevel = 0;
|
||||
experienceTotal = 0;
|
||||
addExperience(newXp);
|
||||
requiredXP = Math.min(experienceTotal, requiredXP);
|
||||
|
||||
player.addExperience(requiredXP);
|
||||
|
||||
int newXp = experienceTotal - requiredXP;
|
||||
experience = 0;
|
||||
experienceLevel = 0;
|
||||
experienceTotal = 0;
|
||||
addExperience(newXp);
|
||||
} else {
|
||||
int takeXp = Math.min(getXpBarCapacity(), experienceTotal);
|
||||
player.addExperience(takeXp);
|
||||
|
||||
int newXp = experienceTotal - takeXp;
|
||||
experience = 0;
|
||||
experienceLevel = 0;
|
||||
experienceTotal = 0;
|
||||
addExperience(newXp);
|
||||
}
|
||||
}
|
||||
|
||||
private int getPlayerXP(EntityPlayer player) {
|
||||
return (int) (getExperienceForLevel(player.experienceLevel) + (player.experience * player.xpBarCap()));
|
||||
}
|
||||
|
||||
private int getExperienceForLevel(int level) {
|
||||
if(level == 0) {
|
||||
return 0;
|
||||
}
|
||||
if(level > 0 && level < 16) {
|
||||
return level * 17;
|
||||
} else if(level > 15 && level < 31) {
|
||||
return (int) (1.5 * Math.pow(level, 2) - 29.5 * level + 360);
|
||||
} else {
|
||||
return (int) (3.5 * Math.pow(level, 2) - 151.5 * level + 2220);
|
||||
}
|
||||
}
|
||||
|
||||
private void hooverXP() {
|
||||
|
||||
Reference in new issue
Block a user