revamped module system again, polished gui

This commit is contained in:
MachineMuse 2013-01-04 22:36:41 -07:00
parent 14e7752cfb
commit 34f1152bf9
31 changed files with 1051 additions and 557 deletions

View file

@ -3,33 +3,33 @@ package net.machinemuse.general.geometry;
public class FlyFromPointToPoint2D extends Point2D {
protected Point2D prev;
protected long spawnTime;
protected float timeTo;
protected double timeTo;
public FlyFromPointToPoint2D(float x, float y, float x2, float y2,
float timeTo) {
public FlyFromPointToPoint2D(double x, double y, double x2, double y2,
double timeTo) {
super(x2, y2);
prev = new Point2D(x, y);
spawnTime = System.currentTimeMillis();
this.timeTo = timeTo;
}
public FlyFromPointToPoint2D(Point2D prev, Point2D target, float timeTo) {
public FlyFromPointToPoint2D(Point2D prev, Point2D target, double timeTo) {
this(prev.x(), prev.y(), target.x(), target.y(), timeTo);
}
@Override
public float x() {
public double x() {
return doRatio(prev.x, x);
}
@Override
public float y() {
public double y() {
return doRatio(prev.y, y);
}
public float doRatio(float val1, float val2) {
public double doRatio(double val1, double val2) {
long elapsed = System.currentTimeMillis() - spawnTime;
float ratio = elapsed / timeTo;
double ratio = elapsed / timeTo;
if (ratio > 1.0F) {
return val2;
} else {

View file

@ -3,6 +3,7 @@ package net.machinemuse.general.geometry;
import java.nio.DoubleBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.util.ArrayList;
import java.util.List;
import net.machinemuse.powersuits.gui.MuseGui;
@ -61,8 +62,8 @@ public abstract class MuseRenderer {
drawCircleAround(13, 13, 2);
}
public static void drawCircleAround(float xoffset, float yoffset,
float radius) {
public static void drawCircleAround(double xoffset, double yoffset,
double radius) {
int start = (int) (System.currentTimeMillis() / 4 % 360);
double startangle = 2.0 * Math.PI * start / 360.0;
double endangle = startangle + 2.0 * Math.PI;
@ -91,6 +92,28 @@ public abstract class MuseRenderer {
arraysOff();
}
/**
* Creates a list of points linearly interpolated between points a and b
* noninclusive.
*
* @return A list of num points
*/
public static List<Point2D> pointsInLine(int num, Point2D a, Point2D b) {
List<Point2D> points = new ArrayList<Point2D>();
if (num < 1) {
return null;
} else if (num < 2) {
points.add(b.minus(a).times(0.5F).plus(a));
} else {
Point2D step = b.minus(a).times(1.0F / (num + 1));
for (int i = 1; i < num + 1; i++) {
points.add(a.plus(step.times(i)));
}
}
return points;
}
public static DoubleBuffer getColourGradient(Colour c1, Colour c2,
int numsegments) {
DoubleBuffer buffer = BufferUtils.createDoubleBuffer(numsegments * 4);
@ -380,8 +403,8 @@ public abstract class MuseRenderer {
/**
* Draws a rectangle with a vertical gradient between the specified colors.
*/
public static void drawFrameRect(float left, float top, float right,
float bottom, Colour borderColour, Colour insideColour,
public static void drawFrameRect(double left, double top, double right,
double bottom, Colour borderColour, Colour insideColour,
double zLevel, double cornerradius)
{
texturelessOn();
@ -452,26 +475,23 @@ public abstract class MuseRenderer {
public static void drawGradientRect3D(Vec3 origin, Vec3 size, Colour c1,
Colour c2)
{
Tessellator tessellator = Tessellator.instance;
tessellator.setBrightness(256);
tessellator.startDrawingQuads();
tessellator.setColorRGBA_F((float) c1.r, (float) c1.g, (float) c1.b,
(float) c1.a);
tessellator.addVertex(origin.xCoord, origin.yCoord,
texturelessOn();
GL11.glBegin(GL11.GL_QUADS);
c1.doGL();
GL11.glVertex3d(origin.xCoord, origin.yCoord,
origin.zCoord);
tessellator.addVertex(origin.xCoord + size.xCoord, origin.yCoord,
GL11.glVertex3d(origin.xCoord + size.xCoord, origin.yCoord,
origin.zCoord);
tessellator.setColorRGBA_F((float) c2.r, (float) c2.g, (float) c2.b,
(float) c2.a);
tessellator.addVertex(origin.xCoord + size.xCoord, origin.yCoord
c2.doGL();
GL11.glVertex3d(origin.xCoord + size.xCoord, origin.yCoord
+ size.yCoord,
origin.zCoord + size.zCoord);
tessellator.addVertex(origin.xCoord, origin.yCoord + size.yCoord,
GL11.glVertex3d(origin.xCoord, origin.yCoord + size.yCoord,
origin.zCoord + size.zCoord);
tessellator.draw();
GL11.glEnd();
texturelessOff();
}
public static void drawItemAt(double x, double y, ItemStack item) {
@ -554,6 +574,11 @@ public abstract class MuseRenderer {
new Colour(1, 1, 1, 1).getInt());
}
public static void drawCenteredString(String s, double x, double y) {
double xradius = getFontRenderer().getStringWidth(s) / 2;
drawString(s, x - xradius, y);
}
/**
* Draws a rectangular prism (cube or otherwise orthogonal)
*/

View file

@ -10,10 +10,10 @@ package net.machinemuse.general.geometry;
*
*/
public class Point2D {
protected float x;
protected float y;
protected double x;
protected double y;
public Point2D(float x, float y) {
public Point2D(double x, double y) {
this.x = x;
this.y = y;
}
@ -22,19 +22,19 @@ public class Point2D {
this(p.x, p.y);
}
public float x() {
public double x() {
return x;
}
public float y() {
public double y() {
return y;
}
public void setX(float x) {
public void setX(double x) {
this.x = x;
}
public void setY(float y) {
public void setY(double y) {
this.y = y;
}
@ -46,7 +46,7 @@ public class Point2D {
return new Point2D(x - b.x, y - b.y);
}
public Point2D times(float f) {
return new Point2D(x * f, y * f);
public Point2D times(double scalefactor) {
return new Point2D(x * scalefactor, y * scalefactor);
}
}

View file

@ -93,15 +93,15 @@ public class TinkerTableModel extends Render {
// cube.render(0.016000f);
GL11.glPopMatrix();
for (int i = 0; i < 2; i++) {
GL11.glDisable(GL11.GL_CULL_FACE);
for (int i = 0; i < 1; i++) {
drawScanLine(angle);
}
GL11.glDisable(GL11.GL_CULL_FACE);
MuseRenderer.drawGradientRect3D(
Vec3.createVectorHelper(0, 1.2, 0),
Vec3.createVectorHelper(1, 0, 1),
new Colour(0.3f, 1.0f, 0.3f, 0.8f),
new Colour(0.3f, 1.0f, 0.3f, 0.8f));
new Colour(0.0f, 1.0f, 0.0f, 0.3f),
new Colour(0.0f, 1.0f, 0.0f, 0.3f));
GL11.glEnable(GL11.GL_CULL_FACE);
// MuseRenderer.off2D();
@ -119,11 +119,16 @@ public class TinkerTableModel extends Render {
GL11.glVertex3d(0.5, 1.05 + 0.02f * Math.sin(angle * 3), 0.5);
GL11.glVertex3d(xtarg, 1.2f, ytarg);
GL11.glEnd();
// MuseRenderer.drawGradientRect3D(
// Vec3.createVectorHelper(Math.floor(xtarg * 16.0) / 16.0, 1.201,
// Math.floor(ytarg * 16.0) / 16.0),
// Vec3.createVectorHelper(1.0 / 16.0, 0, 1.0 / 16.0),
// new Colour(0.0f, 1.0f, 0.0f, 0.4f),
// new Colour(0.0f, 1.0f, 0.0f, 0.4f));
}
/**
* Sets the models various rotation angles then renders the model.
* Sets the model's various rotation angles then renders the model.
*/
public void render(Entity par1Entity, float par2, float par3, float par4,
float par5, float par6, float par7) {

View file

@ -45,9 +45,15 @@ public class ClientProxy extends CommonProxy {
*/
@Override
public void registerHandlers() {
TickRegistry.registerTickHandler(playerTickHandler, Side.CLIENT);
TickRegistry.registerTickHandler(renderTickHandler, Side.CLIENT);
packetHandler = new MusePacketHandler().register();
}
@Override
public void postInit() {
}
}

View file

@ -37,4 +37,9 @@ public class CommonProxy {
packetHandler = new MusePacketHandler();
packetHandler.register();
}
public void postInit() {
// TODO Auto-generated method stub
}
}

View file

@ -4,11 +4,8 @@ import java.util.HashMap;
import java.util.Map;
import net.machinemuse.powersuits.gui.MuseIcon;
import net.machinemuse.powersuits.item.ModularItemCommon;
import net.machinemuse.powersuits.tinker.TinkerAction;
import net.machinemuse.powersuits.tinker.TinkerEffectAdditive;
import net.machinemuse.powersuits.tinker.TinkerEffectMultiplicative;
import net.machinemuse.powersuits.tinker.TinkerRequirement;
import net.machinemuse.powersuits.item.ModularCommon;
import net.machinemuse.powersuits.powermodule.GenericModule;
import net.minecraft.block.Block;
import net.minecraft.block.StepSound;
import net.minecraft.block.material.Material;
@ -16,6 +13,7 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.Configuration;
import basiccomponents.common.BasicComponents;
/**
* Initial attempt at storing all tweakable/configurable values in one class.
@ -27,10 +25,18 @@ import net.minecraftforge.common.Configuration;
public class Config extends Configuration {
private static final int[] assignedItemIDs = new int[Items.values().length];
private static final int[] assignedBlockIDs = new int[Blocks.values().length];
private static final Map<String, TinkerAction> tinkerings = new HashMap();
private static final Map<String, GenericModule> allModules = new HashMap();
public static Map<String, TinkerAction> getTinkerings() {
return tinkerings;
public static Map<String, GenericModule> getAllModules() {
return allModules;
}
public static GenericModule getModule(String key) {
return allModules.get(key);
}
public static void addModule(GenericModule module) {
allModules.put(module.getName(), module);
}
private static Configuration config;
@ -112,10 +118,6 @@ public class Config extends Configuration {
return assignedBlockIDs[block.ordinal()];
}
public static void addTinkerAction(TinkerAction action) {
tinkerings.put(action.getName(), action);
}
/**
* Load all the tinkerings in the config file into memory. Eventually. For
* now, they are hardcoded.
@ -124,73 +126,68 @@ public class Config extends Configuration {
boolean[] ARMORONLY = { true, true, true, true, false };
boolean[] TOOLONLY = { false, false, false, false, true };
boolean[] ALLITEMS = { true, true, true, true, true };
addTinkerAction(new TinkerAction("Add armor plating", ARMORONLY)
.addCost(new ItemStack(Item.ingotIron))
.addEffect(
new TinkerEffectAdditive(
ModularItemCommon.ARMOR_VALUE, 1.0, 2.0))
.addEffect(
new TinkerEffectAdditive(
ModularItemCommon.ARMOR_DURABILITY, 1.0, 2.0))
.addEffect(
new TinkerEffectAdditive(
ModularItemCommon.ARMOR_WEIGHT, 1.0, 2.0))
GenericModule module;
module = new GenericModule(ModularCommon.IRON_SHIELDING, ARMORONLY)
.setDescription("Iron plating is heavy but protective.")
.setIcon(MuseIcon.PLATE_1_RED)
.setCategory(ModularCommon.CATEGORY_ARMOR)
.setDefaultDouble(ModularCommon.ARMOR_THICKNESS, 3)
.addInstallCost(new ItemStack(Item.ingotIron, 3))
.addInstallCost(
new ItemStack(BasicComponents.itemCircuit, 1, 0))
.addSalvageRefund(new ItemStack(Item.ingotIron, 2));
addModule(module);
module = new GenericModule(ModularCommon.DIAMOND_SHIELDING, ARMORONLY)
.setDescription(
"By adding some iron plating, you might be able to make this armor more protective.")
.setCategory("Armor")
.setIcon(new MuseIcon("/icons.png", 1)));
addTinkerAction(new TinkerAction("Lighten armor plating", ARMORONLY)
.addCost(new ItemStack(Item.lightStoneDust))
.addEffect(
new TinkerEffectMultiplicative(
ModularItemCommon.ARMOR_VALUE, .95, 1))
.addEffect(
new TinkerEffectMultiplicative(
ModularItemCommon.ARMOR_DURABILITY, .95, 1))
.addEffect(
new TinkerEffectMultiplicative(
ModularItemCommon.ARMOR_WEIGHT, .9, 1))
.addRequirement(
new TinkerRequirement(ModularItemCommon.ARMOR_VALUE,
2, 10))
.addRequirement(
new TinkerRequirement(ModularItemCommon.ARMOR_WEIGHT,
2, 1000000))
"Diamonds are lighter, harder, and more protective than Iron but much harder to find.")
.setIcon(MuseIcon.PLATE_1_BLUE)
.setCategory(ModularCommon.CATEGORY_ARMOR)
.setDefaultDouble(ModularCommon.ARMOR_THICKNESS, 3)
.setDefaultDouble(ModularCommon.ARMOR_DURABILITY, 1000)
.addInstallCost(new ItemStack(Item.diamond, 3))
.addInstallCost(
new ItemStack(BasicComponents.itemCircuit, 1, 1))
.addSalvageRefund(new ItemStack(Item.diamond, 2));
addModule(module);
module = new GenericModule(ModularCommon.SHOVEL, TOOLONLY)
.setDescription(
"Using the lightening effects of glowstone, you might be able to reduce the weight of this armor.")
.setCategory("Armor")
.setIcon(new MuseIcon("/icons.png", 4)));
addTinkerAction(new TinkerAction("Install a battery", ALLITEMS)
.addCost(new ItemStack(Item.redstone))
.addEffect(
new TinkerEffectAdditive(
ModularItemCommon.MAXIMUM_ENERGY, 10000.0,
20000.0))
.addEffect(
new TinkerEffectAdditive(
ModularItemCommon.BATTERY_WEIGHT, 0.5, 1))
.addRequirement(
new TinkerRequirement(
ModularItemCommon.MAXIMUM_ENERGY, -100, 0))
"Shovels are good for soft materials like dirt and sand.")
.setIcon(MuseIcon.TOOL_SHOVEL)
.setCategory(ModularCommon.CATEGORY_TOOL)
.addInstallCost(new ItemStack(Item.ingotIron, 3))
.addSalvageRefund(new ItemStack(Item.ingotIron, 2));
addModule(module);
module = new GenericModule(ModularCommon.AXE, TOOLONLY)
.setDescription(
"By adding a battery, you might be able to have a source of energy on hand at all times.")
.setCategory("Battery")
.setIcon(new MuseIcon("/icons.png", 5)));
addTinkerAction(new TinkerAction("Lighten the battery", ALLITEMS)
.addCost(new ItemStack(Item.redstone))
.addEffect(
new TinkerEffectMultiplicative(
ModularItemCommon.MAXIMUM_ENERGY, .95, 1))
.addEffect(
new TinkerEffectMultiplicative(
ModularItemCommon.BATTERY_WEIGHT, .9, .95))
.addRequirement(
new TinkerRequirement(
ModularItemCommon.MAXIMUM_ENERGY, '>', 10000))
"Axes are mostly for chopping trees.")
.setIcon(MuseIcon.TOOL_AXE)
.setCategory(ModularCommon.CATEGORY_TOOL)
.addInstallCost(new ItemStack(Item.ingotIron, 3))
.addSalvageRefund(new ItemStack(Item.ingotIron, 2));
addModule(module);
module = new GenericModule(ModularCommon.PICKAXE, TOOLONLY)
.setDescription(
"Using lapis instead of redstone might allow you to store the same amount of energy in a smaller frame.")
.setCategory("Battery")
.setIcon(new MuseIcon("/icons.png", 9)));
"Picks are good for harder materials like stone and ore.")
.setIcon(MuseIcon.TOOL_PICK)
.setCategory(ModularCommon.CATEGORY_TOOL)
.addInstallCost(new ItemStack(Item.ingotIron, 3))
.addSalvageRefund(new ItemStack(Item.ingotIron, 2));
addModule(module);
module = new GenericModule(ModularCommon.BATTERY, ALLITEMS)
.setDescription(
"Integrate a battery to allow the item to store energy.")
.setIcon(MuseIcon.ORB_1_GREEN)
.setCategory(ModularCommon.CATEGORY_ENERGY)
.addInstallCost(new ItemStack(BasicComponents.itemBattery, 1))
.addSalvageRefund(new ItemStack(BasicComponents.itemBattery, 1));
addModule(module);
}
/**
@ -267,7 +264,7 @@ public class Config extends Configuration {
* An enum to describe the various GUI windows which can appear. IDs are
* less important here since this data isn't saved or synced.
*
* @author Claire
* @author MachineMuse
*
*/
public static enum Guis {

View file

@ -1,8 +1,10 @@
package net.machinemuse.powersuits.common;
import net.machinemuse.powersuits.gui.GuiTinkerTable;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.stats.AchievementList;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
@ -26,6 +28,8 @@ public class GuiHandler implements IGuiHandler {
int x, int y, int z) {
switch (ID) {
case 0:
Minecraft.getMinecraft().thePlayer.addStat(
AchievementList.openInventory, 1);
return new GuiTinkerTable((EntityClientPlayerMP) player);
default:
return null;

View file

@ -159,5 +159,6 @@ public class PowersuitsMod {
*/
@PostInit
public void postInit(FMLPostInitializationEvent event) {
proxy.postInit();
}
}

View file

@ -1,25 +1,14 @@
package net.machinemuse.powersuits.gui;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.general.geometry.FlyFromPointToPoint2D;
import net.machinemuse.general.geometry.MuseRenderer;
import net.machinemuse.general.geometry.Point2D;
import net.machinemuse.powersuits.gui.clickable.ClickableButton;
import net.machinemuse.powersuits.gui.clickable.ClickableItem;
import net.machinemuse.powersuits.gui.clickable.ClickableTinkerAction;
import net.machinemuse.powersuits.gui.frame.IGuiFrame;
import net.machinemuse.powersuits.gui.frame.InstallSalvageFrame;
import net.machinemuse.powersuits.gui.frame.ItemInfoFrame;
import net.machinemuse.powersuits.item.ItemUtils;
import net.machinemuse.powersuits.network.MusePacket;
import net.machinemuse.powersuits.network.MusePacketTinkerRequest;
import net.machinemuse.powersuits.tinker.TinkerAction;
import net.machinemuse.powersuits.gui.frame.ItemSelectionFrame;
import net.machinemuse.powersuits.gui.frame.ModuleSelectionFrame;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.network.Player;
/**
* The gui class for the TinkerTable block.
@ -29,15 +18,10 @@ import cpw.mods.fml.common.network.Player;
*/
public class GuiTinkerTable extends MuseGui {
protected EntityClientPlayerMP player;
protected List<ClickableItem> itemButtons;
protected int selectedItemStack = -1;
protected List<ClickableTinkerAction> tinkeringButtons;
protected int selectedTinkerAction = -1;
protected List<ItemStack> workingUpgradeCost;
protected List<ItemStack> workingDowngradeRefund;
protected ClickableButton applyTinkerButton;
protected IGuiFrame statsFrame;
protected boolean refresh = true;
protected ItemInfoFrame statsFrame;
protected ItemSelectionFrame itemSelectFrame;
protected ModuleSelectionFrame moduleSelectFrame;
protected InstallSalvageFrame installFrame;
/**
* Constructor. Takes a player as an argument.
@ -46,10 +30,9 @@ public class GuiTinkerTable extends MuseGui {
*/
public GuiTinkerTable(EntityClientPlayerMP player) {
this.player = player;
this.loadItems();
this.xSize = 256;
this.ySize = 226;
}
/**
@ -59,94 +42,33 @@ public class GuiTinkerTable extends MuseGui {
public void initGui()
{
super.initGui();
}
/**
* Add the clickables for the modular items available
*
*/
public void loadItems() {
itemButtons = new ArrayList<ClickableItem>();
List<Integer> slots = ItemUtils
.getModularItemSlotsInInventory(player.inventory);
if (slots.size() > 0) {
List<Point2D> points = this.pointsInLine(slots.size(),
new Point2D(absX(-0.9F), absY(0.9F)),
new Point2D(absX(-0.9F), absY(-0.9F)));
Iterator<Integer> slotiterator = slots.iterator();
Iterator<Point2D> pointiterator = points.iterator();
for (int slot : slots) {
ClickableItem clickie = new ClickableItem(
player.inventory.getStackInSlot(slot),
// Fly from middle over 200 ms
new FlyFromPointToPoint2D(
new Point2D(absX(0), absY(0)),
pointiterator.next(), 200),
slot);
itemButtons.add(clickie);
}
}
}
protected void loadTinkersList(ClickableItem itemClicked) {
statsFrame = new ItemInfoFrame(
itemSelectFrame = new ItemSelectionFrame(
new Point2D(absX(-0.95F), absY(-0.95F)),
new Point2D(absX(-0.78F), absY(0.95F)),
Colour.LIGHTBLUE.withAlpha(0.8F),
Colour.DARKBLUE.withAlpha(0.8F),
player);
statsFrame = new ItemInfoFrame(player,
new Point2D(absX(0f), absY(-0.9f)),
new Point2D(absX(0.9f), absY(0.9f)),
new Point2D(absX(0.9f), absY(0.0f)),
Colour.LIGHTBLUE.withAlpha(0.8),
Colour.DARKBLUE.withAlpha(0.8),
itemClicked.getItem());
tinkeringButtons = new ArrayList();
List<TinkerAction> workingTinkers = ItemUtils
.getValidTinkersForItem(player, itemClicked
.getItem());
if (workingTinkers.size() > 0) {
List<Point2D> points = this.pointsInLine(workingTinkers.size(),
new Point2D(absX(-0.7F), absY(-0.9F)),
new Point2D(absX(-0.7F), absY(0.9F)));
Iterator<Point2D> pointiter = points.iterator();
for (TinkerAction tinker : workingTinkers) {
tinkeringButtons.add(new ClickableTinkerAction(tinker,
pointiter
.next()));
}
}
itemSelectFrame);
moduleSelectFrame = new ModuleSelectionFrame(
new Point2D(absX(-0.75F), absY(-0.95f)),
new Point2D(absX(-0.05F), absY(0.55f)),
Colour.LIGHTBLUE.withAlpha(0.8),
Colour.DARKBLUE.withAlpha(0.8),
itemSelectFrame);
installFrame = new InstallSalvageFrame(
player,
new Point2D(absX(-0.75F), absY(0.6f)),
new Point2D(absX(-0.05F), absY(0.95f)),
Colour.LIGHTBLUE.withAlpha(0.8),
Colour.DARKBLUE.withAlpha(0.8),
itemSelectFrame, moduleSelectFrame);
}
// public void drawNthItem(ItemStack stack, int n) {
// // TBI
// // draw item
// // draw a button if it's moddable
// }
//
public void drawSelection() {
if (selectedItemStack != -1) {
MuseRenderer.drawCircleAround(
itemButtons.get(selectedItemStack).getPosition().x(),
itemButtons.get(selectedItemStack).getPosition().y(),
10);
}
if (selectedTinkerAction != -1) {
MuseRenderer
.drawCircleAround(
tinkeringButtons.get(selectedTinkerAction)
.getPosition().x(),
tinkeringButtons.get(selectedTinkerAction)
.getPosition().y(),
10);
}
}
// public void drawLayout(AugLayout layout) {
//
// }
//
/**
* Draws the background layer for the GUI.
*/
@ -161,55 +83,29 @@ public class GuiTinkerTable extends MuseGui {
@Override
public void drawScreen(int x, int y, float z) {
super.drawScreen(x, y, z);
if (refresh) {
refresh = false;
loadItems();
if (selectedItemStack != -1
&& selectedItemStack < itemButtons.size()) {
loadTinkersList(itemButtons.get(selectedItemStack));
}
refreshUpgrades();
}
// if (refresh) {
// refresh = false;
// loadItems();
// if (selectedItemStack != -1
// && selectedItemStack < itemButtons.size()) {
// loadModulesList(itemButtons.get(selectedItemStack));
// }
// refreshUpgrades();
// }
drawBackground();
drawClickables(this.itemButtons);
drawSelection();
if (statsFrame != null) {
statsFrame.draw();
}
drawClickables(this.tinkeringButtons);
drawApplyTinkerFrame();
drawToolTip();
}
/**
* Draws the tinkering cost, buttons, and labels.
*/
public void drawApplyTinkerFrame() {
if (workingUpgradeCost != null && workingUpgradeCost.size() > 0) {
MuseRenderer.drawString("Cost:", absX(-0.7F),
absY(0.7F));
List<Point2D> points = this.pointsInLine(workingUpgradeCost.size(),
new Point2D(absX(-0.4F), absY(0.7F)),
new Point2D(absX(-0.8F), absY(0.7F)));
Iterator<Point2D> pointiter = points.iterator();
for (ItemStack item : workingUpgradeCost) {
Point2D next = pointiter.next();
MuseRenderer.drawItemAt(next.x(), next.y(),
item);
}
applyTinkerButton.draw();
if (itemSelectFrame != null) {
itemSelectFrame.draw();
}
}
/**
* Clear all the UI stuff that's there.
*/
protected void clearSelections() {
this.selectedTinkerAction = -1;
this.workingUpgradeCost = null;
this.workingDowngradeRefund = null;
this.applyTinkerButton = null;
if (moduleSelectFrame != null) {
moduleSelectFrame.draw();
}
if (installFrame != null) {
installFrame.draw();
}
drawToolTip();
}
/**
@ -220,63 +116,9 @@ public class GuiTinkerTable extends MuseGui {
{
if (button == 0) // Left Mouse Button
{
int itemClicked = hitboxClickables(x, y, this.itemButtons);
int augClicked = hitboxClickables(x, y, this.tinkeringButtons);
if (itemClicked != -1) {
clearSelections();
this.selectedItemStack = itemClicked;
loadTinkersList(itemButtons.get(itemClicked));
} else if (augClicked != -1) {
this.selectedTinkerAction = augClicked;
refreshUpgrades();
} else if (applyTinkerButton != null
&& applyTinkerButton.isEnabled()
&& applyTinkerButton.hitBox(x, y)) {
doTinker();
}
}
}
/**
* Performs all the functions associated with the upgrade button. This
* requires communicating with the server.
*/
private void doTinker() {
if (ItemUtils.hasInInventory(workingUpgradeCost, player.inventory)) {
// ItemUtils.deleteFromInventory(workingUpgradeCost,
// player.inventory);
// workingAugmentation.upgrade();
MusePacket newpacket = new MusePacketTinkerRequest(
(Player) player,
itemButtons.get(selectedItemStack).inventorySlot,
tinkeringButtons.get(selectedTinkerAction).getAction()
.getName()
);
player.sendQueue.addToSendQueue(newpacket.getPacket250());
// player.sendQueue.sendPacket();
}
}
/**
* Updates the apply tinker button.
*/
private void refreshUpgrades() {
if (selectedTinkerAction != -1
&& tinkeringButtons.size() > selectedTinkerAction) {
this.workingUpgradeCost =
tinkeringButtons.get(selectedTinkerAction).getAction()
.getCosts();
if (workingUpgradeCost != null) {
this.applyTinkerButton = new ClickableButton("Apply",
new Point2D(-.4F, 0.9F),
new Point2D(0.20F, 0.05F), true);
if (ItemUtils.hasInInventory(workingUpgradeCost,
player.inventory)) {
applyTinkerButton.setEnabled(true);
} else {
applyTinkerButton.setEnabled(false);
}
}
itemSelectFrame.onMouseDown(x, y);
moduleSelectFrame.onMouseDown(x, y);
installFrame.onMouseDown(x, y);
}
}
@ -286,19 +128,14 @@ public class GuiTinkerTable extends MuseGui {
@Override
protected List<String> getToolTip(int x, int y) {
List<String> hitTip = null;
int itemHover = hitboxClickables(x, y, this.itemButtons);
if (itemHover > -1) {
hitTip = itemButtons.get(itemHover).getToolTip();
hitTip = itemSelectFrame.getToolTip(x, y);
if (hitTip != null) {
return hitTip;
}
int augHover = hitboxClickables(x, y, this.tinkeringButtons);
if (augHover > -1) {
hitTip = tinkeringButtons.get(augHover).getToolTip();
hitTip = moduleSelectFrame.getToolTip(x, y);
if (hitTip != null) {
return hitTip;
}
return hitTip;
}
@Override
public void refresh() {
refresh = true;
}
}

View file

@ -1,6 +1,5 @@
package net.machinemuse.powersuits.gui;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@ -105,28 +104,6 @@ public class MuseGui extends GuiScreen {
return -1;
}
/**
* Creates a list of points linearly interpolated between points a and b
* noninclusive.
*
* @return A list of num points
*/
public List<Point2D> pointsInLine(int num, Point2D a, Point2D b) {
List<Point2D> points = new ArrayList<Point2D>();
if (num < 1) {
return null;
} else if (num < 2) {
points.add(b.minus(a).times(0.5F).plus(a));
} else {
Point2D step = b.minus(a).times(1.0F / (num + 1));
for (int i = 1; i < num + 2; i++) {
points.add(a.plus(step.times(i)));
}
}
return points;
}
/**
* Whether or not this gui pauses the game in single player.
*/
@ -234,16 +211,30 @@ public class MuseGui extends GuiScreen {
strwidth = currstrwidth;
}
}
int top, bottom, left, right;
if (y > this.height / 2) {
top = y - 10 * tooltip.size() - 8;
bottom = y;
left = x;
right = x + 8 + strwidth;
} else {
top = y;
bottom = y + 10 * tooltip.size() + 8;
left = x + 4;
right = x + 12 + strwidth;
}
MuseRenderer.drawFrameRect(
x, y - 10 * tooltip.size() - 5,
x + 10 + strwidth, y + 5,
left, top,
right, bottom,
new Colour(0.2F, 0.6F, 0.9F, 0.7F),
new Colour(0.1F, 0.3F, 0.4F, 0.7F),
0.0F, 8f);
0.0F, 4f);
for (int i = 0; i < tooltip.size(); i++) {
MuseRenderer.drawString(tooltip.get(i),
x + 5,
y - 10 * (tooltip.size() - i));
left + 4,
bottom - 10 * (tooltip.size() - i) - 4);
}
}
}

View file

@ -2,7 +2,31 @@ package net.machinemuse.powersuits.gui;
public class MuseIcon {
public static final String ICON_PATH = "/icons.png";
public static final MuseIcon ORB1 = new MuseIcon(ICON_PATH, 0);
public static final MuseIcon ORB_1_GREEN = new MuseIcon(ICON_PATH, 0);
public static final MuseIcon ORB_1_RED = new MuseIcon(ICON_PATH, 1);
public static final MuseIcon ORB_1_BLUE = new MuseIcon(ICON_PATH, 2);
public static final MuseIcon PLATE_1_GREEN = new MuseIcon(ICON_PATH, 3);
public static final MuseIcon PLATE_1_RED = new MuseIcon(ICON_PATH, 4);
public static final MuseIcon PLATE_1_BLUE = new MuseIcon(ICON_PATH, 5);
public static final MuseIcon NEXUS_1_GREEN = new MuseIcon(ICON_PATH, 6);
public static final MuseIcon NEXUS_1_RED = new MuseIcon(ICON_PATH, 7);
public static final MuseIcon NEXUS_1_BLUE = new MuseIcon(ICON_PATH, 8);
public static final MuseIcon TOOL_AXE = new MuseIcon(ICON_PATH, 9);
public static final MuseIcon TOOL_PICK = new MuseIcon(ICON_PATH, 10);
public static final MuseIcon TOOL_SHOVEL = new MuseIcon(ICON_PATH, 11);
public static final MuseIcon TOOL_SHEARS = new MuseIcon(ICON_PATH, 12);
public static final MuseIcon TOOL_FIST = new MuseIcon(ICON_PATH, 13);
public static final MuseIcon TOOL_PINCH = new MuseIcon(ICON_PATH, 14);
public static final MuseIcon ARMOR_HEAD = new MuseIcon(ICON_PATH, 15);
public static final MuseIcon PLATE_2_GREEN = new MuseIcon(ICON_PATH, 16);
public static final MuseIcon PLATE_2_RED = new MuseIcon(ICON_PATH, 17);
public static final MuseIcon PLATE_2_BLUE = new MuseIcon(ICON_PATH, 18);
public static final MuseIcon INDICATOR_1_BLUE = new MuseIcon(ICON_PATH, 19);
public static final MuseIcon INDICATOR_1_RED = new MuseIcon(ICON_PATH, 20);
public static final MuseIcon INDICATOR_1_GREEN = new MuseIcon(ICON_PATH, 21);
public static final MuseIcon ARMOR_TORSO = new MuseIcon(ICON_PATH, 31);
public static final MuseIcon ARMOR_LEGS = new MuseIcon(ICON_PATH, 47);
public static final MuseIcon ARMOR_FEET = new MuseIcon(ICON_PATH, 63);
String texturefile;
int index;

View file

@ -16,7 +16,7 @@ import net.machinemuse.general.geometry.Point2D;
public class ClickableButton extends Clickable {
protected String label;
protected Point2D radius;
private boolean enabled;
protected boolean enabled;
public ClickableButton(String label, Point2D position, Point2D radius,
boolean enabled) {
@ -52,10 +52,11 @@ public class ClickableButton extends Clickable {
position.y() - radius.y(),
position.x() + radius.x(),
position.y() + radius.y(),
topcolour,
bottomcolour,
0.0F, Math.min(radius.x(), radius.y()));
MuseRenderer.drawString(this.label, position.x(), position.y());
topcolour,
0.0F, 4);
MuseRenderer.drawCenteredString(this.label, position.x(),
position.y() - 4);
}
/*
@ -69,8 +70,8 @@ public class ClickableButton extends Clickable {
/**
* Todo: Fix!
*/
boolean hitx = false;
boolean hity = false;
boolean hitx = Math.abs(position.x() - x) < radius.x();
boolean hity = Math.abs(position.y() - y) < radius.y();
return hitx && hity;
}
@ -81,7 +82,6 @@ public class ClickableButton extends Clickable {
*/
@Override
public List<String> getToolTip() {
// TODO Auto-generated method stub
return null;
}

View file

@ -0,0 +1,45 @@
package net.machinemuse.powersuits.gui.clickable;
import java.util.List;
import net.machinemuse.general.geometry.MuseRenderer;
import net.machinemuse.general.geometry.Point2D;
public class ClickableLabel implements IClickable {
protected String label;
protected Point2D position;
public ClickableLabel(String label, Point2D position) {
this.label = label;
this.position = position;
}
/*
* (non-Javadoc)
*
* @see
* machinemuse.powersuits.gui.Clickable#draw(net.minecraft.client.renderer
* .RenderEngine, machinemuse.powersuits.gui.MuseGui)
*/
@Override
public void draw() {
MuseRenderer.drawCenteredString(this.label, position.x(),
position.y() - 4);
}
@Override
public boolean hitBox(int x, int y) {
return false;
}
/*
* (non-Javadoc)
*
* @see machinemuse.powersuits.gui.Clickable#getToolTip()
*/
@Override
public List<String> getToolTip() {
return null;
}
}

View file

@ -7,8 +7,7 @@ import net.machinemuse.general.MuseStringUtils;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.general.geometry.MuseRenderer;
import net.machinemuse.general.geometry.Point2D;
import net.machinemuse.powersuits.tinker.TinkerAction;
import net.machinemuse.powersuits.tinker.TinkerEffect;
import net.machinemuse.powersuits.powermodule.GenericModule;
/**
* Extends the Clickable class to make a clickable Augmentation; note that this
@ -16,26 +15,23 @@ import net.machinemuse.powersuits.tinker.TinkerEffect;
*
* @author MachineMuse
*/
public class ClickableTinkerAction extends Clickable {
private TinkerAction action;
public class ClickableModule extends Clickable {
private GenericModule module;
/**
* @param vaug
*/
public ClickableTinkerAction(TinkerAction action, Point2D position) {
public ClickableModule(GenericModule module, Point2D position) {
super(position);
this.setAction(action);
this.setModule(module);
}
@Override
public List<String> getToolTip() {
List<String> toolTipText = new ArrayList();
toolTipText.add(getAction().name);
toolTipText.add(getModule().getName());
toolTipText.addAll(MuseStringUtils.wrapStringToLength(
getAction().description, 30));
for (TinkerEffect effect : getAction().getEffects()) {
toolTipText.add(effect.toString());
}
getModule().getDescription(), 30));
return toolTipText;
}
@ -47,7 +43,7 @@ public class ClickableTinkerAction extends Clickable {
Colour.getGreyscale(1.0f, 1.0f).doGL();
MuseRenderer.drawIconAt(getPosition().x() - 8, getPosition().y() - 8,
getAction().getIcon(), null);
getModule().getIcon(), null);
}
@ -58,12 +54,12 @@ public class ClickableTinkerAction extends Clickable {
return hitx && hity;
}
public TinkerAction getAction() {
return action;
public GenericModule getModule() {
return module;
}
public ClickableTinkerAction setAction(TinkerAction action) {
this.action = action;
public ClickableModule setModule(GenericModule module) {
this.module = module;
return this;
}

View file

@ -0,0 +1,143 @@
package net.machinemuse.powersuits.gui.frame;
import java.util.List;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.general.geometry.MuseRenderer;
import net.machinemuse.general.geometry.Point2D;
import net.machinemuse.powersuits.gui.clickable.ClickableButton;
import net.machinemuse.powersuits.gui.clickable.ClickableItem;
import net.machinemuse.powersuits.gui.clickable.ClickableModule;
import net.machinemuse.powersuits.item.ItemUtils;
import net.machinemuse.powersuits.network.MusePacket;
import net.machinemuse.powersuits.network.MusePacketInstallModuleRequest;
import net.machinemuse.powersuits.powermodule.GenericModule;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.network.Player;
public class InstallSalvageFrame extends ScrollableFrame {
protected ItemSelectionFrame targetItem;
protected ModuleSelectionFrame targetModule;
protected ClickableButton installButton;
protected ClickableButton salvageButton;
protected EntityClientPlayerMP player;
public InstallSalvageFrame(EntityClientPlayerMP player, Point2D topleft,
Point2D bottomright,
Colour borderColour, Colour insideColour,
ItemSelectionFrame targetItem, ModuleSelectionFrame targetModule) {
super(topleft, bottomright, borderColour, insideColour);
this.player = player;
this.targetItem = targetItem;
this.targetModule = targetModule;
double sizex = bottomright.x() - topleft.x();
double sizey = bottomright.y() - topleft.y();
this.installButton = new ClickableButton("Install", new Point2D(
bottomright.x() - sizex / 2.0, bottomright.y() - sizey
/ 4.0),
new Point2D(20, 6), true);
this.salvageButton = new ClickableButton("Salvage", new Point2D(
topleft.x() + sizex / 2.0, topleft.y() + sizey / 4.0),
new Point2D(20, 6), false);
}
@Override
public void draw() {
if (targetItem.getSelectedItem() != null
&& targetModule.getSelectedModule() != null) {
drawBackground();
drawItems();
drawButtons();
}
}
private void drawBackground() {
MuseRenderer.drawFrameRect(topleft, bottomright, borderColour,
insideColour, 0, 4);
}
private void drawItems() {
ItemStack stack = targetItem.getSelectedItem().getItem();
GenericModule module = targetModule.getSelectedModule().getModule();
List<ItemStack> itemsToDraw;
double yoffset;
if (!ItemUtils.itemHasModule(stack, module.getName())) {
itemsToDraw = targetModule.getSelectedModule()
.getModule().getInstallCost();
yoffset = topleft.y() + 4;
} else {
itemsToDraw = targetModule.getSelectedModule()
.getModule().getSalvageRefund();
yoffset = bottomright.y() - 20;
}
double xoffset = -8.0 * itemsToDraw.size()
+ (topleft.x() + bottomright.x()) / 2;
int i = 0;
for (ItemStack costItem : itemsToDraw) {
MuseRenderer.drawItemAt(
16 * i++ + xoffset,
yoffset,
costItem);
}
}
private void drawButtons() {
ItemStack stack = targetItem.getSelectedItem().getItem();
GenericModule module = targetModule.getSelectedModule().getModule();
if (!ItemUtils.itemHasModule(stack, module.getName())) {
installButton.setEnabled(ItemUtils.hasInInventory(
module.getInstallCost(), player.inventory));
installButton.draw();
} else {
salvageButton.draw();
}
}
@Override
public void onMouseDown(int x, int y) {
ClickableItem selItem = targetItem.getSelectedItem();
ClickableModule selModule = targetModule.getSelectedModule();
if (selItem != null && selModule != null) {
ItemStack stack = selItem.getItem();
GenericModule module = selModule.getModule();
if (!ItemUtils.itemHasModule(stack, module.getName())) {
if (installButton.hitBox(x, y)) {
doInstall();
}
} else {
if (salvageButton.hitBox(x, y)) {
doSalvage();
}
}
}
}
private void doSalvage() {
}
/**
* Performs all the functions associated with the install button. This
* requires communicating with the server.
*/
private void doInstall() {
ItemStack stack = targetItem.getSelectedItem().getItem();
GenericModule module = targetModule.getSelectedModule().getModule();
if (ItemUtils.hasInInventory(module.getInstallCost(), player.inventory)) {
// Doing it client-side first in case of lag
ItemUtils.deleteFromInventory(module.getInstallCost(),
player.inventory);
ItemUtils.itemAddModule(stack, module);
// Now send request to server to make it legit
MusePacket newpacket = new MusePacketInstallModuleRequest(
(Player) player,
targetItem.getSelectedItem().inventorySlot,
module.getName());
player.sendQueue.addToSendQueue(newpacket.getPacket250());
}
}
}

View file

@ -6,53 +6,59 @@ import java.util.List;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.general.geometry.MuseRenderer;
import net.machinemuse.general.geometry.Point2D;
import net.machinemuse.powersuits.gui.clickable.ClickableItem;
import net.machinemuse.powersuits.item.IModularItem;
import net.machinemuse.powersuits.tinker.TinkerAction;
import net.minecraft.item.ItemStack;
import net.minecraft.entity.player.EntityPlayer;
import org.lwjgl.opengl.GL11;
public class ItemInfoFrame implements IGuiFrame {
public static final double SCALEFACTOR = 0.5;
protected ItemStack stack;
protected ItemSelectionFrame target;
protected TinkerAction previewAction;
protected Point2D topleft;
protected Point2D bottomright;
protected Colour borderColour;
protected Colour insideColour;
protected EntityPlayer player;
public ItemInfoFrame(Point2D topleft, Point2D bottomright,
Colour borderColour, Colour insideColour, ItemStack itemStack) {
this.topleft = topleft;
this.bottomright = bottomright;
public ItemInfoFrame(EntityPlayer player, Point2D topleft,
Point2D bottomright,
Colour borderColour, Colour insideColour, ItemSelectionFrame target) {
this.topleft = topleft.times(1.0 / SCALEFACTOR);
this.bottomright = bottomright.times(1.0 / SCALEFACTOR);
this.borderColour = borderColour;
this.insideColour = insideColour;
this.stack = itemStack;
// this.left /= SCALEFACTOR;
// this.right /= SCALEFACTOR;
// this.top /= SCALEFACTOR;
// this.bottom /= SCALEFACTOR;
this.target = target;
this.player = player;
}
@Override
public void draw() {
GL11.glPushMatrix();
// GL11.glScaled(SCALEFACTOR, SCALEFACTOR, SCALEFACTOR);
MuseRenderer.drawFrameRect(topleft, bottomright, borderColour,
insideColour, 0, 8);
int xoffset = 8;
int yoffset = 8;
int i = 0;
List<String> info = ((IModularItem) stack.getItem()).getLongInfo(stack);
for (String infostring : info) {
String[] str = infostring.split("\t");
MuseRenderer.drawStringsJustified(Arrays.asList(str), topleft.x()
+ xoffset, bottomright.x() - xoffset, topleft.y() + yoffset
+ i * 10);
ClickableItem selected = target.getSelectedItem();
if (selected != null) {
GL11.glPushMatrix();
GL11.glScaled(SCALEFACTOR, SCALEFACTOR, SCALEFACTOR);
MuseRenderer.drawFrameRect(topleft, bottomright, borderColour,
insideColour, 0, 8);
int xoffset = 8;
int yoffset = 8;
int i = 0;
List<String> info = ((IModularItem) selected.getItem().getItem())
.getLongInfo(player, selected.getItem());
for (String infostring : info) {
String[] str = infostring.split("\t");
MuseRenderer.drawStringsJustified(Arrays.asList(str),
topleft.x()
+ xoffset, bottomright.x() - xoffset,
topleft.y() + yoffset
+ i * 10);
i++;
i++;
}
GL11.glPopMatrix();
}
GL11.glPopMatrix();
}

View file

@ -1,54 +1,137 @@
package net.machinemuse.powersuits.gui.frame;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.general.geometry.FlyFromPointToPoint2D;
import net.machinemuse.general.geometry.MuseRenderer;
import net.machinemuse.general.geometry.Point2D;
import net.machinemuse.powersuits.gui.clickable.ClickableItem;
import net.machinemuse.powersuits.item.ItemUtils;
import net.minecraft.entity.player.EntityPlayer;
public class ItemSelectionFrame implements IGuiFrame {
protected Point2D topleft;
protected Point2D bottomright;
protected Colour borderColour;
protected Colour insideColour;
public class ItemSelectionFrame extends ScrollableFrame {
protected List<ClickableItem> itemButtons;
protected int selectedItemStack = -1;
protected EntityPlayer player;
protected List<Point2D> itemPoints;
public ItemSelectionFrame(Point2D topleft, Point2D bottomright,
Colour borderColour, Colour insideColour) {
this.topleft = topleft;
this.bottomright = bottomright;
this.borderColour = borderColour;
this.insideColour = insideColour;
Colour borderColour, Colour insideColour, EntityPlayer player) {
super(topleft, bottomright, borderColour, insideColour);
this.player = player;
List<Integer> slots = ItemUtils
.getModularItemSlotsInInventory(player.inventory);
loadPoints(slots.size());
loadItems();
}
private void loadPoints(int num) {
double centerx = (topleft.x() + bottomright.x()) / 2;
double centery = (topleft.y() + bottomright.y()) / 2;
itemPoints = new ArrayList();
List<Point2D> targetPoints = MuseRenderer.pointsInLine(num,
new Point2D(centerx, bottomright.y()),
new Point2D(centerx, topleft.y()));
for (Point2D point : targetPoints) {
// Fly from middle over 200 ms
itemPoints.add(new FlyFromPointToPoint2D(
new Point2D(centerx, centery),
point, 200));
}
}
private void loadItems() {
itemButtons = new ArrayList<ClickableItem>();
double centerx = (topleft.x() + bottomright.x()) / 2;
double centery = (topleft.y() + bottomright.y()) / 2;
List<Integer> slots = ItemUtils
.getModularItemSlotsInInventory(player.inventory);
if (slots.size() > itemPoints.size()) {
loadPoints(slots.size());
}
if (slots.size() > 0) {
Iterator<Point2D> pointiterator = itemPoints.iterator();
for (int slot : slots) {
ClickableItem clickie = new ClickableItem(
player.inventory.getStackInSlot(slot),
pointiterator.next(), slot);
itemButtons.add(clickie);
}
}
}
@Override
public void draw() {
// TODO Auto-generated method stub
loadItems();
drawBackground();
drawItems();
drawSelection();
}
private void drawBackground() {
MuseRenderer.drawFrameRect(topleft, bottomright, borderColour,
insideColour, 0, 8);
insideColour, 0, 4);
}
private void drawItems() {
for (ClickableItem item : itemButtons) {
item.draw();
}
}
private void drawSelection() {
if (selectedItemStack != -1) {
MuseRenderer.drawCircleAround(
Math.floor(itemButtons.get(selectedItemStack).getPosition()
.x()),
Math.floor(itemButtons.get(selectedItemStack).getPosition()
.y()),
10);
}
}
public ClickableItem getSelectedItem() {
if (itemButtons.size() > selectedItemStack && selectedItemStack != -1) {
return itemButtons.get(selectedItemStack);
} else {
return null;
}
}
@Override
public void onMouseDown(int x, int y) {
// TODO Auto-generated method stub
}
@Override
public void onMouseMove(int x, int y) {
// TODO Auto-generated method stub
}
@Override
public void onMouseUp(int x, int y) {
// TODO Auto-generated method stub
int i = 0;
for (ClickableItem item : itemButtons) {
if (item.hitBox(x, y)) {
selectedItemStack = i;
break;
} else {
i++;
}
}
}
@Override
public List<String> getToolTip(int x, int y) {
// TODO Auto-generated method stub
return null;
int itemHover = -1;
int i = 0;
for (ClickableItem item : itemButtons) {
if (item.hitBox(x, y)) {
itemHover = i;
break;
} else {
i++;
}
}
if (itemHover > -1) {
return itemButtons.get(itemHover).getToolTip();
} else {
return null;
}
}
}

View file

@ -0,0 +1,149 @@
package net.machinemuse.powersuits.gui.frame;
import java.util.*;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.general.geometry.MuseRenderer;
import net.machinemuse.general.geometry.Point2D;
import net.machinemuse.powersuits.gui.clickable.ClickableItem;
import net.machinemuse.powersuits.gui.clickable.ClickableModule;
import net.machinemuse.powersuits.item.ItemUtils;
import net.machinemuse.powersuits.powermodule.GenericModule;
public class ModuleSelectionFrame extends ScrollableFrame {
protected ItemSelectionFrame target;
protected Map<String, ModuleSelectionSubFrame> categories;
protected List<ClickableModule> moduleButtons;
protected int selectedModule = -1;
public ModuleSelectionFrame(Point2D topleft, Point2D bottomright,
Colour borderColour, Colour insideColour, ItemSelectionFrame target) {
super(topleft, bottomright, borderColour, insideColour);
this.target = target;
moduleButtons = new ArrayList();
categories = new HashMap();
}
@Override
public void draw() {
if (target.getSelectedItem() != null) {
loadModules();
drawBackground();
drawItems();
drawSelection();
}
}
private void drawBackground() {
MuseRenderer.drawFrameRect(topleft, bottomright, borderColour,
insideColour, 0, 4);
}
private void drawItems() {
for (ModuleSelectionSubFrame frame : categories.values()) {
frame.draw();
}
}
private void drawSelection() {
ClickableModule module = getSelectedModule();
if (module != null) {
MuseRenderer.drawCircleAround(
moduleButtons.get(selectedModule).getPosition().x(),
moduleButtons.get(selectedModule).getPosition().y(),
10);
}
}
public ClickableModule getSelectedModule() {
if (moduleButtons.size() > selectedModule && selectedModule != -1) {
return moduleButtons.get(selectedModule);
} else {
return null;
}
}
public void loadModules() {
ClickableItem clickie = target.getSelectedItem();
if (clickie != null) {
double centerx = (topleft.x() + bottomright.x()) / 2;
double centery = (topleft.y() + bottomright.y()) / 2;
moduleButtons = new ArrayList();
categories = new HashMap();
List<GenericModule> workingModules = ItemUtils
.getValidModulesForItem(null,
clickie.getItem());
if (workingModules.size() > 0) {
List<Point2D> points = MuseRenderer.pointsInLine(
workingModules.size(),
new Point2D(centerx, topleft.y()),
new Point2D(centerx, bottomright.y()));
Iterator<Point2D> pointiter = points.iterator();
for (GenericModule module : workingModules) {
ModuleSelectionSubFrame frame = getOrCreateCategory(module
.getCategory());
moduleButtons.add(frame.addModule(module));
}
}
}
}
private ModuleSelectionSubFrame getOrCreateCategory(String category) {
if (categories.containsKey(category)) {
return categories.get(category);
} else {
ModuleSelectionSubFrame frame = new ModuleSelectionSubFrame(
category,
new Point2D(topleft.x() + 4, topleft.y() + 4 + 30
* categories.size()),
new Point2D(bottomright.x() - 4, bottomright.y() + 34 + 30
* categories.size()));
categories.put(category, frame);
return frame;
}
}
@Override
public void onMouseDown(int x, int y) {
loadModules();
int i = 0;
for (ClickableModule module : moduleButtons) {
if (module.hitBox(x, y)) {
selectedModule = i;
break;
} else {
i++;
}
}
}
@Override
public List<String> getToolTip(int x, int y) {
if (moduleButtons != null) {
int moduleHover = -1;
int i = 0;
for (ClickableModule module : moduleButtons) {
if (module.hitBox(x, y)) {
moduleHover = i;
break;
} else {
i++;
}
}
if (moduleHover > -1) {
return moduleButtons.get(moduleHover).getToolTip();
} else {
return null;
}
} else {
return null;
}
}
}

View file

@ -0,0 +1,40 @@
package net.machinemuse.powersuits.gui.frame;
import java.util.ArrayList;
import java.util.List;
import net.machinemuse.general.geometry.MuseRenderer;
import net.machinemuse.general.geometry.Point2D;
import net.machinemuse.powersuits.gui.clickable.ClickableModule;
import net.machinemuse.powersuits.powermodule.GenericModule;
public class ModuleSelectionSubFrame {
protected List<ClickableModule> moduleButtons;
protected Point2D topleft;
protected Point2D bottomright;
protected String category;
public ModuleSelectionSubFrame(String category, Point2D topleft,
Point2D bottomright) {
this.category = category;
this.topleft = topleft;
this.bottomright = bottomright;
this.moduleButtons = new ArrayList<ClickableModule>();
}
public void draw() {
MuseRenderer.drawString(this.category, topleft.x(), topleft.y());
for (ClickableModule clickie : moduleButtons) {
clickie.draw();
}
}
public ClickableModule addModule(GenericModule module) {
double x = topleft.x() + 8 + 16 * moduleButtons.size();
double y = topleft.y() + 16;
ClickableModule clickie = new ClickableModule(module, new Point2D(x, y));
this.moduleButtons.add(clickie);
return clickie;
}
}

View file

@ -3,6 +3,7 @@ package net.machinemuse.powersuits.item;
import java.util.List;
import net.machinemuse.powersuits.common.Config;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import universalelectricity.core.implement.IItemElectric;
@ -27,6 +28,6 @@ public interface IModularItem extends IItemElectric {
* @param stack
* @return
*/
public List<String> getLongInfo(ItemStack stack);
public List<String> getLongInfo(EntityPlayer player, ItemStack stack);
}

View file

@ -56,7 +56,12 @@ public abstract class ItemPowerArmor extends ItemArmor
// How much of incoming damage is absorbed by this armor piece.
// 1.0 = absorbs all damage
// 0.5 = 50% damage to item, 50% damage carried over
double absorbRatio = Math.min(0.04 * getArmorDouble(armor), 0.25);
double absorbRatio;
if (player instanceof EntityPlayer) {
absorbRatio = 0.04 * getArmorDouble((EntityPlayer) player, armor);
} else {
absorbRatio = 0.1;
}
// Maximum damage absorbed by this piece. Actual damage to this item
// will be clamped between (damage * absorbRatio) and (absorbMax). Note
@ -73,27 +78,22 @@ public abstract class ItemPowerArmor extends ItemArmor
*/
@Override
public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {
return (int) getArmorDouble(armor);
return (int) getArmorDouble(player, armor);
}
public double getArmorDouble(ItemStack stack) {
public double getArmorDouble(EntityPlayer player, ItemStack stack) {
double totalarmor = 0;
NBTTagCompound props = ItemUtils.getMuseItemTag(stack);
double physArmor = ItemUtils.getDoubleOrZero(props,
ModularItemCommon.ARMOR_VALUE);
double armorDura = ItemUtils.getDoubleOrZero(props,
ModularItemCommon.ARMOR_DURABILITY);
if (armorDura > 0) {
totalarmor += physArmor;
}
double energy = ItemUtils.getAvailableEnergy(player);
double elecArmor = ItemUtils.getDoubleOrZero(props,
ModularItemCommon.PASSIVE_SHIELDING);
double energy = ItemUtils.getDoubleOrZero(props,
ModularItemCommon.CURRENT_ENERGY);
if (energy > 0) {
totalarmor += elecArmor;
if (ItemUtils.itemHasModule(stack, ModularCommon.IRON_SHIELDING)
&& energy > 0) {
totalarmor += 3;
}
if (ItemUtils.itemHasModule(stack, ModularCommon.DIAMOND_SHIELDING)
&& energy > 0) {
totalarmor += 5;
}
// Make it so each armor piece can only contribute 1/4 of the armor
@ -138,7 +138,7 @@ public abstract class ItemPowerArmor extends ItemArmor
@Override
public void addInformation(ItemStack stack,
EntityPlayer player, List currentTipList, boolean advancedToolTips) {
ModularItemCommon.addInformation(stack, player, currentTipList,
ModularCommon.addInformation(stack, player, currentTipList,
advancedToolTips);
}
@ -147,11 +147,12 @@ public abstract class ItemPowerArmor extends ItemArmor
}
@Override
public List<String> getLongInfo(ItemStack stack) {
public List<String> getLongInfo(EntityPlayer player, ItemStack stack) {
List<String> info = new ArrayList();
NBTTagCompound itemProperties = ItemUtils
.getMuseItemTag(stack);
info.add(formatInfo("Armor", getArmorDouble(stack)));
info.add("Detailed Summary");
info.add(formatInfo("Armor", getArmorDouble(player, stack)));
info.add(formatInfo("Energy Storage", getMaxJoules(stack)));
return info;
}
@ -161,32 +162,32 @@ public abstract class ItemPowerArmor extends ItemArmor
// //////////////////////////////////////////////
@Override
public double onReceive(double amps, double voltage, ItemStack itemStack) {
return ModularItemCommon.onReceive(amps, voltage, itemStack);
return ModularCommon.onReceive(amps, voltage, itemStack);
}
@Override
public double onUse(double joulesNeeded, ItemStack itemStack) {
return ModularItemCommon.onUse(joulesNeeded, itemStack);
return ModularCommon.onUse(joulesNeeded, itemStack);
}
@Override
public double getJoules(Object... data) {
return ModularItemCommon.getJoules(getAsStack(data));
return ModularCommon.getJoules(getAsStack(data));
}
@Override
public void setJoules(double joules, Object... data) {
ModularItemCommon.setJoules(joules, getAsStack(data));
ModularCommon.setJoules(joules, getAsStack(data));
}
@Override
public double getMaxJoules(Object... data) {
return ModularItemCommon.getMaxJoules(getAsStack(data));
return ModularCommon.getMaxJoules(getAsStack(data));
}
@Override
public double getVoltage() {
return ModularItemCommon.getVoltage();
return ModularCommon.getVoltage();
}
@Override

View file

@ -168,10 +168,11 @@ public class ItemPowerTool extends ItemTool
}
@Override
public List<String> getLongInfo(ItemStack stack) {
public List<String> getLongInfo(EntityPlayer player, ItemStack stack) {
List<String> info = new ArrayList();
NBTTagCompound itemProperties = ItemUtils
.getMuseItemTag(stack);
info.add("Detailed Summary");
info.add("Material\t" + getToolMaterialName());
info.add(formatInfo("Energy Storage", getMaxJoules(stack)));
return info;
@ -195,7 +196,7 @@ public class ItemPowerTool extends ItemTool
@Override
public void addInformation(ItemStack stack,
EntityPlayer player, List currentTipList, boolean advancedToolTips) {
ModularItemCommon.addInformation(stack, player, currentTipList,
ModularCommon.addInformation(stack, player, currentTipList,
advancedToolTips);
}
@ -204,32 +205,32 @@ public class ItemPowerTool extends ItemTool
// /////////////////////////////////////////// //
@Override
public double onReceive(double amps, double voltage, ItemStack itemStack) {
return ModularItemCommon.onReceive(amps, voltage, itemStack);
return ModularCommon.onReceive(amps, voltage, itemStack);
}
@Override
public double onUse(double joulesNeeded, ItemStack itemStack) {
return ModularItemCommon.onUse(joulesNeeded, itemStack);
return ModularCommon.onUse(joulesNeeded, itemStack);
}
@Override
public double getJoules(Object... data) {
return ModularItemCommon.getJoules(getAsStack(data));
return ModularCommon.getJoules(getAsStack(data));
}
@Override
public void setJoules(double joules, Object... data) {
ModularItemCommon.setJoules(joules, getAsStack(data));
ModularCommon.setJoules(joules, getAsStack(data));
}
@Override
public double getMaxJoules(Object... data) {
return ModularItemCommon.getMaxJoules(getAsStack(data));
return ModularCommon.getMaxJoules(getAsStack(data));
}
@Override
public double getVoltage() {
return ModularItemCommon.getVoltage();
return ModularCommon.getVoltage();
}
@Override

View file

@ -5,7 +5,7 @@ import java.util.LinkedList;
import java.util.List;
import net.machinemuse.powersuits.common.Config;
import net.machinemuse.powersuits.tinker.TinkerAction;
import net.machinemuse.powersuits.powermodule.GenericModule;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
@ -15,39 +15,80 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class ItemUtils {
public static final String nbtPrefix = "mmmpsmod";
public static final String NBTPREFIX = "mmmpsmod";
public static List<TinkerAction> getValidTinkersForItem(
public static List<GenericModule> getValidModulesForItem(
EntityPlayer player, ItemStack stack) {
List<TinkerAction> validActions = new ArrayList();
for (TinkerAction action : Config.getTinkerings().values()) {
if (action.validate(player, stack)) {
validActions.add(action);
List<GenericModule> validModules = new ArrayList();
for (GenericModule module : Config.getAllModules().values()) {
if (module.isValidForSlot(getAsModular(stack.getItem())
.getItemType().ordinal())) {
validModules.add(module);
}
}
return validActions;
return validModules;
}
public static boolean tagHasModule(NBTTagCompound tag, String moduleName) {
if (tag.hasKey(moduleName)) {
return true;
} else {
return false;
}
}
public static boolean itemHasModule(ItemStack stack, String moduleName) {
return tagHasModule(getMuseItemTag(stack), moduleName);
}
public static void tagAddModule(NBTTagCompound tag, GenericModule module) {
tag.setCompoundTag(module.getName(), module.getNewTag());
}
public static void itemAddModule(ItemStack stack, GenericModule module) {
tagAddModule(getMuseItemTag(stack), module);
}
public static boolean removeModule(NBTTagCompound tag, String moduleName) {
if (tag.hasKey(moduleName)) {
tag.removeTag(moduleName);
return true;
} else {
return false;
}
}
public static boolean removeModule(ItemStack stack, String moduleName) {
return removeModule(getMuseItemTag(stack), moduleName);
}
/**
* Gets or creates stack.getTagCompound().getTag(NBTPREFIX)
*
* @param stack
* @return an NBTTagCompound, may be newly created. If stack is null,
* returns null.
*/
public static NBTTagCompound getMuseItemTag(ItemStack stack) {
if (stack == null) {
return null;
}
NBTTagCompound properties = null;
NBTTagCompound stackTag;
if (stack.hasTagCompound()) {
NBTTagCompound stackTag = stack.getTagCompound();
if (stackTag.hasKey(nbtPrefix)) {
properties = stackTag
.getCompoundTag(nbtPrefix);
} else {
properties = new NBTTagCompound();
properties.setCompoundTag(nbtPrefix,
properties);
}
stackTag = stack.getTagCompound();
} else {
NBTTagCompound stackTag = new NBTTagCompound();
stackTag = new NBTTagCompound();
stack.setTagCompound(stackTag);
}
NBTTagCompound properties;
if (stackTag.hasKey(NBTPREFIX)) {
properties = stackTag
.getCompoundTag(NBTPREFIX);
} else {
properties = new NBTTagCompound();
stackTag.setCompoundTag(nbtPrefix, properties);
stackTag.setCompoundTag(NBTPREFIX,
properties);
}
return properties;
}

View file

@ -8,7 +8,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import universalelectricity.core.electricity.ElectricInfo;
public abstract class ModularItemCommon {
public abstract class ModularCommon {
/**
* String literals as constants to eliminate case sensitivity issues etc.
*/
@ -18,7 +18,21 @@ public abstract class ModularItemCommon {
public static final String ARMOR_WEIGHT = "Armor Weight";
public static final String ARMOR_DURABILITY = "Armor Durability";
public static final String ARMOR_VALUE = "Armor Value";
public static final String PASSIVE_SHIELDING = "Passive Shielding";
public static final String ARMOR_THICKNESS = "Armor Thickness";
public static final String IRON_SHIELDING = "Iron Shielding";
public static final String DIAMOND_SHIELDING = "Diamond Shielding";
public static final String SHOVEL = "Shovel";
public static final String BATTERY = "Battery";
/**
* Categories for modules
*/
public static final String CATEGORY_ARMOR = "Armor";
public static final String CATEGORY_ENERGY = "Energy";
public static final String CATEGORY_TOOL = "Tool";
public static final String CATEGORY_WEAPON = "Weapon";
public static final String AXE = "Axe";
public static final String PICKAXE = "Pickaxe";
/**
* Adds information to the item's tooltip when 'getting' it.
@ -40,8 +54,9 @@ public abstract class ModularItemCommon {
if (stack.getItem() instanceof ItemPowerTool) {
String mode = ItemUtils.getStringOrNull(stack, "Tool Mode");
if (mode != null) {
currentTipList.add("Mode:" + MuseStringUtils.wrapFormatTags(mode,
MuseStringUtils.FormatCodes.Red));
currentTipList.add("Mode:"
+ MuseStringUtils.wrapFormatTags(mode,
MuseStringUtils.FormatCodes.Red));
}
}
String energyinfo = "Energy: "
@ -83,13 +98,16 @@ public abstract class ModularItemCommon {
}
public static void setJoules(double joules, ItemStack stack) {
ItemUtils.setDoubleOrRemove(stack, ModularItemCommon.CURRENT_ENERGY,
ItemUtils.setDoubleOrRemove(stack, ModularCommon.CURRENT_ENERGY,
joules);
}
public static double getMaxJoules(ItemStack stack) {
return ItemUtils.getDoubleOrZero(stack,
ModularItemCommon.MAXIMUM_ENERGY);
double maxEnergy = 0;
if (ItemUtils.itemHasModule(stack, ModularCommon.BATTERY)) {
maxEnergy += 20000;
}
return maxEnergy;
}
public static double getVoltage() {

View file

@ -32,7 +32,7 @@ import cpw.mods.fml.relauncher.Side;
*/
public class MusePacketHandler implements IPacketHandler {
public MusePacketHandler register() {
addPacketType(1, MusePacketTinkerRequest.class);
addPacketType(1, MusePacketInstallModuleRequest.class);
addPacketType(2, MusePacketInventoryRefresh.class);
NetworkRegistry.instance().registerChannel(this,

View file

@ -9,12 +9,11 @@ import java.util.List;
import net.machinemuse.powersuits.common.Config;
import net.machinemuse.powersuits.item.ItemUtils;
import net.machinemuse.powersuits.tinker.TinkerAction;
import net.machinemuse.powersuits.powermodule.GenericModule;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.common.network.Player;
@ -28,7 +27,7 @@ import cpw.mods.fml.relauncher.Side;
* @author MachineMuse
*
*/
public class MusePacketTinkerRequest extends MusePacket {
public class MusePacketInstallModuleRequest extends MusePacket {
protected ItemStack stack;
protected int itemSlot;
protected String tinkerName;
@ -42,7 +41,7 @@ public class MusePacketTinkerRequest extends MusePacket {
* Slot containing the item for which the upgrade is requested
* @param tinkerName
*/
public MusePacketTinkerRequest(Player player, int itemSlot,
public MusePacketInstallModuleRequest(Player player, int itemSlot,
String tinkerName) {
super(player);
writeInt(itemSlot);
@ -57,7 +56,7 @@ public class MusePacketTinkerRequest extends MusePacket {
* @throws IOException
*
*/
public MusePacketTinkerRequest(DataInputStream data, Player player) {
public MusePacketInstallModuleRequest(DataInputStream data, Player player) {
super(player, data);
itemSlot = readInt();
tinkerName = readString(64);
@ -73,15 +72,13 @@ public class MusePacketTinkerRequest extends MusePacket {
if (tinkerName != null) {
InventoryPlayer inventory = playerEntity.inventory;
int entityId = playerEntity.entityId;
TinkerAction tinkerType = Config.getTinkerings().get(tinkerName);
NBTTagCompound itemTag = ItemUtils
.getMuseItemTag(stack)
.getCompoundTag(tinkerName);
GenericModule moduleType = Config.getModule(tinkerName);
List<ItemStack> cost = moduleType.getInstallCost();
if (tinkerType.validate(playerEntity, stack)) {
if (ItemUtils.hasInInventory(cost, playerEntity.inventory)) {
List<Integer> slots = ItemUtils.deleteFromInventory(
tinkerType.getCosts(), inventory);
tinkerType.apply(stack);
cost, inventory);
ItemUtils.itemAddModule(stack, moduleType);
slots.add(this.itemSlot);
for (Integer slotiter : slots) {
MusePacket reply = new MusePacketInventoryRefresh(

View file

@ -0,0 +1,106 @@
package net.machinemuse.powersuits.powermodule;
import java.util.ArrayList;
import java.util.List;
import net.machinemuse.powersuits.gui.MuseIcon;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class GenericModule {
protected String name;
protected String description;
protected String category;
protected MuseIcon icon;
protected boolean[] validSlots;
protected List<ItemStack> installCost;
protected List<ItemStack> salvageRefund;
protected List<TinkerTradeoff> tradeoffs;
protected NBTTagCompound defaultTag;
public GenericModule(String name,
boolean[] validSlots) {
this.name = name;
this.validSlots = validSlots;
this.installCost = new ArrayList();
this.salvageRefund = new ArrayList();
this.tradeoffs = new ArrayList();
this.defaultTag = new NBTTagCompound();
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
public String getCategory() {
return category;
}
public MuseIcon getIcon() {
return icon;
}
public NBTTagCompound getNewTag() {
return (NBTTagCompound) defaultTag.copy();
}
public boolean isValidForSlot(int i) {
return validSlots[i];
}
public List<ItemStack> getInstallCost() {
return installCost;
}
public List<ItemStack> getSalvageRefund() {
return salvageRefund;
}
public List<TinkerTradeoff> getTradeoffs() {
return tradeoffs;
}
public GenericModule setDescription(String description) {
this.description = description;
return this;
}
public GenericModule setCategory(String category) {
this.category = category;
return this;
}
public GenericModule setIcon(MuseIcon icon) {
this.icon = icon;
return this;
}
public GenericModule setDefaultString(String key, String value) {
this.defaultTag.setString(key, value);
return this;
}
public GenericModule setDefaultDouble(String key, double value) {
this.defaultTag.setDouble(key, value);
return this;
}
public GenericModule addInstallCost(ItemStack stack) {
this.installCost.add(stack);
return this;
}
public GenericModule addSalvageRefund(ItemStack stack) {
this.salvageRefund.add(stack);
return this;
}
public GenericModule addTradeoff(TinkerTradeoff tradeoff) {
this.tradeoffs.add(tradeoff);
return this;
}
}

View file

@ -1,4 +1,4 @@
package net.machinemuse.powersuits.tinker;
package net.machinemuse.powersuits.powermodule;
import java.util.List;
@ -9,9 +9,15 @@ import net.minecraft.item.ItemStack;
public interface IPowerModule {
public abstract List<ItemStack> getInstallCost(ItemStack item);
public abstract List<ItemStack> getSalvageAmount(ItemStack item);
public abstract List<ItemStack> getSalvageRefund(ItemStack item);
public abstract MuseIcon getIcon(ItemStack item);
public abstract String getCategory();
public abstract boolean validForSlot(int slotnumber);
public abstract IGuiFrame getTinkerFrame(ItemStack item);
public abstract List<String> getTooltip();
}

View file

@ -0,0 +1,5 @@
package net.machinemuse.powersuits.powermodule;
public class TinkerTradeoff {
}

View file

@ -1,39 +0,0 @@
package net.machinemuse.powersuits.tinker;
import java.util.List;
import net.machinemuse.powersuits.gui.MuseIcon;
import net.machinemuse.powersuits.gui.frame.IGuiFrame;
import net.minecraft.item.ItemStack;
public class GenericModule implements IPowerModule {
public GenericModule() {
// TODO Auto-generated constructor stub
}
@Override
public List<ItemStack> getInstallCost(ItemStack item) {
// TODO Auto-generated method stub
return null;
}
@Override
public List<ItemStack> getSalvageAmount(ItemStack item) {
// TODO Auto-generated method stub
return null;
}
@Override
public MuseIcon getIcon(ItemStack item) {
// TODO Auto-generated method stub
return null;
}
@Override
public IGuiFrame getTinkerFrame(ItemStack item) {
// TODO Auto-generated method stub
return null;
}
}