Vibration Chamber GUI

Preliminary work on Vibration Chamber GUI.
This commit is contained in:
Chris committed 2015-07-21 09:40:32 -04:00
1 parent 635a8d9252
commit 6eff3b98ab
7 files changed
+236 -39

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
7/21/2015 0.8.10.8
Added Essentia Vibration Chamber recipe & research.
TODO: Add Vibration Chamber GUI.
Preliminary work on Vibration Chamber GUI.
TODO: Add to export whitelist
7/10/2015 0.8.10.8
@@ -11,9 +11,11 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.common.util.ForgeDirection;
import thaumcraft.api.aspects.Aspect;
import thaumicenergistics.ThaumicEnergistics;
import thaumicenergistics.gui.ThEGuiHandler;
import thaumicenergistics.registries.BlockEnum;
import thaumicenergistics.texture.BlockTextureManager;
import thaumicenergistics.tileentities.TileEssentiaVibrationChamber;
@@ -40,6 +42,21 @@ public class BlockEssentiaVibrationChamber
this.setCreativeTab( ThaumicEnergistics.ThETab );
}
@Override
protected boolean onBlockActivated( final World world, final int x, final int y, final int z, final EntityPlayer player )
{
// Ignore fake players
if( player instanceof FakePlayer )
{
return false;
}
// Launch the GUI
ThEGuiHandler.launchGui( ThEGuiHandler.ESSENTIA_VIBRATION_CHAMBER, player, world, x, y, z );
return true;
}
@Override
public TileEntity createNewTileEntity( final World world, final int metaData )
{
@@ -0,0 +1,65 @@
package thaumicenergistics.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.FakePlayer;
import thaumcraft.api.aspects.Aspect;
import thaumicenergistics.aspect.AspectStack;
import thaumicenergistics.tileentities.TileEssentiaVibrationChamber;
public class ContainerEssentiaVibrationChamber
extends Container
{
/**
* The essentia vibration chamber.
*/
private final TileEssentiaVibrationChamber chamber;
public ContainerEssentiaVibrationChamber( final EntityPlayer player, final World world, final int x, final int y, final int z )
{
// Get the tile entity
TileEntity te = world.getTileEntity( x, y, z );
// Ensure it is an E.V.C
if( te instanceof TileEssentiaVibrationChamber )
{
// Set the chamber
this.chamber = (TileEssentiaVibrationChamber)te;
}
else
{
// Invalid tile entity
this.chamber = null;
}
}
@Override
public boolean canInteractWith( final EntityPlayer player )
{
return !( player instanceof FakePlayer );
}
public int getPowerLevel()
{
return 5;
}
public Aspect getProcessingAspect()
{
return Aspect.FIRE;
}
public float getRemainingPercent()
{
return 0.5F;
}
public AspectStack getStoredEssentia()
{
return null;
}
}
@@ -0,0 +1,107 @@
package thaumicenergistics.gui;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import thaumicenergistics.container.ContainerEssentiaVibrationChamber;
import thaumicenergistics.gui.abstraction.AbstractGuiBase;
import thaumicenergistics.texture.GuiTextureManager;
public class GuiEssentiaVibrationChamber
extends AbstractGuiBase
{
/**
* The width of the gui
*/
private static final int GUI_WIDTH = 176;
/**
* The height of the gui
*/
private static final int GUI_HEIGHT = 82;
/**
* Thaumcraft's alchemy furnace GUI texture
*/
private static final ResourceLocation alchemyFurnaceTexture = new ResourceLocation( "Thaumcraft", "textures/gui/gui_alchemyfurnace.png" );
public GuiEssentiaVibrationChamber( final EntityPlayer player, final World world, final int x, final int y, final int z )
{
// Create the container and call super
super( new ContainerEssentiaVibrationChamber( player, world, x, y, z ) );
// Set the width and height
this.xSize = GuiEssentiaVibrationChamber.GUI_WIDTH;
this.ySize = GuiEssentiaVibrationChamber.GUI_HEIGHT;
}
@Override
protected void drawGuiContainerBackgroundLayer( final float alpha, final int mouseX, final int mouseY )
{
// No tint + no cutout
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
// Bind the chamber gui texture
Minecraft.getMinecraft().renderEngine.bindTexture( GuiTextureManager.ESSENTIA_VIBRATION_CHAMBER.getTexture() );
// Draw the GUI
this.drawTexturedModalRect( this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize );
int powerOffset = mouseY % 18;
// Draw the power bar
if( powerOffset > 0 )
{
this.drawTexturedModalRect( this.guiLeft + 96, this.guiTop + 32 + powerOffset, 51, 83 + powerOffset, 6, 18 - powerOffset );
}
// Bind the alchemy furnace gui texture
Minecraft.getMinecraft().renderEngine.bindTexture( new ResourceLocation( "thaumcraft", "textures/gui/gui_alchemyfurnace.png" ) );
int storedOffset = 48 - ( ( mouseX / 20 ) % 48 );
// Draw stored essentia amount underlay
if( storedOffset > 0 )
{
this.drawTexturedModalRect( this.guiLeft + 62, this.guiTop + 16 + storedOffset, 200, storedOffset, 8, 48 - storedOffset );
}
// Enable blending
GL11.glEnable( GL11.GL_BLEND );
// Set the blending mode
GL11.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );
// Draw stored essentia amount overlay
this.drawTexturedModalRect( this.guiLeft + 61, this.guiTop + 12, 232, 0, 11, 56 );
int progressOffset = 20 - ( mouseX % 20 );
// Draw fire/progress
if( progressOffset > 0 )
{
this.drawTexturedModalRect( this.guiLeft + 78, this.guiTop + 30 + progressOffset, 177, progressOffset, 15, 20 - progressOffset );
}
// Disable blending
GL11.glDisable( GL11.GL_BLEND );
}
@Override
public void drawGuiContainerForegroundLayer( final int mouseX, final int mouseY )
{
}
@Override
public void initGui()
{
// Call super
super.initGui();
}
}
@@ -7,6 +7,7 @@ import thaumicenergistics.ThaumicEnergistics;
import thaumicenergistics.container.ContainerArcaneAssembler;
import thaumicenergistics.container.ContainerEssentiaCell;
import thaumicenergistics.container.ContainerEssentiaCellWorkbench;
import thaumicenergistics.container.ContainerEssentiaVibrationChamber;
import thaumicenergistics.container.ContainerKnowledgeInscriber;
import thaumicenergistics.container.ContainerPriority;
import thaumicenergistics.container.ContainerWirelessEssentiaTerminal;
@@ -55,6 +56,11 @@ public class ThEGuiHandler
*/
public static final int KNOWLEDGE_INSCRIBER = 60;
/**
* ID of the knowledge inscriber gui.
*/
public static final int ESSENTIA_VIBRATION_CHAMBER = 70;
/**
* Extra data used for some GUI calls.
*/
@@ -226,28 +232,28 @@ public class ThEGuiHandler
}
switch ( ID )
{
// Is this the cell workbench?
if( ID == ThEGuiHandler.CELL_WORKBENCH_ID )
{
return new GuiEssentiaCellWorkbench( player, world, x, y, z );
}
case ThEGuiHandler.CELL_WORKBENCH_ID:
return new GuiEssentiaCellWorkbench( player, world, x, y, z );
// Is this the wireless gui?
if( ID == ThEGuiHandler.WIRELESS_TERMINAL_ID )
{
return GuiEssentiaCellTerminal.NewWirelessEssentiaTerminalGui( player );
}
// Is this the wireless gui?
case ThEGuiHandler.WIRELESS_TERMINAL_ID:
return GuiEssentiaCellTerminal.NewWirelessEssentiaTerminalGui( player );
// Is this the arcane assembler?
if( ID == ThEGuiHandler.ARCANE_ASSEMBLER_ID )
{
return new GuiArcaneAssembler( player, world, x, y, z );
}
// Is this the arcane assembler?
case ThEGuiHandler.ARCANE_ASSEMBLER_ID:
return new GuiArcaneAssembler( player, world, x, y, z );
// Is this the knowledge inscriber?
if( ID == ThEGuiHandler.KNOWLEDGE_INSCRIBER )
{
return new GuiKnowledgeInscriber( player, world, x, y, z );
// Is this the knowledge inscriber?
case ThEGuiHandler.KNOWLEDGE_INSCRIBER:
return new GuiKnowledgeInscriber( player, world, x, y, z );
// Vibration chamber?
case ThEGuiHandler.ESSENTIA_VIBRATION_CHAMBER:
return new GuiEssentiaVibrationChamber( player, world, x, y, z );
}
// No matching GUI element found
@@ -297,29 +303,30 @@ public class ThEGuiHandler
}
switch ( ID )
{
// Is this the cell workbench?
if( ID == ThEGuiHandler.CELL_WORKBENCH_ID )
{
return new ContainerEssentiaCellWorkbench( player, world, x, y, z );
}
case ThEGuiHandler.CELL_WORKBENCH_ID:
return new ContainerEssentiaCellWorkbench( player, world, x, y, z );
// Is this the wireless gui?
if( ID == ThEGuiHandler.WIRELESS_TERMINAL_ID )
{
HandlerWirelessEssentiaTerminal handler = (HandlerWirelessEssentiaTerminal)ThEGuiHandler.extraData[0];
return new ContainerWirelessEssentiaTerminal( player, handler );
}
// Is this the wireless gui?
case ThEGuiHandler.WIRELESS_TERMINAL_ID:
HandlerWirelessEssentiaTerminal handler = (HandlerWirelessEssentiaTerminal)ThEGuiHandler.extraData[0];
return new ContainerWirelessEssentiaTerminal( player, handler );
// Is this the arcane assembler?
if( ID == ThEGuiHandler.ARCANE_ASSEMBLER_ID )
{
return new ContainerArcaneAssembler( player, world, x, y, z );
}
// Is this the arcane assembler?
case ThEGuiHandler.ARCANE_ASSEMBLER_ID:
return new ContainerArcaneAssembler( player, world, x, y, z );
// Is this the knowledge inscriber?
case ThEGuiHandler.KNOWLEDGE_INSCRIBER:
return new ContainerKnowledgeInscriber( player, world, x, y, z );
// Vibration chamber?
case ThEGuiHandler.ESSENTIA_VIBRATION_CHAMBER:
return new ContainerEssentiaVibrationChamber( player, world, x, y, z );
// Is this the knowledge inscriber?
if( ID == ThEGuiHandler.KNOWLEDGE_INSCRIBER )
{
return new ContainerKnowledgeInscriber( player, world, x, y, z );
}
// No matching GUI element found
@@ -13,7 +13,8 @@ public enum GuiTextureManager
PRIORITY ("priority"),
CELL_WORKBENCH ("essentia.cell.workbench"),
ARCANE_ASSEMBLER ("arcane.assembler"),
KNOWLEDGE_INSCRIBER ("knowledge.inscriber");
KNOWLEDGE_INSCRIBER ("knowledge.inscriber"),
ESSENTIA_VIBRATION_CHAMBER ("essentia.vibration.chamber");
private ResourceLocation texture;
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB