Added aquatic modules and colours
This commit is contained in:
parent
f9e986e4d5
commit
cf3719adfb
18 changed files with 249 additions and 54 deletions
Binary file not shown.
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 5.3 KiB |
|
@ -13,6 +13,7 @@ public class Colour {
|
|||
public static final Colour DARKBLUE = new Colour(0.0, 0.0, 0.5, 1.0);
|
||||
public static final Colour ORANGE = new Colour(0.9, 0.6, 0.2, 1.0);
|
||||
public static final Colour YELLOW = new Colour(0.0, 0.0, 0.5, 1.0);
|
||||
public static final Colour WHITE = new Colour(1.0, 1.0, 1.0, 1.0);
|
||||
|
||||
/**
|
||||
* The RGBA values are stored as floats from 0.0F (nothing) to 1.0F (full
|
||||
|
|
|
@ -49,17 +49,19 @@ public class MuseIcon {
|
|||
public static final MuseIcon BATTERY_EMPTY = new MuseIcon(WC_ICON_PATH, 15);
|
||||
public static final MuseIcon SHOCK_ABSORBER = new MuseIcon(WC_ICON_PATH, 16);
|
||||
public static final MuseIcon PARACHUTE_MODULE = new MuseIcon(WC_ICON_PATH, 18);
|
||||
public static final MuseIcon SHIELD = new MuseIcon(WC_ICON_PATH, 20);
|
||||
public static final MuseIcon TRANSPARENT_ARMOR = new MuseIcon(WC_ICON_PATH, 20);
|
||||
public static final MuseIcon GO_FAST = new MuseIcon(WC_ICON_PATH, 21);
|
||||
|
||||
// Component icons
|
||||
public static final MuseIcon COMPONENT_WIRING = new MuseIcon(MUSE_ICON_PATH, 0);
|
||||
public static final MuseIcon COMPONENT_CAPACITOR = new MuseIcon(MUSE_ICON_PATH, 1);
|
||||
public static final MuseIcon COMPONENT_LVCAPACITOR = new MuseIcon(MUSE_ICON_PATH, 1);
|
||||
public static final MuseIcon COMPONENT_SOLENOID = new MuseIcon(MUSE_ICON_PATH, 2);
|
||||
public static final MuseIcon COMPONENT_GLIDERWING = new MuseIcon(MUSE_ICON_PATH, 4);
|
||||
public static final MuseIcon COMPONENT_SERVOMOTOR = new MuseIcon(MUSE_ICON_PATH, 3);
|
||||
public static final MuseIcon COMPONENT_IONTHRUSTER = new MuseIcon(MUSE_ICON_PATH, 5);
|
||||
public static final MuseIcon COMPONENT_PARACHUTE = new MuseIcon(MUSE_ICON_PATH, 6);
|
||||
public static final MuseIcon COMPONENT_MVCAPACITOR = new MuseIcon(MUSE_ICON_PATH, 7);
|
||||
public static final MuseIcon COMPONENT_HVCAPACITOR = new MuseIcon(MUSE_ICON_PATH, 8);
|
||||
|
||||
String texturefile;
|
||||
int index;
|
||||
|
|
|
@ -200,22 +200,58 @@ public class Config extends Configuration {
|
|||
.addTradeoffProperty("Overclock", ModularCommon.PICKAXE_HARVEST_SPEED, 18);
|
||||
ModuleManager.addModule(module);
|
||||
|
||||
module = new PowerModule(ModularCommon.MODULE_BATTERY_BASIC, ALLITEMS, MuseIcon.BATTERY_EMPTY, ModularCommon.CATEGORY_ENERGY)
|
||||
module = new PowerModule(ModularCommon.MODULE_BATTERY_BASIC, ALLITEMS, MuseIcon.COMPONENT_LVCAPACITOR, ModularCommon.CATEGORY_ENERGY)
|
||||
.setDescription("Integrate a battery to allow the item to store energy.")
|
||||
.addInstallCost(new ItemStack(BasicComponents.itemBattery, 1))
|
||||
.addInstallCost(copyAndResize(ItemComponent.lvcapacitor, 1))
|
||||
.addBaseProperty(ModularCommon.MAXIMUM_ENERGY, 20000, "J")
|
||||
.addBaseProperty(ModularCommon.WEIGHT, 2000, "g")
|
||||
.addTradeoffProperty("Battery Size", ModularCommon.MAXIMUM_ENERGY, 80000)
|
||||
.addTradeoffProperty("Battery Size", ModularCommon.WEIGHT, 8000);
|
||||
ModuleManager.addModule(module);
|
||||
|
||||
module = new PowerModule(ModularCommon.MODULE_BATTERY_ADVANCED, ALLITEMS, MuseIcon.BATTERY_EMPTY, ModularCommon.CATEGORY_ENERGY)
|
||||
.setDescription("Integrate a more advanced battery to store more energy.")
|
||||
.addInstallCost(copyAndResize(ItemComponent.mvcapacitor, 1))
|
||||
.addBaseProperty(ModularCommon.MAXIMUM_ENERGY, 100000, "J")
|
||||
.addBaseProperty(ModularCommon.WEIGHT, 2000, "g")
|
||||
.addTradeoffProperty("Battery Size", ModularCommon.MAXIMUM_ENERGY, 400000)
|
||||
.addTradeoffProperty("Battery Size", ModularCommon.WEIGHT, 8000);
|
||||
ModuleManager.addModule(module);
|
||||
|
||||
module = new PowerModule(ModularCommon.MODULE_BATTERY_ELITE, ALLITEMS, MuseIcon.BATTERY_FULL, ModularCommon.CATEGORY_ENERGY)
|
||||
.setDescription("Integrate a the most advanced battery to store an extensive amount of energy.")
|
||||
.addInstallCost(copyAndResize(ItemComponent.hvcapacitor, 1))
|
||||
.addBaseProperty(ModularCommon.MAXIMUM_ENERGY, 750000, "J")
|
||||
.addBaseProperty(ModularCommon.WEIGHT, 2000, "g")
|
||||
.addTradeoffProperty("Battery Size", ModularCommon.MAXIMUM_ENERGY, 4250000)
|
||||
.addTradeoffProperty("Battery Size", ModularCommon.WEIGHT, 8000);
|
||||
ModuleManager.addModule(module);
|
||||
|
||||
module = new PowerModule(ModularCommon.MODULE_DIAMOND_PICK_UPGRADE, TOOLONLY, MuseIcon.INDICATOR_1_BLUE, ModularCommon.CATEGORY_TOOL)
|
||||
.setDescription("Add diamonds to allow your pickaxe module to mine Obsidian. *REQUIRES PICKAXE MODULE TO WORK*")
|
||||
.addInstallCost(copyAndResize(ItemComponent.solenoid, 1))
|
||||
.addInstallCost(new ItemStack(Item.diamond, 3));
|
||||
ModuleManager.addModule(module);
|
||||
|
||||
module = new PowerModule(ModularCommon.MODULE_TRANSPARENT_ARMOR, ARMORONLY, MuseIcon.SHIELD, ModularCommon.CATEGORY_COSMETIC)
|
||||
module = new PowerModule(ModularCommon.MODULE_RED_TINT, ARMORONLY, MuseIcon.PLATE_2_RED, ModularCommon.CATEGORY_COSMETIC)
|
||||
.setDescription("Give your armor some red tinting. Combine with the other cosmetic modules to customize your armor's appearance.")
|
||||
.addInstallCost(new ItemStack(Item.dyePowder, 1, 1))
|
||||
.addTradeoffProperty("Intensity", ModularCommon.MODULE_RED_TINT, 1, "%");
|
||||
ModuleManager.addModule(module);
|
||||
|
||||
module = new PowerModule(ModularCommon.MODULE_GREEN_TINT, ARMORONLY, MuseIcon.PLATE_2_GREEN, ModularCommon.CATEGORY_COSMETIC)
|
||||
.setDescription("Give your armor some green tinting. Combine with the other cosmetic modules to customize your armor's appearance.")
|
||||
.addInstallCost(new ItemStack(Item.dyePowder, 1, 2))
|
||||
.addTradeoffProperty("Intensity", ModularCommon.MODULE_GREEN_TINT, 1, "%");
|
||||
ModuleManager.addModule(module);
|
||||
|
||||
module = new PowerModule(ModularCommon.MODULE_BLUE_TINT, ARMORONLY, MuseIcon.PLATE_2_BLUE, ModularCommon.CATEGORY_COSMETIC)
|
||||
.setDescription("Give your armor some blue tinting. Combine with the other cosmetic modules to customize your armor's appearance.")
|
||||
.addInstallCost(new ItemStack(Item.dyePowder, 1, 4))
|
||||
.addTradeoffProperty("Intensity", ModularCommon.MODULE_BLUE_TINT, 1, "%");
|
||||
ModuleManager.addModule(module);
|
||||
|
||||
module = new PowerModule(ModularCommon.MODULE_TRANSPARENT_ARMOR, ARMORONLY, MuseIcon.TRANSPARENT_ARMOR, ModularCommon.CATEGORY_COSMETIC)
|
||||
.setDescription("Make the item transparent, so you can show off your skin without losing armor.")
|
||||
.addInstallCost(new ItemStack(Block.glass, 3));
|
||||
ModuleManager.addModule(module);
|
||||
|
@ -238,7 +274,7 @@ public class Config extends Configuration {
|
|||
.addInstallCost(copyAndResize(ItemComponent.servoMotor, 4));
|
||||
ModuleManager.addSimpleTradeoff(
|
||||
module, "Power",
|
||||
ModularCommon.JUMP_ENERGY_CONSUMPTION, "J", 0, 100,
|
||||
ModularCommon.JUMP_ENERGY_CONSUMPTION, "J", 0, 25,
|
||||
ModularCommon.JUMP_MULTIPLIER, "%", 1, 2);
|
||||
ModuleManager.addModule(module);
|
||||
|
||||
|
@ -248,16 +284,16 @@ public class Config extends Configuration {
|
|||
.addInstallCost(new ItemStack(Block.cloth, 2));
|
||||
ModuleManager.addSimpleTradeoff(
|
||||
module, "Power",
|
||||
ModularCommon.SHOCK_ABSORB_ENERGY_CONSUMPTION, "J", 0, 10,
|
||||
ModularCommon.SHOCK_ABSORB_ENERGY_CONSUMPTION, "J/m", 0, 1,
|
||||
ModularCommon.SHOCK_ABSORB_MULTIPLIER, "%", 0, 1);
|
||||
ModuleManager.addModule(module);
|
||||
|
||||
module = new PowerModule(ModularCommon.MODULE_GLIDER, TORSOONLY, MuseIcon.GLIDER, ModularCommon.CATEGORY_MOVEMENT)
|
||||
.setDescription("Tack on some wings to turn downward into forward momentum. Press shift while falling to activate.")
|
||||
.setDescription("Tack on some wings to turn downward into forward momentum. Press Sneak (defaults to shift) while falling to activate.")
|
||||
.addInstallCost(copyAndResize(ItemComponent.gliderWing, 2));
|
||||
ModuleManager.addModule(module);
|
||||
|
||||
module = new PowerModule(ModularCommon.MODULE_PARACHUTE, TORSOONLY, MuseIcon.PLATE_2_GREEN, ModularCommon.CATEGORY_MOVEMENT)
|
||||
module = new PowerModule(ModularCommon.MODULE_PARACHUTE, TORSOONLY, MuseIcon.PARACHUTE_MODULE, ModularCommon.CATEGORY_MOVEMENT)
|
||||
.setDescription("Add a parachute to slow your descent. Activate by pressing space in midair.")
|
||||
.addInstallCost(copyAndResize(ItemComponent.parachute, 2));
|
||||
ModuleManager.addModule(module);
|
||||
|
@ -267,7 +303,7 @@ public class Config extends Configuration {
|
|||
.addInstallCost(copyAndResize(ItemComponent.ionThruster, 4))
|
||||
.addBaseProperty(ModularCommon.JET_ENERGY_CONSUMPTION, 0, "J/s")
|
||||
.addBaseProperty(ModularCommon.JET_THRUST, 0, "N")
|
||||
.addTradeoffProperty("Thrust", ModularCommon.JET_ENERGY_CONSUMPTION, 16)
|
||||
.addTradeoffProperty("Thrust", ModularCommon.JET_ENERGY_CONSUMPTION, 100)
|
||||
.addTradeoffProperty("Thrust", ModularCommon.JET_THRUST, 0.16);
|
||||
ModuleManager.addModule(module);
|
||||
|
||||
|
@ -276,9 +312,27 @@ public class Config extends Configuration {
|
|||
.addInstallCost(copyAndResize(ItemComponent.ionThruster, 2))
|
||||
.addBaseProperty(ModularCommon.JET_ENERGY_CONSUMPTION, 0)
|
||||
.addBaseProperty(ModularCommon.JET_THRUST, 0)
|
||||
.addTradeoffProperty("Thrust", ModularCommon.JET_ENERGY_CONSUMPTION, 8)
|
||||
.addTradeoffProperty("Thrust", ModularCommon.JET_ENERGY_CONSUMPTION, 50)
|
||||
.addTradeoffProperty("Thrust", ModularCommon.JET_THRUST, 0.08);
|
||||
ModuleManager.addModule(module);
|
||||
|
||||
module = new PowerModule(ModularCommon.MODULE_WATER_ELECTROLYZER, HEADONLY, MuseIcon.PLATE_1_BLUE, ModularCommon.CATEGORY_AQUATIC)
|
||||
.setDescription("When you run out of air, this module will jolt the water around you, electrolyzing a small bubble to breathe from.")
|
||||
.addInstallCost(copyAndResize(ItemComponent.lvcapacitor, 1))
|
||||
.addBaseProperty(ModularCommon.WATERBREATHING_ENERGY_CONSUMPTION, 1000, "J");
|
||||
ModuleManager.addModule(module);
|
||||
|
||||
module = new PowerModule(ModularCommon.MODULE_AQUA_AFFINITY, TOOLONLY, MuseIcon.ORB_1_BLUE, ModularCommon.CATEGORY_AQUATIC)
|
||||
.setDescription("Reduces the speed penalty for using your tool underwater.")
|
||||
.addInstallCost(copyAndResize(ItemComponent.servoMotor, 1))
|
||||
.addBaseProperty(ModularCommon.AQUA_AFFINITY_ENERGY_CONSUMPTION, 0, "J")
|
||||
.addBaseProperty(ModularCommon.UNDERWATER_HARVEST_SPEED, 0.2, "%")
|
||||
.addTradeoffProperty("Power", ModularCommon.AQUA_AFFINITY_ENERGY_CONSUMPTION, 100)
|
||||
.addTradeoffProperty("Power", ModularCommon.UNDERWATER_HARVEST_SPEED, 0.8);
|
||||
ModuleManager.addModule(module);
|
||||
|
||||
|
||||
// red = 1, green = 2, blue = 4
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -58,6 +58,7 @@ public class PowersuitsMod {
|
|||
public static ItemPowerArmorLegs powerArmorLegs;
|
||||
public static ItemPowerArmorFeet powerArmorFeet;
|
||||
public static ItemPowerTool powerTool;
|
||||
public static ItemComponent components;
|
||||
public static BlockTinkerTable tinkerTable;
|
||||
|
||||
/**
|
||||
|
@ -115,7 +116,7 @@ public class PowersuitsMod {
|
|||
powerArmorFeet = new ItemPowerArmorFeet();
|
||||
powerTool = new ItemPowerTool();
|
||||
tinkerTable = new BlockTinkerTable();
|
||||
ItemComponent components = new ItemComponent();
|
||||
components = new ItemComponent();
|
||||
components.populate();
|
||||
|
||||
Config.loadPowerModules();
|
||||
|
|
|
@ -70,13 +70,21 @@ public class RecipeManager {
|
|||
GameRegistry.addRecipe(ItemComponent.parachute,
|
||||
"WWW", "S S", 'W', wool, 'S', string);
|
||||
|
||||
GameRegistry.addRecipe(ItemComponent.capacitor,
|
||||
GameRegistry.addRecipe(ItemComponent.lvcapacitor,
|
||||
"GPL",
|
||||
"W W",
|
||||
'W', ItemComponent.wiring,
|
||||
'G', goldNugget,
|
||||
'P', paper,
|
||||
'L', lapis);
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(ItemComponent.mvcapacitor,
|
||||
"WBW",
|
||||
'W', ItemComponent.wiring,
|
||||
'B', "advancedBattery"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(ItemComponent.hvcapacitor,
|
||||
"WBW",
|
||||
'W', ItemComponent.wiring,
|
||||
'B', "eliteBattery"));
|
||||
|
||||
GameRegistry.addRecipe(ItemComponent.solenoid,
|
||||
"WIW",
|
||||
|
@ -149,14 +157,19 @@ public class RecipeManager {
|
|||
"WWW",
|
||||
"S S", 'W', wool, 'S', string));
|
||||
|
||||
// GameRegistry.addRecipe(ItemComponent.capacitor,
|
||||
// "GPL",
|
||||
// "W W",
|
||||
// 'W', ItemComponent.wiring,
|
||||
// 'G', goldNugget,
|
||||
// 'P', paper,
|
||||
// 'L', lapis);
|
||||
//
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(ItemComponent.lvcapacitor,
|
||||
"WBW",
|
||||
'W', ItemComponent.wiring,
|
||||
'B', "battery"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(ItemComponent.mvcapacitor,
|
||||
"WBW",
|
||||
'W', ItemComponent.wiring,
|
||||
'B', "advancedBattery"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(ItemComponent.hvcapacitor,
|
||||
"WBW",
|
||||
'W', ItemComponent.wiring,
|
||||
'B', "eliteBattery"));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(ItemComponent.solenoid, true,
|
||||
"WIW",
|
||||
"WIW",
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
package net.machinemuse.powersuits.event;
|
||||
|
||||
import net.machinemuse.powersuits.item.IModularItem;
|
||||
import net.machinemuse.powersuits.item.ItemPowerArmor;
|
||||
import net.machinemuse.powersuits.item.ItemPowerTool;
|
||||
import net.machinemuse.powersuits.item.ItemUtils;
|
||||
import net.machinemuse.powersuits.item.ModularCommon;
|
||||
import net.machinemuse.powersuits.powermodule.ModuleManager;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
|
||||
|
@ -44,7 +47,7 @@ public class EventHandler {
|
|||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
public void handleBreakSpeedEvent(PlayerEvent.BreakSpeed event) {
|
||||
public void handleBreakSpeed(PlayerEvent.BreakSpeed event) {
|
||||
Block block = event.block;
|
||||
EntityPlayer player = event.entityPlayer;
|
||||
double harvestSpeed = event.newSpeed;
|
||||
|
@ -77,8 +80,32 @@ public class EventHandler {
|
|||
harvestSpeed = 1;
|
||||
|
||||
}
|
||||
if (harvestSpeed > 1
|
||||
&& player.isInsideOfMaterial(Material.water)
|
||||
&& ItemUtils.itemHasModule(stack, ModularCommon.MODULE_AQUA_AFFINITY)
|
||||
&& energy > ModuleManager.computeModularProperty(stack, ModularCommon.AQUA_AFFINITY_ENERGY_CONSUMPTION)) {
|
||||
harvestSpeed *= 5 * ModuleManager.computeModularProperty(stack, ModularCommon.UNDERWATER_HARVEST_SPEED);
|
||||
}
|
||||
event.newSpeed = (float) harvestSpeed;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
public void handleLivingUpdateEvent(LivingEvent.LivingUpdateEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
ItemStack helmet = player.getCurrentArmor(3);
|
||||
if (helmet != null && helmet.getItem() instanceof IModularItem
|
||||
&& ItemUtils.itemHasModule(helmet, ModularCommon.MODULE_WATER_ELECTROLYZER)) {
|
||||
double energy = ItemUtils.getPlayerEnergy(player);
|
||||
double energyConsumption = ModuleManager.computeModularProperty(helmet, ModularCommon.WATERBREATHING_ENERGY_CONSUMPTION);
|
||||
if (energy > energyConsumption && player.getAir() < 10) {
|
||||
ItemUtils.drainPlayerEnergy(player, energyConsumption);
|
||||
player.setAir(300);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,10 @@ public class ItemComponent extends Item {
|
|||
public static ItemStack gliderWing;
|
||||
public static ItemStack ionThruster;
|
||||
public static ItemStack parachute;
|
||||
public static ItemStack capacitor;
|
||||
public static ItemStack lvcapacitor;
|
||||
public static ItemStack mvcapacitor;
|
||||
public static ItemStack hvcapacitor;
|
||||
public static ItemStack evcapacitor;
|
||||
|
||||
public ItemComponent() {
|
||||
super(Config.getAssignedItemID(Config.Items.PowerArmorComponent));
|
||||
|
@ -57,7 +60,9 @@ public class ItemComponent extends Item {
|
|||
servoMotor = addComponent("Servo Motor", MuseIcon.COMPONENT_SERVOMOTOR);
|
||||
gliderWing = addComponent("Glider Wing", MuseIcon.COMPONENT_GLIDERWING);
|
||||
ionThruster = addComponent("Ion Thruster", MuseIcon.COMPONENT_IONTHRUSTER);
|
||||
capacitor = addComponent("Capacitor", MuseIcon.COMPONENT_CAPACITOR);
|
||||
lvcapacitor = addComponent("LV Capacitor", MuseIcon.COMPONENT_LVCAPACITOR);
|
||||
mvcapacitor = addComponent("MV Capacitor", MuseIcon.COMPONENT_MVCAPACITOR);
|
||||
hvcapacitor = addComponent("HV Capacitor", MuseIcon.COMPONENT_HVCAPACITOR);
|
||||
parachute = addComponent("Parachute", MuseIcon.COMPONENT_PARACHUTE);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,9 +4,11 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import net.machinemuse.general.MuseStringUtils;
|
||||
import net.machinemuse.general.geometry.Colour;
|
||||
import net.machinemuse.general.gui.MuseIcon;
|
||||
import net.machinemuse.powersuits.common.Config;
|
||||
import net.machinemuse.powersuits.common.Config.Items;
|
||||
import net.machinemuse.powersuits.common.MuseLogger;
|
||||
import net.machinemuse.powersuits.powermodule.ModuleManager;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -18,6 +20,11 @@ import net.minecraft.util.DamageSource;
|
|||
import net.minecraftforge.common.IArmorTextureProvider;
|
||||
import net.minecraftforge.common.ISpecialArmor;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Describes the 4 different modular armor pieces - head, torso, legs, feet.
|
||||
*
|
||||
|
@ -37,9 +44,9 @@ public abstract class ItemPowerArmor extends ItemArmor
|
|||
* @param armorType
|
||||
* 0 = head; 1 = torso; 2 = legs; 3 = feet
|
||||
*/
|
||||
public ItemPowerArmor(int id, EnumArmorMaterial material,
|
||||
public ItemPowerArmor(int id,
|
||||
int renderIndex, int armorType) {
|
||||
super(id, material, renderIndex, armorType);
|
||||
super(id, EnumArmorMaterial.CLOTH, renderIndex, armorType);
|
||||
setTextureFile(MuseIcon.SEBK_ICON_PATH);
|
||||
setMaxStackSize(1);
|
||||
setCreativeTab(Config.getCreativeTab());
|
||||
|
@ -48,12 +55,19 @@ public abstract class ItemPowerArmor extends ItemArmor
|
|||
@Override
|
||||
public String getArmorTextureFile(ItemStack itemstack) {
|
||||
if (itemstack != null) {
|
||||
if (ItemUtils.itemHasModule(itemstack, ModularCommon.MODULE_TRANSPARENT_ARMOR)) {
|
||||
return Config.BLANK_ARMOR_MODEL_PATH;
|
||||
} else if (itemstack.getItem() instanceof ItemPowerArmorLegs) {
|
||||
return Config.SEBK_ARMORPANTS_PATH;
|
||||
NBTTagCompound itemTag = ItemUtils.getMuseItemTag(itemstack);
|
||||
if(itemTag.hasKey("didColour")) {
|
||||
|
||||
itemTag.removeTag("didColour");
|
||||
return Config.BLANK_ARMOR_MODEL_PATH;
|
||||
} else {
|
||||
return Config.SEBK_ARMOR_PATH;
|
||||
if (ItemUtils.itemHasModule(itemstack, ModularCommon.MODULE_TRANSPARENT_ARMOR)) {
|
||||
return Config.BLANK_ARMOR_MODEL_PATH;
|
||||
} else if (itemstack.getItem() instanceof ItemPowerArmorLegs) {
|
||||
return Config.SEBK_ARMORPANTS_PATH;
|
||||
} else {
|
||||
return Config.SEBK_ARMOR_PATH;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Config.BLANK_ARMOR_MODEL_PATH;
|
||||
|
@ -94,6 +108,64 @@ public abstract class ItemPowerArmor extends ItemArmor
|
|||
absorbMax);
|
||||
}
|
||||
|
||||
public static double clampDouble(double value, double min, double max) {
|
||||
if (value < min)
|
||||
return min;
|
||||
if (value > max)
|
||||
return max;
|
||||
return value;
|
||||
}
|
||||
|
||||
public Colour getColorFromItemStack(ItemStack stack) {
|
||||
double computedred = ModuleManager.computeModularProperty(stack, ModularCommon.MODULE_RED_TINT);
|
||||
double computedgreen = ModuleManager.computeModularProperty(stack, ModularCommon.MODULE_GREEN_TINT);
|
||||
double computedblue = ModuleManager.computeModularProperty(stack, ModularCommon.MODULE_BLUE_TINT);
|
||||
Colour colour = new Colour(
|
||||
clampDouble(1 + computedred - (computedblue + computedgreen), 0, 1),
|
||||
clampDouble(1 + computedgreen - (computedblue + computedred), 0, 1),
|
||||
clampDouble(1 + computedblue - (computedred + computedgreen), 0, 1),
|
||||
1.0F);
|
||||
return colour;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int par2)
|
||||
{
|
||||
Colour c = getColorFromItemStack(stack);
|
||||
return c.getInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor(ItemStack stack) {
|
||||
|
||||
NBTTagCompound itemTag = ItemUtils.getMuseItemTag(stack);
|
||||
itemTag.setString("didColour", "yes");
|
||||
Colour c = getColorFromItemStack(stack);
|
||||
return c.getInt();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether the specified armor ItemStack has a color.
|
||||
*/
|
||||
public boolean hasColor(ItemStack stack)
|
||||
{
|
||||
NBTTagCompound itemTag = ItemUtils.getMuseItemTag(stack);
|
||||
if (ItemUtils.tagHasModule(itemTag, ModularCommon.MODULE_RED_TINT)
|
||||
|| ItemUtils.tagHasModule(itemTag, ModularCommon.MODULE_GREEN_TINT)
|
||||
|| ItemUtils.tagHasModule(itemTag, ModularCommon.MODULE_BLUE_TINT)) {
|
||||
MuseLogger.logDebug("True!");
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherited from ISpecialArmor, allows us to customize the calculations for
|
||||
* how much armor will display on the player's HUD.
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
package net.machinemuse.powersuits.item;
|
||||
|
||||
import net.machinemuse.powersuits.common.Config;
|
||||
import net.minecraft.item.EnumArmorMaterial;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
/**
|
||||
|
@ -17,7 +16,6 @@ public class ItemPowerArmorFeet extends ItemPowerArmor {
|
|||
*/
|
||||
public ItemPowerArmorFeet() {
|
||||
super(Config.getAssignedItemID(Config.Items.PowerArmorFeet), // itemID
|
||||
EnumArmorMaterial.IRON, // Material
|
||||
0, // Texture index for rendering armor on the player
|
||||
3); // armor type. 0=head, 1=torso, 2=legs, 3=feet
|
||||
itemType = Config.Items.PowerArmorFeet;
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
package net.machinemuse.powersuits.item;
|
||||
|
||||
import net.machinemuse.powersuits.common.Config;
|
||||
import net.minecraft.item.EnumArmorMaterial;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
public class ItemPowerArmorHead extends ItemPowerArmor {
|
||||
public ItemPowerArmorHead() {
|
||||
super(Config.getAssignedItemID(Config.Items.PowerArmorHead), // itemID
|
||||
EnumArmorMaterial.IRON, // Material
|
||||
0, // Texture index for rendering armor on the player
|
||||
0); // armor type. 0=head, 1=torso, 2=legs, 3=feet
|
||||
itemType = Config.Items.PowerArmorHead;
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
package net.machinemuse.powersuits.item;
|
||||
|
||||
import net.machinemuse.powersuits.common.Config;
|
||||
import net.minecraft.item.EnumArmorMaterial;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
public class ItemPowerArmorLegs extends ItemPowerArmor {
|
||||
public ItemPowerArmorLegs() {
|
||||
super(Config.getAssignedItemID(Config.Items.PowerArmorLegs), // itemID
|
||||
EnumArmorMaterial.IRON, // Material
|
||||
0, // Texture index for rendering armor on the player
|
||||
2); // armor type. 0=head, 1=torso, 2=legs, 3=feet
|
||||
itemType = Config.Items.PowerArmorLegs;
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
package net.machinemuse.powersuits.item;
|
||||
|
||||
import net.machinemuse.powersuits.common.Config;
|
||||
import net.minecraft.item.EnumArmorMaterial;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
public class ItemPowerArmorTorso extends ItemPowerArmor {
|
||||
public ItemPowerArmorTorso() {
|
||||
super(Config.getAssignedItemID(Config.Items.PowerArmorTorso), // itemID
|
||||
EnumArmorMaterial.IRON, // Material
|
||||
0, // Texture index for rendering armor on the player
|
||||
1); // armor type. 0=head, 1=torso, 2=legs, 3=feet
|
||||
itemType = Config.Items.PowerArmorTorso;
|
||||
|
|
|
@ -139,10 +139,16 @@ public class ItemPowerTool extends ItemTool
|
|||
} else if (ForgeHooks.isToolEffective(ironAxe, block, meta)) {
|
||||
drain = ModuleManager.computeModularProperty(stack, ModularCommon.AXE_ENERGY_CONSUMPTION);
|
||||
} else {
|
||||
drain = 1;
|
||||
drain = 0;
|
||||
}
|
||||
|
||||
if (drain > 0 && entity.isInsideOfMaterial(Material.water)
|
||||
&& ItemUtils.itemHasModule(stack, ModularCommon.MODULE_AQUA_AFFINITY)) {
|
||||
drain += ModuleManager.computeModularProperty(stack, ModularCommon.AQUA_AFFINITY_ENERGY_CONSUMPTION);
|
||||
}
|
||||
if (entity instanceof EntityPlayer) {
|
||||
ItemUtils.drainPlayerEnergy((EntityPlayer) entity, drain);
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
ItemUtils.drainPlayerEnergy(player, drain);
|
||||
} else {
|
||||
onUse(drain, stack);
|
||||
}
|
||||
|
@ -252,7 +258,6 @@ public class ItemPowerTool extends ItemTool
|
|||
NBTTagCompound itemProperties = ItemUtils
|
||||
.getMuseItemTag(stack);
|
||||
info.add("Detailed Summary");
|
||||
info.add("Material\t" + getToolMaterialName());
|
||||
info.add(formatInfo("Energy Storage", getMaxJoules(stack)) + "J");
|
||||
info.add(formatInfo("Weight", ModularCommon.getTotalWeight(stack)) + "g");
|
||||
return info;
|
||||
|
|
|
@ -375,6 +375,16 @@ public class ItemUtils {
|
|||
|
||||
public static void transferStackWithChance(ItemStack itemsToGive,
|
||||
ItemStack destinationStack, double chanceOfSuccess) {
|
||||
if(ItemUtils.isSameItem(itemsToGive, ItemComponent.lvcapacitor)) {
|
||||
return;
|
||||
}
|
||||
if(ItemUtils.isSameItem(itemsToGive, ItemComponent.mvcapacitor)) {
|
||||
return;
|
||||
}
|
||||
if(ItemUtils.isSameItem(itemsToGive, ItemComponent.hvcapacitor)) {
|
||||
return;
|
||||
}
|
||||
|
||||
int maxSize = destinationStack.getMaxStackSize();
|
||||
while (itemsToGive.stackSize > 0
|
||||
&& destinationStack.stackSize < maxSize) {
|
||||
|
|
|
@ -35,6 +35,9 @@ public abstract class ModularCommon {
|
|||
public static final String SHOCK_ABSORB_ENERGY_CONSUMPTION = "Impact Energy consumption";
|
||||
public static final String JET_ENERGY_CONSUMPTION = "Jet Energy Consumption";
|
||||
public static final String JET_THRUST = "Jet Thrust";
|
||||
public static final String WATERBREATHING_ENERGY_CONSUMPTION = "Jolt Energy";
|
||||
public static final String AQUA_AFFINITY_ENERGY_CONSUMPTION = "Underwater Energy Consumption";
|
||||
public static final String UNDERWATER_HARVEST_SPEED = "Underwater Harvest Speed";
|
||||
|
||||
/**
|
||||
* Module names
|
||||
|
@ -58,6 +61,11 @@ public abstract class ModularCommon {
|
|||
public static final String MODULE_JETBOOTS = "Jet Boots";
|
||||
public static final String MODULE_PARACHUTE = "Parachute";
|
||||
public static final String MODULE_ANTIGRAVITY = "Antigravity Drive";
|
||||
public static final String MODULE_WATER_ELECTROLYZER = "Water Electrolyzer";
|
||||
public static final String MODULE_AQUA_AFFINITY = "Aqua Affinity";
|
||||
public static final String MODULE_RED_TINT = "Red Tint";
|
||||
public static final String MODULE_GREEN_TINT = "Green Tint";
|
||||
public static final String MODULE_BLUE_TINT = "Blue Tint";
|
||||
|
||||
/**
|
||||
* Categories for modules
|
||||
|
@ -68,6 +76,7 @@ public abstract class ModularCommon {
|
|||
public static final String CATEGORY_WEAPON = "Weapon";
|
||||
public static final String CATEGORY_MOVEMENT = "Movement";
|
||||
public static final String CATEGORY_COSMETIC = "Cosmetic";
|
||||
public static final String CATEGORY_AQUATIC = "Aquatic";
|
||||
|
||||
/**
|
||||
* Adds information to the item's tooltip when 'getting' it.
|
||||
|
|
|
@ -7,6 +7,10 @@ import java.io.DataInputStream;
|
|||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import net.machinemuse.powersuits.common.Config;
|
||||
import net.machinemuse.powersuits.common.PowersuitsMod;
|
||||
import net.machinemuse.powersuits.common.Config.Items;
|
||||
import net.machinemuse.powersuits.item.ItemComponent;
|
||||
import net.machinemuse.powersuits.item.ItemUtils;
|
||||
import net.machinemuse.powersuits.powermodule.ModuleManager;
|
||||
import net.machinemuse.powersuits.powermodule.PowerModule;
|
||||
|
@ -78,20 +82,22 @@ public class MusePacketInstallModuleRequest extends MusePacket {
|
|||
|
||||
if (ItemUtils.hasInInventory(cost, playerEntity.inventory)) {
|
||||
List<Integer> slots = ItemUtils.findInInventoryForCost(cost, playerEntity.inventory);
|
||||
double amps = 0;
|
||||
double volts = ItemUtils.getAsModular(stack.getItem()).getVoltage(stack);
|
||||
for (Integer slot : slots) {
|
||||
ItemStack stackInSlot = playerEntity.inventory.getStackInSlot(slot);
|
||||
if (stackInSlot != null && stackInSlot.getItem() instanceof IItemElectric) {
|
||||
IItemElectric electricItem = (IItemElectric) stackInSlot.getItem();
|
||||
amps = electricItem.getJoules(stackInSlot) / volts;
|
||||
}
|
||||
}
|
||||
List<Integer> slotsToUpdate = ItemUtils.deleteFromInventory(
|
||||
cost, inventory);
|
||||
ItemUtils.itemAddModule(stack, moduleType);
|
||||
slots.add(this.itemSlot);
|
||||
ItemUtils.getAsModular(stack.getItem()).onReceive(amps, volts, stack);
|
||||
for(ItemStack itemCost : cost) {
|
||||
double joules = ItemUtils.getAsModular(stack.getItem()).getJoules(stack);
|
||||
if(ItemUtils.isSameItem(itemCost, ItemComponent.lvcapacitor)) {
|
||||
ItemUtils.getAsModular(stack.getItem()).setJoules(joules + 20000, stack);
|
||||
}
|
||||
if(ItemUtils.isSameItem(itemCost, ItemComponent.mvcapacitor)) {
|
||||
ItemUtils.getAsModular(stack.getItem()).setJoules(joules + 100000, stack);
|
||||
}
|
||||
if(ItemUtils.isSameItem(itemCost, ItemComponent.hvcapacitor)) {
|
||||
ItemUtils.getAsModular(stack.getItem()).setJoules(joules + 750000, stack);
|
||||
}
|
||||
}
|
||||
for (Integer slotiter : slotsToUpdate) {
|
||||
MusePacket reply = new MusePacketInventoryRefresh(
|
||||
player,
|
||||
|
|
|
@ -9,7 +9,6 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
import net.machinemuse.general.gui.MuseIcon;
|
||||
import net.machinemuse.powersuits.common.MuseLogger;
|
||||
import net.machinemuse.powersuits.powermodule.property.IPropertyModifier;
|
||||
import net.machinemuse.powersuits.powermodule.property.PropertyModifierFlatAdditive;
|
||||
import net.machinemuse.powersuits.powermodule.property.PropertyModifierLinearAdditive;
|
||||
|
@ -77,7 +76,6 @@ public class PowerModule {
|
|||
}
|
||||
|
||||
public PowerModule addBaseProperty(String propertyName, double baseVal, String unit) {
|
||||
MuseLogger.logDebug("Adding unit: " + propertyName + " maps to " + unit);
|
||||
units.put(propertyName, unit);
|
||||
return addPropertyModifier(propertyName, new PropertyModifierFlatAdditive(baseVal));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue