mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-19 19:59:58 +00:00
Added flipper upgrade for DS boots.
This commit is contained in:
1 parent
fd3c868d0d
commit
aca0a0c43c
6 files changed
+78
-1
No files matched your search
@@ -172,6 +172,8 @@ public final class Config {
|
||||
public static double darkSteelGliderVerticalSpeed = -0.05;
|
||||
public static double darkSteelGliderVerticalSpeedSprinting = -0.15;
|
||||
|
||||
public static int darkSteelSwimCost = 15;
|
||||
|
||||
public static int darkSteelSoundLocatorCost = 10;
|
||||
public static int darkSteelSoundLocatorRange = 40;
|
||||
public static int darkSteelSoundLocatorLifespan = 40;
|
||||
@@ -462,6 +464,9 @@ public final class Config {
|
||||
darkSteelFallDistanceCost = config.get(sectionDarkSteel.name, "darkSteelFallDistanceCost", darkSteelFallDistanceCost,
|
||||
"Amount of power used (RF) per block height of fall distance damage negated.").getInt(darkSteelFallDistanceCost);
|
||||
|
||||
darkSteelSwimCost = config.get(sectionDarkSteel.name, "darkSteelGliderCost", darkSteelGliderCost,
|
||||
"Number of levels required for the 'Swim' upgrade.").getInt(darkSteelGliderCost);
|
||||
|
||||
darkSteelGliderCost = config.get(sectionDarkSteel.name, "darkSteelGliderCost", darkSteelGliderCost,
|
||||
"Number of levels required for the 'Glider' upgrade.").getInt(darkSteelGliderCost);
|
||||
darkSteelGliderHorizontalSpeed = config.get(sectionDarkSteel.name, "darkSteelGliderHorizontalSpeed", darkSteelGliderHorizontalSpeed,
|
||||
|
||||
@@ -87,10 +87,24 @@ public class DarkSteelController {
|
||||
updateSword(player);
|
||||
|
||||
updateGlide(player);
|
||||
|
||||
updateSwim(player);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void updateSwim(EntityPlayer player) {
|
||||
ItemStack boots = player.getEquipmentInSlot(1);
|
||||
SwimUpgrade upgrade = SwimUpgrade.loadFromItem(boots);
|
||||
if(upgrade == null) {
|
||||
return;
|
||||
}
|
||||
if(player.isInWater()) {
|
||||
player.motionX *= 1.1;
|
||||
player.motionZ *= 1.1;
|
||||
}
|
||||
}
|
||||
|
||||
private void updateGlide(EntityPlayer player) {
|
||||
if(!isGlideActive(player) || !isGliderUpgradeEquipped(player)) {
|
||||
return;
|
||||
@@ -169,7 +183,7 @@ public class DarkSteelController {
|
||||
} else if(moveInst.getModifier(sprintModifiers[0].getID()) != null) {
|
||||
moveInst.removeModifier(sprintModifiers[0]);
|
||||
}
|
||||
|
||||
|
||||
ItemStack leggings = player.getEquipmentInSlot(2);
|
||||
SpeedUpgrade speedUpgrade = SpeedUpgrade.loadFromItem(leggings);
|
||||
if(leggings != null && leggings.getItem() == EnderIO.itemDarkSteelLeggings && speedUpgrade != null) {
|
||||
|
||||
@@ -36,6 +36,7 @@ public class DarkSteelRecipeManager {
|
||||
upgrades.add(SpeedUpgrade.SPEED_THREE);
|
||||
upgrades.add(GliderUpgrade.INSTANCE);
|
||||
upgrades.add(SoundDetectorUpgrade.INSTANCE);
|
||||
upgrades.add(SwimUpgrade.INSTANCE);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -107,6 +107,7 @@ public class ItemDarkSteelArmor extends ItemArmor implements IEnergyContainerIte
|
||||
SpeedUpgrade.SPEED_THREE.writeToItem(is);
|
||||
} else if(armorType == 3) {
|
||||
JumpUpgrade.JUMP_THREE.writeToItem(is);
|
||||
SwimUpgrade.INSTANCE.writeToItem(is);
|
||||
} else if(armorType == 1) {
|
||||
GliderUpgrade.INSTANCE.writeToItem(is);
|
||||
} else if(armorType == 0) {
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package crazypants.enderio.item.darksteel;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.config.Config;
|
||||
|
||||
public class SwimUpgrade extends AbstractUpgrade {
|
||||
|
||||
private static String UPGRADE_NAME = "swim";
|
||||
|
||||
public static final SwimUpgrade INSTANCE = new SwimUpgrade();
|
||||
|
||||
public static SwimUpgrade 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 SwimUpgrade((NBTTagCompound) stack.stackTagCompound.getTag(KEY_UPGRADE_PREFIX + UPGRADE_NAME));
|
||||
}
|
||||
|
||||
|
||||
public SwimUpgrade(NBTTagCompound tag) {
|
||||
super(UPGRADE_NAME, tag);
|
||||
}
|
||||
|
||||
public SwimUpgrade() {
|
||||
super(UPGRADE_NAME, "enderio.darksteel.upgrade.swim", new ItemStack(Blocks.waterlily), Config.darkSteelSwimCost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAddToItem(ItemStack stack) {
|
||||
if(stack == null || stack.getItem() != EnderIO.itemDarkSteelBoots) {
|
||||
return false;
|
||||
}
|
||||
SwimUpgrade up = loadFromItem(stack);
|
||||
if(up == null) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeUpgradeToNBT(NBTTagCompound upgradeRoot) {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user