mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-25 14:34:28 +00:00
New dark steel armor / tool upgrade stuff done.
This commit is contained in:
1 parent
9a694ba531
commit
076b041622
7 files changed
+165
-36
No files matched your search
@@ -85,8 +85,14 @@ public final class Config {
|
||||
public static int darkSteelPowerStorageLevelTwo = 250000;
|
||||
public static int darkSteelPowerStorageLevelThree = 500000;
|
||||
|
||||
public static double darkSteelLeggingWalkModifier = 0.3;
|
||||
public static double darkSteelLeggingSprintModifier = 0.5;
|
||||
public static float darkSteelSpeedOneWalkModifier = 0.1f;
|
||||
public static float darkSteelSpeedTwoWalkMultiplier = 0.2f;
|
||||
public static float darkSteelSpeedThreeWalkMultiplier = 0.3f;
|
||||
|
||||
public static float darkSteelSpeedOneSprintModifier = 0.1f;
|
||||
public static float darkSteelSpeedTwoSprintMultiplier= 0.3f;
|
||||
public static float darkSteelSpeedThreeSprintMultiplier = 0.5f;
|
||||
|
||||
public static double darkSteelBootsJumpModifier = 1.5;
|
||||
|
||||
public static int darkSteelWalkPowerCost = darkSteelPowerStorageLevelTwo / 3000;
|
||||
@@ -288,10 +294,26 @@ public final class Config {
|
||||
"Number of levels required for the 'Vibrant' upgrade.").getInt(darkSteelUpgradePowerThreeCost);
|
||||
|
||||
|
||||
darkSteelLeggingWalkModifier = config.get("Settings", "darkSteelLeggingWalkModifier", darkSteelLeggingWalkModifier,
|
||||
"Speed modifier applied when walking in the Dark Steel Boots.").getDouble(darkSteelLeggingWalkModifier);
|
||||
darkSteelLeggingSprintModifier = config.get("Settings", "darkSteelLeggingSprintModifier", darkSteelLeggingSprintModifier,
|
||||
"Speed modifier applied when sprinting in the Dark Steel Boots.").getDouble(darkSteelLeggingSprintModifier);
|
||||
// darkSteelLeggingWalkModifier = config.get("Settings", "darkSteelLeggingWalkModifier", darkSteelLeggingWalkModifier,
|
||||
// "Speed modifier applied when walking in the Dark Steel Boots.").getDouble(darkSteelLeggingWalkModifier);
|
||||
// darkSteelLeggingSprintModifier = config.get("Settings", "darkSteelLeggingSprintModifier", darkSteelLeggingSprintModifier,
|
||||
// "Speed modifier applied when sprinting in the Dark Steel Boots.").getDouble(darkSteelLeggingSprintModifier);
|
||||
|
||||
darkSteelSpeedOneWalkModifier = (float)config.get("Settings", "darkSteelSpeedOneWalkModifier", darkSteelSpeedOneWalkModifier,
|
||||
"Speed modifier applied when walking in the Dark Steel Boots with Speed I.").getDouble(darkSteelSpeedOneWalkModifier);
|
||||
darkSteelSpeedTwoWalkMultiplier = (float)config.get("Settings", "darkSteelSpeedTwoWalkMultiplier", darkSteelSpeedTwoWalkMultiplier,
|
||||
"Speed modifier applied when walking in the Dark Steel Boots with Speed I.").getDouble(darkSteelSpeedTwoWalkMultiplier);
|
||||
darkSteelSpeedThreeWalkMultiplier = (float)config.get("Settings", "darkSteelSpeedThreeWalkMultiplier", darkSteelSpeedThreeWalkMultiplier,
|
||||
"Speed modifier applied when walking in the Dark Steel Boots with Speed I.").getDouble(darkSteelSpeedThreeWalkMultiplier);
|
||||
|
||||
darkSteelSpeedOneSprintModifier = (float)config.get("Settings", "darkSteelSpeedOneSprintModifier", darkSteelSpeedOneSprintModifier,
|
||||
"Speed modifier applied when walking in the Dark Steel Boots with Speed I.").getDouble(darkSteelSpeedOneSprintModifier);
|
||||
darkSteelSpeedTwoSprintMultiplier = (float)config.get("Settings", "darkSteelSpeedTwoSprintMultiplier", darkSteelSpeedTwoSprintMultiplier,
|
||||
"Speed modifier applied when walking in the Dark Steel Boots with Speed I.").getDouble(darkSteelSpeedTwoSprintMultiplier);
|
||||
darkSteelSpeedThreeSprintMultiplier = (float)config.get("Settings", "darkSteelSpeedThreeSprintMultiplier", darkSteelSpeedThreeSprintMultiplier,
|
||||
"Speed modifier applied when walking in the Dark Steel Boots with Speed I.").getDouble(darkSteelSpeedThreeSprintMultiplier);
|
||||
|
||||
|
||||
darkSteelBootsJumpModifier = config.get("Settings", "darkSteelBootsJumpModifier", darkSteelBootsJumpModifier,
|
||||
"Jump height modifier applied when jumping with Dark Steel Boots equipped").getDouble(darkSteelBootsJumpModifier);
|
||||
|
||||
|
||||
@@ -21,23 +21,24 @@ public class ItemRecipes {
|
||||
ItemStack darkSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.DARK_STEEL.ordinal());
|
||||
ItemStack vibCry = new ItemStack(EnderIO.itemMaterial, 1, Material.VIBRANT_CYSTAL.ordinal());
|
||||
|
||||
GameRegistry.addShapedRecipe(EnderIO.itemDarkSteelHelmet.createItemStack(), "scs", "s s", " ", 's', darkSteel, 'c', vibCry);
|
||||
GameRegistry.addShapedRecipe(EnderIO.itemDarkSteelHelmet.createItemStack(), " ", "scs", "s s", 's', darkSteel, 'c', vibCry);
|
||||
GameRegistry.addShapedRecipe(EnderIO.itemDarkSteelHelmet.createItemStack(), "sss", "s s", " ", 's', darkSteel);
|
||||
GameRegistry.addShapedRecipe(EnderIO.itemDarkSteelHelmet.createItemStack(), " ", "sss", "s s", 's', darkSteel);
|
||||
|
||||
GameRegistry.addShapedRecipe(EnderIO.itemDarkSteelChestplate.createItemStack(), "s s", "scs", "sss", 's', darkSteel, 'c', vibCry);
|
||||
GameRegistry.addShapedRecipe(EnderIO.itemDarkSteelChestplate.createItemStack(), "s s", "sss", "sss", 's', darkSteel);
|
||||
|
||||
GameRegistry.addShapedRecipe(EnderIO.itemDarkSteelLeggings.createItemStack(), "csc", "s s", "s s", 's', darkSteel, 'c', vibCry);
|
||||
GameRegistry.addShapedRecipe(EnderIO.itemDarkSteelLeggings.createItemStack(), "sss", "s s", "s s", 's', darkSteel);
|
||||
|
||||
GameRegistry.addShapedRecipe(EnderIO.itemDarkSteelBoots.createItemStack(), "s s", "c c", " ", 's', darkSteel, 'c', vibCry);
|
||||
GameRegistry.addShapedRecipe(EnderIO.itemDarkSteelBoots.createItemStack(), " ", "s s", "c c", 's', darkSteel, 'c', vibCry);
|
||||
GameRegistry.addShapedRecipe(EnderIO.itemDarkSteelBoots.createItemStack(), "s s", "s s", " ", 's', darkSteel);
|
||||
GameRegistry.addShapedRecipe(EnderIO.itemDarkSteelBoots.createItemStack(), " ", "s s", "s s", 's', darkSteel);
|
||||
|
||||
GameRegistry.addShapedRecipe(EnderIO.itemDarkSteelBoots.createItemStack(), " ", "s s", "c c", 's', darkSteel, 'c', vibCry);
|
||||
GameRegistry.addShapedRecipe(EnderIO.itemDarkSteelBoots.createItemStack(), " ", "s s", "s s", 's', darkSteel);
|
||||
|
||||
GameRegistry.addShapedRecipe(EnderIO.itemDarkSteelSword.createItemStack(), " s ", " s ", " c ", 's', darkSteel, 'c', vibCry);
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(EnderIO.itemDarkSteelPickaxe.createItemStack(), "scs", " w ", " w ", 's', darkSteel, 'c', vibCry, 'w',
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(EnderIO.itemDarkSteelSword.createItemStack(), " s ", " s ", " w ", 's', darkSteel, 't', "stickWood"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(EnderIO.itemDarkSteelSword.createItemStack(), " s ", " s ", " w ", 's', darkSteel, 't', "woodStick"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(EnderIO.itemDarkSteelPickaxe.createItemStack(), "sss", " w ", " w ", 's', darkSteel, 'c', vibCry, 'w',
|
||||
"stickWood"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(EnderIO.itemDarkSteelPickaxe.createItemStack(), "scs", " w ", " w ", 's', darkSteel, 'c', vibCry, 'w',
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(EnderIO.itemDarkSteelPickaxe.createItemStack(), "sss", " w ", " w ", 's', darkSteel, 'c', vibCry, 'w',
|
||||
"woodStick"));
|
||||
|
||||
}
|
||||
|
||||
@@ -22,11 +22,17 @@ public class DarkSteelController {
|
||||
|
||||
public static final DarkSteelController instance = new DarkSteelController();
|
||||
|
||||
private AttributeModifier walkModifier = new AttributeModifier(new UUID(12879874982l, 320981923), "generic.movementSpeed",
|
||||
Config.darkSteelLeggingWalkModifier, 1);
|
||||
private AttributeModifier[] walkModifiers = new AttributeModifier[] {
|
||||
new AttributeModifier(new UUID(12879874982l, 320981923), "generic.movementSpeed", SpeedUpgrade.WALK_MULTIPLIERS[0], 1),
|
||||
new AttributeModifier(new UUID(12879874982l, 320981923), "generic.movementSpeed", SpeedUpgrade.WALK_MULTIPLIERS[1], 1),
|
||||
new AttributeModifier(new UUID(12879874982l, 320981923), "generic.movementSpeed", SpeedUpgrade.WALK_MULTIPLIERS[2], 1),
|
||||
};
|
||||
|
||||
private AttributeModifier sprintModifier = new AttributeModifier(new UUID(6, 320981923), "generic.movementSpeed",
|
||||
Config.darkSteelLeggingSprintModifier, 1);
|
||||
private AttributeModifier[] sprintModifiers = new AttributeModifier[] {
|
||||
new AttributeModifier(new UUID(12879874982l, 320981923), "generic.movementSpeed", SpeedUpgrade.SPRINT_MULTIPLIERS[0], 1),
|
||||
new AttributeModifier(new UUID(12879874982l, 320981923), "generic.movementSpeed", SpeedUpgrade.SPRINT_MULTIPLIERS[1], 1),
|
||||
new AttributeModifier(new UUID(12879874982l, 320981923), "generic.movementSpeed", SpeedUpgrade.SPRINT_MULTIPLIERS[2], 1),
|
||||
};
|
||||
|
||||
private AttributeModifier swordDamageModifierPowered = new AttributeModifier(new UUID(63242325, 320981923), "Weapon modifier",
|
||||
2, 0);
|
||||
@@ -46,7 +52,7 @@ public class DarkSteelController {
|
||||
//boots step height
|
||||
ItemStack boots = player.getEquipmentInSlot(1);
|
||||
JumpUpgrade jumpUpgrade = JumpUpgrade.loadFromItem(boots);
|
||||
if(jumpUpgrade == null || boots != null && boots.getItem() == EnderIO.itemDarkSteelBoots) {
|
||||
if(jumpUpgrade != null && boots != null && boots.getItem() == EnderIO.itemDarkSteelBoots) {
|
||||
player.stepHeight = 1.0023F;
|
||||
} else if(player.stepHeight == 1.0023F) {
|
||||
player.stepHeight = 0.5001F;
|
||||
@@ -54,23 +60,25 @@ public class DarkSteelController {
|
||||
|
||||
//leggings
|
||||
IAttributeInstance moveInst = player.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.movementSpeed);
|
||||
moveInst.removeModifier(walkModifier);
|
||||
moveInst.removeModifier(sprintModifier);
|
||||
moveInst.removeModifier(walkModifiers[0]); //any will so as they all have the same UID
|
||||
moveInst.removeModifier(sprintModifiers[0]);
|
||||
|
||||
ItemStack leggings = player.getEquipmentInSlot(2);
|
||||
if(leggings != null && leggings.getItem() == EnderIO.itemDarkSteelLeggings) {
|
||||
SpeedUpgrade speedUpgrade = SpeedUpgrade.loadFromItem(leggings);
|
||||
if(leggings != null && leggings.getItem() == EnderIO.itemDarkSteelLeggings && speedUpgrade != null) {
|
||||
|
||||
double horzMovement = Math.sqrt(player.motionX * player.motionX + player.motionZ * player.motionZ);
|
||||
double costModifier = player.isSprinting() ? (Config.darkSteelSprintPowerCost * 1.25) : Config.darkSteelWalkPowerCost;
|
||||
double costModifier = player.isSprinting() ? Config.darkSteelSprintPowerCost : Config.darkSteelWalkPowerCost;
|
||||
costModifier = costModifier + (costModifier * speedUpgrade.walkMultiplier);
|
||||
int cost = (int) (horzMovement * costModifier);
|
||||
|
||||
int totalEnergy = getPlayerEnergy(player, EnderIO.itemDarkSteelLeggings);
|
||||
if(totalEnergy > 0 && totalEnergy >= cost) {
|
||||
usePlayerEnergy(player, EnderIO.itemDarkSteelLeggings, cost);
|
||||
if(player.isSprinting()) {
|
||||
moveInst.applyModifier(sprintModifier);
|
||||
moveInst.applyModifier(sprintModifiers[speedUpgrade.level - 1]);
|
||||
} else {
|
||||
moveInst.applyModifier(walkModifier);
|
||||
moveInst.applyModifier(walkModifiers[speedUpgrade.level - 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -89,11 +97,9 @@ public class DarkSteelController {
|
||||
}
|
||||
|
||||
void usePlayerEnergy(EntityPlayer player, ItemDarkSteelArmor armor, int cost) {
|
||||
|
||||
if(cost == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int remaining = cost;
|
||||
if(Config.darkSteelDrainPowerFromInventory) {
|
||||
for (ItemStack stack : player.inventory.mainInventory) {
|
||||
|
||||
@@ -25,6 +25,9 @@ public class DarkSteelRecipeManager {
|
||||
upgrades.add(JumpUpgrade.JUMP_ONE);
|
||||
upgrades.add(JumpUpgrade.JUMP_TWO);
|
||||
upgrades.add(JumpUpgrade.JUMP_THREE);
|
||||
upgrades.add(SpeedUpgrade.SPEED_ONE);
|
||||
upgrades.add(SpeedUpgrade.SPEED_TWO);
|
||||
upgrades.add(SpeedUpgrade.SPEED_THREE);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package crazypants.enderio.item.darksteel;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.material.Material;
|
||||
|
||||
public class JumpUpgrade extends AbstractUpgrade {
|
||||
|
||||
@@ -37,7 +37,7 @@ public class JumpUpgrade extends AbstractUpgrade {
|
||||
}
|
||||
|
||||
public JumpUpgrade(String unlocName,int level, int levelCost) {
|
||||
super(UPGRADE_NAME, unlocName, new ItemStack(Items.apple), levelCost);
|
||||
super(UPGRADE_NAME, unlocName, new ItemStack(EnderIO.itemMaterial, 1, Material.PULSATING_CYSTAL.ordinal()), levelCost);
|
||||
this.level = (short)level;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package crazypants.enderio.item.darksteel;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import crazypants.enderio.Config;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.material.Material;
|
||||
|
||||
public class SpeedUpgrade extends AbstractUpgrade {
|
||||
|
||||
private static final String KEY_LEVEL = "level";
|
||||
|
||||
private static final String KEY_MULTIPLIER = "multiplier";
|
||||
|
||||
private static String UPGRADE_NAME = "speedBoost";
|
||||
|
||||
public static float[] WALK_MULTIPLIERS = new float[] {
|
||||
Config.darkSteelSpeedOneWalkModifier,
|
||||
Config.darkSteelSpeedTwoWalkMultiplier,
|
||||
Config.darkSteelSpeedThreeWalkMultiplier
|
||||
};
|
||||
|
||||
public static float[] SPRINT_MULTIPLIERS = new float[] {
|
||||
Config.darkSteelSpeedOneSprintModifier,
|
||||
Config.darkSteelSpeedTwoSprintMultiplier,
|
||||
Config.darkSteelSpeedThreeSprintMultiplier
|
||||
};
|
||||
|
||||
public static SpeedUpgrade SPEED_ONE = new SpeedUpgrade("enderio.darksteel.upgrade.speed_one", 1, 15);
|
||||
public static SpeedUpgrade SPEED_TWO = new SpeedUpgrade("enderio.darksteel.upgrade.speed_two", 2, 20);
|
||||
public static SpeedUpgrade SPEED_THREE = new SpeedUpgrade("enderio.darksteel.upgrade.speed_three", 3, 30);
|
||||
|
||||
protected short level;
|
||||
protected float walkMultiplier;
|
||||
protected float sprintMultiplier;
|
||||
|
||||
public static SpeedUpgrade loadFromItem(ItemStack stack) {
|
||||
if(stack == null) {
|
||||
return null;
|
||||
}
|
||||
if(stack.stackTagCompound == null) {
|
||||
return null;
|
||||
}
|
||||
if(!stack.stackTagCompound.hasKey(KEY_UPGRADE_PREFIX + UPGRADE_NAME)) {
|
||||
return null;
|
||||
}
|
||||
return new SpeedUpgrade((NBTTagCompound) stack.stackTagCompound.getTag(KEY_UPGRADE_PREFIX + UPGRADE_NAME));
|
||||
}
|
||||
|
||||
public SpeedUpgrade(NBTTagCompound tag) {
|
||||
super(UPGRADE_NAME, tag);
|
||||
level = tag.getShort(KEY_LEVEL);
|
||||
}
|
||||
|
||||
public SpeedUpgrade(String unlocName,int level, int levelCost) {
|
||||
super(UPGRADE_NAME, unlocName, new ItemStack(EnderIO.itemMaterial, 1, Material.PULSATING_CYSTAL.ordinal()), levelCost);
|
||||
this.level = (short)level;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAddToItem(ItemStack stack) {
|
||||
if(stack == null || stack.getItem() != EnderIO.itemDarkSteelLeggings || !EnergyUpgrade.itemHasAnyPowerUpgrade(stack)) {
|
||||
return false;
|
||||
}
|
||||
SpeedUpgrade up = loadFromItem(stack);
|
||||
if(up == null) {
|
||||
return level == 1;
|
||||
}
|
||||
return up.level == level - 1;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasUpgrade(ItemStack stack) {
|
||||
if(!super.hasUpgrade(stack)) {
|
||||
return false;
|
||||
}
|
||||
SpeedUpgrade up = loadFromItem(stack);
|
||||
if(up == null) {
|
||||
return false;
|
||||
}
|
||||
return up.unlocName.equals(unlocName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeUpgradeToNBT(NBTTagCompound upgradeRoot) {
|
||||
upgradeRoot.setShort(KEY_LEVEL, level);
|
||||
upgradeRoot.setFloat(KEY_MULTIPLIER, walkMultiplier);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user