added field tinker module
This commit is contained in:
parent
274a15f165
commit
af64ab2d37
8 changed files with 112 additions and 17 deletions
|
@ -0,0 +1,63 @@
|
|||
package net.machinemuse.general.gui;
|
||||
|
||||
import net.machinemuse.general.geometry.Colour;
|
||||
import net.machinemuse.general.geometry.MusePoint2D;
|
||||
import net.machinemuse.general.gui.frame.*;
|
||||
import net.machinemuse.utils.MuseRenderer;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
|
||||
/**
|
||||
* The gui class for the TinkerTable block.
|
||||
*
|
||||
* @author MachineMuse
|
||||
*/
|
||||
public class GuiFieldTinker extends MuseGui {
|
||||
protected EntityClientPlayerMP player;
|
||||
|
||||
protected ItemSelectionFrame itemSelectFrame;
|
||||
|
||||
/**
|
||||
* Constructor. Takes a player as an argument.
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
public GuiFieldTinker(EntityClientPlayerMP player) {
|
||||
this.player = player;
|
||||
this.xSize = 256;
|
||||
this.ySize = 200;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the buttons (and other controls) to the screen.
|
||||
*/
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
itemSelectFrame = new ItemSelectionFrame(new MusePoint2D(absX(-0.95F), absY(-0.95F)), new MusePoint2D(absX(-0.78F), absY(0.95F)),
|
||||
Colour.LIGHTBLUE.withAlpha(0.8F), Colour.DARKBLUE.withAlpha(0.8F), player);
|
||||
frames.add(itemSelectFrame);
|
||||
|
||||
ItemInfoFrame statsFrame = new ItemInfoFrame(player, new MusePoint2D(absX(0f), absY(-0.9f)), new MusePoint2D(absX(0.9f), absY(-0.05f)),
|
||||
Colour.LIGHTBLUE.withAlpha(0.8), Colour.DARKBLUE.withAlpha(0.8), itemSelectFrame);
|
||||
frames.add(statsFrame);
|
||||
|
||||
ModuleSelectionFrame moduleSelectFrame = new ModuleSelectionFrame(new MusePoint2D(absX(-0.75F), absY(-0.95f)), new MusePoint2D(absX(-0.05F),
|
||||
absY(0.95f)), Colour.LIGHTBLUE.withAlpha(0.8), Colour.DARKBLUE.withAlpha(0.8), itemSelectFrame);
|
||||
frames.add(moduleSelectFrame);
|
||||
|
||||
ModuleTweakFrame tweakFrame = new ModuleTweakFrame(player, new MusePoint2D(absX(0f), absY(0f)), new MusePoint2D(absX(0.9f), absY(0.9f)),
|
||||
Colour.LIGHTBLUE.withAlpha(0.8), Colour.DARKBLUE.withAlpha(0.8), itemSelectFrame, moduleSelectFrame);
|
||||
frames.add(tweakFrame);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int x, int y, float z) {
|
||||
super.drawScreen(x, y, z);
|
||||
if (itemSelectFrame.hasNoItems()) {
|
||||
double centerx = absX(0);
|
||||
double centery = absY(0);
|
||||
MuseRenderer.drawCenteredString("No modular powersuit items", centerx, centery - 5);
|
||||
MuseRenderer.drawCenteredString("found in inventory. Make some!", centerx, centery + 5);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package net.machinemuse.powersuits.block;
|
||||
package net.machinemuse.general.gui;
|
||||
|
||||
import net.machinemuse.general.geometry.Colour;
|
||||
import net.machinemuse.general.geometry.MusePoint2D;
|
|
@ -4,6 +4,8 @@ import net.machinemuse.general.geometry.Colour;
|
|||
import net.machinemuse.general.geometry.FlyFromPointToPoint2D;
|
||||
import net.machinemuse.general.geometry.MusePoint2D;
|
||||
import net.machinemuse.general.gui.clickable.ClickableItem;
|
||||
import net.machinemuse.general.sound.Musique;
|
||||
import net.machinemuse.general.sound.SoundLoader;
|
||||
import net.machinemuse.utils.MuseItemUtils;
|
||||
import net.machinemuse.utils.MuseRenderer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -117,6 +119,7 @@ public class ItemSelectionFrame extends ScrollableFrame {
|
|||
int i = 0;
|
||||
for (ClickableItem item : itemButtons) {
|
||||
if (item.hitBox(x, y)) {
|
||||
Musique.playClientSound(SoundLoader.SOUND_GUI_SELECT, 1);
|
||||
selectedItemStack = i;
|
||||
break;
|
||||
} else {
|
||||
|
|
|
@ -7,6 +7,8 @@ import net.machinemuse.general.geometry.MuseRect;
|
|||
import net.machinemuse.general.geometry.MuseRelativeRect;
|
||||
import net.machinemuse.general.gui.clickable.ClickableItem;
|
||||
import net.machinemuse.general.gui.clickable.ClickableModule;
|
||||
import net.machinemuse.general.sound.Musique;
|
||||
import net.machinemuse.general.sound.SoundLoader;
|
||||
import net.machinemuse.utils.MuseItemUtils;
|
||||
import net.machinemuse.utils.MuseRenderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -163,6 +165,7 @@ public class ModuleSelectionFrame extends ScrollableFrame {
|
|||
int i = 0;
|
||||
for (ClickableModule module : moduleButtons) {
|
||||
if (module.hitBox(x, y)) {
|
||||
Musique.playClientSound(SoundLoader.SOUND_GUI_SELECT, 1);
|
||||
selectedModule = i;
|
||||
prevSelection = module.getModule();
|
||||
break;
|
||||
|
|
|
@ -67,7 +67,6 @@ public class ModuleTweakFrame extends ScrollableFrame {
|
|||
@Override
|
||||
public void draw() {
|
||||
if (sliders != null) {
|
||||
MuseRenderer.drawCenteredString("Tinker", (border.left() + border.right()) / 4, border.top() / 2 + 2);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScaled(SCALERATIO, SCALERATIO, SCALERATIO);
|
||||
super.draw();
|
||||
|
@ -83,6 +82,7 @@ public class ModuleTweakFrame extends ScrollableFrame {
|
|||
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
MuseRenderer.drawCenteredString("Tinker", (border.left() + border.right()) / 4, border.top() / 2 + 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
package net.machinemuse.general.sound;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public class Musique {
|
||||
public static void playOneshotSound(EntityPlayer player, String soundname, float volume) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
|
||||
Minecraft.getMinecraft().sndManager.playSoundFX(SoundLoader.SOUND_JUMP_ASSIST, 1.0f, 1.0f);
|
||||
// Minecraft.getMinecraft().sndManager.playEntitySound(SoundLoader.SOUND_JUMP_ASSIST, player, 1.0f, 1.0f, true);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -199,6 +199,7 @@ public class Config {
|
|||
addModule(new HoeModule(TOOLONLY));
|
||||
addModule(new LuxCapacitor(TOOLONLY));
|
||||
addModule(new OmniWrenchModule(TOOLONLY));
|
||||
addModule(new FieldTinkerModule(TOOLONLY));
|
||||
|
||||
// Weapon
|
||||
addModule(new MeleeAssistModule(TOOLONLY));
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
package net.machinemuse.powersuits.powermodule.tool
|
||||
|
||||
import net.machinemuse.api.IModularItem
|
||||
import net.machinemuse.powersuits.powermodule.PowerModuleBase
|
||||
import net.machinemuse.utils.{MuseItemUtils, MuseCommonStrings}
|
||||
import net.machinemuse.api.moduletrigger.IRightClickModule
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.world.World
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.machinemuse.powersuits.common.ModularPowersuits
|
||||
import net.machinemuse.powersuits.item.ItemComponent
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: Claire2
|
||||
* Date: 4/30/13
|
||||
* Time: 3:14 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
class FieldTinkerModule(list: java.util.List[IModularItem]) extends PowerModuleBase(list) with IRightClickModule {
|
||||
addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.controlCircuit, 1))
|
||||
addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.servoMotor, 2))
|
||||
def getCategory: String = MuseCommonStrings.CATEGORY_SPECIAL
|
||||
|
||||
def getName: String = "Field Tinker Module"
|
||||
|
||||
def getDescription: String = "Maybe you can't memorize the blueprints, but you should at least be able to fine tune your modules without Inspiration\u2122 Inc. LLC."
|
||||
|
||||
def getTextureFile: String = "transparentarmor"
|
||||
|
||||
def onItemUse(itemStack: ItemStack, player: EntityPlayer, world: World, x: Int, y: Int, z: Int, side: Int, hitX: Float, hitY: Float, hitZ: Float) {}
|
||||
|
||||
def onItemUseFirst(itemStack: ItemStack, player: EntityPlayer, world: World, x: Int, y: Int, z: Int, side: Int, hitX: Float, hitY: Float, hitZ: Float): Boolean = {false}
|
||||
|
||||
def onPlayerStoppedUsing(itemStack: ItemStack, world: World, player: EntityPlayer, par4: Int) {}
|
||||
|
||||
def onRightClick(player: EntityPlayer, world: World, item: ItemStack) {
|
||||
player.openGui(ModularPowersuits.instance, 2, world, player.posX.toInt, player.posY.toInt, player.posZ.toInt)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue