Added colouring to power tool, fixed build script (maybe)

This commit is contained in:
MachineMuse 2013-02-10 21:42:19 -07:00
parent 8968237d31
commit 75ac92c636
7 changed files with 48 additions and 26 deletions

View file

@ -120,6 +120,7 @@
<mkdir dir="${mcpsrc.dir}/thermalexpansion/api" />
<mkdir dir="${mcpsrc.dir}/thermalexpansion/api/core" />
<move file="${download.dir}/thermalexpansion/api/core/ItemRegistry.java" todir="${mcpsrc.dir}/thermalexpansion/api/core/ItemRegistry.java" />
<move file="${download.dir}/thermalexpansion/api/core/IChargeableItem.java" todir="${mcpsrc.dir}/thermalexpansion/api/core/IChargeableItem.java" />
<delete dir="${download.dir}/thermalexpansion" />
</target>

View file

@ -7,6 +7,7 @@
package net.machinemuse.powersuits.client.render;
import net.machinemuse.general.MuseRenderer;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.powersuits.common.Config;
import net.machinemuse.powersuits.common.MuseLogger;
import net.minecraft.client.Minecraft;
@ -319,7 +320,7 @@ public class ToolModel extends ModelBase
child.rotateAngleZ -= parent.rotateAngleZ;
}
public void render(Entity entity, float scale, boolean renderTypeIsFirstPerson)
public void render(Entity entity, float scale, boolean renderTypeIsFirstPerson, Colour c1)
{
// super.render(entity, f, f1, f2, f3, f4, f5);
int numsegments = 16;
@ -376,6 +377,9 @@ public class ToolModel extends ModelBase
ForgeHooksClient.bindTexture(Config.SEBK_TOOL_TEXTURE, 0);
if (c1 != null) {
c1.doGL();
}
double scale1 = 1.0 / 16.0;
boolean isThisEntity = entity == Minecraft.getMinecraft().renderViewEntity;
boolean gameIsFirstPerson = (Minecraft.getMinecraft().gameSettings.thirdPersonView == 0);
@ -452,7 +456,7 @@ public class ToolModel extends ModelBase
supportleft3.render(scale);
supportleft4.render(scale);
supportleft5.render(scale);
Colour.WHITE.doGL();
MuseRenderer.glowOn();
crystal.render(scale);

View file

@ -55,16 +55,18 @@ public class ToolRenderer extends Render implements IItemRenderer {
Object... data) {
boolean drawIcon = false;
Colour colour = ItemPowerTool.getColorFromItemStack(itemStack);
switch (type) {
case ENTITY:
RenderBlocks renderEntity = (RenderBlocks) data[0];
EntityItem entityEntity = (EntityItem) data[1];
model.setNeutralPose();
model.render(null, 1, false);
model.render(null, 1, false, colour);
break;
case INVENTORY:
RenderBlocks renderInventory = (RenderBlocks) data[0];
MuseRenderer.drawIconAt(0, 0, ItemPowerTool.getCurrentIconFor(itemStack), Colour.WHITE);
MuseRenderer.drawIconAt(0, 0, ItemPowerTool.getCurrentIconFor(itemStack), colour);
break;
case EQUIPPED:
RenderBlocks renderEquipped = (RenderBlocks) data[0];
@ -76,7 +78,7 @@ public class ToolRenderer extends Render implements IItemRenderer {
model.setNeutralPose();
}
model.render(entityEquipped, 1, false);
model.render(entityEquipped, 1, false, colour);
break;
case FIRST_PERSON_MAP:
EntityPlayer playerFirstPerson = (EntityPlayer) data[0];
@ -84,7 +86,7 @@ public class ToolRenderer extends Render implements IItemRenderer {
MapData mapDataFirstPerson = (MapData) data[2];
model.setPoseForPlayer(playerFirstPerson, itemStack);
model.render(playerFirstPerson, 1, true);
model.render(playerFirstPerson, 1, true, colour);
break;
default:
}

View file

@ -206,7 +206,6 @@ public class Config {
module = new PowerModule(ModularCommon.MODULE_PLASMA_CANNON, TOOLONLY, MuseIcon.WEAPON_ELECTRIC, ModularCommon.CATEGORY_WEAPON)
.setDescription("Use electrical arcs in a containment field to superheat air to a plasma and launch it at enemies.")
.setToggleable(true)
.setIsActive(true)
.addBaseProperty(ModularCommon.PLASMA_CANNON_ENERGY_PER_TICK, 10, "J")
.addBaseProperty(ModularCommon.PLASMA_CANNON_DAMAGE_AT_FULL_CHARGE, 2, "pt")
@ -220,7 +219,6 @@ public class Config {
module = new PowerModule(ModularCommon.MODULE_MELEE_ASSIST, TOOLONLY, MuseIcon.PUNCHY, ModularCommon.CATEGORY_WEAPON)
.setDescription("A much simpler addon, makes your powertool punches hit harder.")
.setToggleable(true)
.setIsActive(true)
.addBaseProperty(ModularCommon.PUNCH_ENERGY, 10, "J")
.addBaseProperty(ModularCommon.PUNCH_DAMAGE, 2, "pt")
@ -264,17 +262,6 @@ public class Config {
.addTradeoffProperty("Overclock", ModularCommon.SHOVEL_HARVEST_SPEED, 17);
addModule(module);
module = new PowerModule(ModularCommon.MODULE_AXE, TOOLONLY, MuseIcon.TOOL_AXE, ModularCommon.CATEGORY_TOOL)
.setIsActive(true)
.setDescription("Axes are mostly for chopping trees.")
.addInstallCost(new ItemStack(Item.ingotIron, 3))
.addInstallCost(copyAndResize(ItemComponent.solenoid, 1))
.addBaseProperty(ModularCommon.AXE_ENERGY_CONSUMPTION, 100, "J")
.addBaseProperty(ModularCommon.AXE_HARVEST_SPEED, 8, "x")
.addTradeoffProperty("Overclock", ModularCommon.AXE_ENERGY_CONSUMPTION, 900)
.addTradeoffProperty("Overclock", ModularCommon.AXE_HARVEST_SPEED, 17);
addModule(module);
module = new PowerModule(ModularCommon.MODULE_PICKAXE, TOOLONLY, MuseIcon.TOOL_PICK, ModularCommon.CATEGORY_TOOL)
.setIsActive(true)
.setDescription("Picks are good for harder materials like stone and ore.")
@ -286,6 +273,17 @@ public class Config {
.addTradeoffProperty("Overclock", ModularCommon.PICKAXE_HARVEST_SPEED, 17);
addModule(module);
module = new PowerModule(ModularCommon.MODULE_AXE, TOOLONLY, MuseIcon.TOOL_AXE, ModularCommon.CATEGORY_TOOL)
.setIsActive(true)
.setDescription("Axes are mostly for chopping trees.")
.addInstallCost(new ItemStack(Item.ingotIron, 3))
.addInstallCost(copyAndResize(ItemComponent.solenoid, 1))
.addBaseProperty(ModularCommon.AXE_ENERGY_CONSUMPTION, 100, "J")
.addBaseProperty(ModularCommon.AXE_HARVEST_SPEED, 8, "x")
.addTradeoffProperty("Overclock", ModularCommon.AXE_ENERGY_CONSUMPTION, 900)
.addTradeoffProperty("Overclock", ModularCommon.AXE_HARVEST_SPEED, 17);
addModule(module);
module = new PowerModule(ModularCommon.MODULE_DIAMOND_PICK_UPGRADE, TOOLONLY, MuseIcon.DIAMOND_PICK, ModularCommon.CATEGORY_SPECIAL)
.setDescription("Add diamonds to allow your pickaxe module to mine Obsidian. *REQUIRES PICKAXE MODULE TO WORK*")
.addInstallCost(copyAndResize(ItemComponent.solenoid, 1))

View file

@ -37,7 +37,7 @@ public class EntityPlasmaBolt extends EntityThrowable {
this.motionX = direction.xCoord * scale;
this.motionY = direction.yCoord * scale;
this.motionZ = direction.zCoord * scale;
double r = this.size / 50.0 - direction.yCoord * Math.max(shootingEntity.getEyeHeight(), 0);
double r = this.size / 50.0 - direction.yCoord * shootingEntity.getEyeHeight();
double xoffset = 1.3f + r;
double yoffset = -.2;
double zoffset = 0.3f;

View file

@ -9,6 +9,7 @@ import net.machinemuse.api.ModularCommon;
import net.machinemuse.api.ModuleManager;
import net.machinemuse.api.MuseItemUtils;
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;
@ -20,11 +21,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemTool;
import net.minecraft.item.*;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.DamageSource;
import net.minecraft.util.Vec3;
@ -90,6 +87,26 @@ public class ItemPowerTool extends ItemTool
return getStrVsBlock(stack, block, 0);
}
public static Colour getColorFromItemStack(ItemStack stack) {
double computedred = ModuleManager.computeModularProperty(stack, ModularCommon.RED_TINT);
double computedgreen = ModuleManager.computeModularProperty(stack, ModularCommon.GREEN_TINT);
double computedblue = ModuleManager.computeModularProperty(stack, ModularCommon.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;
}
public static double clampDouble(double value, double min, double max) {
if (value < min)
return min;
if (value > max)
return max;
return value;
}
public static boolean canHarvestBlock(ItemStack stack, Block block, int meta, EntityPlayer player) {
if (player != null) {
double energy = MuseItemUtils.getPlayerEnergy(player);

View file

@ -129,7 +129,7 @@ public class RenderTickHandler implements ITickHandler {
}
}
// MuseRenderer.blendingOff();
MuseRenderer.blendingOff();
}
}