mirror of
https://github.com/GTNewHorizons/ThaumicEnergistics.git
synced 2026-11-13 16:54:22 +00:00
Update BS+SA
This commit is contained in:
309 files changed
+50659
-55377
No files matched your search
@@ -0,0 +1,44 @@
|
||||
* text eol=lf
|
||||
|
||||
*.[jJ][aA][rR] binary
|
||||
|
||||
*.[pP][nN][gG] binary
|
||||
*.[jJ][pP][gG] binary
|
||||
*.[jJ][pP][eE][gG] binary
|
||||
*.[gG][iI][fF] binary
|
||||
*.[tT][iI][fF] binary
|
||||
*.[tT][iI][fF][fF] binary
|
||||
*.[iI][cC][oO] binary
|
||||
*.[sS][vV][gG] text
|
||||
*.[eE][pP][sS] binary
|
||||
*.[xX][cC][fF] binary
|
||||
|
||||
*.[kK][aA][rR] binary
|
||||
*.[mM]4[aA] binary
|
||||
*.[mM][iI][dD] binary
|
||||
*.[mM][iI][dD][iI] binary
|
||||
*.[mM][pP]3 binary
|
||||
*.[oO][gG][gG] binary
|
||||
*.[rR][aA] binary
|
||||
|
||||
*.7[zZ] binary
|
||||
*.[gG][zZ] binary
|
||||
*.[tT][aA][rR] binary
|
||||
*.[tT][gG][zZ] binary
|
||||
*.[zZ][iI][pP] binary
|
||||
|
||||
*.[tT][cC][nN] binary
|
||||
*.[sS][oO] binary
|
||||
*.[dD][lL][lL] binary
|
||||
*.[dD][yY][lL][iI][bB] binary
|
||||
*.[pP][sS][dD] binary
|
||||
*.[tT][tT][fF] binary
|
||||
*.[oO][tT][fF] binary
|
||||
|
||||
*.[pP][aA][tT][cC][hH] -text
|
||||
|
||||
*.[bB][aA][tT] text eol=crlf
|
||||
*.[cC][mM][dD] text eol=crlf
|
||||
*.[pP][sS]1 text eol=crlf
|
||||
|
||||
*[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary
|
||||
@@ -0,0 +1,10 @@
|
||||
plugins {
|
||||
id 'com.diffplug.blowdryerSetup' version '1.6.0'
|
||||
}
|
||||
|
||||
apply plugin: 'com.diffplug.blowdryerSetup'
|
||||
|
||||
blowdryerSetup {
|
||||
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.1.5')
|
||||
//devLocal '.' // Use this when testing config updates locally
|
||||
}
|
||||
@@ -8,59 +8,58 @@ import javax.annotation.Nonnull;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public abstract class IThEBlocks
|
||||
{
|
||||
/**
|
||||
* Arcane Assembler.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription ArcaneAssembler;
|
||||
public abstract class IThEBlocks {
|
||||
/**
|
||||
* Arcane Assembler.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription ArcaneAssembler;
|
||||
|
||||
/**
|
||||
* Distilation Pattern Encoder.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription DistillationPatternEncoder;
|
||||
/**
|
||||
* Distilation Pattern Encoder.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription DistillationPatternEncoder;
|
||||
|
||||
/**
|
||||
* Essentia Cell Workbench.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription EssentiaCellWorkbench;
|
||||
/**
|
||||
* Essentia Cell Workbench.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription EssentiaCellWorkbench;
|
||||
|
||||
/**
|
||||
* Essentia Provider.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription EssentiaProvider;
|
||||
/**
|
||||
* Essentia Provider.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription EssentiaProvider;
|
||||
|
||||
/**
|
||||
* Essentia Vibration Chamber.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription EssentiaVibrationChamber;
|
||||
/**
|
||||
* Essentia Vibration Chamber.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription EssentiaVibrationChamber;
|
||||
|
||||
/**
|
||||
* Infusion Provider.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription InfusionProvider;
|
||||
/**
|
||||
* Infusion Provider.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription InfusionProvider;
|
||||
|
||||
/**
|
||||
* Iron Gearbox.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription IronGearBox;
|
||||
/**
|
||||
* Iron Gearbox.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription IronGearBox;
|
||||
|
||||
/**
|
||||
* Knowledge Inscriber.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription KnowledgeInscriber;
|
||||
/**
|
||||
* Knowledge Inscriber.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription KnowledgeInscriber;
|
||||
|
||||
/**
|
||||
* Thaumium Gearbox.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription ThaumiumGearBox;
|
||||
/**
|
||||
* Thaumium Gearbox.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription ThaumiumGearBox;
|
||||
}
|
||||
@@ -6,117 +6,116 @@ package thaumicenergistics.api;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public interface IThEConfig
|
||||
{
|
||||
/**
|
||||
* If true essentia gas will be blacklisted from ExtraCells.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean blacklistEssentiaFluidInExtraCells();
|
||||
public interface IThEConfig {
|
||||
/**
|
||||
* If true essentia gas will be blacklisted from ExtraCells.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean blacklistEssentiaFluidInExtraCells();
|
||||
|
||||
/**
|
||||
* Controls the conversion ratio of essentia/fluid. <BR>
|
||||
* 1 essentia unit is converted to this many mb's of fluid.
|
||||
*/
|
||||
int conversionMultiplier();
|
||||
/**
|
||||
* Controls the conversion ratio of essentia/fluid. <BR>
|
||||
* 1 essentia unit is converted to this many mb's of fluid.
|
||||
*/
|
||||
int conversionMultiplier();
|
||||
|
||||
/**
|
||||
* Can the Arcane Assembler be crafted.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean craftArcaneAssembler();
|
||||
/**
|
||||
* Can the Arcane Assembler be crafted.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean craftArcaneAssembler();
|
||||
|
||||
/**
|
||||
* Can the ACT be crafted.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean craftArcaneCraftingTerminal();
|
||||
/**
|
||||
* Can the ACT be crafted.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean craftArcaneCraftingTerminal();
|
||||
|
||||
/**
|
||||
* Can the DPE be crafted.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean craftDistillationPatternEncoder();
|
||||
/**
|
||||
* Can the DPE be crafted.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean craftDistillationPatternEncoder();
|
||||
|
||||
/**
|
||||
* Can Essentia cells be crafted.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean craftEssentiaCells();
|
||||
/**
|
||||
* Can Essentia cells be crafted.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean craftEssentiaCells();
|
||||
|
||||
/**
|
||||
* Can the Essentia Provider be crafted.
|
||||
*/
|
||||
boolean craftEssentiaProvider();
|
||||
/**
|
||||
* Can the Essentia Provider be crafted.
|
||||
*/
|
||||
boolean craftEssentiaProvider();
|
||||
|
||||
/**
|
||||
* Can the EVC be crafted.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean craftEssentiaVibrationChamber();
|
||||
/**
|
||||
* Can the EVC be crafted.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean craftEssentiaVibrationChamber();
|
||||
|
||||
/**
|
||||
* Can the golem backpack be crafted.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean craftGolemWifiBackpack();
|
||||
/**
|
||||
* Can the golem backpack be crafted.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean craftGolemWifiBackpack();
|
||||
|
||||
/**
|
||||
* Can the Infusion Provider be crafted.
|
||||
*/
|
||||
boolean craftInfusionProvider();
|
||||
/**
|
||||
* Can the Infusion Provider be crafted.
|
||||
*/
|
||||
boolean craftInfusionProvider();
|
||||
|
||||
/**
|
||||
* Controls if the import/export/storage can be crafted.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean craftIOBuses();
|
||||
/**
|
||||
* Controls if the import/export/storage can be crafted.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean craftIOBuses();
|
||||
|
||||
/**
|
||||
* Can the VRI be crafted.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean craftVisRelayInterface();
|
||||
/**
|
||||
* Can the VRI be crafted.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean craftVisRelayInterface();
|
||||
|
||||
/**
|
||||
* Can the WET be crafted.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean craftWirelessEssentiaTerminal();
|
||||
/**
|
||||
* Can the WET be crafted.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean craftWirelessEssentiaTerminal();
|
||||
|
||||
/**
|
||||
* If true the iron and thaumium gearbox's will be rendered as a standard
|
||||
* block.
|
||||
*/
|
||||
boolean disableGearboxModel();
|
||||
/**
|
||||
* If true the iron and thaumium gearbox's will be rendered as a standard
|
||||
* block.
|
||||
*/
|
||||
boolean disableGearboxModel();
|
||||
|
||||
/**
|
||||
* Controls if Certus Quartz can be duped in the crucible.
|
||||
*/
|
||||
boolean enableCertusQuartzDupe();
|
||||
/**
|
||||
* Controls if Certus Quartz can be duped in the crucible.
|
||||
*/
|
||||
boolean enableCertusQuartzDupe();
|
||||
|
||||
/**
|
||||
* Is the wrench focus enabled.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean enableWrenchFocus();
|
||||
/**
|
||||
* Is the wrench focus enabled.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean enableWrenchFocus();
|
||||
|
||||
/**
|
||||
* When enabled, overwrites the AE2 facade setting for certain Thaumcraft blocks,
|
||||
* allowing them to become facades.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean forceTCFacades();
|
||||
/**
|
||||
* When enabled, overwrites the AE2 facade setting for certain Thaumcraft blocks,
|
||||
* allowing them to become facades.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean forceTCFacades();
|
||||
}
|
||||
@@ -6,15 +6,14 @@ package thaumicenergistics.api;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public interface IThEEssentiaContainerPermission
|
||||
{
|
||||
/**
|
||||
* Can the container be partially filled?
|
||||
*/
|
||||
boolean canHoldPartialAmount();
|
||||
public interface IThEEssentiaContainerPermission {
|
||||
/**
|
||||
* Can the container be partially filled?
|
||||
*/
|
||||
boolean canHoldPartialAmount();
|
||||
|
||||
/**
|
||||
* The maximum amount this container can hold
|
||||
*/
|
||||
int maximumCapacity();
|
||||
/**
|
||||
* The maximum amount this container can hold
|
||||
*/
|
||||
int maximumCapacity();
|
||||
}
|
||||
@@ -9,14 +9,13 @@ import thaumcraft.api.aspects.Aspect;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public interface IThEEssentiaGas
|
||||
{
|
||||
/**
|
||||
* Get the aspect of the gas.<br>
|
||||
* Can be null if the gas itself is invalid.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nullable
|
||||
Aspect getAspect();
|
||||
public interface IThEEssentiaGas {
|
||||
/**
|
||||
* Get the aspect of the gas.<br>
|
||||
* Can be null if the gas itself is invalid.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nullable
|
||||
Aspect getAspect();
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package thaumicenergistics.api;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
@@ -16,80 +16,79 @@ import thaumicenergistics.api.storage.IAspectStack;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public interface IThEInteractionHelper
|
||||
{
|
||||
/**
|
||||
* Converts an amount of milibuckets to an amount of Essentia.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
long convertEssentiaAmountToFluidAmount( long essentiaAmount );
|
||||
public interface IThEInteractionHelper {
|
||||
/**
|
||||
* Converts an amount of milibuckets to an amount of Essentia.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
long convertEssentiaAmountToFluidAmount(long essentiaAmount);
|
||||
|
||||
/**
|
||||
* Converts an amount of Essentia to an amount of milibuckets.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
long convertFluidAmountToEssentiaAmount( long milibuckets );
|
||||
/**
|
||||
* Converts an amount of Essentia to an amount of milibuckets.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
long convertFluidAmountToEssentiaAmount(long milibuckets);
|
||||
|
||||
/**
|
||||
* Creates a new instance of an aspect stack.
|
||||
*
|
||||
* @param aspect
|
||||
* @param stackSize
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
IAspectStack createAspectStack( @Nullable Aspect aspect, long stackSize );
|
||||
/**
|
||||
* Creates a new instance of an aspect stack.
|
||||
*
|
||||
* @param aspect
|
||||
* @param stackSize
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
IAspectStack createAspectStack(@Nullable Aspect aspect, long stackSize);
|
||||
|
||||
/**
|
||||
* Returns the Arcane Crafting Terminals GUI class.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
Class getArcaneCraftingTerminalGUIClass();
|
||||
/**
|
||||
* Returns the Arcane Crafting Terminals GUI class.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
Class getArcaneCraftingTerminalGUIClass();
|
||||
|
||||
/**
|
||||
* Opens the wireless gui for the specified player.
|
||||
* The item the player is holding is used for the settings and power.
|
||||
* Must be called from the server side.
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
void openWirelessTerminalGui( @Nonnull EntityPlayer player );
|
||||
/**
|
||||
* Opens the wireless gui for the specified player.
|
||||
* The item the player is holding is used for the settings and power.
|
||||
* Must be called from the server side.
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
void openWirelessTerminalGui(@Nonnull EntityPlayer player);
|
||||
|
||||
/**
|
||||
* The {@code IThEWirelessEssentiaTerminal} is assumed to be the item the player is holding, and is no longer needs to be passed in.
|
||||
*
|
||||
*
|
||||
* @param player
|
||||
* @param terminalInterface
|
||||
* is now ignored
|
||||
* @see #openWirelessTerminalGui(EntityPlayer)
|
||||
*/
|
||||
@Deprecated
|
||||
void openWirelessTerminalGui( @Nonnull EntityPlayer player, IThEWirelessEssentiaTerminal terminalInterface );
|
||||
/**
|
||||
* The {@code IThEWirelessEssentiaTerminal} is assumed to be the item the player is holding, and is no longer needs to be passed in.
|
||||
*
|
||||
*
|
||||
* @param player
|
||||
* @param terminalInterface
|
||||
* is now ignored
|
||||
* @see #openWirelessTerminalGui(EntityPlayer)
|
||||
*/
|
||||
@Deprecated
|
||||
void openWirelessTerminalGui(@Nonnull EntityPlayer player, IThEWirelessEssentiaTerminal terminalInterface);
|
||||
|
||||
/**
|
||||
* Registers a handler to receive golem events.
|
||||
*
|
||||
* @param handler
|
||||
*/
|
||||
void registerGolemHookHandler( @Nonnull IGolemHookHandler handler );
|
||||
/**
|
||||
* Registers a handler to receive golem events.
|
||||
*
|
||||
* @param handler
|
||||
*/
|
||||
void registerGolemHookHandler(@Nonnull IGolemHookHandler handler);
|
||||
|
||||
/**
|
||||
* Attempts to set the Arcane Crafting Terminals recipe to the items
|
||||
* specified for the current player.<br>
|
||||
* Call is ignored if player does not have an A.C.T. GUI open.<br>
|
||||
* The items array should be of size 9. Items will be placed in the crafting
|
||||
* grid according to index where
|
||||
* <ul>
|
||||
* <li>0 = Top-Left</li>
|
||||
* <li>1 = Top-Middle</li>
|
||||
* <li>2 = Top-Right</li>
|
||||
* <li>etc</li>
|
||||
* </ul>
|
||||
* Null items are allowed.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
void setArcaneCraftingTerminalRecipe( @Nonnull ItemStack[] items );
|
||||
/**
|
||||
* Attempts to set the Arcane Crafting Terminals recipe to the items
|
||||
* specified for the current player.<br>
|
||||
* Call is ignored if player does not have an A.C.T. GUI open.<br>
|
||||
* The items array should be of size 9. Items will be placed in the crafting
|
||||
* grid according to index where
|
||||
* <ul>
|
||||
* <li>0 = Top-Left</li>
|
||||
* <li>1 = Top-Middle</li>
|
||||
* <li>2 = Top-Right</li>
|
||||
* <li>etc</li>
|
||||
* </ul>
|
||||
* Null items are allowed.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
void setArcaneCraftingTerminalRecipe(@Nonnull ItemStack[] items);
|
||||
}
|
||||
@@ -12,46 +12,45 @@ import net.minecraft.item.ItemStack;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public interface IThEItemDescription
|
||||
{
|
||||
public interface IThEItemDescription {
|
||||
|
||||
/**
|
||||
* Gets the block of this item, if it has one.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nullable
|
||||
Block getBlock();
|
||||
/**
|
||||
* Gets the block of this item, if it has one.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nullable
|
||||
Block getBlock();
|
||||
|
||||
/**
|
||||
* Gets the damage, or meta, value of the item.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getDamage();
|
||||
/**
|
||||
* Gets the damage, or meta, value of the item.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getDamage();
|
||||
|
||||
/**
|
||||
* Gets the item.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
Item getItem();
|
||||
/**
|
||||
* Gets the item.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
Item getItem();
|
||||
|
||||
/**
|
||||
* Gets a stack of size 1.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
ItemStack getStack();
|
||||
/**
|
||||
* Gets a stack of size 1.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
ItemStack getStack();
|
||||
|
||||
/**
|
||||
* Gets a stack of the specified size.
|
||||
*
|
||||
* @param amount
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
ItemStack getStacks( int amount );
|
||||
/**
|
||||
* Gets a stack of the specified size.
|
||||
*
|
||||
* @param amount
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
ItemStack getStacks(int amount);
|
||||
}
|
||||
@@ -8,107 +8,106 @@ import javax.annotation.Nonnull;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public abstract class IThEItems
|
||||
{
|
||||
/**
|
||||
* Coalescence Core.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription CoalescenceCore;
|
||||
public abstract class IThEItems {
|
||||
/**
|
||||
* Coalescence Core.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription CoalescenceCore;
|
||||
|
||||
/**
|
||||
* Diffusion Core.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription DiffusionCore;
|
||||
/**
|
||||
* Diffusion Core.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription DiffusionCore;
|
||||
|
||||
/**
|
||||
* 16 KiloByte essentia storage cell.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription EssentiaCell_16k;
|
||||
/**
|
||||
* 16 KiloByte essentia storage cell.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription EssentiaCell_16k;
|
||||
|
||||
/**
|
||||
* 1 KiloByte essentia storage cell.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription EssentiaCell_1k;
|
||||
/**
|
||||
* 1 KiloByte essentia storage cell.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription EssentiaCell_1k;
|
||||
|
||||
/**
|
||||
* 4 KiloByte essentia storage cell.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription EssentiaCell_4k;
|
||||
/**
|
||||
* 4 KiloByte essentia storage cell.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription EssentiaCell_4k;
|
||||
|
||||
/**
|
||||
* 64 KiloByte essentia storage cell.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription EssentiaCell_64k;
|
||||
/**
|
||||
* 64 KiloByte essentia storage cell.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription EssentiaCell_64k;
|
||||
|
||||
/**
|
||||
* Creative essentia storage cell.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription EssentiaCell_Creative;
|
||||
/**
|
||||
* Creative essentia storage cell.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription EssentiaCell_Creative;
|
||||
|
||||
/**
|
||||
* Essentia storage cell housing.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription EssentiaCell_Casing;
|
||||
/**
|
||||
* Essentia storage cell housing.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription EssentiaCell_Casing;
|
||||
|
||||
/**
|
||||
* 16 KiloByte essentia storage cell component.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription EssentiaStorageComponent_16k;
|
||||
/**
|
||||
* 16 KiloByte essentia storage cell component.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription EssentiaStorageComponent_16k;
|
||||
|
||||
/**
|
||||
* 1 KiloByte essentia storage cell component.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription EssentiaStorageComponent_1k;
|
||||
/**
|
||||
* 1 KiloByte essentia storage cell component.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription EssentiaStorageComponent_1k;
|
||||
|
||||
/**
|
||||
* 4 KiloByte essentia storage cell component.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription EssentiaStorageComponent_4k;
|
||||
/**
|
||||
* 4 KiloByte essentia storage cell component.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription EssentiaStorageComponent_4k;
|
||||
|
||||
/**
|
||||
* 64 KiloByte essentia storage cell component.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription EssentiaStorageComponent_64k;
|
||||
/**
|
||||
* 64 KiloByte essentia storage cell component.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription EssentiaStorageComponent_64k;
|
||||
|
||||
/**
|
||||
* Iron gear.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription IronGear;
|
||||
/**
|
||||
* Iron gear.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription IronGear;
|
||||
|
||||
/**
|
||||
* Wireless essentia terminal
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription WirelessEssentiaTerminal;
|
||||
/**
|
||||
* Wireless essentia terminal
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription WirelessEssentiaTerminal;
|
||||
|
||||
/**
|
||||
* Knowledge core.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription KnowledgeCore;
|
||||
/**
|
||||
* Knowledge core.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription KnowledgeCore;
|
||||
|
||||
/**
|
||||
* AE Wrench wand focus.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription WandFocusAEWrench;
|
||||
/**
|
||||
* AE Wrench wand focus.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription WandFocusAEWrench;
|
||||
|
||||
/**
|
||||
* Golem wireless backpack.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription GolemWifiBackpack;
|
||||
/**
|
||||
* Golem wireless backpack.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription GolemWifiBackpack;
|
||||
}
|
||||
@@ -8,59 +8,58 @@ import javax.annotation.Nonnull;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public abstract class IThEParts
|
||||
{
|
||||
/**
|
||||
* Arcane crafting terminal.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription ArcaneCrafting_Terminal;
|
||||
public abstract class IThEParts {
|
||||
/**
|
||||
* Arcane crafting terminal.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription ArcaneCrafting_Terminal;
|
||||
|
||||
/**
|
||||
* Essentia export bus.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription Essentia_ExportBus;
|
||||
/**
|
||||
* Essentia export bus.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription Essentia_ExportBus;
|
||||
|
||||
/**
|
||||
* Essentia import bus.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription Essentia_ImportBus;
|
||||
/**
|
||||
* Essentia import bus.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription Essentia_ImportBus;
|
||||
|
||||
/**
|
||||
* Essentia level emitter.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription Essentia_LevelEmitter;
|
||||
/**
|
||||
* Essentia level emitter.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription Essentia_LevelEmitter;
|
||||
|
||||
/**
|
||||
* Essentia storage bus.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription Essentia_StorageBus;
|
||||
/**
|
||||
* Essentia storage bus.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription Essentia_StorageBus;
|
||||
|
||||
/**
|
||||
* Essentia terminal.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription Essentia_Terminal;
|
||||
/**
|
||||
* Essentia terminal.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription Essentia_Terminal;
|
||||
|
||||
/**
|
||||
* Vis relay interface.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription VisRelay_Interface;
|
||||
/**
|
||||
* Vis relay interface.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription VisRelay_Interface;
|
||||
|
||||
/**
|
||||
* Essentia storage monitor.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription Essentia_StorageMonitor;
|
||||
/**
|
||||
* Essentia storage monitor.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription Essentia_StorageMonitor;
|
||||
|
||||
/**
|
||||
* Essentia conversion monitor.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription Essentia_ConversionMonitor;
|
||||
/**
|
||||
* Essentia conversion monitor.
|
||||
*/
|
||||
@Nonnull
|
||||
public IThEItemDescription Essentia_ConversionMonitor;
|
||||
}
|
||||
@@ -14,90 +14,96 @@ import thaumcraft.api.aspects.IEssentiaContainerItem;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public interface IThETransportPermissions
|
||||
{
|
||||
public interface IThETransportPermissions {
|
||||
|
||||
/**
|
||||
* Adds a tile entity to both inject & extract whitelists.
|
||||
* The tile must implement the interface {@link IAspectContainer}<br>
|
||||
* Capacity is required to function properly
|
||||
*
|
||||
* @param tileClass
|
||||
* @return True if added to the lists, False if not.
|
||||
*/
|
||||
<T extends TileEntity & IAspectContainer> boolean addAspectContainerTileToBothPermissions( @Nonnull Class<T> tileClass, int capacity );
|
||||
/**
|
||||
* Adds a tile entity to both inject & extract whitelists.
|
||||
* The tile must implement the interface {@link IAspectContainer}<br>
|
||||
* Capacity is required to function properly
|
||||
*
|
||||
* @param tileClass
|
||||
* @return True if added to the lists, False if not.
|
||||
*/
|
||||
<T extends TileEntity & IAspectContainer> boolean addAspectContainerTileToBothPermissions(
|
||||
@Nonnull Class<T> tileClass, int capacity);
|
||||
|
||||
/**
|
||||
* Adds a tile entity to the extract whitelist.
|
||||
* The tile must implement the interface {@link IAspectContainer}<br>
|
||||
* Note: Capacity can be 0 if the tile doesn't truely 'contain' essentia.
|
||||
*
|
||||
* @param tileClass
|
||||
* @return True if added to the list or already present, False otherwise.
|
||||
*/
|
||||
<T extends TileEntity & IAspectContainer> boolean addAspectContainerTileToExtractPermissions( @Nonnull Class<T> tileClass, int capacity );
|
||||
/**
|
||||
* Adds a tile entity to the extract whitelist.
|
||||
* The tile must implement the interface {@link IAspectContainer}<br>
|
||||
* Note: Capacity can be 0 if the tile doesn't truely 'contain' essentia.
|
||||
*
|
||||
* @param tileClass
|
||||
* @return True if added to the list or already present, False otherwise.
|
||||
*/
|
||||
<T extends TileEntity & IAspectContainer> boolean addAspectContainerTileToExtractPermissions(
|
||||
@Nonnull Class<T> tileClass, int capacity);
|
||||
|
||||
/**
|
||||
* Adds a tile entity to the inject whitelist.
|
||||
* The tile must implement the interface {@link IAspectContainer}<br>
|
||||
* Capacity is required to function properly.
|
||||
*
|
||||
* @param tileClass
|
||||
* @return True if added to the list, False if not.
|
||||
*/
|
||||
<T extends TileEntity & IAspectContainer> boolean addAspectContainerTileToInjectPermissions( @Nonnull Class<T> tileClass, int capacity );
|
||||
/**
|
||||
* Adds a tile entity to the inject whitelist.
|
||||
* The tile must implement the interface {@link IAspectContainer}<br>
|
||||
* Capacity is required to function properly.
|
||||
*
|
||||
* @param tileClass
|
||||
* @return True if added to the list, False if not.
|
||||
*/
|
||||
<T extends TileEntity & IAspectContainer> boolean addAspectContainerTileToInjectPermissions(
|
||||
@Nonnull Class<T> tileClass, int capacity);
|
||||
|
||||
/**
|
||||
* Adds an item to the whitelist that must match the specified damage value.
|
||||
*
|
||||
* @param itemClass
|
||||
* @param capacity
|
||||
* @param damageValue
|
||||
* @param canHoldPartialAmount
|
||||
*/
|
||||
void addEssentiaContainerItemToTransportPermissions( @Nonnull Class<? extends IEssentiaContainerItem> itemClass, int capacity, int damageValue,
|
||||
boolean canHoldPartialAmount );
|
||||
/**
|
||||
* Adds an item to the whitelist that must match the specified damage value.
|
||||
*
|
||||
* @param itemClass
|
||||
* @param capacity
|
||||
* @param damageValue
|
||||
* @param canHoldPartialAmount
|
||||
*/
|
||||
void addEssentiaContainerItemToTransportPermissions(
|
||||
@Nonnull Class<? extends IEssentiaContainerItem> itemClass,
|
||||
int capacity,
|
||||
int damageValue,
|
||||
boolean canHoldPartialAmount);
|
||||
|
||||
/**
|
||||
* Adds the specified item to the whitelist.
|
||||
*
|
||||
* @param containerItem
|
||||
* @param capacity
|
||||
* @param canHoldPartialAmount
|
||||
*/
|
||||
void addEssentiaContainerItemToTransportPermissions( @Nonnull ItemStack containerItem, int capacity, boolean canHoldPartialAmount );
|
||||
/**
|
||||
* Adds the specified item to the whitelist.
|
||||
*
|
||||
* @param containerItem
|
||||
* @param capacity
|
||||
* @param canHoldPartialAmount
|
||||
*/
|
||||
void addEssentiaContainerItemToTransportPermissions(
|
||||
@Nonnull ItemStack containerItem, int capacity, boolean canHoldPartialAmount);
|
||||
|
||||
/**
|
||||
* Checks if the container can be extracted from
|
||||
*
|
||||
* @param container
|
||||
* @return
|
||||
*/
|
||||
boolean canExtractFromAspectContainerTile( @Nonnull IAspectContainer container );
|
||||
/**
|
||||
* Checks if the container can be extracted from
|
||||
*
|
||||
* @param container
|
||||
* @return
|
||||
*/
|
||||
boolean canExtractFromAspectContainerTile(@Nonnull IAspectContainer container);
|
||||
|
||||
/**
|
||||
* Checks if the container can be injected into
|
||||
*
|
||||
* @param container
|
||||
* @return
|
||||
*/
|
||||
boolean canInjectToAspectContainerTile( @Nonnull IAspectContainer container );
|
||||
/**
|
||||
* Checks if the container can be injected into
|
||||
*
|
||||
* @param container
|
||||
* @return
|
||||
*/
|
||||
boolean canInjectToAspectContainerTile(@Nonnull IAspectContainer container);
|
||||
|
||||
/**
|
||||
* Returns the registered capacity of the specified container.
|
||||
*
|
||||
* @param container
|
||||
* @return Registered capacity, or -1 if not registered.
|
||||
*/
|
||||
int getAspectContainerTileCapacity( @Nonnull IAspectContainer container );
|
||||
/**
|
||||
* Returns the registered capacity of the specified container.
|
||||
*
|
||||
* @param container
|
||||
* @return Registered capacity, or -1 if not registered.
|
||||
*/
|
||||
int getAspectContainerTileCapacity(@Nonnull IAspectContainer container);
|
||||
|
||||
/**
|
||||
* Gets the information about the container as it was registered to the
|
||||
* whitelist.
|
||||
*
|
||||
* @param itemClass
|
||||
* @param damageValue
|
||||
* @return Info if was registered, null otherwise.
|
||||
*/
|
||||
IThEEssentiaContainerPermission getEssentiaContainerInfo( @Nonnull Class<? extends Item> itemClass, int damageValue );
|
||||
/**
|
||||
* Gets the information about the container as it was registered to the
|
||||
* whitelist.
|
||||
*
|
||||
* @param itemClass
|
||||
* @param damageValue
|
||||
* @return Info if was registered, null otherwise.
|
||||
*/
|
||||
IThEEssentiaContainerPermission getEssentiaContainerInfo(@Nonnull Class<? extends Item> itemClass, int damageValue);
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package thaumicenergistics.api;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import appeng.api.features.INetworkEncodable;
|
||||
import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||
import javax.annotation.Nonnull;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
@@ -14,15 +14,13 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public interface IThEWirelessEssentiaTerminal
|
||||
extends INetworkEncodable, IAEItemPowerStorage
|
||||
{
|
||||
/**
|
||||
* Gets the tag used to store the terminal data.
|
||||
*
|
||||
* @param terminalItemstack
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
NBTTagCompound getWETerminalTag( @Nonnull ItemStack terminalItemstack );
|
||||
public interface IThEWirelessEssentiaTerminal extends INetworkEncodable, IAEItemPowerStorage {
|
||||
/**
|
||||
* Gets the tag used to store the terminal data.
|
||||
*
|
||||
* @param terminalItemstack
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
NBTTagCompound getWETerminalTag(@Nonnull ItemStack terminalItemstack);
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package thaumicenergistics.api;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
/**
|
||||
* Thaumic Energistics API
|
||||
@@ -12,83 +12,76 @@ import com.google.common.collect.ImmutableList;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public abstract class ThEApi
|
||||
{
|
||||
protected static ThEApi api = null;
|
||||
public abstract class ThEApi {
|
||||
protected static ThEApi api = null;
|
||||
|
||||
/**
|
||||
* Gets the Thaumic Energistics API.
|
||||
* Note: Only available after the PREINIT event.
|
||||
*/
|
||||
@Nullable
|
||||
public static ThEApi instance()
|
||||
{
|
||||
// Have we already retrieved the api?
|
||||
if( ThEApi.api == null )
|
||||
{
|
||||
try
|
||||
{
|
||||
// Attempt to locate the API implementation
|
||||
Class clazz = Class.forName( "thaumicenergistics.implementaion.ThEAPIImplementation" );
|
||||
/**
|
||||
* Gets the Thaumic Energistics API.
|
||||
* Note: Only available after the PREINIT event.
|
||||
*/
|
||||
@Nullable
|
||||
public static ThEApi instance() {
|
||||
// Have we already retrieved the api?
|
||||
if (ThEApi.api == null) {
|
||||
try {
|
||||
// Attempt to locate the API implementation
|
||||
Class clazz = Class.forName("thaumicenergistics.implementaion.ThEAPIImplementation");
|
||||
|
||||
// Get the instance method
|
||||
Method instanceAccessor = clazz.getMethod( "instance" );
|
||||
// Get the instance method
|
||||
Method instanceAccessor = clazz.getMethod("instance");
|
||||
|
||||
// Attempt to get the API instance
|
||||
ThEApi.api = (ThEApi)instanceAccessor.invoke( null );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
// Unable to locate the API, return null
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// Attempt to get the API instance
|
||||
ThEApi.api = (ThEApi) instanceAccessor.invoke(null);
|
||||
} catch (Exception e) {
|
||||
// Unable to locate the API, return null
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return ThEApi.api;
|
||||
}
|
||||
return ThEApi.api;
|
||||
}
|
||||
|
||||
/**
|
||||
* Blocks
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract IThEBlocks blocks();
|
||||
/**
|
||||
* Blocks
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract IThEBlocks blocks();
|
||||
|
||||
/**
|
||||
* Configuration
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract IThEConfig config();
|
||||
/**
|
||||
* Configuration
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract IThEConfig config();
|
||||
|
||||
/**
|
||||
* Essentia Gasses
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract ImmutableList<List<IThEEssentiaGas>> essentiaGases();
|
||||
/**
|
||||
* Essentia Gasses
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract ImmutableList<List<IThEEssentiaGas>> essentiaGases();
|
||||
|
||||
/**
|
||||
* Gets the ThE interaction manager
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract IThEInteractionHelper interact();
|
||||
/**
|
||||
* Gets the ThE interaction manager
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract IThEInteractionHelper interact();
|
||||
|
||||
/**
|
||||
* Items
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract IThEItems items();
|
||||
/**
|
||||
* Items
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract IThEItems items();
|
||||
|
||||
/**
|
||||
* Cable Parts
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract IThEParts parts();
|
||||
|
||||
/**
|
||||
* Transport Permissions.
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract IThETransportPermissions transportPermissions();
|
||||
/**
|
||||
* Cable Parts
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract IThEParts parts();
|
||||
|
||||
/**
|
||||
* Transport Permissions.
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract IThETransportPermissions transportPermissions();
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package thaumicenergistics.api.entities;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -51,219 +51,242 @@ import thaumcraft.common.entities.golems.EntityGolemBase;
|
||||
* @see IGolemHookSyncRegistry
|
||||
*
|
||||
*/
|
||||
public interface IGolemHookHandler
|
||||
{
|
||||
/**
|
||||
* Defines interaction levels.
|
||||
*
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public static enum InteractionLevel
|
||||
{
|
||||
/**
|
||||
* The interaction was not handled at all.<br>
|
||||
* <ul>
|
||||
* <li>GUI will be shown, if golem has one.</li>
|
||||
* <li>customInteraction() will not be called.</li>
|
||||
* <li>Sync data will not be sent.</li>
|
||||
* <li>setupGolem() will not be called.</li>
|
||||
* </ul>
|
||||
*/
|
||||
NoInteraction,
|
||||
public interface IGolemHookHandler {
|
||||
/**
|
||||
* Defines interaction levels.
|
||||
*
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public static enum InteractionLevel {
|
||||
/**
|
||||
* The interaction was not handled at all.<br>
|
||||
* <ul>
|
||||
* <li>GUI will be shown, if golem has one.</li>
|
||||
* <li>customInteraction() will not be called.</li>
|
||||
* <li>Sync data will not be sent.</li>
|
||||
* <li>setupGolem() will not be called.</li>
|
||||
* </ul>
|
||||
*/
|
||||
NoInteraction,
|
||||
|
||||
/**
|
||||
* The interaction was handled, but no sync data changed, and golem does not need to be re-setup.<br>
|
||||
* <ul>
|
||||
* <li>GUI will not be shown</li>
|
||||
* <li>customInteraction() called.
|
||||
* <li>
|
||||
* <li>Sync data will not be sent.</li>
|
||||
* <li>setupGolem() will not be called.</li>
|
||||
* </ul>
|
||||
*/
|
||||
BasicInteraction,
|
||||
/**
|
||||
* The interaction was handled, but no sync data changed, and golem does not need to be re-setup.<br>
|
||||
* <ul>
|
||||
* <li>GUI will not be shown</li>
|
||||
* <li>customInteraction() called.
|
||||
* <li>
|
||||
* <li>Sync data will not be sent.</li>
|
||||
* <li>setupGolem() will not be called.</li>
|
||||
* </ul>
|
||||
*/
|
||||
BasicInteraction,
|
||||
|
||||
/**
|
||||
* The interaction was handled and sync data changed, but the golem does not need to be re-setup<br>
|
||||
* <ul>
|
||||
* <li>GUI will not be shown</li>
|
||||
* <li>customInteraction() called.</li>
|
||||
* <li>Sync data sent.</li>
|
||||
* <li>setupGolem() will not be called.</li>
|
||||
* </ul>
|
||||
*/
|
||||
SyncInteraction,
|
||||
/**
|
||||
* The interaction was handled and sync data changed, but the golem does not need to be re-setup<br>
|
||||
* <ul>
|
||||
* <li>GUI will not be shown</li>
|
||||
* <li>customInteraction() called.</li>
|
||||
* <li>Sync data sent.</li>
|
||||
* <li>setupGolem() will not be called.</li>
|
||||
* </ul>
|
||||
*/
|
||||
SyncInteraction,
|
||||
|
||||
/**
|
||||
* The interaction was handled and the golem needs to be re-setup.
|
||||
* <ul>
|
||||
* <li>GUI will not be shown</li>
|
||||
* <li>customInteraction() called.</li>
|
||||
* <li>Sync data sent.</li>
|
||||
* <li>setupGolem() called.</li>
|
||||
* </ul>
|
||||
*/
|
||||
FullInteraction;
|
||||
}
|
||||
/**
|
||||
* The interaction was handled and the golem needs to be re-setup.
|
||||
* <ul>
|
||||
* <li>GUI will not be shown</li>
|
||||
* <li>customInteraction() called.</li>
|
||||
* <li>Sync data sent.</li>
|
||||
* <li>setupGolem() called.</li>
|
||||
* </ul>
|
||||
*/
|
||||
FullInteraction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Any data you wish to sync between the server and clients can be added here.<br/>
|
||||
* The added bytes are considered the default state, and will be added to all golems in that state.
|
||||
*
|
||||
* @param syncRegistry
|
||||
*/
|
||||
void addDefaultSyncEntries( @Nonnull IGolemHookSyncRegistry syncRegistry );
|
||||
/**
|
||||
* Any data you wish to sync between the server and clients can be added here.<br/>
|
||||
* The added bytes are considered the default state, and will be added to all golems in that state.
|
||||
*
|
||||
* @param syncRegistry
|
||||
*/
|
||||
void addDefaultSyncEntries(@Nonnull IGolemHookSyncRegistry syncRegistry);
|
||||
|
||||
/**
|
||||
* Called when the golem was left clicked by a player holding the Golemancers Bell.
|
||||
*
|
||||
* @param golem
|
||||
* @param handlerData
|
||||
* Handler data attached to the golem.
|
||||
* @param itemGolemPlacer
|
||||
* Itemstack that will be used to hold the golem.
|
||||
* @param player
|
||||
* @param dismantled
|
||||
* True if the golem will drop its core and upgrades.
|
||||
* @param side
|
||||
* Server or Client @Nonnull Side side
|
||||
*/
|
||||
void bellLeftClicked( @Nonnull final EntityGolemBase golem, @Nullable Object handlerData, @Nonnull ItemStack itemGolemPlacer,
|
||||
@Nonnull EntityPlayer player, boolean dismantled, @Nonnull Side side );
|
||||
/**
|
||||
* Called when the golem was left clicked by a player holding the Golemancers Bell.
|
||||
*
|
||||
* @param golem
|
||||
* @param handlerData
|
||||
* Handler data attached to the golem.
|
||||
* @param itemGolemPlacer
|
||||
* Itemstack that will be used to hold the golem.
|
||||
* @param player
|
||||
* @param dismantled
|
||||
* True if the golem will drop its core and upgrades.
|
||||
* @param side
|
||||
* Server or Client @Nonnull Side side
|
||||
*/
|
||||
void bellLeftClicked(
|
||||
@Nonnull final EntityGolemBase golem,
|
||||
@Nullable Object handlerData,
|
||||
@Nonnull ItemStack itemGolemPlacer,
|
||||
@Nonnull EntityPlayer player,
|
||||
boolean dismantled,
|
||||
@Nonnull Side side);
|
||||
|
||||
/**
|
||||
* Return true if you can handle this interaction.<br/>
|
||||
*
|
||||
* @param golem
|
||||
* @param handlerData
|
||||
* Handler data attached to the golem.
|
||||
* @param player
|
||||
* @param side
|
||||
* Server or Client
|
||||
* @return The level of interaction.
|
||||
*/
|
||||
@Nonnull
|
||||
InteractionLevel canHandleInteraction( @Nonnull final EntityGolemBase golem, @Nullable Object handlerData, @Nonnull EntityPlayer player,
|
||||
@Nonnull Side side );
|
||||
/**
|
||||
* Return true if you can handle this interaction.<br/>
|
||||
*
|
||||
* @param golem
|
||||
* @param handlerData
|
||||
* Handler data attached to the golem.
|
||||
* @param player
|
||||
* @param side
|
||||
* Server or Client
|
||||
* @return The level of interaction.
|
||||
*/
|
||||
@Nonnull
|
||||
InteractionLevel canHandleInteraction(
|
||||
@Nonnull final EntityGolemBase golem,
|
||||
@Nullable Object handlerData,
|
||||
@Nonnull EntityPlayer player,
|
||||
@Nonnull Side side);
|
||||
|
||||
/**
|
||||
* Called when the golem has been interacted with and it hasn't been handled by Thaumcraft.<br/>
|
||||
*
|
||||
* @param golem
|
||||
* @param handlerData
|
||||
* Handler data attached to the golem.
|
||||
* @param syncData
|
||||
* @param player
|
||||
* @param side
|
||||
* Server or Client
|
||||
* @return Return the handler data you wish to attach to the golem, or null to clear any attached data.
|
||||
*/
|
||||
@Nullable
|
||||
Object customInteraction( @Nonnull final EntityGolemBase golem, @Nullable Object handlerData, @Nonnull IGolemHookSyncRegistry syncData,
|
||||
@Nonnull EntityPlayer player, @Nonnull Side side );
|
||||
/**
|
||||
* Called when the golem has been interacted with and it hasn't been handled by Thaumcraft.<br/>
|
||||
*
|
||||
* @param golem
|
||||
* @param handlerData
|
||||
* Handler data attached to the golem.
|
||||
* @param syncData
|
||||
* @param player
|
||||
* @param side
|
||||
* Server or Client
|
||||
* @return Return the handler data you wish to attach to the golem, or null to clear any attached data.
|
||||
*/
|
||||
@Nullable
|
||||
Object customInteraction(
|
||||
@Nonnull final EntityGolemBase golem,
|
||||
@Nullable Object handlerData,
|
||||
@Nonnull IGolemHookSyncRegistry syncData,
|
||||
@Nonnull EntityPlayer player,
|
||||
@Nonnull Side side);
|
||||
|
||||
/**
|
||||
* Called when a golem receives a tick, if {@code needsDynamicUpdate} returned true during registration.<br>
|
||||
* If setting sync data, you do not need to track if the sync data has changed yourself. The {@code syncData} class
|
||||
* tracks this internally and will only ever send updates if the data has actually changed. Although for performance reasons
|
||||
* it would be a good idea to keep a tick counter and only set the data periodically if there is any processing involved.<br>
|
||||
* Note: This is only called server side.
|
||||
*
|
||||
* @param golem
|
||||
* @param serverHandlerData
|
||||
* @param syncData
|
||||
*/
|
||||
void golemTick( @Nonnull EntityGolemBase golem, @Nullable Object serverHandlerData, @Nonnull IGolemHookSyncRegistry syncData );
|
||||
/**
|
||||
* Called when a golem receives a tick, if {@code needsDynamicUpdate} returned true during registration.<br>
|
||||
* If setting sync data, you do not need to track if the sync data has changed yourself. The {@code syncData} class
|
||||
* tracks this internally and will only ever send updates if the data has actually changed. Although for performance reasons
|
||||
* it would be a good idea to keep a tick counter and only set the data periodically if there is any processing involved.<br>
|
||||
* Note: This is only called server side.
|
||||
*
|
||||
* @param golem
|
||||
* @param serverHandlerData
|
||||
* @param syncData
|
||||
*/
|
||||
void golemTick(
|
||||
@Nonnull EntityGolemBase golem,
|
||||
@Nullable Object serverHandlerData,
|
||||
@Nonnull IGolemHookSyncRegistry syncData);
|
||||
|
||||
/**
|
||||
* Return true if your handler wants to be called each time the golem gets a tick from the server.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean needsDynamicUpdates();
|
||||
/**
|
||||
* Return true if your handler wants to be called each time the golem gets a tick from the server.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean needsDynamicUpdates();
|
||||
|
||||
/**
|
||||
* Return true if your handler wants to be called when a golem is rendered.<br/>
|
||||
* Note: This is called only once during registration.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean needsRenderer();
|
||||
/**
|
||||
* Return true if your handler wants to be called when a golem is rendered.<br/>
|
||||
* Note: This is called only once during registration.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean needsRenderer();
|
||||
|
||||
/**
|
||||
* Called when reading the golem's NBT.<br />
|
||||
* Note: Called during a world load, not when the golem is placed via its item.
|
||||
*
|
||||
* @param golem
|
||||
* @param nbtTag
|
||||
* @return Return the handler data you wish to attach to the golem, or null to clear any attached data.
|
||||
*/
|
||||
@Nullable
|
||||
Object readEntityFromNBT( @Nonnull final EntityGolemBase golem, @Nonnull NBTTagCompound nbtTag );
|
||||
/**
|
||||
* Called when reading the golem's NBT.<br />
|
||||
* Note: Called during a world load, not when the golem is placed via its item.
|
||||
*
|
||||
* @param golem
|
||||
* @param nbtTag
|
||||
* @return Return the handler data you wish to attach to the golem, or null to clear any attached data.
|
||||
*/
|
||||
@Nullable
|
||||
Object readEntityFromNBT(@Nonnull final EntityGolemBase golem, @Nonnull NBTTagCompound nbtTag);
|
||||
|
||||
/**
|
||||
* Called when a golem is being rendered, if {@code needsRenderer} returned true during registration.
|
||||
*
|
||||
* @param golem
|
||||
* @param clientHandlerData
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param partialElaspsedTick
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
void renderGolem( @Nonnull EntityGolemBase golem, @Nullable Object clientHandlerData, double x, double y, double z,
|
||||
float partialElaspsedTick );
|
||||
/**
|
||||
* Called when a golem is being rendered, if {@code needsRenderer} returned true during registration.
|
||||
*
|
||||
* @param golem
|
||||
* @param clientHandlerData
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param partialElaspsedTick
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
void renderGolem(
|
||||
@Nonnull EntityGolemBase golem,
|
||||
@Nullable Object clientHandlerData,
|
||||
double x,
|
||||
double y,
|
||||
double z,
|
||||
float partialElaspsedTick);
|
||||
|
||||
/**
|
||||
* Called just before the golem has finished setting up.<br/>
|
||||
* If you are adding an AI script(s) to the golem, be aware that Thaumcraft clears all of the golems scripts at the beginning of this call. You
|
||||
* will need to add the script(s) each time this is called, but you do not need to worry about removing them.<br/>
|
||||
* Note: The golems inventory may not be ready.
|
||||
*
|
||||
* @param golem
|
||||
* @param handlerData
|
||||
* Handler data attached to the golem.
|
||||
* @param side
|
||||
* Server or Client
|
||||
* @return Return the handler data you wish to attach to the golem, or null to clear any attached data.
|
||||
*/
|
||||
@Nullable
|
||||
Object setupGolem( @Nonnull final EntityGolemBase golem, @Nullable Object handlerData, @Nonnull IGolemHookSyncRegistry syncData,
|
||||
@Nonnull Side side );
|
||||
/**
|
||||
* Called just before the golem has finished setting up.<br/>
|
||||
* If you are adding an AI script(s) to the golem, be aware that Thaumcraft clears all of the golems scripts at the beginning of this call. You
|
||||
* will need to add the script(s) each time this is called, but you do not need to worry about removing them.<br/>
|
||||
* Note: The golems inventory may not be ready.
|
||||
*
|
||||
* @param golem
|
||||
* @param handlerData
|
||||
* Handler data attached to the golem.
|
||||
* @param side
|
||||
* Server or Client
|
||||
* @return Return the handler data you wish to attach to the golem, or null to clear any attached data.
|
||||
*/
|
||||
@Nullable
|
||||
Object setupGolem(
|
||||
@Nonnull final EntityGolemBase golem,
|
||||
@Nullable Object handlerData,
|
||||
@Nonnull IGolemHookSyncRegistry syncData,
|
||||
@Nonnull Side side);
|
||||
|
||||
/**
|
||||
* Called when a golem is being spawned via it's item.<br/>
|
||||
* Note: This is not called if the item has no NBT data.
|
||||
*
|
||||
* @param golem
|
||||
* @param itemGolemPlacer
|
||||
* @param side
|
||||
* Server or Client
|
||||
* @return Return the handler data you wish to attach to the golem, or null to clear any attached data.
|
||||
*/
|
||||
@Nullable
|
||||
Object spawnGolemFromItemStack( @Nonnull final EntityGolemBase golem, @Nonnull ItemStack itemGolemPlacer, @Nonnull Side side );
|
||||
/**
|
||||
* Called when a golem is being spawned via it's item.<br/>
|
||||
* Note: This is not called if the item has no NBT data.
|
||||
*
|
||||
* @param golem
|
||||
* @param itemGolemPlacer
|
||||
* @param side
|
||||
* Server or Client
|
||||
* @return Return the handler data you wish to attach to the golem, or null to clear any attached data.
|
||||
*/
|
||||
@Nullable
|
||||
Object spawnGolemFromItemStack(
|
||||
@Nonnull final EntityGolemBase golem, @Nonnull ItemStack itemGolemPlacer, @Nonnull Side side);
|
||||
|
||||
/**
|
||||
* Called when sync data has changed.
|
||||
*
|
||||
* @param syncData
|
||||
* @param clientHandlerData
|
||||
* Handler data attached to the golem on the client side.
|
||||
* @return Return the handler data you wish to attach to the golem, or null to clear any attached data.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
Object syncDataChanged( @Nonnull IGolemHookSyncRegistry syncData, @Nullable Object clientHandlerData );
|
||||
/**
|
||||
* Called when sync data has changed.
|
||||
*
|
||||
* @param syncData
|
||||
* @param clientHandlerData
|
||||
* Handler data attached to the golem on the client side.
|
||||
* @return Return the handler data you wish to attach to the golem, or null to clear any attached data.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
Object syncDataChanged(@Nonnull IGolemHookSyncRegistry syncData, @Nullable Object clientHandlerData);
|
||||
|
||||
/**
|
||||
* Called when saving the golem's NBT.<br />
|
||||
* Note: Called during a world save, not when the golem is being turned into an item via Golemancer's Bell.
|
||||
*
|
||||
* @param golem
|
||||
* @param serverHandlerData
|
||||
* @param nbtTag
|
||||
*/
|
||||
void writeEntityNBT( @Nonnull final EntityGolemBase golem, @Nullable Object serverHandlerData, @Nonnull NBTTagCompound nbtTag );
|
||||
/**
|
||||
* Called when saving the golem's NBT.<br />
|
||||
* Note: Called during a world save, not when the golem is being turned into an item via Golemancer's Bell.
|
||||
*
|
||||
* @param golem
|
||||
* @param serverHandlerData
|
||||
* @param nbtTag
|
||||
*/
|
||||
void writeEntityNBT(
|
||||
@Nonnull final EntityGolemBase golem, @Nullable Object serverHandlerData, @Nonnull NBTTagCompound nbtTag);
|
||||
}
|
||||
@@ -6,34 +6,33 @@ package thaumicenergistics.api.entities;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public interface IGolemHookSyncRegistry
|
||||
{
|
||||
/**
|
||||
* Returns the sync char if it is mapped, returns {@code defaultChar} otherwise.
|
||||
*
|
||||
* @param id
|
||||
* @param defaultChar
|
||||
* @return
|
||||
*/
|
||||
char getSyncCharOrDefault( int id, char defaultChar );
|
||||
public interface IGolemHookSyncRegistry {
|
||||
/**
|
||||
* Returns the sync char if it is mapped, returns {@code defaultChar} otherwise.
|
||||
*
|
||||
* @param id
|
||||
* @param defaultChar
|
||||
* @return
|
||||
*/
|
||||
char getSyncCharOrDefault(int id, char defaultChar);
|
||||
|
||||
/**
|
||||
* Registers a new sync byte, and returns the ID that maps to it.<br/>
|
||||
* Note: This can only be called during registration, will throw exception otherwise.
|
||||
*
|
||||
* @param handler
|
||||
* @param c
|
||||
* Initial value of the char.
|
||||
* @return The ID of the char.
|
||||
*/
|
||||
int registerSyncChar( IGolemHookHandler handler, char c );
|
||||
/**
|
||||
* Registers a new sync byte, and returns the ID that maps to it.<br/>
|
||||
* Note: This can only be called during registration, will throw exception otherwise.
|
||||
*
|
||||
* @param handler
|
||||
* @param c
|
||||
* Initial value of the char.
|
||||
* @return The ID of the char.
|
||||
*/
|
||||
int registerSyncChar(IGolemHookHandler handler, char c);
|
||||
|
||||
/**
|
||||
* Updates the sync char.
|
||||
*
|
||||
* @param handler
|
||||
* @param id
|
||||
* @param c
|
||||
*/
|
||||
void updateSyncChar( IGolemHookHandler handler, int id, char c );
|
||||
/**
|
||||
* Updates the sync char.
|
||||
*
|
||||
* @param handler
|
||||
* @param id
|
||||
* @param c
|
||||
*/
|
||||
void updateSyncChar(IGolemHookHandler handler, int id, char c);
|
||||
}
|
||||
@@ -10,19 +10,17 @@ import net.minecraft.item.ItemStack;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public interface ICraftingIssuerHost
|
||||
extends ITerminalHost
|
||||
{
|
||||
/**
|
||||
* Gets the icon for this terminal.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ItemStack getIcon();
|
||||
public interface ICraftingIssuerHost extends ITerminalHost {
|
||||
/**
|
||||
* Gets the icon for this terminal.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ItemStack getIcon();
|
||||
|
||||
/**
|
||||
* Launches the terminal's GUI.
|
||||
* Used to return to the gui after crafting is confirmed or canceled.
|
||||
*/
|
||||
void launchGUI( EntityPlayer player );
|
||||
/**
|
||||
* Launches the terminal's GUI.
|
||||
* Used to return to the gui after crafting is confirmed or canceled.
|
||||
*/
|
||||
void launchGUI(EntityPlayer player);
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package thaumicenergistics.api.grid;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
|
||||
@@ -13,53 +13,52 @@ import thaumcraft.api.aspects.Aspect;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public interface IDigiVisSource
|
||||
{
|
||||
/**
|
||||
* Drains digivis from this source.
|
||||
*
|
||||
* @param digiVisAspect
|
||||
* @param amount
|
||||
* @return The amount drained.
|
||||
*/
|
||||
int consumeVis( @Nonnull Aspect digiVisAspect, int amount );
|
||||
public interface IDigiVisSource {
|
||||
/**
|
||||
* Drains digivis from this source.
|
||||
*
|
||||
* @param digiVisAspect
|
||||
* @param amount
|
||||
* @return The amount drained.
|
||||
*/
|
||||
int consumeVis(@Nonnull Aspect digiVisAspect, int amount);
|
||||
|
||||
/**
|
||||
* Get's the AE grid the source is attached to.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nullable
|
||||
IGrid getGrid();
|
||||
/**
|
||||
* Get's the AE grid the source is attached to.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nullable
|
||||
IGrid getGrid();
|
||||
|
||||
/**
|
||||
* Returns the location of the source.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
DimensionalCoord getLocation();
|
||||
/**
|
||||
* Returns the location of the source.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
DimensionalCoord getLocation();
|
||||
|
||||
/**
|
||||
* Gets the side of cable the source part is attached to.
|
||||
* If this returns UNKNOWN, it is assumed the source is a whole block.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
ForgeDirection getSide();
|
||||
/**
|
||||
* Gets the side of cable the source part is attached to.
|
||||
* If this returns UNKNOWN, it is assumed the source is a whole block.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
ForgeDirection getSide();
|
||||
|
||||
/**
|
||||
* Get's the unique identifier for this source.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
long getUID();
|
||||
/**
|
||||
* Get's the unique identifier for this source.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
long getUID();
|
||||
|
||||
/**
|
||||
* Is the source active?
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isActive();
|
||||
/**
|
||||
* Is the source active?
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isActive();
|
||||
}
|
||||
@@ -8,8 +8,4 @@ import appeng.api.networking.IGridCache;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public interface IEssentiaGrid
|
||||
extends IGridCache, IMEEssentiaMonitor
|
||||
{
|
||||
|
||||
}
|
||||
public interface IEssentiaGrid extends IGridCache, IMEEssentiaMonitor {}
|
||||
@@ -9,13 +9,11 @@ import thaumcraft.api.aspects.Aspect;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public interface IEssentiaWatcher
|
||||
extends Collection<Aspect>
|
||||
{
|
||||
/**
|
||||
* Return the host for this watcher.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IEssentiaWatcherHost getHost();
|
||||
public interface IEssentiaWatcher extends Collection<Aspect> {
|
||||
/**
|
||||
* Return the host for this watcher.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IEssentiaWatcherHost getHost();
|
||||
}
|
||||
@@ -8,24 +8,23 @@ import thaumcraft.api.aspects.Aspect;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public interface IEssentiaWatcherHost
|
||||
{
|
||||
/**
|
||||
* Called when essentia levels change in the network.
|
||||
*
|
||||
* @param aspect
|
||||
* Aspect of the changed essentia.
|
||||
* @param storedAmount
|
||||
* The full amount stored in the network.
|
||||
* @param changeAmount
|
||||
* The amount that just changed.
|
||||
*/
|
||||
void onEssentiaChange( Aspect aspect, long storedAmount, long changeAmount );
|
||||
public interface IEssentiaWatcherHost {
|
||||
/**
|
||||
* Called when essentia levels change in the network.
|
||||
*
|
||||
* @param aspect
|
||||
* Aspect of the changed essentia.
|
||||
* @param storedAmount
|
||||
* The full amount stored in the network.
|
||||
* @param changeAmount
|
||||
* The amount that just changed.
|
||||
*/
|
||||
void onEssentiaChange(Aspect aspect, long storedAmount, long changeAmount);
|
||||
|
||||
/**
|
||||
* Providers the essentia watcher for your host.
|
||||
*
|
||||
* @param newWatcher
|
||||
*/
|
||||
void updateWatcher( IEssentiaWatcher newWatcher );
|
||||
/**
|
||||
* Providers the essentia watcher for your host.
|
||||
*
|
||||
* @param newWatcher
|
||||
*/
|
||||
void updateWatcher(IEssentiaWatcher newWatcher);
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package thaumicenergistics.api.grid;
|
||||
|
||||
import java.util.Collection;
|
||||
import javax.annotation.Nonnull;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import java.util.Collection;
|
||||
import javax.annotation.Nonnull;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumicenergistics.api.storage.IAspectStack;
|
||||
|
||||
@@ -13,63 +13,72 @@ import thaumicenergistics.api.storage.IAspectStack;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public interface IMEEssentiaMonitor
|
||||
{
|
||||
/**
|
||||
* Adds a listener to the essentia grid.
|
||||
*
|
||||
* @param listener
|
||||
* @param verificationToken
|
||||
* Token used to verify the receiver is still valid, and wants to continue receiving events.
|
||||
*/
|
||||
void addListener( @Nonnull IMEEssentiaMonitorReceiver listener, @Nonnull Object verificationToken );
|
||||
public interface IMEEssentiaMonitor {
|
||||
/**
|
||||
* Adds a listener to the essentia grid.
|
||||
*
|
||||
* @param listener
|
||||
* @param verificationToken
|
||||
* Token used to verify the receiver is still valid, and wants to continue receiving events.
|
||||
*/
|
||||
void addListener(@Nonnull IMEEssentiaMonitorReceiver listener, @Nonnull Object verificationToken);
|
||||
|
||||
/**
|
||||
* Extract the specified essentia from the network.<br>
|
||||
*
|
||||
* @param aspect
|
||||
* @param amount
|
||||
* @param mode
|
||||
* @param source
|
||||
* @param powered
|
||||
* If true will take the required power for the extraction, respecting the mode setting.
|
||||
* @return The amount extracted.
|
||||
*/
|
||||
long extractEssentia( @Nonnull Aspect aspect, long amount, @Nonnull Actionable mode, @Nonnull BaseActionSource source, boolean powered );
|
||||
/**
|
||||
* Extract the specified essentia from the network.<br>
|
||||
*
|
||||
* @param aspect
|
||||
* @param amount
|
||||
* @param mode
|
||||
* @param source
|
||||
* @param powered
|
||||
* If true will take the required power for the extraction, respecting the mode setting.
|
||||
* @return The amount extracted.
|
||||
*/
|
||||
long extractEssentia(
|
||||
@Nonnull Aspect aspect,
|
||||
long amount,
|
||||
@Nonnull Actionable mode,
|
||||
@Nonnull BaseActionSource source,
|
||||
boolean powered);
|
||||
|
||||
/**
|
||||
* Returns the how much of the specified essentia is in the network.
|
||||
*
|
||||
* @param aspect
|
||||
* @return
|
||||
*/
|
||||
long getEssentiaAmount( @Nonnull Aspect aspect );
|
||||
/**
|
||||
* Returns the how much of the specified essentia is in the network.
|
||||
*
|
||||
* @param aspect
|
||||
* @return
|
||||
*/
|
||||
long getEssentiaAmount(@Nonnull Aspect aspect);
|
||||
|
||||
/**
|
||||
* Gets the list of essentia in the network.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
Collection<IAspectStack> getEssentiaList();
|
||||
/**
|
||||
* Gets the list of essentia in the network.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
Collection<IAspectStack> getEssentiaList();
|
||||
|
||||
/**
|
||||
* Inject the specified essentia into the network.<br>
|
||||
*
|
||||
* @param aspect
|
||||
* @param amount
|
||||
* @param mode
|
||||
* @param source
|
||||
* @param powered
|
||||
* If true will take the required power for the injection, respecting the mode setting.
|
||||
* @return The amount that could <strong>not</strong> be injected.
|
||||
*/
|
||||
long injectEssentia( @Nonnull Aspect aspect, long amount, @Nonnull Actionable mode, @Nonnull BaseActionSource source, boolean powered );
|
||||
/**
|
||||
* Inject the specified essentia into the network.<br>
|
||||
*
|
||||
* @param aspect
|
||||
* @param amount
|
||||
* @param mode
|
||||
* @param source
|
||||
* @param powered
|
||||
* If true will take the required power for the injection, respecting the mode setting.
|
||||
* @return The amount that could <strong>not</strong> be injected.
|
||||
*/
|
||||
long injectEssentia(
|
||||
@Nonnull Aspect aspect,
|
||||
long amount,
|
||||
@Nonnull Actionable mode,
|
||||
@Nonnull BaseActionSource source,
|
||||
boolean powered);
|
||||
|
||||
/**
|
||||
* Removes a listener from the essentia grid.
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
public void removeListener( @Nonnull IMEEssentiaMonitorReceiver listener );
|
||||
/**
|
||||
* Removes a listener from the essentia grid.
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
public void removeListener(@Nonnull IMEEssentiaMonitorReceiver listener);
|
||||
}
|
||||
@@ -9,23 +9,22 @@ import thaumicenergistics.api.storage.IAspectStack;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public interface IMEEssentiaMonitorReceiver
|
||||
{
|
||||
/**
|
||||
* Verifies that the receiver is still valid.<br>
|
||||
* If returning false the receiver will be removed from the monitor
|
||||
* and the receiver should NOT call removeListener itself.
|
||||
*
|
||||
* @param verificationToken
|
||||
* @return False if the receiver should no longer get updates.
|
||||
*/
|
||||
boolean isValid( @Nonnull Object verificationToken );
|
||||
public interface IMEEssentiaMonitorReceiver {
|
||||
/**
|
||||
* Verifies that the receiver is still valid.<br>
|
||||
* If returning false the receiver will be removed from the monitor
|
||||
* and the receiver should NOT call removeListener itself.
|
||||
*
|
||||
* @param verificationToken
|
||||
* @return False if the receiver should no longer get updates.
|
||||
*/
|
||||
boolean isValid(@Nonnull Object verificationToken);
|
||||
|
||||
/**
|
||||
* Called when a change to the stored essentia occurs.
|
||||
*
|
||||
* @param fromMonitor
|
||||
* @param changes
|
||||
*/
|
||||
void postChange( @Nonnull IMEEssentiaMonitor fromMonitor, @Nonnull Iterable<IAspectStack> changes );
|
||||
/**
|
||||
* Called when a change to the stored essentia occurs.
|
||||
*
|
||||
* @param fromMonitor
|
||||
* @param changes
|
||||
*/
|
||||
void postChange(@Nonnull IMEEssentiaMonitor fromMonitor, @Nonnull Iterable<IAspectStack> changes);
|
||||
}
|
||||
@@ -9,13 +9,12 @@ import thaumcraft.api.aspects.Aspect;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public interface IAspectSelectorContainer
|
||||
{
|
||||
/**
|
||||
* Set the selected aspect.
|
||||
*
|
||||
* @param selectedAspect
|
||||
* Null if no selection.
|
||||
*/
|
||||
void setSelectedAspect( @Nullable Aspect selectedAspect );
|
||||
public interface IAspectSelectorContainer {
|
||||
/**
|
||||
* Set the selected aspect.
|
||||
*
|
||||
* @param selectedAspect
|
||||
* Null if no selection.
|
||||
*/
|
||||
void setSelectedAspect(@Nullable Aspect selectedAspect);
|
||||
}
|
||||
@@ -10,23 +10,20 @@ import thaumcraft.api.aspects.Aspect;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public interface IAspectSelectorGui
|
||||
extends IWidgetHost
|
||||
{
|
||||
/**
|
||||
* Return the selector container.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
IAspectSelectorContainer getContainer();
|
||||
|
||||
/**
|
||||
* Return the selected aspect, or null if no aspect is selected.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nullable
|
||||
Aspect getSelectedAspect();
|
||||
public interface IAspectSelectorGui extends IWidgetHost {
|
||||
/**
|
||||
* Return the selector container.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
IAspectSelectorContainer getContainer();
|
||||
|
||||
/**
|
||||
* Return the selected aspect, or null if no aspect is selected.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nullable
|
||||
Aspect getSelectedAspect();
|
||||
}
|
||||
@@ -10,13 +10,11 @@ import thaumcraft.api.aspects.Aspect;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public interface IAspectSlotGui
|
||||
extends IWidgetHost
|
||||
{
|
||||
/**
|
||||
* The list of aspects to display.
|
||||
*
|
||||
* @param aspectList
|
||||
*/
|
||||
void updateAspects( @Nonnull List<Aspect> aspectList );
|
||||
public interface IAspectSlotGui extends IWidgetHost {
|
||||
/**
|
||||
* The list of aspects to display.
|
||||
*
|
||||
* @param aspectList
|
||||
*/
|
||||
void updateAspects(@Nonnull List<Aspect> aspectList);
|
||||
}
|
||||
@@ -9,13 +9,12 @@ import thaumicenergistics.api.grid.ICraftingIssuerHost;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public interface ICraftingIssuerContainer
|
||||
{
|
||||
/**
|
||||
* Gets the crafting issuer host terminal.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
ICraftingIssuerHost getCraftingHost();
|
||||
public interface ICraftingIssuerContainer {
|
||||
/**
|
||||
* Gets the crafting issuer host terminal.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
ICraftingIssuerHost getCraftingHost();
|
||||
}
|
||||
@@ -9,27 +9,26 @@ import net.minecraft.client.gui.FontRenderer;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public interface IWidgetHost
|
||||
{
|
||||
/**
|
||||
* Gets the font renderer for the GUI.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
FontRenderer getFontRenderer();
|
||||
public interface IWidgetHost {
|
||||
/**
|
||||
* Gets the font renderer for the GUI.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
FontRenderer getFontRenderer();
|
||||
|
||||
/**
|
||||
* Return the left of the GUI.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int guiLeft();
|
||||
/**
|
||||
* Return the left of the GUI.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int guiLeft();
|
||||
|
||||
/**
|
||||
* Return the top of the GUI.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int guiTop();
|
||||
/**
|
||||
* Return the top of the GUI.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int guiTop();
|
||||
}
|
||||
@@ -10,14 +10,12 @@ import thaumcraft.api.aspects.IEssentiaContainerItem;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public interface IRestrictedEssentiaContainerItem
|
||||
extends IEssentiaContainerItem
|
||||
{
|
||||
/**
|
||||
* Returns true if the container accepts the specified aspect.
|
||||
*
|
||||
* @param aspect
|
||||
* @return
|
||||
*/
|
||||
boolean acceptsAspect( @Nonnull Aspect aspect );
|
||||
public interface IRestrictedEssentiaContainerItem extends IEssentiaContainerItem {
|
||||
/**
|
||||
* Returns true if the container accepts the specified aspect.
|
||||
*
|
||||
* @param aspect
|
||||
* @return
|
||||
*/
|
||||
boolean acceptsAspect(@Nonnull Aspect aspect);
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package thaumicenergistics.api.storage;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
@@ -13,170 +13,168 @@ import thaumcraft.api.aspects.Aspect;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public interface IAspectStack
|
||||
{
|
||||
/**
|
||||
* Changes the stack size by the delta amount and returns the new stack size.
|
||||
*
|
||||
* @param delta
|
||||
* @return Adjusted stack size.
|
||||
*/
|
||||
long adjustStackSize( long delta );
|
||||
public interface IAspectStack {
|
||||
/**
|
||||
* Changes the stack size by the delta amount and returns the new stack size.
|
||||
*
|
||||
* @param delta
|
||||
* @return Adjusted stack size.
|
||||
*/
|
||||
long adjustStackSize(long delta);
|
||||
|
||||
/**
|
||||
* Creates a copy of this stack and returns it.
|
||||
*
|
||||
* @return Copy of the stack.
|
||||
*/
|
||||
@Nonnull
|
||||
IAspectStack copy();
|
||||
/**
|
||||
* Creates a copy of this stack and returns it.
|
||||
*
|
||||
* @return Copy of the stack.
|
||||
*/
|
||||
@Nonnull
|
||||
IAspectStack copy();
|
||||
|
||||
/**
|
||||
* Returns the aspect that is stored.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nullable
|
||||
Aspect getAspect();
|
||||
/**
|
||||
* Returns the aspect that is stored.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nullable
|
||||
Aspect getAspect();
|
||||
|
||||
/**
|
||||
* Gets the Thaumcraft description for the aspect.
|
||||
*
|
||||
* @return Localized description, or empty string if no aspect.
|
||||
*/
|
||||
@Nonnull
|
||||
String getAspectDescription();
|
||||
/**
|
||||
* Gets the Thaumcraft description for the aspect.
|
||||
*
|
||||
* @return Localized description, or empty string if no aspect.
|
||||
*/
|
||||
@Nonnull
|
||||
String getAspectDescription();
|
||||
|
||||
/**
|
||||
* Gets the name of the aspect.<br>
|
||||
* This method does not take into consideration if the player has yet discovered the aspect.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
String getAspectName();
|
||||
/**
|
||||
* Gets the name of the aspect.<br>
|
||||
* This method does not take into consideration if the player has yet discovered the aspect.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
String getAspectName();
|
||||
|
||||
/**
|
||||
* Gets the display name of the aspect for the player.
|
||||
*
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
String getAspectName( @Nullable EntityPlayer player );
|
||||
/**
|
||||
* Gets the display name of the aspect for the player.
|
||||
*
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
String getAspectName(@Nullable EntityPlayer player);
|
||||
|
||||
/**
|
||||
* Gets the Thaumcraft tag for the aspect
|
||||
*
|
||||
* @return Thaumcraft tag, or empty string if no aspect.
|
||||
*/
|
||||
@Nonnull
|
||||
String getAspectTag();
|
||||
/**
|
||||
* Gets the Thaumcraft tag for the aspect
|
||||
*
|
||||
* @return Thaumcraft tag, or empty string if no aspect.
|
||||
*/
|
||||
@Nonnull
|
||||
String getAspectTag();
|
||||
|
||||
/**
|
||||
* The chat color associated with this aspect.
|
||||
*
|
||||
* @return Chat prefix string, or empty string if no aspect.
|
||||
*/
|
||||
@Nonnull
|
||||
String getChatColor();
|
||||
/**
|
||||
* The chat color associated with this aspect.
|
||||
*
|
||||
* @return Chat prefix string, or empty string if no aspect.
|
||||
*/
|
||||
@Nonnull
|
||||
String getChatColor();
|
||||
|
||||
/**
|
||||
* Returns true if the aspect is craftable.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean getCraftable();
|
||||
/**
|
||||
* Returns true if the aspect is craftable.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean getCraftable();
|
||||
|
||||
/**
|
||||
* Returns the stack size.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
long getStackSize();
|
||||
/**
|
||||
* Returns the stack size.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
long getStackSize();
|
||||
|
||||
/**
|
||||
* Returns true if the stack has a non-null aspect set.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean hasAspect();
|
||||
/**
|
||||
* Returns true if the stack has a non-null aspect set.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean hasAspect();
|
||||
|
||||
/**
|
||||
* Checks if the player has discovered this aspect.
|
||||
*
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
boolean hasPlayerDiscovered( @Nullable EntityPlayer player );
|
||||
/**
|
||||
* Checks if the player has discovered this aspect.
|
||||
*
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
boolean hasPlayerDiscovered(@Nullable EntityPlayer player);
|
||||
|
||||
/**
|
||||
* Returns true if the size is not positive.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isEmpty();
|
||||
/**
|
||||
* Returns true if the size is not positive.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isEmpty();
|
||||
|
||||
/**
|
||||
* Sets this stack to the data in the stream.
|
||||
*
|
||||
* @param stream
|
||||
*/
|
||||
void readFromStream( @Nonnull ByteBuf stream );
|
||||
/**
|
||||
* Sets this stack to the data in the stream.
|
||||
*
|
||||
* @param stream
|
||||
*/
|
||||
void readFromStream(@Nonnull ByteBuf stream);
|
||||
|
||||
/**
|
||||
* Sets everything.
|
||||
*
|
||||
* @param aspect
|
||||
* @param size
|
||||
* @param craftable
|
||||
*/
|
||||
void setAll( @Nullable Aspect aspect, long size, boolean craftable );
|
||||
/**
|
||||
* Sets everything.
|
||||
*
|
||||
* @param aspect
|
||||
* @param size
|
||||
* @param craftable
|
||||
*/
|
||||
void setAll(@Nullable Aspect aspect, long size, boolean craftable);
|
||||
|
||||
/**
|
||||
* Sets the values of this stack to match the passed stack.<br>
|
||||
* If the stack is null, all values are reset.
|
||||
*
|
||||
* @param stack
|
||||
*/
|
||||
void setAll( @Nullable IAspectStack stack );
|
||||
/**
|
||||
* Sets the values of this stack to match the passed stack.<br>
|
||||
* If the stack is null, all values are reset.
|
||||
*
|
||||
* @param stack
|
||||
*/
|
||||
void setAll(@Nullable IAspectStack stack);
|
||||
|
||||
/**
|
||||
* Sets the aspect for the stack.
|
||||
*
|
||||
* @param aspect
|
||||
*/
|
||||
void setAspect( @Nullable Aspect aspect );
|
||||
/**
|
||||
* Sets the aspect for the stack.
|
||||
*
|
||||
* @param aspect
|
||||
*/
|
||||
void setAspect(@Nullable Aspect aspect);
|
||||
|
||||
/**
|
||||
* Sets if the aspect is craftable.
|
||||
*
|
||||
* @param craftable
|
||||
*/
|
||||
void setCraftable( boolean craftable );
|
||||
/**
|
||||
* Sets if the aspect is craftable.
|
||||
*
|
||||
* @param craftable
|
||||
*/
|
||||
void setCraftable(boolean craftable);
|
||||
|
||||
/**
|
||||
* Sets the size of the stack.
|
||||
*
|
||||
* @param size
|
||||
*/
|
||||
void setStackSize( long size );
|
||||
/**
|
||||
* Sets the size of the stack.
|
||||
*
|
||||
* @param size
|
||||
*/
|
||||
void setStackSize(long size);
|
||||
|
||||
/**
|
||||
* Writes this aspect stack to the specified NBT tag
|
||||
*
|
||||
* @param data
|
||||
* The tag to write to
|
||||
* @return The nbt tag passed in.
|
||||
*/
|
||||
@Nonnull
|
||||
NBTTagCompound writeToNBT( @Nonnull NBTTagCompound data );
|
||||
|
||||
/**
|
||||
* Writes the stack to a bytebuf stream.
|
||||
*
|
||||
* @param stream
|
||||
*/
|
||||
void writeToStream( @Nonnull ByteBuf stream );
|
||||
/**
|
||||
* Writes this aspect stack to the specified NBT tag
|
||||
*
|
||||
* @param data
|
||||
* The tag to write to
|
||||
* @return The nbt tag passed in.
|
||||
*/
|
||||
@Nonnull
|
||||
NBTTagCompound writeToNBT(@Nonnull NBTTagCompound data);
|
||||
|
||||
/**
|
||||
* Writes the stack to a bytebuf stream.
|
||||
*
|
||||
* @param stream
|
||||
*/
|
||||
void writeToStream(@Nonnull ByteBuf stream);
|
||||
}
|
||||
@@ -12,119 +12,118 @@ import thaumcraft.api.aspects.Aspect;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public interface IEssentiaRepo
|
||||
{
|
||||
public interface IEssentiaRepo {
|
||||
|
||||
/**
|
||||
* Returns a set of the stored aspects.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
Set<Aspect> aspectSet();
|
||||
/**
|
||||
* Returns a set of the stored aspects.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
Set<Aspect> aspectSet();
|
||||
|
||||
/**
|
||||
* Removes all entries in the repo.
|
||||
*/
|
||||
void clear();
|
||||
/**
|
||||
* Removes all entries in the repo.
|
||||
*/
|
||||
void clear();
|
||||
|
||||
/**
|
||||
* Returns true if the repo has the aspect stored.
|
||||
*
|
||||
* @param aspect
|
||||
* @return
|
||||
*/
|
||||
boolean containsAspect( @Nonnull Aspect aspect );
|
||||
/**
|
||||
* Returns true if the repo has the aspect stored.
|
||||
*
|
||||
* @param aspect
|
||||
* @return
|
||||
*/
|
||||
boolean containsAspect(@Nonnull Aspect aspect);
|
||||
|
||||
/**
|
||||
* Sets the repo to match the specified collection.
|
||||
* Any existing data is removed.
|
||||
*
|
||||
* @param stacks
|
||||
*/
|
||||
void copyFrom( @Nonnull Collection<IAspectStack> stacks );
|
||||
/**
|
||||
* Sets the repo to match the specified collection.
|
||||
* Any existing data is removed.
|
||||
*
|
||||
* @param stacks
|
||||
*/
|
||||
void copyFrom(@Nonnull Collection<IAspectStack> stacks);
|
||||
|
||||
/**
|
||||
* Gets the aspect stack associated with the aspect or null.
|
||||
*/
|
||||
IAspectStack get( @Nonnull Aspect aspect );
|
||||
/**
|
||||
* Gets the aspect stack associated with the aspect or null.
|
||||
*/
|
||||
IAspectStack get(@Nonnull Aspect aspect);
|
||||
|
||||
/**
|
||||
* Returns all aspect information stored in the repo.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
Collection<IAspectStack> getAll();
|
||||
/**
|
||||
* Returns all aspect information stored in the repo.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
Collection<IAspectStack> getAll();
|
||||
|
||||
/**
|
||||
* Gets the aspect stack associated with the aspect or specified the default value.
|
||||
*/
|
||||
IAspectStack getOrDefault( @Nonnull Aspect aspect, @Nullable IAspectStack defaultValue );
|
||||
/**
|
||||
* Gets the aspect stack associated with the aspect or specified the default value.
|
||||
*/
|
||||
IAspectStack getOrDefault(@Nonnull Aspect aspect, @Nullable IAspectStack defaultValue);
|
||||
|
||||
/**
|
||||
* Returns true if the repo is empty.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isEmpty();
|
||||
/**
|
||||
* Returns true if the repo is empty.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isEmpty();
|
||||
|
||||
/**
|
||||
* Changes the aspect in the repo by the specified values.
|
||||
*
|
||||
* @param aspect
|
||||
* @param change
|
||||
* @param isCraftable
|
||||
* If this value is null and there is a stored value, its crafting status will remain the same.
|
||||
* Otherwise it is set to false.
|
||||
* @return The previous stack, if there was one.
|
||||
*/
|
||||
@Nullable
|
||||
IAspectStack postChange( @Nonnull Aspect aspect, long change, Boolean isCraftable );
|
||||
/**
|
||||
* Changes the aspect in the repo by the specified values.
|
||||
*
|
||||
* @param aspect
|
||||
* @param change
|
||||
* @param isCraftable
|
||||
* If this value is null and there is a stored value, its crafting status will remain the same.
|
||||
* Otherwise it is set to false.
|
||||
* @return The previous stack, if there was one.
|
||||
*/
|
||||
@Nullable
|
||||
IAspectStack postChange(@Nonnull Aspect aspect, long change, Boolean isCraftable);
|
||||
|
||||
/**
|
||||
* Changes the aspect in the repo by the specified aspect stack.
|
||||
*
|
||||
* @param change
|
||||
* @return The previous stack, if there was one.
|
||||
*/
|
||||
@Nullable
|
||||
IAspectStack postChange( @Nonnull IAspectStack change );
|
||||
/**
|
||||
* Changes the aspect in the repo by the specified aspect stack.
|
||||
*
|
||||
* @param change
|
||||
* @return The previous stack, if there was one.
|
||||
*/
|
||||
@Nullable
|
||||
IAspectStack postChange(@Nonnull IAspectStack change);
|
||||
|
||||
/**
|
||||
* Removes an aspect from the repo.<br>
|
||||
* Returns the removed stack, if there was one removed.
|
||||
*
|
||||
* @param aspect
|
||||
* @return
|
||||
*/
|
||||
@Nullable
|
||||
IAspectStack remove( Aspect aspect );
|
||||
/**
|
||||
* Removes an aspect from the repo.<br>
|
||||
* Returns the removed stack, if there was one removed.
|
||||
*
|
||||
* @param aspect
|
||||
* @return
|
||||
*/
|
||||
@Nullable
|
||||
IAspectStack remove(Aspect aspect);
|
||||
|
||||
/**
|
||||
* Sets the aspect in the repo by the specified values.
|
||||
*
|
||||
* @param aspect
|
||||
* @param amount
|
||||
* @param isCraftable
|
||||
* @return The previous stack, if there was one.
|
||||
*/
|
||||
@Nullable
|
||||
IAspectStack setAspect( @Nonnull Aspect aspect, long amount, boolean isCraftable );
|
||||
/**
|
||||
* Sets the aspect in the repo by the specified values.
|
||||
*
|
||||
* @param aspect
|
||||
* @param amount
|
||||
* @param isCraftable
|
||||
* @return The previous stack, if there was one.
|
||||
*/
|
||||
@Nullable
|
||||
IAspectStack setAspect(@Nonnull Aspect aspect, long amount, boolean isCraftable);
|
||||
|
||||
/**
|
||||
* Sets the aspect in the repo to the specified aspect stack.
|
||||
*
|
||||
* @param stack
|
||||
* @return The previous stack, if there was one.
|
||||
*/
|
||||
@Nullable
|
||||
IAspectStack setAspect( @Nonnull IAspectStack stack );
|
||||
/**
|
||||
* Sets the aspect in the repo to the specified aspect stack.
|
||||
*
|
||||
* @param stack
|
||||
* @return The previous stack, if there was one.
|
||||
*/
|
||||
@Nullable
|
||||
IAspectStack setAspect(@Nonnull IAspectStack stack);
|
||||
|
||||
/**
|
||||
* Returns the number of unique aspects stored.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int size();
|
||||
/**
|
||||
* Returns the number of unique aspects stored.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int size();
|
||||
}
|
||||
@@ -8,12 +8,11 @@ import net.minecraft.inventory.IInventory;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public interface IInventoryUpdateReceiver
|
||||
{
|
||||
/**
|
||||
* Called when an inventory is changed.
|
||||
*
|
||||
* @param sourceInventory
|
||||
*/
|
||||
public void onInventoryChanged( IInventory sourceInventory );
|
||||
public interface IInventoryUpdateReceiver {
|
||||
/**
|
||||
* Called when an inventory is changed.
|
||||
*
|
||||
* @param sourceInventory
|
||||
*/
|
||||
public void onInventoryChanged(IInventory sourceInventory);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package thaumicenergistics.api.tiles;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import appeng.api.config.Actionable;
|
||||
import javax.annotation.Nonnull;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.IEssentiaTransport;
|
||||
@@ -12,17 +12,15 @@ import thaumcraft.api.aspects.IEssentiaTransport;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public interface IEssentiaTransportWithSimulate
|
||||
extends IEssentiaTransport
|
||||
{
|
||||
/**
|
||||
* Adds essentia to the transport.
|
||||
*
|
||||
* @param aspect
|
||||
* @param amount
|
||||
* @param side
|
||||
* @param mode
|
||||
* @return Amount that <strong>was</strong> injected.
|
||||
*/
|
||||
int addEssentia( @Nonnull Aspect aspect, int amount, @Nonnull ForgeDirection side, @Nonnull Actionable mode );
|
||||
public interface IEssentiaTransportWithSimulate extends IEssentiaTransport {
|
||||
/**
|
||||
* Adds essentia to the transport.
|
||||
*
|
||||
* @param aspect
|
||||
* @param amount
|
||||
* @param side
|
||||
* @param mode
|
||||
* @return Amount that <strong>was</strong> injected.
|
||||
*/
|
||||
int addEssentia(@Nonnull Aspect aspect, int amount, @Nonnull ForgeDirection side, @Nonnull Actionable mode);
|
||||
}
|
||||
@@ -13,29 +13,22 @@ import thaumicenergistics.common.registries.Renderers;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public class ClientProxy
|
||||
extends CommonProxy
|
||||
{
|
||||
public ClientProxy()
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register( this );
|
||||
}
|
||||
public class ClientProxy extends CommonProxy {
|
||||
public ClientProxy() {
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerRenderers()
|
||||
{
|
||||
// Register the custom block renderers
|
||||
Renderers.registerRenderers();
|
||||
}
|
||||
@Override
|
||||
public void registerRenderers() {
|
||||
// Register the custom block renderers
|
||||
Renderers.registerRenderers();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerTextures( final TextureStitchEvent.Pre event )
|
||||
{
|
||||
// Register all block textures
|
||||
for( BlockTextureManager texture : BlockTextureManager.ALLVALUES )
|
||||
{
|
||||
texture.registerTexture( event.map );
|
||||
}
|
||||
|
||||
}
|
||||
@SubscribeEvent
|
||||
public void registerTextures(final TextureStitchEvent.Pre event) {
|
||||
// Register all block textures
|
||||
for (BlockTextureManager texture : BlockTextureManager.ALLVALUES) {
|
||||
texture.registerTexture(event.map);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
package thaumicenergistics.client.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
* Particles that can be displayed in a GUI.
|
||||
@@ -14,114 +14,121 @@ import net.minecraft.util.ResourceLocation;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public enum EnumGuiParticles
|
||||
{
|
||||
Orb (thaumcraft.client.fx.ParticleEngine.particleTexture, 0, 128, 16, 16, 16, 0, 16),
|
||||
Rune (thaumcraft.client.fx.ParticleEngine.particleTexture, 0, 96, 16, 16, 16, 0, 16),
|
||||
Wispy (thaumcraft.client.fx.ParticleEngine.particleTexture, 0, 80, 16, 16, 16, 0, 16),
|
||||
Knowledge (thaumcraft.client.fx.ParticleEngine.particleTexture, 0, 64, 16, 16, 16, 0, 4);
|
||||
public enum EnumGuiParticles {
|
||||
Orb(thaumcraft.client.fx.ParticleEngine.particleTexture, 0, 128, 16, 16, 16, 0, 16),
|
||||
Rune(thaumcraft.client.fx.ParticleEngine.particleTexture, 0, 96, 16, 16, 16, 0, 16),
|
||||
Wispy(thaumcraft.client.fx.ParticleEngine.particleTexture, 0, 80, 16, 16, 16, 0, 16),
|
||||
Knowledge(thaumcraft.client.fx.ParticleEngine.particleTexture, 0, 64, 16, 16, 16, 0, 4);
|
||||
|
||||
/**
|
||||
* Location of the particle in the texture.
|
||||
*/
|
||||
private int txU, txV, width, height;
|
||||
/**
|
||||
* Location of the particle in the texture.
|
||||
*/
|
||||
private int txU, txV, width, height;
|
||||
|
||||
/**
|
||||
* Amount that U and V change during each animation step.
|
||||
*/
|
||||
private int animationUStep, animationVStep;
|
||||
/**
|
||||
* Amount that U and V change during each animation step.
|
||||
*/
|
||||
private int animationUStep, animationVStep;
|
||||
|
||||
/**
|
||||
* Number of frames in the animation.
|
||||
* Can not be 0.
|
||||
*/
|
||||
private int FrameCount;
|
||||
/**
|
||||
* Number of frames in the animation.
|
||||
* Can not be 0.
|
||||
*/
|
||||
private int FrameCount;
|
||||
|
||||
/**
|
||||
* Texture used to draw the particle.
|
||||
*/
|
||||
private ResourceLocation texture;
|
||||
/**
|
||||
* Texture used to draw the particle.
|
||||
*/
|
||||
private ResourceLocation texture;
|
||||
|
||||
private EnumGuiParticles( final ResourceLocation textureLocation, final int U, final int V, final int width, final int height,
|
||||
final int UStep, final int VStep, final int Frames )
|
||||
{
|
||||
this.texture = textureLocation;
|
||||
this.txU = U;
|
||||
this.txV = V;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.animationUStep = UStep;
|
||||
this.animationVStep = VStep;
|
||||
this.FrameCount = Frames;
|
||||
}
|
||||
private EnumGuiParticles(
|
||||
final ResourceLocation textureLocation,
|
||||
final int U,
|
||||
final int V,
|
||||
final int width,
|
||||
final int height,
|
||||
final int UStep,
|
||||
final int VStep,
|
||||
final int Frames) {
|
||||
this.texture = textureLocation;
|
||||
this.txU = U;
|
||||
this.txV = V;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.animationUStep = UStep;
|
||||
this.animationVStep = VStep;
|
||||
this.FrameCount = Frames;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the engine state.
|
||||
*/
|
||||
public static void finishDraw()
|
||||
{
|
||||
// Set color to white
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
/**
|
||||
* Resets the engine state.
|
||||
*/
|
||||
public static void finishDraw() {
|
||||
// Set color to white
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
// Disable blending
|
||||
GL11.glDisable( GL11.GL_BLEND );
|
||||
}
|
||||
// Disable blending
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the particle.
|
||||
* If settings "needsPrepare" to false, prepare and finish must be called manually.
|
||||
* However this can be useful if drawing multiple of the same particle.
|
||||
*
|
||||
* @param gui
|
||||
* @param positionX
|
||||
* @param positionY
|
||||
* @param frameNumber
|
||||
* @param red
|
||||
* @param green
|
||||
* @param blue
|
||||
* @param needsPrepare
|
||||
*/
|
||||
public void drawParticle( final Gui gui, final int positionX, final int positionY, final int frameNumber, final float red, final float green,
|
||||
final float blue, final boolean needsPrepare )
|
||||
{
|
||||
if( needsPrepare )
|
||||
{
|
||||
this.prepareDraw();
|
||||
}
|
||||
/**
|
||||
* Draws the particle.
|
||||
* If settings "needsPrepare" to false, prepare and finish must be called manually.
|
||||
* However this can be useful if drawing multiple of the same particle.
|
||||
*
|
||||
* @param gui
|
||||
* @param positionX
|
||||
* @param positionY
|
||||
* @param frameNumber
|
||||
* @param red
|
||||
* @param green
|
||||
* @param blue
|
||||
* @param needsPrepare
|
||||
*/
|
||||
public void drawParticle(
|
||||
final Gui gui,
|
||||
final int positionX,
|
||||
final int positionY,
|
||||
final int frameNumber,
|
||||
final float red,
|
||||
final float green,
|
||||
final float blue,
|
||||
final boolean needsPrepare) {
|
||||
if (needsPrepare) {
|
||||
this.prepareDraw();
|
||||
}
|
||||
|
||||
// Wrap the frame number
|
||||
int frameIndex = frameNumber % this.FrameCount;
|
||||
// Wrap the frame number
|
||||
int frameIndex = frameNumber % this.FrameCount;
|
||||
|
||||
// Calculate the U position
|
||||
int U = this.txU + ( this.animationUStep * frameIndex );
|
||||
// Calculate the U position
|
||||
int U = this.txU + (this.animationUStep * frameIndex);
|
||||
|
||||
// Calculate the V position
|
||||
int V = this.txV + ( this.animationVStep * frameIndex );
|
||||
// Calculate the V position
|
||||
int V = this.txV + (this.animationVStep * frameIndex);
|
||||
|
||||
// Set tint color
|
||||
GL11.glColor4f( red, green, blue, 0.90f );
|
||||
// Set tint color
|
||||
GL11.glColor4f(red, green, blue, 0.90f);
|
||||
|
||||
// Draw the particle
|
||||
gui.drawTexturedModalRect( positionX, positionY, U, V, this.width, this.height );
|
||||
// Draw the particle
|
||||
gui.drawTexturedModalRect(positionX, positionY, U, V, this.width, this.height);
|
||||
|
||||
if( needsPrepare )
|
||||
{
|
||||
EnumGuiParticles.finishDraw();
|
||||
}
|
||||
}
|
||||
if (needsPrepare) {
|
||||
EnumGuiParticles.finishDraw();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the engine to draw this particle.
|
||||
* Must be called before drawing, but can be called once then
|
||||
* draw called multiple times for the same particle.
|
||||
*/
|
||||
public void prepareDraw()
|
||||
{
|
||||
// Bind the texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture( this.texture );
|
||||
/**
|
||||
* Prepares the engine to draw this particle.
|
||||
* Must be called before drawing, but can be called once then
|
||||
* draw called multiple times for the same particle.
|
||||
*/
|
||||
public void prepareDraw() {
|
||||
// Bind the texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(this.texture);
|
||||
|
||||
// Enable alpha blending
|
||||
GL11.glEnable( GL11.GL_BLEND );
|
||||
GL11.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE );
|
||||
}
|
||||
// Enable alpha blending
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
package thaumicenergistics.client.gui;
|
||||
|
||||
import java.util.Dictionary;
|
||||
import java.util.Hashtable;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.Dictionary;
|
||||
import java.util.Hashtable;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumicenergistics.client.gui.abstraction.ThEBaseGui;
|
||||
@@ -25,167 +25,177 @@ import thaumicenergistics.common.tiles.TileArcaneAssembler;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiArcaneAssembler
|
||||
extends ThEBaseGui
|
||||
{
|
||||
/**
|
||||
* Gui size.
|
||||
*/
|
||||
private static final int FULL_GUI_WIDTH = 247, MAIN_GUI_WIDTH = 176, UPGRADE_GUI_WIDTH = 234 - MAIN_GUI_WIDTH, GUI_HEIGHT = 197,
|
||||
UPGRADE_GUI_HEIGHT = 104;
|
||||
public class GuiArcaneAssembler extends ThEBaseGui {
|
||||
/**
|
||||
* Gui size.
|
||||
*/
|
||||
private static final int FULL_GUI_WIDTH = 247,
|
||||
MAIN_GUI_WIDTH = 176,
|
||||
UPGRADE_GUI_WIDTH = 234 - MAIN_GUI_WIDTH,
|
||||
GUI_HEIGHT = 197,
|
||||
UPGRADE_GUI_HEIGHT = 104;
|
||||
|
||||
/**
|
||||
* Title position.
|
||||
*/
|
||||
private static final int TITLE_POS_X = 6, TITLE_POS_Y = 6;
|
||||
/**
|
||||
* Title position.
|
||||
*/
|
||||
private static final int TITLE_POS_X = 6, TITLE_POS_Y = 6;
|
||||
|
||||
/**
|
||||
* Vis bar positions.
|
||||
*/
|
||||
private static final int VIS_EMPTY_Y = 87, VIS_FULL_Y = 202, VIS_BAR_HEIGHT = 16, VIS_BAR_WIDTH = 4;
|
||||
/**
|
||||
* Vis bar positions.
|
||||
*/
|
||||
private static final int VIS_EMPTY_Y = 87, VIS_FULL_Y = 202, VIS_BAR_HEIGHT = 16, VIS_BAR_WIDTH = 4;
|
||||
|
||||
/**
|
||||
* Title displayed on the GUI
|
||||
*/
|
||||
private String title;
|
||||
/**
|
||||
* Title displayed on the GUI
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* Map's an aspect to an X location.
|
||||
*/
|
||||
private Dictionary<Aspect, Integer> visBarPositionMap = new Hashtable<Aspect, Integer>();
|
||||
/**
|
||||
* Map's an aspect to an X location.
|
||||
*/
|
||||
private Dictionary<Aspect, Integer> visBarPositionMap = new Hashtable<Aspect, Integer>();
|
||||
|
||||
/**
|
||||
* True if the player is holding a network tool.
|
||||
*/
|
||||
private boolean hasNetworkTool = false;
|
||||
/**
|
||||
* True if the player is holding a network tool.
|
||||
*/
|
||||
private boolean hasNetworkTool = false;
|
||||
|
||||
/**
|
||||
* Fake aspect used to simplify progress bar draw calls
|
||||
*/
|
||||
private Aspect progressAspect = Aspect.MECHANISM;
|
||||
/**
|
||||
* Fake aspect used to simplify progress bar draw calls
|
||||
*/
|
||||
private Aspect progressAspect = Aspect.MECHANISM;
|
||||
|
||||
public GuiArcaneAssembler( final EntityPlayer player, final World world, final int X, final int Y, final int Z )
|
||||
{
|
||||
// Call super
|
||||
super( new ContainerArcaneAssembler( player, world, X, Y, Z ) );
|
||||
public GuiArcaneAssembler(final EntityPlayer player, final World world, final int X, final int Y, final int Z) {
|
||||
// Call super
|
||||
super(new ContainerArcaneAssembler(player, world, X, Y, Z));
|
||||
|
||||
this.hasNetworkTool = ( (ContainerArcaneAssembler)this.inventorySlots ).hasNetworkTool();
|
||||
this.hasNetworkTool = ((ContainerArcaneAssembler) this.inventorySlots).hasNetworkTool();
|
||||
|
||||
// Set the GUI size
|
||||
this.xSize = ( this.hasNetworkTool ? GuiArcaneAssembler.FULL_GUI_WIDTH : GuiArcaneAssembler.MAIN_GUI_WIDTH +
|
||||
GuiArcaneAssembler.UPGRADE_GUI_WIDTH );
|
||||
this.ySize = GuiArcaneAssembler.GUI_HEIGHT;
|
||||
// Set the GUI size
|
||||
this.xSize = (this.hasNetworkTool
|
||||
? GuiArcaneAssembler.FULL_GUI_WIDTH
|
||||
: GuiArcaneAssembler.MAIN_GUI_WIDTH + GuiArcaneAssembler.UPGRADE_GUI_WIDTH);
|
||||
this.ySize = GuiArcaneAssembler.GUI_HEIGHT;
|
||||
|
||||
// Set the title
|
||||
this.title = ThEStrings.Gui_TitleArcaneAssembler.getLocalized();
|
||||
// Set the title
|
||||
this.title = ThEStrings.Gui_TitleArcaneAssembler.getLocalized();
|
||||
|
||||
// Add the vis bar positions
|
||||
this.visBarPositionMap.put( Aspect.AIR, 41 );
|
||||
this.visBarPositionMap.put( Aspect.WATER, 59 );
|
||||
this.visBarPositionMap.put( Aspect.FIRE, 77 );
|
||||
this.visBarPositionMap.put( Aspect.ORDER, 95 );
|
||||
this.visBarPositionMap.put( Aspect.ENTROPY, 113 );
|
||||
this.visBarPositionMap.put( Aspect.EARTH, 131 );
|
||||
this.visBarPositionMap.put( this.progressAspect, 149 );
|
||||
}
|
||||
// Add the vis bar positions
|
||||
this.visBarPositionMap.put(Aspect.AIR, 41);
|
||||
this.visBarPositionMap.put(Aspect.WATER, 59);
|
||||
this.visBarPositionMap.put(Aspect.FIRE, 77);
|
||||
this.visBarPositionMap.put(Aspect.ORDER, 95);
|
||||
this.visBarPositionMap.put(Aspect.ENTROPY, 113);
|
||||
this.visBarPositionMap.put(Aspect.EARTH, 131);
|
||||
this.visBarPositionMap.put(this.progressAspect, 149);
|
||||
}
|
||||
|
||||
private void drawVisBar( final Aspect aspect, final float percent )
|
||||
{
|
||||
// Calculate the height
|
||||
int height = (int)Math.floor( percent * GuiArcaneAssembler.VIS_BAR_HEIGHT );
|
||||
private void drawVisBar(final Aspect aspect, final float percent) {
|
||||
// Calculate the height
|
||||
int height = (int) Math.floor(percent * GuiArcaneAssembler.VIS_BAR_HEIGHT);
|
||||
|
||||
if( height > 0 )
|
||||
{
|
||||
// Calculate the X/U position
|
||||
int xuPos = this.visBarPositionMap.get( aspect );
|
||||
if (height > 0) {
|
||||
// Calculate the X/U position
|
||||
int xuPos = this.visBarPositionMap.get(aspect);
|
||||
|
||||
// Calculate the Y pos
|
||||
int yPos = GuiArcaneAssembler.VIS_EMPTY_Y + ( GuiArcaneAssembler.VIS_BAR_HEIGHT - height );
|
||||
// Calculate the Y pos
|
||||
int yPos = GuiArcaneAssembler.VIS_EMPTY_Y + (GuiArcaneAssembler.VIS_BAR_HEIGHT - height);
|
||||
|
||||
// Calculate the v pos
|
||||
int vPos = GuiArcaneAssembler.VIS_FULL_Y + ( GuiArcaneAssembler.VIS_BAR_HEIGHT - height );
|
||||
// Calculate the v pos
|
||||
int vPos = GuiArcaneAssembler.VIS_FULL_Y + (GuiArcaneAssembler.VIS_BAR_HEIGHT - height);
|
||||
|
||||
// Draw the bar
|
||||
this.drawTexturedModalRect( this.guiLeft + xuPos, this.guiTop + yPos, xuPos, vPos, GuiArcaneAssembler.VIS_BAR_WIDTH, height );
|
||||
}
|
||||
}
|
||||
// Draw the bar
|
||||
this.drawTexturedModalRect(
|
||||
this.guiLeft + xuPos, this.guiTop + yPos, xuPos, vPos, GuiArcaneAssembler.VIS_BAR_WIDTH, height);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw background
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer( final float alpha, final int mouseX, final int mouseY )
|
||||
{
|
||||
// Full white
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
/**
|
||||
* Draw background
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(final float alpha, final int mouseX, final int mouseY) {
|
||||
// Full white
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
// Bind the workbench gui texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture( GuiTextureManager.ARCANE_ASSEMBLER.getTexture() );
|
||||
// Bind the workbench gui texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(GuiTextureManager.ARCANE_ASSEMBLER.getTexture());
|
||||
|
||||
// Draw the gui texture
|
||||
if( this.hasNetworkTool )
|
||||
{
|
||||
// Draw the full gui
|
||||
this.drawTexturedModalRect( this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Draw main body
|
||||
this.drawTexturedModalRect( this.guiLeft, this.guiTop, 0, 0, GuiArcaneAssembler.MAIN_GUI_WIDTH, this.ySize );
|
||||
// Draw the gui texture
|
||||
if (this.hasNetworkTool) {
|
||||
// Draw the full gui
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
|
||||
} else {
|
||||
// Draw main body
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, GuiArcaneAssembler.MAIN_GUI_WIDTH, this.ySize);
|
||||
|
||||
// Draw upgrades
|
||||
this.drawTexturedModalRect( this.guiLeft + GuiArcaneAssembler.MAIN_GUI_WIDTH, this.guiTop, GuiArcaneAssembler.MAIN_GUI_WIDTH, 0,
|
||||
GuiArcaneAssembler.UPGRADE_GUI_WIDTH, GuiArcaneAssembler.UPGRADE_GUI_HEIGHT );
|
||||
}
|
||||
// Draw upgrades
|
||||
this.drawTexturedModalRect(
|
||||
this.guiLeft + GuiArcaneAssembler.MAIN_GUI_WIDTH,
|
||||
this.guiTop,
|
||||
GuiArcaneAssembler.MAIN_GUI_WIDTH,
|
||||
0,
|
||||
GuiArcaneAssembler.UPGRADE_GUI_WIDTH,
|
||||
GuiArcaneAssembler.UPGRADE_GUI_HEIGHT);
|
||||
}
|
||||
|
||||
// Get the aspect amounts
|
||||
AspectList storedVis = ( (ContainerArcaneAssembler)this.inventorySlots ).assembler.getStoredVis();
|
||||
// Get the aspect amounts
|
||||
AspectList storedVis = ((ContainerArcaneAssembler) this.inventorySlots).assembler.getStoredVis();
|
||||
|
||||
// Draw the bars
|
||||
for( Aspect aspect : TileArcaneAssembler.PRIMALS )
|
||||
{
|
||||
float percent = storedVis.getAmount( aspect ) / (float)TileArcaneAssembler.MAX_STORED_CVIS;
|
||||
this.drawVisBar( aspect, percent );
|
||||
}
|
||||
// Draw the bars
|
||||
for (Aspect aspect : TileArcaneAssembler.PRIMALS) {
|
||||
float percent = storedVis.getAmount(aspect) / (float) TileArcaneAssembler.MAX_STORED_CVIS;
|
||||
this.drawVisBar(aspect, percent);
|
||||
}
|
||||
|
||||
// Draw crafting percent
|
||||
this.drawVisBar( this.progressAspect, ( (ContainerArcaneAssembler)this.inventorySlots ).assembler.getPercentComplete() );
|
||||
// Draw crafting percent
|
||||
this.drawVisBar(
|
||||
this.progressAspect, ((ContainerArcaneAssembler) this.inventorySlots).assembler.getPercentComplete());
|
||||
|
||||
// Call super
|
||||
super.drawAEToolAndUpgradeSlots( alpha, mouseX, mouseY );
|
||||
}
|
||||
// Call super
|
||||
super.drawAEToolAndUpgradeSlots(alpha, mouseX, mouseY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground
|
||||
*/
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer( final int mouseX, final int mouseY )
|
||||
{
|
||||
// Draw the title
|
||||
this.fontRendererObj.drawString( this.title, GuiArcaneAssembler.TITLE_POS_X, GuiArcaneAssembler.TITLE_POS_Y, 0 );
|
||||
/**
|
||||
* Draw the foreground
|
||||
*/
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
|
||||
// Draw the title
|
||||
this.fontRendererObj.drawString(this.title, GuiArcaneAssembler.TITLE_POS_X, GuiArcaneAssembler.TITLE_POS_Y, 0);
|
||||
|
||||
// Is the mouse over any of the bars?
|
||||
for( Aspect aspect : TileArcaneAssembler.PRIMALS )
|
||||
{
|
||||
int left = this.visBarPositionMap.get( aspect );
|
||||
if( ThEGuiHelper.INSTANCE.isPointInGuiRegion( GuiArcaneAssembler.VIS_EMPTY_Y, left, GuiArcaneAssembler.VIS_BAR_HEIGHT,
|
||||
GuiArcaneAssembler.VIS_BAR_WIDTH, mouseX, mouseY, this.guiLeft, this.guiTop ) )
|
||||
{
|
||||
// Add the aspect name to the tooltip
|
||||
this.tooltip.add( ThEGuiHelper.INSTANCE.getAspectChatColor( aspect ) + StringUtils.capitalize( aspect.getTag() ) );
|
||||
// Is the mouse over any of the bars?
|
||||
for (Aspect aspect : TileArcaneAssembler.PRIMALS) {
|
||||
int left = this.visBarPositionMap.get(aspect);
|
||||
if (ThEGuiHelper.INSTANCE.isPointInGuiRegion(
|
||||
GuiArcaneAssembler.VIS_EMPTY_Y,
|
||||
left,
|
||||
GuiArcaneAssembler.VIS_BAR_HEIGHT,
|
||||
GuiArcaneAssembler.VIS_BAR_WIDTH,
|
||||
mouseX,
|
||||
mouseY,
|
||||
this.guiLeft,
|
||||
this.guiTop)) {
|
||||
// Add the aspect name to the tooltip
|
||||
this.tooltip.add(
|
||||
ThEGuiHelper.INSTANCE.getAspectChatColor(aspect) + StringUtils.capitalize(aspect.getTag()));
|
||||
|
||||
// Add the amount
|
||||
int amount = ( (ContainerArcaneAssembler)this.inventorySlots ).assembler.getStoredVis().getAmount( aspect );
|
||||
this.tooltip.add( Float.toString( amount / 10.0F ) + " / 150" );
|
||||
// Add the amount
|
||||
int amount = ((ContainerArcaneAssembler) this.inventorySlots)
|
||||
.assembler
|
||||
.getStoredVis()
|
||||
.getAmount(aspect);
|
||||
this.tooltip.add(Float.toString(amount / 10.0F) + " / 150");
|
||||
|
||||
// Add the discount
|
||||
float discount = ( (ContainerArcaneAssembler)this.inventorySlots ).assembler.getVisDiscountForAspect( aspect );
|
||||
this.tooltip.add( String.format( "%.0f%% %s", ( discount * 100.0F ), StatCollector.translateToLocal( "tc.vis.costavg" ) ) );
|
||||
|
||||
// Stop searching
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Add the discount
|
||||
float discount =
|
||||
((ContainerArcaneAssembler) this.inventorySlots).assembler.getVisDiscountForAspect(aspect);
|
||||
this.tooltip.add(String.format(
|
||||
"%.0f%% %s", (discount * 100.0F), StatCollector.translateToLocal("tc.vis.costavg")));
|
||||
|
||||
// Stop searching
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,11 +1,11 @@
|
||||
package thaumicenergistics.client.gui;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import appeng.client.gui.implementations.GuiCraftAmount;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.core.localization.GuiText;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.lang.reflect.Field;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -20,116 +20,96 @@ import thaumicenergistics.common.network.packet.server.Packet_S_ConfirmCraftingJ
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiCraftAmountBridge
|
||||
extends GuiCraftAmount
|
||||
{
|
||||
/**
|
||||
* The thing that issued the crafting request.
|
||||
*/
|
||||
protected ICraftingIssuerHost host;
|
||||
public class GuiCraftAmountBridge extends GuiCraftAmount {
|
||||
/**
|
||||
* The thing that issued the crafting request.
|
||||
*/
|
||||
protected ICraftingIssuerHost host;
|
||||
|
||||
/**
|
||||
* Button that returns to the terminal's GUI.
|
||||
*/
|
||||
protected GuiTabButton buttonReturnToTerminalHost;
|
||||
/**
|
||||
* Button that returns to the terminal's GUI.
|
||||
*/
|
||||
protected GuiTabButton buttonReturnToTerminalHost;
|
||||
|
||||
/**
|
||||
* The player that is using the GUI.
|
||||
*/
|
||||
protected EntityPlayer player;
|
||||
/**
|
||||
* The player that is using the GUI.
|
||||
*/
|
||||
protected EntityPlayer player;
|
||||
|
||||
/**
|
||||
* The next button.
|
||||
*/
|
||||
protected GuiButton buttonNext;
|
||||
/**
|
||||
* The next button.
|
||||
*/
|
||||
protected GuiButton buttonNext;
|
||||
|
||||
/**
|
||||
* The amount-to-craft text box.
|
||||
*/
|
||||
protected GuiTextField amountToCraft;
|
||||
/**
|
||||
* The amount-to-craft text box.
|
||||
*/
|
||||
protected GuiTextField amountToCraft;
|
||||
|
||||
public GuiCraftAmountBridge( final EntityPlayer player, final ICraftingIssuerHost craftingHost )
|
||||
{
|
||||
// Call super
|
||||
super( player.inventory, craftingHost );
|
||||
public GuiCraftAmountBridge(final EntityPlayer player, final ICraftingIssuerHost craftingHost) {
|
||||
// Call super
|
||||
super(player.inventory, craftingHost);
|
||||
|
||||
// Set the host
|
||||
this.host = craftingHost;
|
||||
// Set the host
|
||||
this.host = craftingHost;
|
||||
|
||||
// Set the player
|
||||
this.player = player;
|
||||
}
|
||||
// Set the player
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed( final GuiButton btn )
|
||||
{
|
||||
if( btn == this.buttonReturnToTerminalHost )
|
||||
{
|
||||
// Change back to host GUI
|
||||
this.host.launchGUI( this.player );
|
||||
}
|
||||
else if( btn == this.buttonNext )
|
||||
{
|
||||
try
|
||||
{
|
||||
// Parse the amount
|
||||
long amount = Long.parseLong( this.amountToCraft.getText() );
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
if (btn == this.buttonReturnToTerminalHost) {
|
||||
// Change back to host GUI
|
||||
this.host.launchGUI(this.player);
|
||||
} else if (btn == this.buttonNext) {
|
||||
try {
|
||||
// Parse the amount
|
||||
long amount = Long.parseLong(this.amountToCraft.getText());
|
||||
|
||||
// Ask server to show confirm gui
|
||||
Packet_S_ConfirmCraftingJob.sendConfirmAutoCraft( this.player, amount, isShiftKeyDown() );
|
||||
}
|
||||
catch( final NumberFormatException e )
|
||||
{
|
||||
// Reset amount to 1
|
||||
this.amountToCraft.setText( "1" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Call super
|
||||
super.actionPerformed( btn );
|
||||
}
|
||||
}
|
||||
// Ask server to show confirm gui
|
||||
Packet_S_ConfirmCraftingJob.sendConfirmAutoCraft(this.player, amount, isShiftKeyDown());
|
||||
} catch (final NumberFormatException e) {
|
||||
// Reset amount to 1
|
||||
this.amountToCraft.setText("1");
|
||||
}
|
||||
} else {
|
||||
// Call super
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
// Call super
|
||||
super.initGui();
|
||||
@Override
|
||||
public void initGui() {
|
||||
// Call super
|
||||
super.initGui();
|
||||
|
||||
// Get the icon of the host
|
||||
ItemStack myIcon = this.host.getIcon();
|
||||
// Get the icon of the host
|
||||
ItemStack myIcon = this.host.getIcon();
|
||||
|
||||
// Create the return button
|
||||
this.buttonReturnToTerminalHost = new GuiTabButton( this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), itemRender );
|
||||
this.buttonList.add( this.buttonReturnToTerminalHost );
|
||||
// Create the return button
|
||||
this.buttonReturnToTerminalHost =
|
||||
new GuiTabButton(this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), itemRender);
|
||||
this.buttonList.add(this.buttonReturnToTerminalHost);
|
||||
|
||||
// Get the next button
|
||||
for( Object buttonObj : this.buttonList )
|
||||
{
|
||||
if( buttonObj instanceof GuiButton )
|
||||
{
|
||||
GuiButton button = (GuiButton)buttonObj;
|
||||
if( button.displayString == GuiText.Next.getLocal() )
|
||||
{
|
||||
this.buttonNext = button;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get the amount to craft
|
||||
Field atcField;
|
||||
try
|
||||
{
|
||||
atcField = GuiCraftAmount.class.getDeclaredField( "amountToCraft" );
|
||||
atcField.setAccessible( true );
|
||||
this.amountToCraft = (GuiTextField)atcField.get( this );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
// Get the next button
|
||||
for (Object buttonObj : this.buttonList) {
|
||||
if (buttonObj instanceof GuiButton) {
|
||||
GuiButton button = (GuiButton) buttonObj;
|
||||
if (button.displayString == GuiText.Next.getLocal()) {
|
||||
this.buttonNext = button;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get the amount to craft
|
||||
Field atcField;
|
||||
try {
|
||||
atcField = GuiCraftAmount.class.getDeclaredField("amountToCraft");
|
||||
atcField.setAccessible(true);
|
||||
this.amountToCraft = (GuiTextField) atcField.get(this);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,47 +15,41 @@ import thaumicenergistics.api.grid.ICraftingIssuerHost;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiCraftConfirmBridge
|
||||
extends GuiCraftConfirm
|
||||
{
|
||||
/**
|
||||
* Player using this GUI
|
||||
*/
|
||||
protected EntityPlayer player;
|
||||
public class GuiCraftConfirmBridge extends GuiCraftConfirm {
|
||||
/**
|
||||
* Player using this GUI
|
||||
*/
|
||||
protected EntityPlayer player;
|
||||
|
||||
/**
|
||||
* The thing that issued the crafting request.
|
||||
*/
|
||||
protected ICraftingIssuerHost host;
|
||||
/**
|
||||
* The thing that issued the crafting request.
|
||||
*/
|
||||
protected ICraftingIssuerHost host;
|
||||
|
||||
public GuiCraftConfirmBridge( final EntityPlayer player, final ICraftingIssuerHost craftingHost )
|
||||
{
|
||||
// Call super
|
||||
super( player.inventory, craftingHost );
|
||||
public GuiCraftConfirmBridge(final EntityPlayer player, final ICraftingIssuerHost craftingHost) {
|
||||
// Call super
|
||||
super(player.inventory, craftingHost);
|
||||
|
||||
// Set the player
|
||||
this.player = player;
|
||||
// Set the player
|
||||
this.player = player;
|
||||
|
||||
// Set the host
|
||||
this.host = craftingHost;
|
||||
}
|
||||
// Set the host
|
||||
this.host = craftingHost;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed( final GuiButton btn )
|
||||
{
|
||||
// Sanity check
|
||||
if( btn == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
// Sanity check
|
||||
if (btn == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Call super
|
||||
super.actionPerformed( btn );
|
||||
// Call super
|
||||
super.actionPerformed(btn);
|
||||
|
||||
// Cancel button or start button?
|
||||
if( ( btn == super.getCancelButton() ) || ( btn.displayString.equals( GuiText.Start.getLocal() ) ) )
|
||||
{
|
||||
this.host.launchGUI( this.player );
|
||||
}
|
||||
}
|
||||
// Cancel button or start button?
|
||||
if ((btn == super.getCancelButton()) || (btn.displayString.equals(GuiText.Start.getLocal()))) {
|
||||
this.host.launchGUI(this.player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
package thaumicenergistics.client.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@@ -13,6 +12,7 @@ import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import thaumicenergistics.api.storage.IInventoryUpdateReceiver;
|
||||
@@ -34,291 +34,280 @@ import thaumicenergistics.common.utils.ThEUtils;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiDistillationPatternEncoder
|
||||
extends ThEBaseGui
|
||||
implements IInventoryUpdateReceiver
|
||||
{
|
||||
/**
|
||||
* Gui size.
|
||||
*/
|
||||
private static final int GUI_WIDTH = 176, GUI_HEIGHT = 234;
|
||||
public class GuiDistillationPatternEncoder extends ThEBaseGui implements IInventoryUpdateReceiver {
|
||||
/**
|
||||
* Gui size.
|
||||
*/
|
||||
private static final int GUI_WIDTH = 176, GUI_HEIGHT = 234;
|
||||
|
||||
/**
|
||||
* Position of the title string.
|
||||
*/
|
||||
private static final int TITLE_POS_X = 6, TITLE_POS_Y = 6;
|
||||
/**
|
||||
* Position of the title string.
|
||||
*/
|
||||
private static final int TITLE_POS_X = 6, TITLE_POS_Y = 6;
|
||||
|
||||
/**
|
||||
* Position of the encode button
|
||||
*/
|
||||
private static final int BUTTON_ENCODE_POS_X = 146, BUTTON_ENCODE_POS_Y = 94;
|
||||
/**
|
||||
* Position of the encode button
|
||||
*/
|
||||
private static final int BUTTON_ENCODE_POS_X = 146, BUTTON_ENCODE_POS_Y = 94;
|
||||
|
||||
/**
|
||||
* Half of the size of a standard item
|
||||
*/
|
||||
private static final int ITEM_HALF_SIZE = 8;
|
||||
/**
|
||||
* Half of the size of a standard item
|
||||
*/
|
||||
private static final int ITEM_HALF_SIZE = 8;
|
||||
|
||||
/**
|
||||
* Scale to draw the Thaumometer at.
|
||||
*/
|
||||
private static final float THAUMOMETER_SCALE = 2.8f;
|
||||
/**
|
||||
* Scale to draw the Thaumometer at.
|
||||
*/
|
||||
private static final float THAUMOMETER_SCALE = 2.8f;
|
||||
|
||||
/**
|
||||
* Title of the gui.
|
||||
*/
|
||||
private final String title;
|
||||
/**
|
||||
* Title of the gui.
|
||||
*/
|
||||
private final String title;
|
||||
|
||||
/**
|
||||
* The GUI's container.
|
||||
*/
|
||||
private final ContainerDistillationPatternEncoder deContainer;
|
||||
/**
|
||||
* The GUI's container.
|
||||
*/
|
||||
private final ContainerDistillationPatternEncoder deContainer;
|
||||
|
||||
/**
|
||||
* Thaumcraft's thaumometer
|
||||
*/
|
||||
private final ItemStack thaumometer = new ItemStack( ConfigItems.itemThaumometer );
|
||||
/**
|
||||
* Thaumcraft's thaumometer
|
||||
*/
|
||||
private final ItemStack thaumometer = new ItemStack(ConfigItems.itemThaumometer);
|
||||
|
||||
/**
|
||||
* Particles
|
||||
*/
|
||||
private final ArrayList<GuiParticleAnimator> particles = new ArrayList<GuiParticleAnimator>();
|
||||
/**
|
||||
* Particles
|
||||
*/
|
||||
private final ArrayList<GuiParticleAnimator> particles = new ArrayList<GuiParticleAnimator>();
|
||||
|
||||
/**
|
||||
* The encode button.
|
||||
*/
|
||||
private GuiButtonEncodePattern buttonEncode;
|
||||
/**
|
||||
* The encode button.
|
||||
*/
|
||||
private GuiButtonEncodePattern buttonEncode;
|
||||
|
||||
/**
|
||||
* Set true when the source item may have been changed.
|
||||
*/
|
||||
private boolean sourceItemDirty = false;
|
||||
/**
|
||||
* Set true when the source item may have been changed.
|
||||
*/
|
||||
private boolean sourceItemDirty = false;
|
||||
|
||||
public GuiDistillationPatternEncoder( final EntityPlayer player, final World world, final int x, final int y, final int z )
|
||||
{
|
||||
// Call super
|
||||
super( new ContainerDistillationPatternEncoder( player, world, x, y, z ) );
|
||||
public GuiDistillationPatternEncoder(
|
||||
final EntityPlayer player, final World world, final int x, final int y, final int z) {
|
||||
// Call super
|
||||
super(new ContainerDistillationPatternEncoder(player, world, x, y, z));
|
||||
|
||||
// Set the title
|
||||
this.title = ThEStrings.Block_DistillationEncoder.getLocalized();
|
||||
// Set the title
|
||||
this.title = ThEStrings.Block_DistillationEncoder.getLocalized();
|
||||
|
||||
// Set the GUI size
|
||||
this.xSize = GuiDistillationPatternEncoder.GUI_WIDTH;
|
||||
this.ySize = GuiDistillationPatternEncoder.GUI_HEIGHT;
|
||||
// Set the GUI size
|
||||
this.xSize = GuiDistillationPatternEncoder.GUI_WIDTH;
|
||||
this.ySize = GuiDistillationPatternEncoder.GUI_HEIGHT;
|
||||
|
||||
// Set the container
|
||||
this.deContainer = (ContainerDistillationPatternEncoder)this.inventorySlots;
|
||||
this.deContainer.slotUpdateReceiver = this;
|
||||
// Set the container
|
||||
this.deContainer = (ContainerDistillationPatternEncoder) this.inventorySlots;
|
||||
this.deContainer.slotUpdateReceiver = this;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Checks for item changes to the source item.
|
||||
*/
|
||||
private void checkSourceItem() {
|
||||
// Clear the dirty bit
|
||||
this.sourceItemDirty = false;
|
||||
|
||||
/**
|
||||
* Checks for item changes to the source item.
|
||||
*/
|
||||
private void checkSourceItem()
|
||||
{
|
||||
// Clear the dirty bit
|
||||
this.sourceItemDirty = false;
|
||||
// Clear any existing particles
|
||||
this.particles.clear();
|
||||
|
||||
// Clear any existing particles
|
||||
this.particles.clear();
|
||||
// Is there a source item to check?
|
||||
if (!this.deContainer.slotSourceItem.getHasStack()) {
|
||||
// Done
|
||||
return;
|
||||
}
|
||||
|
||||
// Is there a source item to check?
|
||||
if( !this.deContainer.slotSourceItem.getHasStack() )
|
||||
{
|
||||
// Done
|
||||
return;
|
||||
}
|
||||
// Check each slot
|
||||
boolean isItemScanned = false;
|
||||
for (Slot slot : this.deContainer.slotSourceAspects) {
|
||||
// Does the slot have a stack?
|
||||
if (slot.getHasStack()) {
|
||||
// Get the aspect for that stack
|
||||
Aspect aspect = ItemCraftingAspect.getAspect(slot.getStack());
|
||||
if (aspect != null) {
|
||||
// Found something
|
||||
isItemScanned = true;
|
||||
|
||||
// Check each slot
|
||||
boolean isItemScanned = false;
|
||||
for( Slot slot : this.deContainer.slotSourceAspects )
|
||||
{
|
||||
// Does the slot have a stack?
|
||||
if( slot.getHasStack() )
|
||||
{
|
||||
// Get the aspect for that stack
|
||||
Aspect aspect = ItemCraftingAspect.getAspect( slot.getStack() );
|
||||
if( aspect != null )
|
||||
{
|
||||
// Found something
|
||||
isItemScanned = true;
|
||||
// Create the animator
|
||||
GuiParticleAnimator gpa = new GuiParticleAnimator(
|
||||
this.deContainer.slotSourceItem.xDisplayPosition,
|
||||
this.deContainer.slotSourceItem.yDisplayPosition,
|
||||
slot.xDisplayPosition,
|
||||
slot.yDisplayPosition,
|
||||
0.3f,
|
||||
EnumGuiParticles.Orb);
|
||||
|
||||
// Create the animator
|
||||
GuiParticleAnimator gpa = new GuiParticleAnimator( this.deContainer.slotSourceItem.xDisplayPosition,
|
||||
this.deContainer.slotSourceItem.yDisplayPosition,
|
||||
slot.xDisplayPosition,
|
||||
slot.yDisplayPosition,
|
||||
0.3f,
|
||||
EnumGuiParticles.Orb );
|
||||
// Set FPS
|
||||
gpa.setFPS(30);
|
||||
|
||||
// Set FPS
|
||||
gpa.setFPS( 30 );
|
||||
// Set the color
|
||||
float[] argb = ThEGuiHelper.INSTANCE.convertPackedColorToARGBf(aspect.getColor());
|
||||
gpa.setColor(argb[1], argb[2], argb[3]);
|
||||
|
||||
// Set the color
|
||||
float[] argb = ThEGuiHelper.INSTANCE.convertPackedColorToARGBf( aspect.getColor() );
|
||||
gpa.setColor( argb[1], argb[2], argb[3] );
|
||||
// Add to the list
|
||||
this.particles.add(gpa);
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Add to the list
|
||||
this.particles.add( gpa );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isItemScanned) {
|
||||
// Play the on sound
|
||||
ThEUtils.playClientSound(null, "thaumcraft:hhon");
|
||||
} else {
|
||||
// Play the off sound
|
||||
ThEUtils.playClientSound(null, "thaumcraft:hhoff");
|
||||
}
|
||||
}
|
||||
|
||||
if( isItemScanned )
|
||||
{
|
||||
// Play the on sound
|
||||
ThEUtils.playClientSound( null, "thaumcraft:hhon" );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Play the off sound
|
||||
ThEUtils.playClientSound( null, "thaumcraft:hhoff" );
|
||||
}
|
||||
/**
|
||||
* Draw the background.
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(final float alpha, final int mouseX, final int mouseY) {
|
||||
// Full white
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
}
|
||||
// Bind the encoder gui texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(GuiTextureManager.DISTILLATION_ENCODER.getTexture());
|
||||
|
||||
/**
|
||||
* Draw the background.
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer( final float alpha, final int mouseX, final int mouseY )
|
||||
{
|
||||
// Full white
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
// Draw the gui texture
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
// Bind the encoder gui texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture( GuiTextureManager.DISTILLATION_ENCODER.getTexture() );
|
||||
// Calculate the position and rotation of the thaumometer
|
||||
float th_PosX = (float) this.guiLeft
|
||||
+ ContainerDistillationPatternEncoder.SLOT_SOURCE_ITEM_POS_X
|
||||
+ GuiDistillationPatternEncoder.ITEM_HALF_SIZE;
|
||||
float th_PosY = this.guiTop
|
||||
+ (ContainerDistillationPatternEncoder.SLOT_SOURCE_ITEM_POS_Y - 0.25f)
|
||||
+ GuiDistillationPatternEncoder.ITEM_HALF_SIZE;
|
||||
float th_Rotation = (System.currentTimeMillis() % 36000) * 0.02f;
|
||||
float th_ScaleOffset = (float) Math.sin(th_Rotation * 0.15f) * 0.1f;
|
||||
|
||||
// Draw the gui texture
|
||||
this.drawTexturedModalRect( this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize );
|
||||
// Disable depth testing and push the matrix
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glPushMatrix();
|
||||
|
||||
// Calculate the position and rotation of the thaumometer
|
||||
float th_PosX = (float)this.guiLeft + ContainerDistillationPatternEncoder.SLOT_SOURCE_ITEM_POS_X +
|
||||
GuiDistillationPatternEncoder.ITEM_HALF_SIZE;
|
||||
float th_PosY = this.guiTop + ( ContainerDistillationPatternEncoder.SLOT_SOURCE_ITEM_POS_Y - 0.25f ) +
|
||||
GuiDistillationPatternEncoder.ITEM_HALF_SIZE;
|
||||
float th_Rotation = ( System.currentTimeMillis() % 36000 ) * 0.02f;
|
||||
float th_ScaleOffset = (float)Math.sin( th_Rotation * 0.15f ) * 0.1f;
|
||||
// Translate
|
||||
GL11.glTranslatef(th_PosX, th_PosY, 0.0F);
|
||||
|
||||
// Disable depth testing and push the matrix
|
||||
GL11.glDisable( GL11.GL_DEPTH_TEST );
|
||||
GL11.glPushMatrix();
|
||||
// Scale
|
||||
GL11.glScalef(
|
||||
GuiDistillationPatternEncoder.THAUMOMETER_SCALE + th_ScaleOffset,
|
||||
GuiDistillationPatternEncoder.THAUMOMETER_SCALE + th_ScaleOffset,
|
||||
1.0f);
|
||||
|
||||
// Translate
|
||||
GL11.glTranslatef( th_PosX, th_PosY, 0.0F );
|
||||
// Rotate
|
||||
GL11.glRotatef(th_Rotation, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
// Scale
|
||||
GL11.glScalef( GuiDistillationPatternEncoder.THAUMOMETER_SCALE + th_ScaleOffset,
|
||||
GuiDistillationPatternEncoder.THAUMOMETER_SCALE + th_ScaleOffset, 1.0f );
|
||||
// Draw thaumometer
|
||||
GuiScreen.itemRender.renderItemAndEffectIntoGUI(
|
||||
this.fontRendererObj,
|
||||
this.mc.getTextureManager(),
|
||||
this.thaumometer,
|
||||
-GuiDistillationPatternEncoder.ITEM_HALF_SIZE,
|
||||
-GuiDistillationPatternEncoder.ITEM_HALF_SIZE);
|
||||
|
||||
// Rotate
|
||||
GL11.glRotatef( th_Rotation, 0.0f, 0.0f, 1.0f );
|
||||
// Restore
|
||||
GL11.glPopMatrix();
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
// Draw thaumometer
|
||||
GuiScreen.itemRender.renderItemAndEffectIntoGUI( this.fontRendererObj, this.mc.getTextureManager(),
|
||||
this.thaumometer, -GuiDistillationPatternEncoder.ITEM_HALF_SIZE, -GuiDistillationPatternEncoder.ITEM_HALF_SIZE );
|
||||
/**
|
||||
* Draw the foreground.
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
|
||||
// Draw the title
|
||||
this.fontRendererObj.drawString(
|
||||
this.title, GuiDistillationPatternEncoder.TITLE_POS_X, GuiDistillationPatternEncoder.TITLE_POS_Y, 0);
|
||||
|
||||
// Restore
|
||||
GL11.glPopMatrix();
|
||||
GL11.glEnable( GL11.GL_DEPTH_TEST );
|
||||
}
|
||||
// Check the source item
|
||||
if (this.sourceItemDirty) {
|
||||
this.checkSourceItem();
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground.
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer( final int mouseX, final int mouseY )
|
||||
{
|
||||
// Draw the title
|
||||
this.fontRendererObj.drawString( this.title, GuiDistillationPatternEncoder.TITLE_POS_X, GuiDistillationPatternEncoder.TITLE_POS_Y, 0 );
|
||||
// Any particles?
|
||||
if (this.particles.size() > 0) {
|
||||
// Prep
|
||||
EnumGuiParticles.Orb.prepareDraw();
|
||||
|
||||
// Check the source item
|
||||
if( this.sourceItemDirty )
|
||||
{
|
||||
this.checkSourceItem();
|
||||
}
|
||||
// Draw each
|
||||
for (Iterator<GuiParticleAnimator> iterator = this.particles.iterator(); iterator.hasNext(); ) {
|
||||
if (!iterator.next().draw(this, false)) {
|
||||
// Remove if done.
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
// Any particles?
|
||||
if( this.particles.size() > 0 )
|
||||
{
|
||||
// Prep
|
||||
EnumGuiParticles.Orb.prepareDraw();
|
||||
// Finish
|
||||
EnumGuiParticles.finishDraw();
|
||||
}
|
||||
}
|
||||
|
||||
// Draw each
|
||||
for( Iterator<GuiParticleAnimator> iterator = this.particles.iterator(); iterator.hasNext(); )
|
||||
{
|
||||
if( !iterator.next().draw( this, false ) )
|
||||
{
|
||||
// Remove if done.
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void mouseClicked(final int mouseX, final int mouseY, final int mouseButton) {
|
||||
// Call super
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
|
||||
// Finish
|
||||
EnumGuiParticles.finishDraw();
|
||||
}
|
||||
// Was the mouse clicked over a widget?
|
||||
for (Slot slot : this.deContainer.slotSourceAspects) {
|
||||
if (slot.getHasStack()
|
||||
&& ThEGuiHelper.INSTANCE.isPointInGuiRegion(
|
||||
slot.yDisplayPosition,
|
||||
slot.xDisplayPosition,
|
||||
18,
|
||||
18,
|
||||
mouseX,
|
||||
mouseY,
|
||||
this.guiLeft,
|
||||
this.guiTop)) {
|
||||
// Play clicky sound
|
||||
ThEUtils.playClientSound(null, "gui.button.press");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
protected void onButtonClicked(final GuiButton button, final int mouseButton) {
|
||||
// Encode button?
|
||||
if (button == this.buttonEncode) {
|
||||
// Ask server to encode
|
||||
Packet_S_DistillationEncoder.sendEncodePattern(this.deContainer.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked( final int mouseX, final int mouseY, final int mouseButton )
|
||||
{
|
||||
// Call super
|
||||
super.mouseClicked( mouseX, mouseY, mouseButton );
|
||||
@Override
|
||||
public void initGui() {
|
||||
// Call super
|
||||
super.initGui();
|
||||
|
||||
// Was the mouse clicked over a widget?
|
||||
for( Slot slot : this.deContainer.slotSourceAspects )
|
||||
{
|
||||
if( slot.getHasStack() && ThEGuiHelper.INSTANCE.isPointInGuiRegion(
|
||||
slot.yDisplayPosition, slot.xDisplayPosition,
|
||||
18, 18, mouseX, mouseY,
|
||||
this.guiLeft, this.guiTop ) )
|
||||
{
|
||||
// Play clicky sound
|
||||
ThEUtils.playClientSound( null, "gui.button.press" );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Create the encode button
|
||||
this.buttonEncode = new GuiButtonEncodePattern(
|
||||
0,
|
||||
GuiDistillationPatternEncoder.BUTTON_ENCODE_POS_X + this.guiLeft,
|
||||
GuiDistillationPatternEncoder.BUTTON_ENCODE_POS_Y + this.guiTop,
|
||||
AEStateIconsEnum.STANDARD_ICON_SIZE,
|
||||
AEStateIconsEnum.STANDARD_ICON_SIZE);
|
||||
this.buttonList.add(this.buttonEncode);
|
||||
|
||||
@Override
|
||||
protected void onButtonClicked( final GuiButton button, final int mouseButton )
|
||||
{
|
||||
// Encode button?
|
||||
if( button == this.buttonEncode )
|
||||
{
|
||||
// Ask server to encode
|
||||
Packet_S_DistillationEncoder.sendEncodePattern( this.deContainer.getPlayer() );
|
||||
}
|
||||
}
|
||||
// Reset flags
|
||||
this.sourceItemDirty = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
// Call super
|
||||
super.initGui();
|
||||
|
||||
// Create the encode button
|
||||
this.buttonEncode = new GuiButtonEncodePattern( 0, GuiDistillationPatternEncoder.BUTTON_ENCODE_POS_X + this.guiLeft,
|
||||
GuiDistillationPatternEncoder.BUTTON_ENCODE_POS_Y + this.guiTop,
|
||||
AEStateIconsEnum.STANDARD_ICON_SIZE,
|
||||
AEStateIconsEnum.STANDARD_ICON_SIZE );
|
||||
this.buttonList.add( this.buttonEncode );
|
||||
|
||||
// Reset flags
|
||||
this.sourceItemDirty = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the container when the source item has changed.
|
||||
*/
|
||||
@Override
|
||||
public void onInventoryChanged( final IInventory sourceInventory )
|
||||
{
|
||||
this.sourceItemDirty = true;
|
||||
}
|
||||
/**
|
||||
* Called by the container when the source item has changed.
|
||||
*/
|
||||
@Override
|
||||
public void onInventoryChanged(final IInventory sourceInventory) {
|
||||
this.sourceItemDirty = true;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,15 +1,13 @@
|
||||
package thaumicenergistics.client.gui;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumicenergistics.api.gui.IAspectSlotGui;
|
||||
import thaumicenergistics.client.gui.abstraction.ThEBaseGui;
|
||||
@@ -31,289 +29,270 @@ import thaumicenergistics.common.tiles.TileEssentiaCellWorkbench;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiEssentiaCellWorkbench
|
||||
extends ThEBaseGui
|
||||
implements IAspectSlotGui
|
||||
{
|
||||
private class SimpleAspectWidget
|
||||
extends WidgetAspectSlot
|
||||
{
|
||||
public class GuiEssentiaCellWorkbench extends ThEBaseGui implements IAspectSlotGui {
|
||||
private class SimpleAspectWidget extends WidgetAspectSlot {
|
||||
|
||||
public SimpleAspectWidget( final int ID, final int posX, final int posY, final EntityPlayer player )
|
||||
{
|
||||
super( GuiEssentiaCellWorkbench.this, player, null, ID, posX, posY );
|
||||
}
|
||||
public SimpleAspectWidget(final int ID, final int posX, final int posY, final EntityPlayer player) {
|
||||
super(GuiEssentiaCellWorkbench.this, player, null, ID, posX, posY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked( final Aspect withAspect )
|
||||
{
|
||||
// Ignored
|
||||
}
|
||||
@Override
|
||||
public void mouseClicked(final Aspect withAspect) {
|
||||
// Ignored
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Gui size.
|
||||
*/
|
||||
private static final int GUI_WIDTH = 176, GUI_HEIGHT = 251;
|
||||
|
||||
/**
|
||||
* Gui size.
|
||||
*/
|
||||
private static final int GUI_WIDTH = 176, GUI_HEIGHT = 251;
|
||||
/**
|
||||
* Title position.
|
||||
*/
|
||||
private static final int TITLE_POS_X = 6, TITLE_POS_Y = 6;
|
||||
|
||||
/**
|
||||
* Title position.
|
||||
*/
|
||||
private static final int TITLE_POS_X = 6, TITLE_POS_Y = 6;
|
||||
/**
|
||||
* Widget starting position.
|
||||
*/
|
||||
private static final int WIDGET_POS_X = 7, WIDGET_POS_Y = 28;
|
||||
|
||||
/**
|
||||
* Widget starting position.
|
||||
*/
|
||||
private static final int WIDGET_POS_X = 7, WIDGET_POS_Y = 28;
|
||||
/**
|
||||
* Number of widgets per row.
|
||||
*/
|
||||
private static final int WIDGETS_PER_ROW = 9;
|
||||
|
||||
/**
|
||||
* Number of widgets per row.
|
||||
*/
|
||||
private static final int WIDGETS_PER_ROW = 9;
|
||||
/**
|
||||
* Number of widget rows.
|
||||
*/
|
||||
private static final int WIDGET_ROWS = 7;
|
||||
|
||||
/**
|
||||
* Number of widget rows.
|
||||
*/
|
||||
private static final int WIDGET_ROWS = 7;
|
||||
/**
|
||||
* How many partition widgets to make.
|
||||
*/
|
||||
private static final int NUMBER_OF_WIDGETS = 63;
|
||||
|
||||
/**
|
||||
* How many partition widgets to make.
|
||||
*/
|
||||
private static final int NUMBER_OF_WIDGETS = 63;
|
||||
/**
|
||||
* Cache the cell background icon.
|
||||
*/
|
||||
private static final AEStateIconsEnum CELL_BG_ICON = AEStateIconsEnum.ME_CELL_BACKGROUND;
|
||||
|
||||
/**
|
||||
* Cache the cell background icon.
|
||||
*/
|
||||
private static final AEStateIconsEnum CELL_BG_ICON = AEStateIconsEnum.ME_CELL_BACKGROUND;
|
||||
/**
|
||||
* Partition to current, button info.
|
||||
*/
|
||||
private static final int BUTTON_PARTITION_CURRENT_ID = 0,
|
||||
BUTTON_PARTITION_CURRENT_X = -18,
|
||||
BUTTON_PARTITION_CURRENT_Y = 28;
|
||||
|
||||
/**
|
||||
* Partition to current, button info.
|
||||
*/
|
||||
private static final int BUTTON_PARTITION_CURRENT_ID = 0, BUTTON_PARTITION_CURRENT_X = -18, BUTTON_PARTITION_CURRENT_Y = 28;
|
||||
/**
|
||||
* Clear partitioning, button info.
|
||||
*/
|
||||
private static final int BUTTON_CLEAR_ID = 1, BUTTON_CLEAR_X = -18, BUTTON_CLEAR_Y = 8;
|
||||
/**
|
||||
* The player viewing the gui.
|
||||
*/
|
||||
private final EntityPlayer player;
|
||||
|
||||
/**
|
||||
* Clear partitioning, button info.
|
||||
*/
|
||||
private static final int BUTTON_CLEAR_ID = 1, BUTTON_CLEAR_X = -18, BUTTON_CLEAR_Y = 8;
|
||||
/**
|
||||
* The player viewing the gui.
|
||||
*/
|
||||
private final EntityPlayer player;
|
||||
/**
|
||||
* Title of the window
|
||||
*/
|
||||
private final String title;
|
||||
|
||||
/**
|
||||
* Title of the window
|
||||
*/
|
||||
private final String title;
|
||||
/**
|
||||
* Array of aspect widgets used to show partition aspects.
|
||||
*/
|
||||
private final SimpleAspectWidget[] partitionWidgets;
|
||||
|
||||
/**
|
||||
* Array of aspect widgets used to show partition aspects.
|
||||
*/
|
||||
private final SimpleAspectWidget[] partitionWidgets;
|
||||
/**
|
||||
* Cell Workbench.
|
||||
*/
|
||||
public final TileEssentiaCellWorkbench workbench;
|
||||
|
||||
/**
|
||||
* Cell Workbench.
|
||||
*/
|
||||
public final TileEssentiaCellWorkbench workbench;
|
||||
public GuiEssentiaCellWorkbench(
|
||||
final EntityPlayer player, final World world, final int x, final int y, final int z) {
|
||||
// Call super
|
||||
super(new ContainerEssentiaCellWorkbench(player, world, x, y, z));
|
||||
|
||||
public GuiEssentiaCellWorkbench( final EntityPlayer player, final World world, final int x, final int y, final int z )
|
||||
{
|
||||
// Call super
|
||||
super( new ContainerEssentiaCellWorkbench( player, world, x, y, z ) );
|
||||
// Set the player
|
||||
this.player = player;
|
||||
|
||||
// Set the player
|
||||
this.player = player;
|
||||
// Set the width and height
|
||||
this.xSize = GuiEssentiaCellWorkbench.GUI_WIDTH;
|
||||
this.ySize = GuiEssentiaCellWorkbench.GUI_HEIGHT;
|
||||
|
||||
// Set the width and height
|
||||
this.xSize = GuiEssentiaCellWorkbench.GUI_WIDTH;
|
||||
this.ySize = GuiEssentiaCellWorkbench.GUI_HEIGHT;
|
||||
// Set the title
|
||||
this.title = ThEStrings.Gui_TitleEssentiaCellWorkbench.getLocalized();
|
||||
|
||||
// Set the title
|
||||
this.title = ThEStrings.Gui_TitleEssentiaCellWorkbench.getLocalized();
|
||||
// Create the widget array
|
||||
this.partitionWidgets = new SimpleAspectWidget[GuiEssentiaCellWorkbench.NUMBER_OF_WIDGETS];
|
||||
|
||||
// Create the widget array
|
||||
this.partitionWidgets = new SimpleAspectWidget[GuiEssentiaCellWorkbench.NUMBER_OF_WIDGETS];
|
||||
// Get the workbench
|
||||
this.workbench = ((ContainerEssentiaCellWorkbench) this.inventorySlots).workbench;
|
||||
}
|
||||
|
||||
// Get the workbench
|
||||
this.workbench = ( (ContainerEssentiaCellWorkbench)this.inventorySlots ).workbench;
|
||||
}
|
||||
/**
|
||||
* Draw background
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(final float alpha, final int mouseX, final int mouseY) {
|
||||
// Full white
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
/**
|
||||
* Draw background
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer( final float alpha, final int mouseX, final int mouseY )
|
||||
{
|
||||
// Full white
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
// Bind the workbench gui texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(GuiTextureManager.CELL_WORKBENCH.getTexture());
|
||||
|
||||
// Bind the workbench gui texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture( GuiTextureManager.CELL_WORKBENCH.getTexture() );
|
||||
// Draw the gui texture
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
// Draw the gui texture
|
||||
this.drawTexturedModalRect( this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize );
|
||||
// Bind the AE states texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(AEStateIconsEnum.AE_STATES_TEXTURE);
|
||||
|
||||
// Bind the AE states texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture( AEStateIconsEnum.AE_STATES_TEXTURE );
|
||||
// Draw the cell slot background
|
||||
this.drawTexturedModalRect(
|
||||
this.guiLeft + ContainerEssentiaCellWorkbench.CELL_SLOT_X,
|
||||
this.guiTop + ContainerEssentiaCellWorkbench.CELL_SLOT_Y,
|
||||
GuiEssentiaCellWorkbench.CELL_BG_ICON.getU(),
|
||||
GuiEssentiaCellWorkbench.CELL_BG_ICON.getV(),
|
||||
GuiEssentiaCellWorkbench.CELL_BG_ICON.getWidth(),
|
||||
GuiEssentiaCellWorkbench.CELL_BG_ICON.getHeight());
|
||||
}
|
||||
|
||||
// Draw the cell slot background
|
||||
this.drawTexturedModalRect( this.guiLeft + ContainerEssentiaCellWorkbench.CELL_SLOT_X, this.guiTop +
|
||||
ContainerEssentiaCellWorkbench.CELL_SLOT_Y,
|
||||
GuiEssentiaCellWorkbench.CELL_BG_ICON.getU(),
|
||||
GuiEssentiaCellWorkbench.CELL_BG_ICON.getV(), GuiEssentiaCellWorkbench.CELL_BG_ICON.getWidth(),
|
||||
GuiEssentiaCellWorkbench.CELL_BG_ICON.getHeight() );
|
||||
/**
|
||||
* Draw the foreground
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
|
||||
// Draw the title
|
||||
this.fontRendererObj.drawString(
|
||||
this.title, GuiEssentiaCellWorkbench.TITLE_POS_X, GuiEssentiaCellWorkbench.TITLE_POS_Y, 0);
|
||||
|
||||
}
|
||||
// Draw the widgets
|
||||
SimpleAspectWidget widgetUnderMouse = null, currentWidget;
|
||||
for (int index = 0; index < GuiEssentiaCellWorkbench.NUMBER_OF_WIDGETS; index++) {
|
||||
// Get the widget
|
||||
currentWidget = this.partitionWidgets[index];
|
||||
|
||||
/**
|
||||
* Draw the foreground
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer( final int mouseX, final int mouseY )
|
||||
{
|
||||
// Draw the title
|
||||
this.fontRendererObj.drawString( this.title, GuiEssentiaCellWorkbench.TITLE_POS_X, GuiEssentiaCellWorkbench.TITLE_POS_Y, 0 );
|
||||
// Draw the widget
|
||||
currentWidget.drawWidget();
|
||||
|
||||
// Draw the widgets
|
||||
SimpleAspectWidget widgetUnderMouse = null, currentWidget;
|
||||
for( int index = 0; index < GuiEssentiaCellWorkbench.NUMBER_OF_WIDGETS; index++ )
|
||||
{
|
||||
// Get the widget
|
||||
currentWidget = this.partitionWidgets[index];
|
||||
// Is the mouse over it?
|
||||
if ((widgetUnderMouse == null) && (currentWidget.isMouseOverWidget(mouseX, mouseY))) {
|
||||
// Mark this widget as the one under the mouse
|
||||
widgetUnderMouse = currentWidget;
|
||||
}
|
||||
}
|
||||
|
||||
// Draw the widget
|
||||
currentWidget.drawWidget();
|
||||
// Is there a widget under the mouse?
|
||||
if (widgetUnderMouse != null) {
|
||||
// Get the widgets tooltip
|
||||
widgetUnderMouse.getTooltip(this.tooltip);
|
||||
}
|
||||
}
|
||||
|
||||
// Is the mouse over it?
|
||||
if( ( widgetUnderMouse == null ) && ( currentWidget.isMouseOverWidget( mouseX, mouseY ) ) )
|
||||
{
|
||||
// Mark this widget as the one under the mouse
|
||||
widgetUnderMouse = currentWidget;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void mouseClicked(final int mouseX, final int mouseY, final int mouseButton) {
|
||||
// Call super
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
|
||||
// Is there a widget under the mouse?
|
||||
if( widgetUnderMouse != null )
|
||||
{
|
||||
// Get the widgets tooltip
|
||||
widgetUnderMouse.getTooltip( this.tooltip );
|
||||
}
|
||||
}
|
||||
for (SimpleAspectWidget partitionWidget : this.partitionWidgets) {
|
||||
if (partitionWidget.isMouseOverWidget(mouseX, mouseY)) {
|
||||
// Get the aspect of the currently held item
|
||||
Aspect itemAspect = EssentiaItemContainerHelper.INSTANCE.getFilterAspectFromItem(
|
||||
this.draggedStack == null ? this.player.inventory.getItemStack() : this.draggedStack.copy());
|
||||
|
||||
@Override
|
||||
protected void mouseClicked( final int mouseX, final int mouseY, final int mouseButton )
|
||||
{
|
||||
// Call super
|
||||
super.mouseClicked( mouseX, mouseY, mouseButton );
|
||||
// Get the aspect of the widget
|
||||
Aspect widgetAspect = partitionWidget.getAspect();
|
||||
|
||||
for( SimpleAspectWidget partitionWidget : this.partitionWidgets )
|
||||
{
|
||||
if( partitionWidget.isMouseOverWidget( mouseX, mouseY ) )
|
||||
{
|
||||
// Get the aspect of the currently held item
|
||||
Aspect itemAspect = EssentiaItemContainerHelper.INSTANCE.getFilterAspectFromItem(this.draggedStack == null ? this.player.inventory.getItemStack() : this.draggedStack.copy());
|
||||
// Add?
|
||||
if ((widgetAspect == null) && (itemAspect != null)) {
|
||||
Packet_S_EssentiaCellWorkbench.sendAddAspect(this.player, this.workbench, itemAspect);
|
||||
}
|
||||
// Remove?
|
||||
else if ((widgetAspect != null) && (itemAspect == null)) {
|
||||
Packet_S_EssentiaCellWorkbench.sendRemoveAspect(this.player, this.workbench, widgetAspect);
|
||||
|
||||
// Get the aspect of the widget
|
||||
Aspect widgetAspect = partitionWidget.getAspect();
|
||||
}
|
||||
// Replace?
|
||||
else if ((widgetAspect != null) && (itemAspect != null)) {
|
||||
Packet_S_EssentiaCellWorkbench.sendReplaceAspect(
|
||||
this.player, this.workbench, widgetAspect, itemAspect);
|
||||
}
|
||||
|
||||
// Add?
|
||||
if( ( widgetAspect == null ) && ( itemAspect != null ) )
|
||||
{
|
||||
Packet_S_EssentiaCellWorkbench.sendAddAspect( this.player, this.workbench, itemAspect );
|
||||
}
|
||||
// Remove?
|
||||
else if( ( widgetAspect != null ) && ( itemAspect == null ) )
|
||||
{
|
||||
Packet_S_EssentiaCellWorkbench.sendRemoveAspect( this.player, this.workbench, widgetAspect );
|
||||
// Stop searching
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.draggedStack = null;
|
||||
}
|
||||
|
||||
}
|
||||
// Replace?
|
||||
else if( ( widgetAspect != null ) && ( itemAspect != null ) )
|
||||
{
|
||||
Packet_S_EssentiaCellWorkbench.sendReplaceAspect( this.player, this.workbench, widgetAspect, itemAspect );
|
||||
@Override
|
||||
protected void onButtonClicked(final GuiButton button, final int mouseButton) {
|
||||
// Which button was clicked?
|
||||
switch (button.id) {
|
||||
case GuiEssentiaCellWorkbench.BUTTON_CLEAR_ID:
|
||||
Packet_S_EssentiaCellWorkbench.sendClearPartitioning(this.player, this.workbench);
|
||||
break;
|
||||
|
||||
}
|
||||
case GuiEssentiaCellWorkbench.BUTTON_PARTITION_CURRENT_ID:
|
||||
Packet_S_EssentiaCellWorkbench.sendPartitionToContents(this.player, this.workbench);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Stop searching
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.draggedStack = null;
|
||||
}
|
||||
@Override
|
||||
public void initGui() {
|
||||
// Call super
|
||||
super.initGui();
|
||||
|
||||
@Override
|
||||
protected void onButtonClicked( final GuiButton button, final int mouseButton )
|
||||
{
|
||||
// Which button was clicked?
|
||||
switch ( button.id )
|
||||
{
|
||||
case GuiEssentiaCellWorkbench.BUTTON_CLEAR_ID:
|
||||
Packet_S_EssentiaCellWorkbench.sendClearPartitioning( this.player, this.workbench );
|
||||
break;
|
||||
// Create the widgets
|
||||
for (int y = 0; y < GuiEssentiaCellWorkbench.WIDGET_ROWS; y++) {
|
||||
// Calculate the Y position of this row
|
||||
int rowYPosition = GuiEssentiaCellWorkbench.WIDGET_POS_Y + (y * 18);
|
||||
|
||||
case GuiEssentiaCellWorkbench.BUTTON_PARTITION_CURRENT_ID:
|
||||
Packet_S_EssentiaCellWorkbench.sendPartitionToContents( this.player, this.workbench );
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int x = 0; x < GuiEssentiaCellWorkbench.WIDGETS_PER_ROW; x++) {
|
||||
// Calculate the X position of the widget
|
||||
int wPosX = GuiEssentiaCellWorkbench.WIDGET_POS_X + (x * 18);
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
// Call super
|
||||
super.initGui();
|
||||
// Calculate the index of the widget
|
||||
int wIndex = (x + (y * GuiEssentiaCellWorkbench.WIDGETS_PER_ROW));
|
||||
|
||||
// Create the widgets
|
||||
for( int y = 0; y < GuiEssentiaCellWorkbench.WIDGET_ROWS; y++ )
|
||||
{
|
||||
// Calculate the Y position of this row
|
||||
int rowYPosition = GuiEssentiaCellWorkbench.WIDGET_POS_Y + ( y * 18 );
|
||||
// Create the widget
|
||||
this.partitionWidgets[wIndex] = new SimpleAspectWidget(wIndex, wPosX, rowYPosition, this.player);
|
||||
}
|
||||
}
|
||||
|
||||
for( int x = 0; x < GuiEssentiaCellWorkbench.WIDGETS_PER_ROW; x++ )
|
||||
{
|
||||
// Calculate the X position of the widget
|
||||
int wPosX = GuiEssentiaCellWorkbench.WIDGET_POS_X + ( x * 18 );
|
||||
// Create the un-partition button
|
||||
this.buttonList.add(new GuiButtonSetCellPartitioningToCurrent(
|
||||
GuiEssentiaCellWorkbench.BUTTON_PARTITION_CURRENT_ID,
|
||||
this.guiLeft + GuiEssentiaCellWorkbench.BUTTON_PARTITION_CURRENT_X,
|
||||
this.guiTop + GuiEssentiaCellWorkbench.BUTTON_PARTITION_CURRENT_Y));
|
||||
|
||||
// Calculate the index of the widget
|
||||
int wIndex = ( x + ( y * GuiEssentiaCellWorkbench.WIDGETS_PER_ROW ) );
|
||||
// Create the partition to current button
|
||||
this.buttonList.add(new GuiButtonClearCellPartitioning(
|
||||
GuiEssentiaCellWorkbench.BUTTON_CLEAR_ID,
|
||||
this.guiLeft + GuiEssentiaCellWorkbench.BUTTON_CLEAR_X,
|
||||
this.guiTop + GuiEssentiaCellWorkbench.BUTTON_CLEAR_Y));
|
||||
|
||||
// Create the widget
|
||||
this.partitionWidgets[wIndex] = new SimpleAspectWidget( wIndex, wPosX, rowYPosition, this.player );
|
||||
}
|
||||
}
|
||||
// Request the list
|
||||
Packet_S_EssentiaCellWorkbench.sendGetPartitionList(this.player, this.workbench);
|
||||
}
|
||||
|
||||
// Create the un-partition button
|
||||
this.buttonList.add( new GuiButtonSetCellPartitioningToCurrent( GuiEssentiaCellWorkbench.BUTTON_PARTITION_CURRENT_ID, this.guiLeft +
|
||||
GuiEssentiaCellWorkbench.BUTTON_PARTITION_CURRENT_X, this.guiTop + GuiEssentiaCellWorkbench.BUTTON_PARTITION_CURRENT_Y ) );
|
||||
/**
|
||||
* Updates the partition widgets to show the aspects in the specified list.
|
||||
*/
|
||||
@Override
|
||||
public void updateAspects(final List<Aspect> aspectList) {
|
||||
// Get the number of aspects in the list
|
||||
int count = aspectList.size();
|
||||
|
||||
// Create the partition to current button
|
||||
this.buttonList.add( new GuiButtonClearCellPartitioning( GuiEssentiaCellWorkbench.BUTTON_CLEAR_ID, this.guiLeft +
|
||||
GuiEssentiaCellWorkbench.BUTTON_CLEAR_X, this.guiTop + GuiEssentiaCellWorkbench.BUTTON_CLEAR_Y ) );
|
||||
|
||||
// Request the list
|
||||
Packet_S_EssentiaCellWorkbench.sendGetPartitionList( this.player, this.workbench );
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the partition widgets to show the aspects in the specified list.
|
||||
*/
|
||||
@Override
|
||||
public void updateAspects( final List<Aspect> aspectList )
|
||||
{
|
||||
// Get the number of aspects in the list
|
||||
int count = aspectList.size();
|
||||
|
||||
// Set the aspects
|
||||
for( int index = 0; index < count; index++ )
|
||||
{
|
||||
this.partitionWidgets[index].setAspect( aspectList.get( index ), 1, false );
|
||||
}
|
||||
|
||||
// Clear the rest
|
||||
for( int index = count; index < GuiEssentiaCellWorkbench.NUMBER_OF_WIDGETS; index++ )
|
||||
{
|
||||
this.partitionWidgets[index].setAspect( null );
|
||||
}
|
||||
}
|
||||
// Set the aspects
|
||||
for (int index = 0; index < count; index++) {
|
||||
this.partitionWidgets[index].setAspect(aspectList.get(index), 1, false);
|
||||
}
|
||||
|
||||
// Clear the rest
|
||||
for (int index = count; index < GuiEssentiaCellWorkbench.NUMBER_OF_WIDGETS; index++) {
|
||||
this.partitionWidgets[index].setAspect(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,14 @@
|
||||
package thaumicenergistics.client.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import appeng.api.config.RedstoneMode;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumicenergistics.api.gui.IAspectSlotGui;
|
||||
import thaumicenergistics.client.gui.abstraction.ThEBaseGui;
|
||||
@@ -35,477 +33,455 @@ import thaumicenergistics.common.parts.ThEPartEssentiaIOBus_Base;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiEssentiaIO
|
||||
extends ThEBaseGui
|
||||
implements WidgetAspectSlot.IConfigurable, IAspectSlotGui
|
||||
{
|
||||
|
||||
/**
|
||||
* Number of rows and columns in the filter grid.
|
||||
*/
|
||||
private static final int FILTER_GRID_SIZE = 3;
|
||||
|
||||
/**
|
||||
* Controls if the widget is drawn.
|
||||
* if filterSize >= this, the widget can be drawn.
|
||||
*/
|
||||
private static final byte[] WIDGET_CONFIG_BYTES = new byte[] { 2, 1, 2, 1, 0, 1, 2, 1, 2 };
|
||||
|
||||
/**
|
||||
* Starting X position for widgets.
|
||||
*/
|
||||
private static final int WIDGET_X_POSITION = 61;
|
||||
|
||||
/**
|
||||
* Starting Y position for widgets.
|
||||
*/
|
||||
private static final int WIDGET_Y_POSITION = 21;
|
||||
|
||||
/**
|
||||
* Height of the gui
|
||||
*/
|
||||
private static final int GUI_HEIGHT = 184;
|
||||
|
||||
/**
|
||||
* Width of the gui when the player does not have a network tool.
|
||||
*/
|
||||
private static final int GUI_WIDTH_NO_TOOL = 211;
|
||||
|
||||
/**
|
||||
* Width of the gui when the player has a network tool.
|
||||
*/
|
||||
private static final int GUI_WIDTH_WITH_TOOL = 246;
|
||||
|
||||
/**
|
||||
* Width of the main body of the gui.
|
||||
* Ignores upgrade and network tool areas.
|
||||
*/
|
||||
private static final int GUI_MAIN_WIDTH = 176;
|
||||
|
||||
/**
|
||||
* Width of the upgrade area of the gui.
|
||||
*/
|
||||
private static final int GUI_UPGRADES_WIDTH = 35;
|
||||
|
||||
/**
|
||||
* Height of the upgrade area of the gui.
|
||||
*/
|
||||
private static final int GUI_UPGRADES_HEIGHT = 86;
|
||||
|
||||
/**
|
||||
* Position of the title string.
|
||||
*/
|
||||
private static final int TITLE_POS_X = 6, TITLE_POS_Y = 5;
|
||||
|
||||
/**
|
||||
* Redstone Control button placement
|
||||
*/
|
||||
private static final int REDSTONE_CONTROL_BUTTON_POS_Y = 2, REDSTONE_CONTROL_BUTTON_POS_X = -18, REDSTONE_CONTROL_BUTTON_SIZE = 16,
|
||||
REDSTONE_CONTROL_BUTTON_ID = 0;
|
||||
|
||||
/**
|
||||
* Void button placement
|
||||
*/
|
||||
private static final int ALLOW_VOID_BUTTON_POS_Y = 2, ALLOW_VOID_BUTTON_POS_X = -19, ALLOW_VOID_BUTTON_ID = 1;
|
||||
|
||||
private static final int CRAFTING_MODE_BUTTON_POS_Y = 40, CRAFTING_MODE_BUTTON_POS_X = -18, CRAFTING_MODE_BUTTON_ID = 2;
|
||||
|
||||
/**
|
||||
* The part associated with this gui.
|
||||
*/
|
||||
private ThEPartEssentiaIOBus_Base part;
|
||||
|
||||
/**
|
||||
* The player viewing this bus gui.
|
||||
*/
|
||||
private EntityPlayer player;
|
||||
|
||||
/**
|
||||
* The size of the buses filter (0-2).
|
||||
*/
|
||||
private byte filterSize;
|
||||
|
||||
/**
|
||||
* Filter widgets.
|
||||
*/
|
||||
private List<WidgetAspectSlot> aspectSlotList = new ArrayList<WidgetAspectSlot>();
|
||||
|
||||
/**
|
||||
* Filter aspects.
|
||||
*/
|
||||
private List<Aspect> filteredAspects = new ArrayList<Aspect>();
|
||||
|
||||
/**
|
||||
* True if the player has a network tool in their inventory.
|
||||
*/
|
||||
private boolean hasNetworkTool;
|
||||
|
||||
/**
|
||||
* Tracks the redstone mode of the bus.
|
||||
*/
|
||||
private RedstoneMode redstoneMode = RedstoneMode.HIGH_SIGNAL;
|
||||
|
||||
/**
|
||||
* Title of the gui
|
||||
*/
|
||||
private final String guiTitle;
|
||||
|
||||
/**
|
||||
* Shown when the bus is redstone controlled
|
||||
*/
|
||||
private GuiButtonRedstoneModes redstoneControlButton = null;
|
||||
|
||||
/**
|
||||
* Button controlling if voiding is allowed.
|
||||
*/
|
||||
private GuiButtonAllowVoid voidModeButton = null;
|
||||
|
||||
/**
|
||||
* Shown when the bus has crafting card
|
||||
*/
|
||||
private GuiButtonCraftingMode craftingModeButton = null;
|
||||
|
||||
/**
|
||||
* Creates the gui
|
||||
*
|
||||
* @param partBus
|
||||
* @param player
|
||||
*/
|
||||
public GuiEssentiaIO( final ThEPartEssentiaIOBus_Base partBus, final EntityPlayer player )
|
||||
{
|
||||
// Call super
|
||||
super( new ContainerPartEssentiaIOBus( partBus, player ) );
|
||||
|
||||
// Set the bus
|
||||
this.part = partBus;
|
||||
|
||||
// Set the player
|
||||
this.player = player;
|
||||
|
||||
// Check if the player has a network tool
|
||||
this.hasNetworkTool = ( (ContainerPartEssentiaIOBus)this.inventorySlots ).hasNetworkTool();
|
||||
|
||||
// Set the width
|
||||
this.xSize = ( this.hasNetworkTool ? GuiEssentiaIO.GUI_WIDTH_WITH_TOOL : GuiEssentiaIO.GUI_WIDTH_NO_TOOL );
|
||||
|
||||
// Set the height
|
||||
this.ySize = GuiEssentiaIO.GUI_HEIGHT;
|
||||
|
||||
// Set the title
|
||||
if( partBus instanceof PartEssentiaImportBus )
|
||||
{
|
||||
// Import
|
||||
this.guiTitle = AEPartsEnum.EssentiaImportBus.getLocalizedName();
|
||||
}
|
||||
else if( partBus instanceof PartEssentiaExportBus )
|
||||
{
|
||||
// Export
|
||||
this.guiTitle = AEPartsEnum.EssentiaExportBus.getLocalizedName();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.guiTitle = "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the GUI background layer
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer( final float alpha, final int mouseX, final int mouseY )
|
||||
{
|
||||
// Full white
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
|
||||
// Get the GUI texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture( GuiTextureManager.ESSENTIA_IO_BUS.getTexture() );
|
||||
|
||||
// Does the user have a network tool?
|
||||
if( this.hasNetworkTool )
|
||||
{
|
||||
// Draw the full gui
|
||||
this.drawTexturedModalRect( this.guiLeft, this.guiTop, 0, 0, GuiEssentiaIO.GUI_WIDTH_WITH_TOOL, GuiEssentiaIO.GUI_HEIGHT );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Draw main gui
|
||||
this.drawTexturedModalRect( this.guiLeft, this.guiTop, 0, 0, GuiEssentiaIO.GUI_MAIN_WIDTH, GuiEssentiaIO.GUI_HEIGHT );
|
||||
|
||||
// Draw upgrade slots
|
||||
this.drawTexturedModalRect( this.guiLeft + GuiEssentiaIO.GUI_MAIN_WIDTH, this.guiTop, GuiEssentiaIO.GUI_MAIN_WIDTH, 0,
|
||||
GuiEssentiaIO.GUI_UPGRADES_WIDTH, GuiEssentiaIO.GUI_UPGRADES_HEIGHT );
|
||||
}
|
||||
|
||||
// Call super
|
||||
super.drawAEToolAndUpgradeSlots( alpha, mouseX, mouseY );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer( final int mouseX, final int mouseY )
|
||||
{
|
||||
// Call super
|
||||
super.drawGuiContainerForegroundLayer( mouseX, mouseY );
|
||||
|
||||
// Draw the title
|
||||
this.fontRendererObj.drawString( this.guiTitle, GuiEssentiaIO.TITLE_POS_X, GuiEssentiaIO.TITLE_POS_Y, 0x000000 );
|
||||
|
||||
boolean hoverUnderlayRendered = false;
|
||||
|
||||
WidgetAspectSlot slotUnderMouse = null;
|
||||
|
||||
for( int i = 0; i < 9; i++ )
|
||||
{
|
||||
WidgetAspectSlot slotWidget = this.aspectSlotList.get( i );
|
||||
|
||||
if( ( !hoverUnderlayRendered ) && ( slotWidget.canRender() ) && ( slotWidget.isMouseOverWidget( mouseX, mouseY ) ) )
|
||||
{
|
||||
slotWidget.drawMouseHoverUnderlay();
|
||||
|
||||
slotUnderMouse = slotWidget;
|
||||
|
||||
hoverUnderlayRendered = true;
|
||||
}
|
||||
|
||||
slotWidget.drawWidget();
|
||||
}
|
||||
|
||||
// Should we get the tooltip from the slot?
|
||||
if( slotUnderMouse != null )
|
||||
{
|
||||
// Add the tooltip from the widget
|
||||
slotUnderMouse.getTooltip( this.tooltip );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the mouse is clicked.
|
||||
*/
|
||||
@Override
|
||||
protected void mouseClicked( final int mouseX, final int mouseY, final int mouseButton )
|
||||
{
|
||||
// Call super
|
||||
super.mouseClicked( mouseX, mouseY, mouseButton );
|
||||
|
||||
// Loop over all widgets
|
||||
for( WidgetAspectSlot aspectSlot : this.aspectSlotList )
|
||||
{
|
||||
// Is the mouse over this widget?
|
||||
if( aspectSlot.isMouseOverWidget( mouseX, mouseY ) )
|
||||
{
|
||||
// Get the aspect of the currently held item
|
||||
Aspect itemAspect = EssentiaItemContainerHelper.INSTANCE.getFilterAspectFromItem(this.draggedStack == null ? this.player.inventory.getItemStack() : this.draggedStack.copy());
|
||||
|
||||
// Is there an aspect?
|
||||
if( itemAspect != null )
|
||||
{
|
||||
// Are we already filtering for this aspect?
|
||||
if( this.filteredAspects.contains( itemAspect ) )
|
||||
{
|
||||
// Ignore
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Inform the slot it was clicked
|
||||
aspectSlot.mouseClicked( itemAspect );
|
||||
|
||||
// Stop searching
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.draggedStack = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button is pressed
|
||||
*/
|
||||
@Override
|
||||
protected void onButtonClicked( final GuiButton button, final int mouseButton )
|
||||
{
|
||||
// Was the clicked button the redstone mode button?
|
||||
if( button.id == GuiEssentiaIO.REDSTONE_CONTROL_BUTTON_ID )
|
||||
{
|
||||
Packet_S_EssentiaIOBus.sendRedstoneModeChange( this.player, this.part );
|
||||
}
|
||||
// Void button?
|
||||
else if( button.id == GuiEssentiaIO.ALLOW_VOID_BUTTON_ID )
|
||||
{
|
||||
if( this.part instanceof PartEssentiaExportBus )
|
||||
{
|
||||
Packet_S_EssentiaIOBus.sendVoidModeChange( this.player, (PartEssentiaExportBus)this.part );
|
||||
}
|
||||
}
|
||||
else if( button.id == GuiEssentiaIO.CRAFTING_MODE_BUTTON_ID )
|
||||
{
|
||||
if( this.part instanceof PartEssentiaExportBus )
|
||||
{
|
||||
Packet_S_EssentiaIOBus.sendCraftingModeChange( this.player, this.part );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getConfigState()
|
||||
{
|
||||
return this.filterSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the gui up.
|
||||
*/
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
// Call super
|
||||
super.initGui();
|
||||
|
||||
// Add the slots
|
||||
for( int row = 0; row < GuiEssentiaIO.FILTER_GRID_SIZE; row++ )
|
||||
{
|
||||
for( int column = 0; column < GuiEssentiaIO.FILTER_GRID_SIZE; column++ )
|
||||
{
|
||||
// Calculate the index
|
||||
int index = ( row * GuiEssentiaIO.FILTER_GRID_SIZE ) + column;
|
||||
|
||||
// Calculate the x position
|
||||
int xPos = GuiEssentiaIO.WIDGET_X_POSITION + ( column * ThEWidget.WIDGET_SIZE );
|
||||
|
||||
// Calculate the y position
|
||||
int yPos = GuiEssentiaIO.WIDGET_Y_POSITION + ( row * ThEWidget.WIDGET_SIZE );
|
||||
|
||||
this.aspectSlotList.add( new WidgetAspectSlot( this, this.player, this.part, index, xPos, yPos, this,
|
||||
GuiEssentiaIO.WIDGET_CONFIG_BYTES[index] ) );
|
||||
}
|
||||
}
|
||||
|
||||
// Create the redstone control button
|
||||
this.redstoneControlButton = new GuiButtonRedstoneModes( GuiEssentiaIO.REDSTONE_CONTROL_BUTTON_ID, this.guiLeft +
|
||||
GuiEssentiaIO.REDSTONE_CONTROL_BUTTON_POS_X, this.guiTop + GuiEssentiaIO.REDSTONE_CONTROL_BUTTON_POS_Y,
|
||||
GuiEssentiaIO.REDSTONE_CONTROL_BUTTON_SIZE, GuiEssentiaIO.REDSTONE_CONTROL_BUTTON_SIZE, this.redstoneMode, false );
|
||||
|
||||
// Create the allow void button if export bus
|
||||
if( this.part instanceof PartEssentiaExportBus )
|
||||
{
|
||||
this.voidModeButton = new GuiButtonAllowVoid( GuiEssentiaIO.ALLOW_VOID_BUTTON_ID, this.guiLeft + GuiEssentiaIO.ALLOW_VOID_BUTTON_POS_X,
|
||||
this.guiTop + GuiEssentiaIO.ALLOW_VOID_BUTTON_POS_Y );
|
||||
this.buttonList.add( this.voidModeButton );
|
||||
|
||||
craftingModeButton = new GuiButtonCraftingMode(CRAFTING_MODE_BUTTON_ID, this.guiLeft +CRAFTING_MODE_BUTTON_POS_X, this.guiTop + CRAFTING_MODE_BUTTON_POS_Y, 16, 16);
|
||||
}
|
||||
|
||||
// Request a full update from the server
|
||||
Packet_S_EssentiaIOBus.sendRequestFilterList( this.player, this.part );
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the server sends a filter size update.
|
||||
*
|
||||
* @param filterSize
|
||||
*/
|
||||
public void onReceiveFilterSize( final byte filterSize )
|
||||
{
|
||||
// Inform our part
|
||||
this.part.onReceiveFilterSize( filterSize );
|
||||
|
||||
this.filterSize = filterSize;
|
||||
|
||||
for (WidgetAspectSlot slot : this.aspectSlotList) {
|
||||
if (!slot.canRender()) {
|
||||
slot.setAspect(null);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the server sends if the bus is redstone controlled.
|
||||
*
|
||||
* @param newRedstoneControled
|
||||
*/
|
||||
public void onReceiveRedstoneControlled( final boolean newRedstoneControled )
|
||||
{
|
||||
// Show/hide the redstone control button
|
||||
if( newRedstoneControled && !this.buttonList.contains( this.redstoneControlButton ) )
|
||||
{
|
||||
// Remove from the list
|
||||
this.buttonList.add( this.redstoneControlButton );
|
||||
|
||||
// Adjust void mode button Y
|
||||
if( this.voidModeButton != null )
|
||||
{
|
||||
this.voidModeButton.yPosition += 18;
|
||||
}
|
||||
}
|
||||
else if( !newRedstoneControled && this.buttonList.contains( this.redstoneControlButton ) )
|
||||
{
|
||||
// Add to list
|
||||
this.buttonList.remove( this.redstoneControlButton );
|
||||
|
||||
// Adjust void mode button Y
|
||||
if( this.voidModeButton != null )
|
||||
{
|
||||
this.voidModeButton.yPosition -= 18;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onReceiveRedstoneMode( final RedstoneMode redstoneMode )
|
||||
{
|
||||
// Set the button state
|
||||
this.redstoneControlButton.setRedstoneMode( redstoneMode );
|
||||
|
||||
// Mark the mode
|
||||
this.redstoneMode = redstoneMode;
|
||||
}
|
||||
|
||||
public void onReceiveHasCrafting( final boolean hasCrafting )
|
||||
{
|
||||
if (hasCrafting && !buttonList.contains(craftingModeButton))
|
||||
{
|
||||
buttonList.add(craftingModeButton);
|
||||
}
|
||||
else if (!hasCrafting && buttonList.contains(craftingModeButton))
|
||||
{
|
||||
buttonList.remove(craftingModeButton);
|
||||
}
|
||||
}
|
||||
public void onReceiveCraftingOnly( final boolean craftingOnly )
|
||||
{
|
||||
if (craftingModeButton != null)
|
||||
{
|
||||
craftingModeButton.setAlwaysCraft(craftingOnly);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Called when the server sends the void mode status
|
||||
*
|
||||
* @param isVoidAllowed
|
||||
*/
|
||||
public void onServerSendVoidMode( final boolean isVoidAllowed )
|
||||
{
|
||||
// Set the void mode if there is a void button
|
||||
if( this.voidModeButton != null )
|
||||
{
|
||||
this.voidModeButton.setIsVoidAllowed( isVoidAllowed );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAspects( final List<Aspect> aspectList )
|
||||
{
|
||||
// Inform our part
|
||||
this.part.onReceiveFilterList( aspectList );
|
||||
|
||||
int count = Math.min( this.aspectSlotList.size(), aspectList.size() );
|
||||
|
||||
for( int i = 0; i < count; i++ )
|
||||
{
|
||||
this.aspectSlotList.get( i ).setAspect( aspectList.get( i ), 1, false );
|
||||
}
|
||||
|
||||
this.filteredAspects = aspectList;
|
||||
|
||||
}
|
||||
|
||||
public class GuiEssentiaIO extends ThEBaseGui implements WidgetAspectSlot.IConfigurable, IAspectSlotGui {
|
||||
|
||||
/**
|
||||
* Number of rows and columns in the filter grid.
|
||||
*/
|
||||
private static final int FILTER_GRID_SIZE = 3;
|
||||
|
||||
/**
|
||||
* Controls if the widget is drawn.
|
||||
* if filterSize >= this, the widget can be drawn.
|
||||
*/
|
||||
private static final byte[] WIDGET_CONFIG_BYTES = new byte[] {2, 1, 2, 1, 0, 1, 2, 1, 2};
|
||||
|
||||
/**
|
||||
* Starting X position for widgets.
|
||||
*/
|
||||
private static final int WIDGET_X_POSITION = 61;
|
||||
|
||||
/**
|
||||
* Starting Y position for widgets.
|
||||
*/
|
||||
private static final int WIDGET_Y_POSITION = 21;
|
||||
|
||||
/**
|
||||
* Height of the gui
|
||||
*/
|
||||
private static final int GUI_HEIGHT = 184;
|
||||
|
||||
/**
|
||||
* Width of the gui when the player does not have a network tool.
|
||||
*/
|
||||
private static final int GUI_WIDTH_NO_TOOL = 211;
|
||||
|
||||
/**
|
||||
* Width of the gui when the player has a network tool.
|
||||
*/
|
||||
private static final int GUI_WIDTH_WITH_TOOL = 246;
|
||||
|
||||
/**
|
||||
* Width of the main body of the gui.
|
||||
* Ignores upgrade and network tool areas.
|
||||
*/
|
||||
private static final int GUI_MAIN_WIDTH = 176;
|
||||
|
||||
/**
|
||||
* Width of the upgrade area of the gui.
|
||||
*/
|
||||
private static final int GUI_UPGRADES_WIDTH = 35;
|
||||
|
||||
/**
|
||||
* Height of the upgrade area of the gui.
|
||||
*/
|
||||
private static final int GUI_UPGRADES_HEIGHT = 86;
|
||||
|
||||
/**
|
||||
* Position of the title string.
|
||||
*/
|
||||
private static final int TITLE_POS_X = 6, TITLE_POS_Y = 5;
|
||||
|
||||
/**
|
||||
* Redstone Control button placement
|
||||
*/
|
||||
private static final int REDSTONE_CONTROL_BUTTON_POS_Y = 2,
|
||||
REDSTONE_CONTROL_BUTTON_POS_X = -18,
|
||||
REDSTONE_CONTROL_BUTTON_SIZE = 16,
|
||||
REDSTONE_CONTROL_BUTTON_ID = 0;
|
||||
|
||||
/**
|
||||
* Void button placement
|
||||
*/
|
||||
private static final int ALLOW_VOID_BUTTON_POS_Y = 2, ALLOW_VOID_BUTTON_POS_X = -19, ALLOW_VOID_BUTTON_ID = 1;
|
||||
|
||||
private static final int CRAFTING_MODE_BUTTON_POS_Y = 40,
|
||||
CRAFTING_MODE_BUTTON_POS_X = -18,
|
||||
CRAFTING_MODE_BUTTON_ID = 2;
|
||||
|
||||
/**
|
||||
* The part associated with this gui.
|
||||
*/
|
||||
private ThEPartEssentiaIOBus_Base part;
|
||||
|
||||
/**
|
||||
* The player viewing this bus gui.
|
||||
*/
|
||||
private EntityPlayer player;
|
||||
|
||||
/**
|
||||
* The size of the buses filter (0-2).
|
||||
*/
|
||||
private byte filterSize;
|
||||
|
||||
/**
|
||||
* Filter widgets.
|
||||
*/
|
||||
private List<WidgetAspectSlot> aspectSlotList = new ArrayList<WidgetAspectSlot>();
|
||||
|
||||
/**
|
||||
* Filter aspects.
|
||||
*/
|
||||
private List<Aspect> filteredAspects = new ArrayList<Aspect>();
|
||||
|
||||
/**
|
||||
* True if the player has a network tool in their inventory.
|
||||
*/
|
||||
private boolean hasNetworkTool;
|
||||
|
||||
/**
|
||||
* Tracks the redstone mode of the bus.
|
||||
*/
|
||||
private RedstoneMode redstoneMode = RedstoneMode.HIGH_SIGNAL;
|
||||
|
||||
/**
|
||||
* Title of the gui
|
||||
*/
|
||||
private final String guiTitle;
|
||||
|
||||
/**
|
||||
* Shown when the bus is redstone controlled
|
||||
*/
|
||||
private GuiButtonRedstoneModes redstoneControlButton = null;
|
||||
|
||||
/**
|
||||
* Button controlling if voiding is allowed.
|
||||
*/
|
||||
private GuiButtonAllowVoid voidModeButton = null;
|
||||
|
||||
/**
|
||||
* Shown when the bus has crafting card
|
||||
*/
|
||||
private GuiButtonCraftingMode craftingModeButton = null;
|
||||
|
||||
/**
|
||||
* Creates the gui
|
||||
*
|
||||
* @param partBus
|
||||
* @param player
|
||||
*/
|
||||
public GuiEssentiaIO(final ThEPartEssentiaIOBus_Base partBus, final EntityPlayer player) {
|
||||
// Call super
|
||||
super(new ContainerPartEssentiaIOBus(partBus, player));
|
||||
|
||||
// Set the bus
|
||||
this.part = partBus;
|
||||
|
||||
// Set the player
|
||||
this.player = player;
|
||||
|
||||
// Check if the player has a network tool
|
||||
this.hasNetworkTool = ((ContainerPartEssentiaIOBus) this.inventorySlots).hasNetworkTool();
|
||||
|
||||
// Set the width
|
||||
this.xSize = (this.hasNetworkTool ? GuiEssentiaIO.GUI_WIDTH_WITH_TOOL : GuiEssentiaIO.GUI_WIDTH_NO_TOOL);
|
||||
|
||||
// Set the height
|
||||
this.ySize = GuiEssentiaIO.GUI_HEIGHT;
|
||||
|
||||
// Set the title
|
||||
if (partBus instanceof PartEssentiaImportBus) {
|
||||
// Import
|
||||
this.guiTitle = AEPartsEnum.EssentiaImportBus.getLocalizedName();
|
||||
} else if (partBus instanceof PartEssentiaExportBus) {
|
||||
// Export
|
||||
this.guiTitle = AEPartsEnum.EssentiaExportBus.getLocalizedName();
|
||||
} else {
|
||||
this.guiTitle = "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the GUI background layer
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(final float alpha, final int mouseX, final int mouseY) {
|
||||
// Full white
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
// Get the GUI texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(GuiTextureManager.ESSENTIA_IO_BUS.getTexture());
|
||||
|
||||
// Does the user have a network tool?
|
||||
if (this.hasNetworkTool) {
|
||||
// Draw the full gui
|
||||
this.drawTexturedModalRect(
|
||||
this.guiLeft, this.guiTop, 0, 0, GuiEssentiaIO.GUI_WIDTH_WITH_TOOL, GuiEssentiaIO.GUI_HEIGHT);
|
||||
} else {
|
||||
// Draw main gui
|
||||
this.drawTexturedModalRect(
|
||||
this.guiLeft, this.guiTop, 0, 0, GuiEssentiaIO.GUI_MAIN_WIDTH, GuiEssentiaIO.GUI_HEIGHT);
|
||||
|
||||
// Draw upgrade slots
|
||||
this.drawTexturedModalRect(
|
||||
this.guiLeft + GuiEssentiaIO.GUI_MAIN_WIDTH,
|
||||
this.guiTop,
|
||||
GuiEssentiaIO.GUI_MAIN_WIDTH,
|
||||
0,
|
||||
GuiEssentiaIO.GUI_UPGRADES_WIDTH,
|
||||
GuiEssentiaIO.GUI_UPGRADES_HEIGHT);
|
||||
}
|
||||
|
||||
// Call super
|
||||
super.drawAEToolAndUpgradeSlots(alpha, mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
|
||||
// Call super
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
|
||||
// Draw the title
|
||||
this.fontRendererObj.drawString(this.guiTitle, GuiEssentiaIO.TITLE_POS_X, GuiEssentiaIO.TITLE_POS_Y, 0x000000);
|
||||
|
||||
boolean hoverUnderlayRendered = false;
|
||||
|
||||
WidgetAspectSlot slotUnderMouse = null;
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
WidgetAspectSlot slotWidget = this.aspectSlotList.get(i);
|
||||
|
||||
if ((!hoverUnderlayRendered)
|
||||
&& (slotWidget.canRender())
|
||||
&& (slotWidget.isMouseOverWidget(mouseX, mouseY))) {
|
||||
slotWidget.drawMouseHoverUnderlay();
|
||||
|
||||
slotUnderMouse = slotWidget;
|
||||
|
||||
hoverUnderlayRendered = true;
|
||||
}
|
||||
|
||||
slotWidget.drawWidget();
|
||||
}
|
||||
|
||||
// Should we get the tooltip from the slot?
|
||||
if (slotUnderMouse != null) {
|
||||
// Add the tooltip from the widget
|
||||
slotUnderMouse.getTooltip(this.tooltip);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the mouse is clicked.
|
||||
*/
|
||||
@Override
|
||||
protected void mouseClicked(final int mouseX, final int mouseY, final int mouseButton) {
|
||||
// Call super
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
|
||||
// Loop over all widgets
|
||||
for (WidgetAspectSlot aspectSlot : this.aspectSlotList) {
|
||||
// Is the mouse over this widget?
|
||||
if (aspectSlot.isMouseOverWidget(mouseX, mouseY)) {
|
||||
// Get the aspect of the currently held item
|
||||
Aspect itemAspect = EssentiaItemContainerHelper.INSTANCE.getFilterAspectFromItem(
|
||||
this.draggedStack == null ? this.player.inventory.getItemStack() : this.draggedStack.copy());
|
||||
|
||||
// Is there an aspect?
|
||||
if (itemAspect != null) {
|
||||
// Are we already filtering for this aspect?
|
||||
if (this.filteredAspects.contains(itemAspect)) {
|
||||
// Ignore
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Inform the slot it was clicked
|
||||
aspectSlot.mouseClicked(itemAspect);
|
||||
|
||||
// Stop searching
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.draggedStack = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button is pressed
|
||||
*/
|
||||
@Override
|
||||
protected void onButtonClicked(final GuiButton button, final int mouseButton) {
|
||||
// Was the clicked button the redstone mode button?
|
||||
if (button.id == GuiEssentiaIO.REDSTONE_CONTROL_BUTTON_ID) {
|
||||
Packet_S_EssentiaIOBus.sendRedstoneModeChange(this.player, this.part);
|
||||
}
|
||||
// Void button?
|
||||
else if (button.id == GuiEssentiaIO.ALLOW_VOID_BUTTON_ID) {
|
||||
if (this.part instanceof PartEssentiaExportBus) {
|
||||
Packet_S_EssentiaIOBus.sendVoidModeChange(this.player, (PartEssentiaExportBus) this.part);
|
||||
}
|
||||
} else if (button.id == GuiEssentiaIO.CRAFTING_MODE_BUTTON_ID) {
|
||||
if (this.part instanceof PartEssentiaExportBus) {
|
||||
Packet_S_EssentiaIOBus.sendCraftingModeChange(this.player, this.part);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getConfigState() {
|
||||
return this.filterSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the gui up.
|
||||
*/
|
||||
@Override
|
||||
public void initGui() {
|
||||
// Call super
|
||||
super.initGui();
|
||||
|
||||
// Add the slots
|
||||
for (int row = 0; row < GuiEssentiaIO.FILTER_GRID_SIZE; row++) {
|
||||
for (int column = 0; column < GuiEssentiaIO.FILTER_GRID_SIZE; column++) {
|
||||
// Calculate the index
|
||||
int index = (row * GuiEssentiaIO.FILTER_GRID_SIZE) + column;
|
||||
|
||||
// Calculate the x position
|
||||
int xPos = GuiEssentiaIO.WIDGET_X_POSITION + (column * ThEWidget.WIDGET_SIZE);
|
||||
|
||||
// Calculate the y position
|
||||
int yPos = GuiEssentiaIO.WIDGET_Y_POSITION + (row * ThEWidget.WIDGET_SIZE);
|
||||
|
||||
this.aspectSlotList.add(new WidgetAspectSlot(
|
||||
this,
|
||||
this.player,
|
||||
this.part,
|
||||
index,
|
||||
xPos,
|
||||
yPos,
|
||||
this,
|
||||
GuiEssentiaIO.WIDGET_CONFIG_BYTES[index]));
|
||||
}
|
||||
}
|
||||
|
||||
// Create the redstone control button
|
||||
this.redstoneControlButton = new GuiButtonRedstoneModes(
|
||||
GuiEssentiaIO.REDSTONE_CONTROL_BUTTON_ID,
|
||||
this.guiLeft + GuiEssentiaIO.REDSTONE_CONTROL_BUTTON_POS_X,
|
||||
this.guiTop + GuiEssentiaIO.REDSTONE_CONTROL_BUTTON_POS_Y,
|
||||
GuiEssentiaIO.REDSTONE_CONTROL_BUTTON_SIZE,
|
||||
GuiEssentiaIO.REDSTONE_CONTROL_BUTTON_SIZE,
|
||||
this.redstoneMode,
|
||||
false);
|
||||
|
||||
// Create the allow void button if export bus
|
||||
if (this.part instanceof PartEssentiaExportBus) {
|
||||
this.voidModeButton = new GuiButtonAllowVoid(
|
||||
GuiEssentiaIO.ALLOW_VOID_BUTTON_ID,
|
||||
this.guiLeft + GuiEssentiaIO.ALLOW_VOID_BUTTON_POS_X,
|
||||
this.guiTop + GuiEssentiaIO.ALLOW_VOID_BUTTON_POS_Y);
|
||||
this.buttonList.add(this.voidModeButton);
|
||||
|
||||
craftingModeButton = new GuiButtonCraftingMode(
|
||||
CRAFTING_MODE_BUTTON_ID,
|
||||
this.guiLeft + CRAFTING_MODE_BUTTON_POS_X,
|
||||
this.guiTop + CRAFTING_MODE_BUTTON_POS_Y,
|
||||
16,
|
||||
16);
|
||||
}
|
||||
|
||||
// Request a full update from the server
|
||||
Packet_S_EssentiaIOBus.sendRequestFilterList(this.player, this.part);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the server sends a filter size update.
|
||||
*
|
||||
* @param filterSize
|
||||
*/
|
||||
public void onReceiveFilterSize(final byte filterSize) {
|
||||
// Inform our part
|
||||
this.part.onReceiveFilterSize(filterSize);
|
||||
|
||||
this.filterSize = filterSize;
|
||||
|
||||
for (WidgetAspectSlot slot : this.aspectSlotList) {
|
||||
if (!slot.canRender()) {
|
||||
slot.setAspect(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the server sends if the bus is redstone controlled.
|
||||
*
|
||||
* @param newRedstoneControled
|
||||
*/
|
||||
public void onReceiveRedstoneControlled(final boolean newRedstoneControled) {
|
||||
// Show/hide the redstone control button
|
||||
if (newRedstoneControled && !this.buttonList.contains(this.redstoneControlButton)) {
|
||||
// Remove from the list
|
||||
this.buttonList.add(this.redstoneControlButton);
|
||||
|
||||
// Adjust void mode button Y
|
||||
if (this.voidModeButton != null) {
|
||||
this.voidModeButton.yPosition += 18;
|
||||
}
|
||||
} else if (!newRedstoneControled && this.buttonList.contains(this.redstoneControlButton)) {
|
||||
// Add to list
|
||||
this.buttonList.remove(this.redstoneControlButton);
|
||||
|
||||
// Adjust void mode button Y
|
||||
if (this.voidModeButton != null) {
|
||||
this.voidModeButton.yPosition -= 18;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onReceiveRedstoneMode(final RedstoneMode redstoneMode) {
|
||||
// Set the button state
|
||||
this.redstoneControlButton.setRedstoneMode(redstoneMode);
|
||||
|
||||
// Mark the mode
|
||||
this.redstoneMode = redstoneMode;
|
||||
}
|
||||
|
||||
public void onReceiveHasCrafting(final boolean hasCrafting) {
|
||||
if (hasCrafting && !buttonList.contains(craftingModeButton)) {
|
||||
buttonList.add(craftingModeButton);
|
||||
} else if (!hasCrafting && buttonList.contains(craftingModeButton)) {
|
||||
buttonList.remove(craftingModeButton);
|
||||
}
|
||||
}
|
||||
|
||||
public void onReceiveCraftingOnly(final boolean craftingOnly) {
|
||||
if (craftingModeButton != null) {
|
||||
craftingModeButton.setAlwaysCraft(craftingOnly);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Called when the server sends the void mode status
|
||||
*
|
||||
* @param isVoidAllowed
|
||||
*/
|
||||
public void onServerSendVoidMode(final boolean isVoidAllowed) {
|
||||
// Set the void mode if there is a void button
|
||||
if (this.voidModeButton != null) {
|
||||
this.voidModeButton.setIsVoidAllowed(isVoidAllowed);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAspects(final List<Aspect> aspectList) {
|
||||
// Inform our part
|
||||
this.part.onReceiveFilterList(aspectList);
|
||||
|
||||
int count = Math.min(this.aspectSlotList.size(), aspectList.size());
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
this.aspectSlotList.get(i).setAspect(aspectList.get(i), 1, false);
|
||||
}
|
||||
|
||||
this.filteredAspects = aspectList;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
package thaumicenergistics.client.gui;
|
||||
|
||||
import java.util.List;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import appeng.api.config.RedstoneMode;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumicenergistics.api.gui.IAspectSlotGui;
|
||||
import thaumicenergistics.client.gui.abstraction.ThEBaseGui;
|
||||
@@ -29,438 +29,428 @@ import thaumicenergistics.common.parts.PartEssentiaLevelEmitter;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiEssentiaLevelEmitter
|
||||
extends ThEBaseGui
|
||||
implements IAspectSlotGui
|
||||
{
|
||||
/**
|
||||
* Normal button labels
|
||||
*/
|
||||
private static final String[] BUTTON_LABELS = { "+1", "+10", "+100", "-1", "-10", "-100" };
|
||||
|
||||
/**
|
||||
* Button labels when shift is being pressed.
|
||||
*/
|
||||
private static final String[] BUTTON_LABELS_SHIFTED = { "+100", "+1000", "+10000", "-100", "-1000", "-10000" };
|
||||
|
||||
/**
|
||||
* Width of the gui
|
||||
*/
|
||||
private static final int GUI_WIDTH = 176;
|
||||
|
||||
/**
|
||||
* Height of the gui
|
||||
*/
|
||||
private static final int GUI_HEIGHT = 184;
|
||||
|
||||
/**
|
||||
* The button index of the redstone mode button.
|
||||
*/
|
||||
private static final int REDSTONE_MODE_BUTTON_INDEX = 6;
|
||||
|
||||
/**
|
||||
* X position of the title string.
|
||||
*/
|
||||
private static final int TITLE_POS_X = 8;
|
||||
|
||||
/**
|
||||
* Y position of the title string.
|
||||
*/
|
||||
private static final int TITLE_POS_Y = 5;
|
||||
|
||||
/**
|
||||
* X offset for the amount field.
|
||||
*/
|
||||
private static final int AMOUNT_OFFSET_X = 25;
|
||||
|
||||
/**
|
||||
* Y offset for the amount field.
|
||||
*/
|
||||
private static final int AMOUNT_OFFSET_Y = 44;
|
||||
|
||||
/**
|
||||
* Width of the amount field.
|
||||
*/
|
||||
private static final int AMOUNT_WIDTH = 80;
|
||||
|
||||
/**
|
||||
* Height of the amount field.
|
||||
*/
|
||||
private static final int AMOUNT_HEIGHT = 10;
|
||||
|
||||
/**
|
||||
* Horizontal padding between buttons.
|
||||
*/
|
||||
private static final int BUTTON_PADDING_HORZ = 8;
|
||||
|
||||
/**
|
||||
* Vertical padding between buttons.
|
||||
*/
|
||||
private static final int BUTTON_PADDING_VERT = 22;
|
||||
|
||||
/**
|
||||
* X position to start drawing buttons.
|
||||
*/
|
||||
private static final int BUTTON_POS_X = 15;
|
||||
|
||||
/**
|
||||
* Y position to start drawing buttons.
|
||||
*/
|
||||
private static final int BUTTON_POS_Y = 17;
|
||||
|
||||
/**
|
||||
* Width of the buttons.
|
||||
*/
|
||||
private static final int BUTTON_WIDTH = 42;
|
||||
|
||||
/**
|
||||
* Height of the buttons.
|
||||
*/
|
||||
private static final int BUTTON_HEIGHT = 20;
|
||||
|
||||
/**
|
||||
* Number of button rows.
|
||||
*/
|
||||
private static final int BUTTON_ROWS = 2;
|
||||
|
||||
/**
|
||||
* Number of button columns.
|
||||
*/
|
||||
private static final int BUTTON_COLUMNS = 3;
|
||||
|
||||
/**
|
||||
* X position of the redstone button.
|
||||
*/
|
||||
private static final int REDSTONE_BUTTON_POS_X = -18;
|
||||
|
||||
/**
|
||||
* Y position of the redstone button.
|
||||
*/
|
||||
private static final int REDSTONE_BUTTON_POS_Y = 2;
|
||||
|
||||
/**
|
||||
* Width and height of the redstone button.
|
||||
*/
|
||||
private static final int REDSTONE_BUTTON_SIZE = 16;
|
||||
|
||||
/**
|
||||
* X position of the filter widget.
|
||||
*/
|
||||
private static final int FILTER_WIDGET_POS_X = 123;
|
||||
|
||||
/**
|
||||
* Y position of the filter widget.
|
||||
*/
|
||||
private static final int FILTER_WIDGET_POS_Y = 39;
|
||||
|
||||
/**
|
||||
* The maximum number of characters that can be typed in the amount field.
|
||||
*/
|
||||
private static final int AMOUNT_MAX_CHARS = 10;
|
||||
|
||||
/**
|
||||
* Amount text field
|
||||
*/
|
||||
private DigitTextField amountField;
|
||||
|
||||
/**
|
||||
* AE part associated with the gui.
|
||||
*/
|
||||
private PartEssentiaLevelEmitter part;
|
||||
|
||||
/**
|
||||
* Player viewing the gui.
|
||||
*/
|
||||
private EntityPlayer player;
|
||||
|
||||
/**
|
||||
* Filter slot.
|
||||
*/
|
||||
private WidgetAspectSlot aspectFilterSlot;
|
||||
|
||||
/**
|
||||
* Create the GUI.
|
||||
*
|
||||
* @param part
|
||||
* AE part associated with the gui.
|
||||
* @param player
|
||||
* Player viewing the gui.
|
||||
*/
|
||||
public GuiEssentiaLevelEmitter( final PartEssentiaLevelEmitter part, final EntityPlayer player )
|
||||
{
|
||||
// Call super
|
||||
super( new ContainerPartEssentiaLevelEmitter( part, player ) );
|
||||
|
||||
// Set the player
|
||||
this.player = player;
|
||||
|
||||
// Set the part
|
||||
this.part = part;
|
||||
|
||||
// Create the filter slot
|
||||
this.aspectFilterSlot = new WidgetAspectSlot( this, this.player, this.part, GuiEssentiaLevelEmitter.FILTER_WIDGET_POS_X,
|
||||
GuiEssentiaLevelEmitter.FILTER_WIDGET_POS_Y );
|
||||
|
||||
// Set the width and height
|
||||
this.xSize = GuiEssentiaLevelEmitter.GUI_WIDTH;
|
||||
this.ySize = GuiEssentiaLevelEmitter.GUI_HEIGHT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the gui background
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer( final float alpha, final int mouseX, final int mouseY )
|
||||
{
|
||||
// Full white
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
|
||||
// Set the texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture( GuiTextureManager.ESSENTIA_LEVEL_EMITTER.getTexture() );
|
||||
|
||||
// Draw the gui texture.
|
||||
this.drawTexturedModalRect( this.guiLeft, this.guiTop, 0, 0, GuiEssentiaLevelEmitter.GUI_WIDTH, GuiEssentiaLevelEmitter.GUI_HEIGHT );
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer( final int mouseX, final int mouseY )
|
||||
{
|
||||
// Draw the title
|
||||
this.fontRendererObj.drawString( AEPartsEnum.EssentiaLevelEmitter.getLocalizedName(), GuiEssentiaLevelEmitter.TITLE_POS_X,
|
||||
GuiEssentiaLevelEmitter.TITLE_POS_Y, 0 );
|
||||
|
||||
// Draw underlay when mouse is over slot.
|
||||
if( this.aspectFilterSlot.isMouseOverWidget( mouseX, mouseY ) )
|
||||
{
|
||||
// Draw underlay
|
||||
this.aspectFilterSlot.drawMouseHoverUnderlay();
|
||||
|
||||
// Get tooltip
|
||||
this.aspectFilterSlot.getTooltip( this.tooltip );
|
||||
}
|
||||
|
||||
// Draw the filter widget
|
||||
this.aspectFilterSlot.drawWidget();
|
||||
|
||||
// Draw the text field
|
||||
this.amountField.drawTextBox();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the player types a key
|
||||
*/
|
||||
@Override
|
||||
protected void keyTyped( final char key, final int keyID )
|
||||
{
|
||||
// Pass to super
|
||||
super.keyTyped( key, keyID );
|
||||
|
||||
// Ensure they was numeric and the string isnt too long to parse, or backspace
|
||||
if( ( Character.isDigit( key ) && ( this.amountField.getText().length() < GuiEssentiaLevelEmitter.AMOUNT_MAX_CHARS ) ) ||
|
||||
( keyID == Keyboard.KEY_BACK ) )
|
||||
{
|
||||
// Pass to the amount field
|
||||
this.amountField.textboxKeyTyped( key, keyID );
|
||||
|
||||
// Convert the text field into a long
|
||||
long wantedAmount = 0;
|
||||
try
|
||||
{
|
||||
wantedAmount = Long.parseLong( this.amountField.getText() );
|
||||
}
|
||||
catch( NumberFormatException e )
|
||||
{
|
||||
}
|
||||
|
||||
// Update the server
|
||||
Packet_S_EssentiaEmitter.sendWantedAmount( wantedAmount, this.part, this.player );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the player clicks a mouse button
|
||||
*/
|
||||
@Override
|
||||
protected void mouseClicked( final int mouseX, final int mouseY, final int mouseBtn )
|
||||
{
|
||||
// Pass to super
|
||||
super.mouseClicked( mouseX, mouseY, mouseBtn );
|
||||
|
||||
// Is the mouse over the widget?
|
||||
if( this.aspectFilterSlot.isMouseOverWidget( mouseX, mouseY ) )
|
||||
{
|
||||
// Pass to the widget
|
||||
this.aspectFilterSlot.mouseClicked(EssentiaItemContainerHelper.INSTANCE.getFilterAspectFromItem(this.draggedStack == null ? this.player.inventory.getItemStack() : this.draggedStack.copy()));
|
||||
}
|
||||
this.draggedStack = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button is clicked.
|
||||
*/
|
||||
@Override
|
||||
protected void onButtonClicked( final GuiButton button, final int mouseButton )
|
||||
{
|
||||
// Get the index of the button that was clicked
|
||||
int index = button.id;
|
||||
|
||||
// Was one of the amount buttons pressed?
|
||||
if( ( index >= 0 ) && ( index < GuiEssentiaLevelEmitter.BUTTON_LABELS.length ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
// Read the adjustment
|
||||
int adjustment = Integer.parseInt( button.displayString );
|
||||
|
||||
// Update the server
|
||||
Packet_S_EssentiaEmitter.sendWantedAmountDelta( adjustment, this.part, this.player );
|
||||
}
|
||||
catch( NumberFormatException e )
|
||||
{
|
||||
}
|
||||
}
|
||||
// Was the redstone mode button pressed?
|
||||
else if( index == GuiEssentiaLevelEmitter.REDSTONE_MODE_BUTTON_INDEX )
|
||||
{
|
||||
// Update the server
|
||||
Packet_S_EssentiaEmitter.sendRedstoneModeToggle( this.part, this.player );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the screen and all the components in it.
|
||||
*/
|
||||
@Override
|
||||
public void drawScreen( final int x, final int y, final float f )
|
||||
{
|
||||
// Call super
|
||||
super.drawScreen( x, y, f );
|
||||
|
||||
// Get the number of buttons
|
||||
int count = GuiEssentiaLevelEmitter.BUTTON_LABELS.length;
|
||||
|
||||
// Loop over the buttons
|
||||
for( int buttonIndex = 0; buttonIndex < count; buttonIndex++ )
|
||||
{
|
||||
// Get the button for this index
|
||||
GuiButton currentButton = (GuiButton)this.buttonList.get( buttonIndex );
|
||||
|
||||
// Is shift being held?
|
||||
if( Keyboard.isKeyDown( Keyboard.KEY_LSHIFT ) || Keyboard.isKeyDown( Keyboard.KEY_RSHIFT ) )
|
||||
{
|
||||
// Shifted label
|
||||
currentButton.displayString = ( BUTTON_LABELS_SHIFTED[buttonIndex] );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Normal label
|
||||
currentButton.displayString = ( BUTTON_LABELS[buttonIndex] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the gui
|
||||
*/
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
// Call super
|
||||
super.initGui();
|
||||
|
||||
// Enable repeat keys
|
||||
Keyboard.enableRepeatEvents( true );
|
||||
|
||||
// Create the amount field
|
||||
this.amountField = new DigitTextField( this.fontRendererObj, GuiEssentiaLevelEmitter.AMOUNT_OFFSET_X,
|
||||
GuiEssentiaLevelEmitter.AMOUNT_OFFSET_Y, GuiEssentiaLevelEmitter.AMOUNT_WIDTH, GuiEssentiaLevelEmitter.AMOUNT_HEIGHT );
|
||||
|
||||
// Start focused
|
||||
this.amountField.setFocused( true );
|
||||
|
||||
// Draw in the forground
|
||||
this.amountField.setEnableBackgroundDrawing( false );
|
||||
|
||||
// Text color white
|
||||
this.amountField.setTextColor( 0xFFFFFFFF );
|
||||
|
||||
// Reset the button list
|
||||
this.buttonList.clear();
|
||||
|
||||
// Add adjustment buttons
|
||||
for( int row = 0; row < GuiEssentiaLevelEmitter.BUTTON_ROWS; row++ )
|
||||
{
|
||||
// Calculate the y position of this row
|
||||
int yPos = ( this.guiTop + GuiEssentiaLevelEmitter.BUTTON_POS_Y ) +
|
||||
( row * ( GuiEssentiaLevelEmitter.BUTTON_HEIGHT + GuiEssentiaLevelEmitter.BUTTON_PADDING_VERT ) );
|
||||
|
||||
for( int column = 0; column < GuiEssentiaLevelEmitter.BUTTON_COLUMNS; column++ )
|
||||
{
|
||||
// Calculate the button index
|
||||
int buttonIndex = ( row * 3 ) + column;
|
||||
|
||||
// Calculate the x position of the button
|
||||
int xPos = ( ( this.guiLeft + GuiEssentiaLevelEmitter.BUTTON_POS_X ) +
|
||||
( column * ( GuiEssentiaLevelEmitter.BUTTON_WIDTH + GuiEssentiaLevelEmitter.BUTTON_PADDING_HORZ ) ) );
|
||||
|
||||
this.buttonList.add( new GuiButton( buttonIndex, xPos, yPos, GuiEssentiaLevelEmitter.BUTTON_WIDTH,
|
||||
GuiEssentiaLevelEmitter.BUTTON_HEIGHT, GuiEssentiaLevelEmitter.BUTTON_LABELS[buttonIndex] ) );
|
||||
}
|
||||
}
|
||||
|
||||
// Add the redstone mode button
|
||||
this.buttonList.add( new GuiButtonRedstoneModes( GuiEssentiaLevelEmitter.REDSTONE_MODE_BUTTON_INDEX, this.guiLeft +
|
||||
GuiEssentiaLevelEmitter.REDSTONE_BUTTON_POS_X, this.guiTop + GuiEssentiaLevelEmitter.REDSTONE_BUTTON_POS_Y,
|
||||
GuiEssentiaLevelEmitter.REDSTONE_BUTTON_SIZE, GuiEssentiaLevelEmitter.REDSTONE_BUTTON_SIZE, RedstoneMode.LOW_SIGNAL, true ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the gui is closing.
|
||||
*/
|
||||
@Override
|
||||
public void onGuiClosed()
|
||||
{
|
||||
// Disable repeat keys
|
||||
Keyboard.enableRepeatEvents( false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the redstone mode
|
||||
*
|
||||
* @param mode
|
||||
*/
|
||||
public void onReceiveRedstoneMode( final RedstoneMode mode )
|
||||
{
|
||||
( (GuiButtonRedstoneModes)this.buttonList.get( GuiEssentiaLevelEmitter.REDSTONE_MODE_BUTTON_INDEX ) ).setRedstoneMode( mode );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the amount
|
||||
*
|
||||
* @param amount
|
||||
*/
|
||||
public void onReceiveThresholdValue( final long amount )
|
||||
{
|
||||
this.amountField.setText( Long.toString( amount ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the filtered aspect
|
||||
*/
|
||||
@Override
|
||||
public void updateAspects( final List<Aspect> aspectList )
|
||||
{
|
||||
if( ( aspectList == null ) || ( aspectList.isEmpty() ) )
|
||||
{
|
||||
this.aspectFilterSlot.setAspect( null );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.aspectFilterSlot.setAspect( aspectList.get( 0 ), 1, false );
|
||||
}
|
||||
}
|
||||
|
||||
public class GuiEssentiaLevelEmitter extends ThEBaseGui implements IAspectSlotGui {
|
||||
/**
|
||||
* Normal button labels
|
||||
*/
|
||||
private static final String[] BUTTON_LABELS = {"+1", "+10", "+100", "-1", "-10", "-100"};
|
||||
|
||||
/**
|
||||
* Button labels when shift is being pressed.
|
||||
*/
|
||||
private static final String[] BUTTON_LABELS_SHIFTED = {"+100", "+1000", "+10000", "-100", "-1000", "-10000"};
|
||||
|
||||
/**
|
||||
* Width of the gui
|
||||
*/
|
||||
private static final int GUI_WIDTH = 176;
|
||||
|
||||
/**
|
||||
* Height of the gui
|
||||
*/
|
||||
private static final int GUI_HEIGHT = 184;
|
||||
|
||||
/**
|
||||
* The button index of the redstone mode button.
|
||||
*/
|
||||
private static final int REDSTONE_MODE_BUTTON_INDEX = 6;
|
||||
|
||||
/**
|
||||
* X position of the title string.
|
||||
*/
|
||||
private static final int TITLE_POS_X = 8;
|
||||
|
||||
/**
|
||||
* Y position of the title string.
|
||||
*/
|
||||
private static final int TITLE_POS_Y = 5;
|
||||
|
||||
/**
|
||||
* X offset for the amount field.
|
||||
*/
|
||||
private static final int AMOUNT_OFFSET_X = 25;
|
||||
|
||||
/**
|
||||
* Y offset for the amount field.
|
||||
*/
|
||||
private static final int AMOUNT_OFFSET_Y = 44;
|
||||
|
||||
/**
|
||||
* Width of the amount field.
|
||||
*/
|
||||
private static final int AMOUNT_WIDTH = 80;
|
||||
|
||||
/**
|
||||
* Height of the amount field.
|
||||
*/
|
||||
private static final int AMOUNT_HEIGHT = 10;
|
||||
|
||||
/**
|
||||
* Horizontal padding between buttons.
|
||||
*/
|
||||
private static final int BUTTON_PADDING_HORZ = 8;
|
||||
|
||||
/**
|
||||
* Vertical padding between buttons.
|
||||
*/
|
||||
private static final int BUTTON_PADDING_VERT = 22;
|
||||
|
||||
/**
|
||||
* X position to start drawing buttons.
|
||||
*/
|
||||
private static final int BUTTON_POS_X = 15;
|
||||
|
||||
/**
|
||||
* Y position to start drawing buttons.
|
||||
*/
|
||||
private static final int BUTTON_POS_Y = 17;
|
||||
|
||||
/**
|
||||
* Width of the buttons.
|
||||
*/
|
||||
private static final int BUTTON_WIDTH = 42;
|
||||
|
||||
/**
|
||||
* Height of the buttons.
|
||||
*/
|
||||
private static final int BUTTON_HEIGHT = 20;
|
||||
|
||||
/**
|
||||
* Number of button rows.
|
||||
*/
|
||||
private static final int BUTTON_ROWS = 2;
|
||||
|
||||
/**
|
||||
* Number of button columns.
|
||||
*/
|
||||
private static final int BUTTON_COLUMNS = 3;
|
||||
|
||||
/**
|
||||
* X position of the redstone button.
|
||||
*/
|
||||
private static final int REDSTONE_BUTTON_POS_X = -18;
|
||||
|
||||
/**
|
||||
* Y position of the redstone button.
|
||||
*/
|
||||
private static final int REDSTONE_BUTTON_POS_Y = 2;
|
||||
|
||||
/**
|
||||
* Width and height of the redstone button.
|
||||
*/
|
||||
private static final int REDSTONE_BUTTON_SIZE = 16;
|
||||
|
||||
/**
|
||||
* X position of the filter widget.
|
||||
*/
|
||||
private static final int FILTER_WIDGET_POS_X = 123;
|
||||
|
||||
/**
|
||||
* Y position of the filter widget.
|
||||
*/
|
||||
private static final int FILTER_WIDGET_POS_Y = 39;
|
||||
|
||||
/**
|
||||
* The maximum number of characters that can be typed in the amount field.
|
||||
*/
|
||||
private static final int AMOUNT_MAX_CHARS = 10;
|
||||
|
||||
/**
|
||||
* Amount text field
|
||||
*/
|
||||
private DigitTextField amountField;
|
||||
|
||||
/**
|
||||
* AE part associated with the gui.
|
||||
*/
|
||||
private PartEssentiaLevelEmitter part;
|
||||
|
||||
/**
|
||||
* Player viewing the gui.
|
||||
*/
|
||||
private EntityPlayer player;
|
||||
|
||||
/**
|
||||
* Filter slot.
|
||||
*/
|
||||
private WidgetAspectSlot aspectFilterSlot;
|
||||
|
||||
/**
|
||||
* Create the GUI.
|
||||
*
|
||||
* @param part
|
||||
* AE part associated with the gui.
|
||||
* @param player
|
||||
* Player viewing the gui.
|
||||
*/
|
||||
public GuiEssentiaLevelEmitter(final PartEssentiaLevelEmitter part, final EntityPlayer player) {
|
||||
// Call super
|
||||
super(new ContainerPartEssentiaLevelEmitter(part, player));
|
||||
|
||||
// Set the player
|
||||
this.player = player;
|
||||
|
||||
// Set the part
|
||||
this.part = part;
|
||||
|
||||
// Create the filter slot
|
||||
this.aspectFilterSlot = new WidgetAspectSlot(
|
||||
this,
|
||||
this.player,
|
||||
this.part,
|
||||
GuiEssentiaLevelEmitter.FILTER_WIDGET_POS_X,
|
||||
GuiEssentiaLevelEmitter.FILTER_WIDGET_POS_Y);
|
||||
|
||||
// Set the width and height
|
||||
this.xSize = GuiEssentiaLevelEmitter.GUI_WIDTH;
|
||||
this.ySize = GuiEssentiaLevelEmitter.GUI_HEIGHT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the gui background
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(final float alpha, final int mouseX, final int mouseY) {
|
||||
// Full white
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
// Set the texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(GuiTextureManager.ESSENTIA_LEVEL_EMITTER.getTexture());
|
||||
|
||||
// Draw the gui texture.
|
||||
this.drawTexturedModalRect(
|
||||
this.guiLeft, this.guiTop, 0, 0, GuiEssentiaLevelEmitter.GUI_WIDTH, GuiEssentiaLevelEmitter.GUI_HEIGHT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
|
||||
// Draw the title
|
||||
this.fontRendererObj.drawString(
|
||||
AEPartsEnum.EssentiaLevelEmitter.getLocalizedName(),
|
||||
GuiEssentiaLevelEmitter.TITLE_POS_X,
|
||||
GuiEssentiaLevelEmitter.TITLE_POS_Y,
|
||||
0);
|
||||
|
||||
// Draw underlay when mouse is over slot.
|
||||
if (this.aspectFilterSlot.isMouseOverWidget(mouseX, mouseY)) {
|
||||
// Draw underlay
|
||||
this.aspectFilterSlot.drawMouseHoverUnderlay();
|
||||
|
||||
// Get tooltip
|
||||
this.aspectFilterSlot.getTooltip(this.tooltip);
|
||||
}
|
||||
|
||||
// Draw the filter widget
|
||||
this.aspectFilterSlot.drawWidget();
|
||||
|
||||
// Draw the text field
|
||||
this.amountField.drawTextBox();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the player types a key
|
||||
*/
|
||||
@Override
|
||||
protected void keyTyped(final char key, final int keyID) {
|
||||
// Pass to super
|
||||
super.keyTyped(key, keyID);
|
||||
|
||||
// Ensure they was numeric and the string isnt too long to parse, or backspace
|
||||
if ((Character.isDigit(key) && (this.amountField.getText().length() < GuiEssentiaLevelEmitter.AMOUNT_MAX_CHARS))
|
||||
|| (keyID == Keyboard.KEY_BACK)) {
|
||||
// Pass to the amount field
|
||||
this.amountField.textboxKeyTyped(key, keyID);
|
||||
|
||||
// Convert the text field into a long
|
||||
long wantedAmount = 0;
|
||||
try {
|
||||
wantedAmount = Long.parseLong(this.amountField.getText());
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
|
||||
// Update the server
|
||||
Packet_S_EssentiaEmitter.sendWantedAmount(wantedAmount, this.part, this.player);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the player clicks a mouse button
|
||||
*/
|
||||
@Override
|
||||
protected void mouseClicked(final int mouseX, final int mouseY, final int mouseBtn) {
|
||||
// Pass to super
|
||||
super.mouseClicked(mouseX, mouseY, mouseBtn);
|
||||
|
||||
// Is the mouse over the widget?
|
||||
if (this.aspectFilterSlot.isMouseOverWidget(mouseX, mouseY)) {
|
||||
// Pass to the widget
|
||||
this.aspectFilterSlot.mouseClicked(EssentiaItemContainerHelper.INSTANCE.getFilterAspectFromItem(
|
||||
this.draggedStack == null ? this.player.inventory.getItemStack() : this.draggedStack.copy()));
|
||||
}
|
||||
this.draggedStack = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button is clicked.
|
||||
*/
|
||||
@Override
|
||||
protected void onButtonClicked(final GuiButton button, final int mouseButton) {
|
||||
// Get the index of the button that was clicked
|
||||
int index = button.id;
|
||||
|
||||
// Was one of the amount buttons pressed?
|
||||
if ((index >= 0) && (index < GuiEssentiaLevelEmitter.BUTTON_LABELS.length)) {
|
||||
try {
|
||||
// Read the adjustment
|
||||
int adjustment = Integer.parseInt(button.displayString);
|
||||
|
||||
// Update the server
|
||||
Packet_S_EssentiaEmitter.sendWantedAmountDelta(adjustment, this.part, this.player);
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
// Was the redstone mode button pressed?
|
||||
else if (index == GuiEssentiaLevelEmitter.REDSTONE_MODE_BUTTON_INDEX) {
|
||||
// Update the server
|
||||
Packet_S_EssentiaEmitter.sendRedstoneModeToggle(this.part, this.player);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the screen and all the components in it.
|
||||
*/
|
||||
@Override
|
||||
public void drawScreen(final int x, final int y, final float f) {
|
||||
// Call super
|
||||
super.drawScreen(x, y, f);
|
||||
|
||||
// Get the number of buttons
|
||||
int count = GuiEssentiaLevelEmitter.BUTTON_LABELS.length;
|
||||
|
||||
// Loop over the buttons
|
||||
for (int buttonIndex = 0; buttonIndex < count; buttonIndex++) {
|
||||
// Get the button for this index
|
||||
GuiButton currentButton = (GuiButton) this.buttonList.get(buttonIndex);
|
||||
|
||||
// Is shift being held?
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
|
||||
// Shifted label
|
||||
currentButton.displayString = (BUTTON_LABELS_SHIFTED[buttonIndex]);
|
||||
} else {
|
||||
// Normal label
|
||||
currentButton.displayString = (BUTTON_LABELS[buttonIndex]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the gui
|
||||
*/
|
||||
@Override
|
||||
public void initGui() {
|
||||
// Call super
|
||||
super.initGui();
|
||||
|
||||
// Enable repeat keys
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
|
||||
// Create the amount field
|
||||
this.amountField = new DigitTextField(
|
||||
this.fontRendererObj,
|
||||
GuiEssentiaLevelEmitter.AMOUNT_OFFSET_X,
|
||||
GuiEssentiaLevelEmitter.AMOUNT_OFFSET_Y,
|
||||
GuiEssentiaLevelEmitter.AMOUNT_WIDTH,
|
||||
GuiEssentiaLevelEmitter.AMOUNT_HEIGHT);
|
||||
|
||||
// Start focused
|
||||
this.amountField.setFocused(true);
|
||||
|
||||
// Draw in the forground
|
||||
this.amountField.setEnableBackgroundDrawing(false);
|
||||
|
||||
// Text color white
|
||||
this.amountField.setTextColor(0xFFFFFFFF);
|
||||
|
||||
// Reset the button list
|
||||
this.buttonList.clear();
|
||||
|
||||
// Add adjustment buttons
|
||||
for (int row = 0; row < GuiEssentiaLevelEmitter.BUTTON_ROWS; row++) {
|
||||
// Calculate the y position of this row
|
||||
int yPos = (this.guiTop + GuiEssentiaLevelEmitter.BUTTON_POS_Y)
|
||||
+ (row * (GuiEssentiaLevelEmitter.BUTTON_HEIGHT + GuiEssentiaLevelEmitter.BUTTON_PADDING_VERT));
|
||||
|
||||
for (int column = 0; column < GuiEssentiaLevelEmitter.BUTTON_COLUMNS; column++) {
|
||||
// Calculate the button index
|
||||
int buttonIndex = (row * 3) + column;
|
||||
|
||||
// Calculate the x position of the button
|
||||
int xPos = ((this.guiLeft + GuiEssentiaLevelEmitter.BUTTON_POS_X)
|
||||
+ (column
|
||||
* (GuiEssentiaLevelEmitter.BUTTON_WIDTH
|
||||
+ GuiEssentiaLevelEmitter.BUTTON_PADDING_HORZ)));
|
||||
|
||||
this.buttonList.add(new GuiButton(
|
||||
buttonIndex,
|
||||
xPos,
|
||||
yPos,
|
||||
GuiEssentiaLevelEmitter.BUTTON_WIDTH,
|
||||
GuiEssentiaLevelEmitter.BUTTON_HEIGHT,
|
||||
GuiEssentiaLevelEmitter.BUTTON_LABELS[buttonIndex]));
|
||||
}
|
||||
}
|
||||
|
||||
// Add the redstone mode button
|
||||
this.buttonList.add(new GuiButtonRedstoneModes(
|
||||
GuiEssentiaLevelEmitter.REDSTONE_MODE_BUTTON_INDEX,
|
||||
this.guiLeft + GuiEssentiaLevelEmitter.REDSTONE_BUTTON_POS_X,
|
||||
this.guiTop + GuiEssentiaLevelEmitter.REDSTONE_BUTTON_POS_Y,
|
||||
GuiEssentiaLevelEmitter.REDSTONE_BUTTON_SIZE,
|
||||
GuiEssentiaLevelEmitter.REDSTONE_BUTTON_SIZE,
|
||||
RedstoneMode.LOW_SIGNAL,
|
||||
true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the gui is closing.
|
||||
*/
|
||||
@Override
|
||||
public void onGuiClosed() {
|
||||
// Disable repeat keys
|
||||
Keyboard.enableRepeatEvents(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the redstone mode
|
||||
*
|
||||
* @param mode
|
||||
*/
|
||||
public void onReceiveRedstoneMode(final RedstoneMode mode) {
|
||||
((GuiButtonRedstoneModes) this.buttonList.get(GuiEssentiaLevelEmitter.REDSTONE_MODE_BUTTON_INDEX))
|
||||
.setRedstoneMode(mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the amount
|
||||
*
|
||||
* @param amount
|
||||
*/
|
||||
public void onReceiveThresholdValue(final long amount) {
|
||||
this.amountField.setText(Long.toString(amount));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the filtered aspect
|
||||
*/
|
||||
@Override
|
||||
public void updateAspects(final List<Aspect> aspectList) {
|
||||
if ((aspectList == null) || (aspectList.isEmpty())) {
|
||||
this.aspectFilterSlot.setAspect(null);
|
||||
} else {
|
||||
this.aspectFilterSlot.setAspect(aspectList.get(0), 1, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,15 @@
|
||||
package thaumicenergistics.client.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumicenergistics.api.gui.IAspectSlotGui;
|
||||
import thaumicenergistics.client.gui.abstraction.ThEBaseGui;
|
||||
@@ -36,318 +34,309 @@ import thaumicenergistics.common.parts.PartEssentiaStorageBus;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiEssentiaStorageBus
|
||||
extends ThEBaseGui
|
||||
implements IAspectSlotGui
|
||||
{
|
||||
/**
|
||||
* The number of columns in the gui.
|
||||
*/
|
||||
private static final int WIDGET_COLUMNS = 3;
|
||||
public class GuiEssentiaStorageBus extends ThEBaseGui implements IAspectSlotGui {
|
||||
/**
|
||||
* The number of columns in the gui.
|
||||
*/
|
||||
private static final int WIDGET_COLUMNS = 3;
|
||||
|
||||
/**
|
||||
* The number of rows in the gui.
|
||||
*/
|
||||
private static final int WIDGET_ROWS = 3;
|
||||
/**
|
||||
* The number of rows in the gui.
|
||||
*/
|
||||
private static final int WIDGET_ROWS = 3;
|
||||
|
||||
/**
|
||||
* The starting X position of the widgets.
|
||||
*/
|
||||
private static final int WIDGET_X_POS = 61;
|
||||
/**
|
||||
* The starting X position of the widgets.
|
||||
*/
|
||||
private static final int WIDGET_X_POS = 61;
|
||||
|
||||
/**
|
||||
* The starting Y position of the widgets.
|
||||
*/
|
||||
private static final int WIDGET_Y_POS = 21;
|
||||
/**
|
||||
* The starting Y position of the widgets.
|
||||
*/
|
||||
private static final int WIDGET_Y_POS = 21;
|
||||
|
||||
/**
|
||||
* The width of the gui with a network tool.
|
||||
*/
|
||||
private static final int GUI_WIDTH_NETWORK_TOOL = 246;
|
||||
/**
|
||||
* The width of the gui with a network tool.
|
||||
*/
|
||||
private static final int GUI_WIDTH_NETWORK_TOOL = 246;
|
||||
|
||||
/**
|
||||
* The width of the gui without a network too
|
||||
*/
|
||||
private static final int GUI_WIDTH_NO_TOOL = 210;
|
||||
/**
|
||||
* The width of the gui without a network too
|
||||
*/
|
||||
private static final int GUI_WIDTH_NO_TOOL = 210;
|
||||
|
||||
/**
|
||||
* The height of the gui
|
||||
*/
|
||||
private static final int GUI_HEIGHT = 184;
|
||||
/**
|
||||
* The height of the gui
|
||||
*/
|
||||
private static final int GUI_HEIGHT = 184;
|
||||
|
||||
/**
|
||||
* X position of the title string.
|
||||
*/
|
||||
private static final int TITLE_X_POS = 6;
|
||||
/**
|
||||
* X position of the title string.
|
||||
*/
|
||||
private static final int TITLE_X_POS = 6;
|
||||
|
||||
/**
|
||||
* Y position of the title string.
|
||||
*/
|
||||
private static final int TITLE_Y_POS = 5;
|
||||
/**
|
||||
* Y position of the title string.
|
||||
*/
|
||||
private static final int TITLE_Y_POS = 5;
|
||||
|
||||
/**
|
||||
* ID of the priority button
|
||||
*/
|
||||
private static final int BUTTON_PRIORITY_ID = 0;
|
||||
/**
|
||||
* ID of the priority button
|
||||
*/
|
||||
private static final int BUTTON_PRIORITY_ID = 0;
|
||||
|
||||
/**
|
||||
* X offset position of the priority button
|
||||
*/
|
||||
private static final int BUTTON_PRIORITY_X_POSITION = 154;
|
||||
/**
|
||||
* X offset position of the priority button
|
||||
*/
|
||||
private static final int BUTTON_PRIORITY_X_POSITION = 154;
|
||||
|
||||
private static final int BUTTON_ALLOW_VOID_ID = 1;
|
||||
private static final int BUTTON_ALLOW_VOID_ID = 1;
|
||||
|
||||
private static final int BUTTON_ALLOW_VOID_X_POS = -18;
|
||||
private static final int BUTTON_ALLOW_VOID_X_POS = -18;
|
||||
|
||||
private static final int BUTTON_ALLOW_VOID_Y_POS = 8;
|
||||
private static final int BUTTON_ALLOW_VOID_Y_POS = 8;
|
||||
|
||||
/**
|
||||
* Player viewing this gui.
|
||||
*/
|
||||
private EntityPlayer player;
|
||||
/**
|
||||
* Player viewing this gui.
|
||||
*/
|
||||
private EntityPlayer player;
|
||||
|
||||
/**
|
||||
* Filter widget list
|
||||
*/
|
||||
private List<WidgetAspectSlot> aspectWidgetList = new ArrayList<WidgetAspectSlot>();
|
||||
/**
|
||||
* Filter widget list
|
||||
*/
|
||||
private List<WidgetAspectSlot> aspectWidgetList = new ArrayList<WidgetAspectSlot>();
|
||||
|
||||
/**
|
||||
* Filter aspect list
|
||||
*/
|
||||
private List<Aspect> filteredAspects = new ArrayList<Aspect>();
|
||||
/**
|
||||
* Filter aspect list
|
||||
*/
|
||||
private List<Aspect> filteredAspects = new ArrayList<Aspect>();
|
||||
|
||||
/**
|
||||
* Does the player have a network tool?
|
||||
*/
|
||||
private boolean hasNetworkTool;
|
||||
/**
|
||||
* Does the player have a network tool?
|
||||
*/
|
||||
private boolean hasNetworkTool;
|
||||
|
||||
/**
|
||||
* Storage bus associated with this gui
|
||||
*/
|
||||
private PartEssentiaStorageBus storageBus;
|
||||
/**
|
||||
* Storage bus associated with this gui
|
||||
*/
|
||||
private PartEssentiaStorageBus storageBus;
|
||||
|
||||
/**
|
||||
* Title of the gui
|
||||
*/
|
||||
private final String guiTitle = AEPartsEnum.EssentiaStorageBus.getLocalizedName();
|
||||
/**
|
||||
* Title of the gui
|
||||
*/
|
||||
private final String guiTitle = AEPartsEnum.EssentiaStorageBus.getLocalizedName();
|
||||
|
||||
/**
|
||||
* Is the storage buss allowed to void excess essentia?
|
||||
*/
|
||||
private boolean isVoidAllowed = false;
|
||||
/**
|
||||
* Is the storage buss allowed to void excess essentia?
|
||||
*/
|
||||
private boolean isVoidAllowed = false;
|
||||
|
||||
/**
|
||||
* Creates the GUI.
|
||||
*
|
||||
* @param storageBus
|
||||
* The part associated with the gui.
|
||||
* @param player
|
||||
* The player viewing the gui.
|
||||
* @param container
|
||||
* The inventory container.
|
||||
*/
|
||||
public GuiEssentiaStorageBus( final PartEssentiaStorageBus storageBus, final EntityPlayer player )
|
||||
{
|
||||
// Call super
|
||||
super( new ContainerPartEssentiaStorageBus( storageBus, player ) );
|
||||
/**
|
||||
* Creates the GUI.
|
||||
*
|
||||
* @param storageBus
|
||||
* The part associated with the gui.
|
||||
* @param player
|
||||
* The player viewing the gui.
|
||||
* @param container
|
||||
* The inventory container.
|
||||
*/
|
||||
public GuiEssentiaStorageBus(final PartEssentiaStorageBus storageBus, final EntityPlayer player) {
|
||||
// Call super
|
||||
super(new ContainerPartEssentiaStorageBus(storageBus, player));
|
||||
|
||||
// Set the player
|
||||
this.player = player;
|
||||
// Set the player
|
||||
this.player = player;
|
||||
|
||||
// Set the storage bus
|
||||
this.storageBus = storageBus;
|
||||
// Set the storage bus
|
||||
this.storageBus = storageBus;
|
||||
|
||||
// Set the network tool
|
||||
this.hasNetworkTool = ( (ContainerPartEssentiaStorageBus)this.inventorySlots ).hasNetworkTool();
|
||||
// Set the network tool
|
||||
this.hasNetworkTool = ((ContainerPartEssentiaStorageBus) this.inventorySlots).hasNetworkTool();
|
||||
|
||||
// Set the width and height
|
||||
this.xSize = ( this.hasNetworkTool ? GuiEssentiaStorageBus.GUI_WIDTH_NETWORK_TOOL : GuiEssentiaStorageBus.GUI_WIDTH_NO_TOOL );
|
||||
this.ySize = GuiEssentiaStorageBus.GUI_HEIGHT;
|
||||
}
|
||||
// Set the width and height
|
||||
this.xSize = (this.hasNetworkTool
|
||||
? GuiEssentiaStorageBus.GUI_WIDTH_NETWORK_TOOL
|
||||
: GuiEssentiaStorageBus.GUI_WIDTH_NO_TOOL);
|
||||
this.ySize = GuiEssentiaStorageBus.GUI_HEIGHT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the gui background
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer( final float alpha, final int mouseX, final int mouseY )
|
||||
{
|
||||
// Full white
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
/**
|
||||
* Draws the gui background
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(final float alpha, final int mouseX, final int mouseY) {
|
||||
// Full white
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
// Set the texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture( GuiTextureManager.ESSENTIA_STORAGE_BUS.getTexture() );
|
||||
// Set the texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(GuiTextureManager.ESSENTIA_STORAGE_BUS.getTexture());
|
||||
|
||||
// Draw main gui
|
||||
this.drawTexturedModalRect( this.guiLeft, this.guiTop, 0, 0, 176, 222 );
|
||||
// Draw main gui
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 222);
|
||||
|
||||
// Draw upgrade slot
|
||||
this.drawTexturedModalRect( this.guiLeft + 179, this.guiTop, 179, 0, 32, 32 );
|
||||
// Draw upgrade slot
|
||||
this.drawTexturedModalRect(this.guiLeft + 179, this.guiTop, 179, 0, 32, 32);
|
||||
|
||||
if( this.hasNetworkTool )
|
||||
{
|
||||
this.drawTexturedModalRect( this.guiLeft + 179, this.guiTop + 93, 178, 93, 68, 68 );
|
||||
}
|
||||
if (this.hasNetworkTool) {
|
||||
this.drawTexturedModalRect(this.guiLeft + 179, this.guiTop + 93, 178, 93, 68, 68);
|
||||
}
|
||||
|
||||
// Call super
|
||||
super.drawAEToolAndUpgradeSlots( alpha, mouseX, mouseY );
|
||||
// Call super
|
||||
super.drawAEToolAndUpgradeSlots(alpha, mouseX, mouseY);
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
|
||||
// Call super
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer( final int mouseX, final int mouseY )
|
||||
{
|
||||
// Call super
|
||||
super.drawGuiContainerForegroundLayer( mouseX, mouseY );
|
||||
// Draw the title
|
||||
this.fontRendererObj.drawString(
|
||||
this.guiTitle, GuiEssentiaStorageBus.TITLE_X_POS, GuiEssentiaStorageBus.TITLE_Y_POS, 0x000000);
|
||||
|
||||
// Draw the title
|
||||
this.fontRendererObj.drawString( this.guiTitle, GuiEssentiaStorageBus.TITLE_X_POS, GuiEssentiaStorageBus.TITLE_Y_POS, 0x000000 );
|
||||
WidgetAspectSlot slotUnderMouse = null;
|
||||
|
||||
WidgetAspectSlot slotUnderMouse = null;
|
||||
// Draw widgets
|
||||
for (WidgetAspectSlot currentWidget : this.aspectWidgetList) {
|
||||
if ((slotUnderMouse == null)
|
||||
&& (currentWidget.canRender())
|
||||
&& (currentWidget.isMouseOverWidget(mouseX, mouseY))) {
|
||||
// Draw the underlay
|
||||
currentWidget.drawMouseHoverUnderlay();
|
||||
|
||||
// Draw widgets
|
||||
for( WidgetAspectSlot currentWidget : this.aspectWidgetList )
|
||||
{
|
||||
if( ( slotUnderMouse == null ) && ( currentWidget.canRender() ) && ( currentWidget.isMouseOverWidget( mouseX, mouseY ) ) )
|
||||
{
|
||||
// Draw the underlay
|
||||
currentWidget.drawMouseHoverUnderlay();
|
||||
// Set the slot
|
||||
slotUnderMouse = currentWidget;
|
||||
}
|
||||
|
||||
// Set the slot
|
||||
slotUnderMouse = currentWidget;
|
||||
}
|
||||
// Draw the widget
|
||||
currentWidget.drawWidget();
|
||||
}
|
||||
|
||||
// Draw the widget
|
||||
currentWidget.drawWidget();
|
||||
}
|
||||
// Should we get the tooltip from the slot?
|
||||
if (slotUnderMouse != null) {
|
||||
// Add the tooltip from the widget
|
||||
slotUnderMouse.getTooltip(this.tooltip);
|
||||
}
|
||||
}
|
||||
|
||||
// Should we get the tooltip from the slot?
|
||||
if( slotUnderMouse != null )
|
||||
{
|
||||
// Add the tooltip from the widget
|
||||
slotUnderMouse.getTooltip( this.tooltip );
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void mouseClicked(final int mouseX, final int mouseY, final int mouseButton) {
|
||||
// Call super
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
|
||||
@Override
|
||||
protected void mouseClicked( final int mouseX, final int mouseY, final int mouseButton )
|
||||
{
|
||||
// Call super
|
||||
super.mouseClicked( mouseX, mouseY, mouseButton );
|
||||
for (WidgetAspectSlot aspectSlot : this.aspectWidgetList) {
|
||||
if (aspectSlot.isMouseOverWidget(mouseX, mouseY)) {
|
||||
// Get the aspect of the currently held item
|
||||
Aspect itemAspect = EssentiaItemContainerHelper.INSTANCE.getFilterAspectFromItem(
|
||||
this.draggedStack == null ? this.player.inventory.getItemStack() : this.draggedStack.copy());
|
||||
|
||||
for( WidgetAspectSlot aspectSlot : this.aspectWidgetList )
|
||||
{
|
||||
if( aspectSlot.isMouseOverWidget( mouseX, mouseY ) )
|
||||
{
|
||||
// Get the aspect of the currently held item
|
||||
Aspect itemAspect = EssentiaItemContainerHelper.INSTANCE.getFilterAspectFromItem(this.draggedStack == null ? this.player.inventory.getItemStack() : this.draggedStack.copy());
|
||||
// Is there an aspect?
|
||||
if (itemAspect != null) {
|
||||
// Are we already filtering for this aspect?
|
||||
if (this.filteredAspects.contains(itemAspect)) {
|
||||
// Ignore
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Is there an aspect?
|
||||
if( itemAspect != null )
|
||||
{
|
||||
// Are we already filtering for this aspect?
|
||||
if( this.filteredAspects.contains( itemAspect ) )
|
||||
{
|
||||
// Ignore
|
||||
return;
|
||||
}
|
||||
aspectSlot.mouseClicked(itemAspect);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.draggedStack = null;
|
||||
}
|
||||
|
||||
aspectSlot.mouseClicked( itemAspect );
|
||||
/**
|
||||
* Called when a button is clicked.
|
||||
*/
|
||||
@Override
|
||||
protected void onButtonClicked(final GuiButton button, final int mouseButton) {
|
||||
// Was the priority button clicked?
|
||||
if (button.id == GuiEssentiaStorageBus.BUTTON_PRIORITY_ID) {
|
||||
// Get the storage buses host
|
||||
TileEntity host = this.storageBus.getHostTile();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.draggedStack = null;
|
||||
}
|
||||
// Get the side the storage bus is attached to
|
||||
ForgeDirection side = this.storageBus.getSide();
|
||||
|
||||
/**
|
||||
* Called when a button is clicked.
|
||||
*/
|
||||
@Override
|
||||
protected void onButtonClicked( final GuiButton button, final int mouseButton )
|
||||
{
|
||||
// Was the priority button clicked?
|
||||
if( button.id == GuiEssentiaStorageBus.BUTTON_PRIORITY_ID )
|
||||
{
|
||||
// Get the storage buses host
|
||||
TileEntity host = this.storageBus.getHostTile();
|
||||
// Ask the server to change to the priority gui
|
||||
Packet_S_ChangeGui.sendGuiChange(
|
||||
ThEGuiHandler.generateSidedID(ThEGuiHandler.PRIORITY_ID, side),
|
||||
this.player,
|
||||
host.getWorldObj(),
|
||||
host.xCoord,
|
||||
host.yCoord,
|
||||
host.zCoord);
|
||||
|
||||
// Get the side the storage bus is attached to
|
||||
ForgeDirection side = this.storageBus.getSide();
|
||||
} else if (button.id == GuiEssentiaStorageBus.BUTTON_ALLOW_VOID_ID) {
|
||||
// Toggle the mode
|
||||
this.isVoidAllowed = !this.isVoidAllowed;
|
||||
|
||||
// Ask the server to change to the priority gui
|
||||
Packet_S_ChangeGui.sendGuiChange( ThEGuiHandler.generateSidedID( ThEGuiHandler.PRIORITY_ID, side ), this.player,
|
||||
host.getWorldObj(), host.xCoord, host.yCoord, host.zCoord );
|
||||
// Update the button
|
||||
((GuiButtonAllowVoid) this.buttonList.get(GuiEssentiaStorageBus.BUTTON_ALLOW_VOID_ID))
|
||||
.setIsVoidAllowed(this.isVoidAllowed);
|
||||
|
||||
}
|
||||
else if( button.id == GuiEssentiaStorageBus.BUTTON_ALLOW_VOID_ID )
|
||||
{
|
||||
// Toggle the mode
|
||||
this.isVoidAllowed = !this.isVoidAllowed;
|
||||
// Update the server
|
||||
Packet_S_EssentiaStorageBus.setVoidAllowed(this.player, this.storageBus, this.isVoidAllowed);
|
||||
}
|
||||
}
|
||||
|
||||
// Update the button
|
||||
( (GuiButtonAllowVoid)this.buttonList.get( GuiEssentiaStorageBus.BUTTON_ALLOW_VOID_ID ) ).setIsVoidAllowed( this.isVoidAllowed );
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
// Update the server
|
||||
Packet_S_EssentiaStorageBus.setVoidAllowed( this.player, this.storageBus, this.isVoidAllowed );
|
||||
}
|
||||
// Create the widgets
|
||||
for (int row = 0; row < GuiEssentiaStorageBus.WIDGET_ROWS; row++) {
|
||||
for (int column = 0; column < GuiEssentiaStorageBus.WIDGET_COLUMNS; column++) {
|
||||
this.aspectWidgetList.add(new WidgetAspectSlot(
|
||||
this,
|
||||
this.player,
|
||||
this.storageBus,
|
||||
(row * GuiEssentiaStorageBus.WIDGET_COLUMNS) + column,
|
||||
GuiEssentiaStorageBus.WIDGET_X_POS + (ThEWidget.WIDGET_SIZE * column),
|
||||
GuiEssentiaStorageBus.WIDGET_Y_POS + (ThEWidget.WIDGET_SIZE * row)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// Create the priority tab button
|
||||
this.buttonList.add(new GuiButtonAETab(
|
||||
GuiEssentiaStorageBus.BUTTON_PRIORITY_ID,
|
||||
this.guiLeft + GuiEssentiaStorageBus.BUTTON_PRIORITY_X_POSITION,
|
||||
this.guiTop,
|
||||
AEStateIconsEnum.WRENCH,
|
||||
"gui.appliedenergistics2.Priority"));
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
// Create the allow void button
|
||||
this.buttonList.add(new GuiButtonAllowVoid(
|
||||
GuiEssentiaStorageBus.BUTTON_ALLOW_VOID_ID,
|
||||
this.guiLeft + GuiEssentiaStorageBus.BUTTON_ALLOW_VOID_X_POS,
|
||||
this.guiTop + GuiEssentiaStorageBus.BUTTON_ALLOW_VOID_Y_POS));
|
||||
}
|
||||
|
||||
// Create the widgets
|
||||
for( int row = 0; row < GuiEssentiaStorageBus.WIDGET_ROWS; row++ )
|
||||
{
|
||||
for( int column = 0; column < GuiEssentiaStorageBus.WIDGET_COLUMNS; column++ )
|
||||
{
|
||||
this.aspectWidgetList.add( new WidgetAspectSlot( this, this.player, this.storageBus,
|
||||
( row * GuiEssentiaStorageBus.WIDGET_COLUMNS ) + column,
|
||||
GuiEssentiaStorageBus.WIDGET_X_POS + ( ThEWidget.WIDGET_SIZE * column ),
|
||||
GuiEssentiaStorageBus.WIDGET_Y_POS + ( ThEWidget.WIDGET_SIZE * row ) ) );
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Called when the server has sent a change to void mode.
|
||||
*
|
||||
* @param isVoidAllowed
|
||||
*/
|
||||
public void onServerSentVoidMode(final boolean isVoidAllowed) {
|
||||
// Set the mode
|
||||
this.isVoidAllowed = isVoidAllowed;
|
||||
|
||||
// Create the priority tab button
|
||||
this.buttonList.add( new GuiButtonAETab( GuiEssentiaStorageBus.BUTTON_PRIORITY_ID, this.guiLeft +
|
||||
GuiEssentiaStorageBus.BUTTON_PRIORITY_X_POSITION, this.guiTop, AEStateIconsEnum.WRENCH,
|
||||
"gui.appliedenergistics2.Priority" ) );
|
||||
// Update the button
|
||||
((GuiButtonAllowVoid) this.buttonList.get(GuiEssentiaStorageBus.BUTTON_ALLOW_VOID_ID))
|
||||
.setIsVoidAllowed(this.isVoidAllowed);
|
||||
}
|
||||
|
||||
// Create the allow void button
|
||||
this.buttonList.add( new GuiButtonAllowVoid( GuiEssentiaStorageBus.BUTTON_ALLOW_VOID_ID, this.guiLeft +
|
||||
GuiEssentiaStorageBus.BUTTON_ALLOW_VOID_X_POS, this.guiTop + GuiEssentiaStorageBus.BUTTON_ALLOW_VOID_Y_POS ) );
|
||||
}
|
||||
@Override
|
||||
public void updateAspects(final List<Aspect> aspectList) {
|
||||
int count = Math.min(this.aspectWidgetList.size(), aspectList.size());
|
||||
|
||||
/**
|
||||
* Called when the server has sent a change to void mode.
|
||||
*
|
||||
* @param isVoidAllowed
|
||||
*/
|
||||
public void onServerSentVoidMode( final boolean isVoidAllowed )
|
||||
{
|
||||
// Set the mode
|
||||
this.isVoidAllowed = isVoidAllowed;
|
||||
|
||||
// Update the button
|
||||
( (GuiButtonAllowVoid)this.buttonList.get( GuiEssentiaStorageBus.BUTTON_ALLOW_VOID_ID ) ).setIsVoidAllowed( this.isVoidAllowed );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAspects( final List<Aspect> aspectList )
|
||||
{
|
||||
int count = Math.min( this.aspectWidgetList.size(), aspectList.size() );
|
||||
|
||||
for( int i = 0; i < count; i++ )
|
||||
{
|
||||
this.aspectWidgetList.get( i ).setAspect( aspectList.get( i ), 1, false );
|
||||
}
|
||||
|
||||
this.filteredAspects = aspectList;
|
||||
|
||||
}
|
||||
for (int i = 0; i < count; i++) {
|
||||
this.aspectWidgetList.get(i).setAspect(aspectList.get(i), 1, false);
|
||||
}
|
||||
|
||||
this.filteredAspects = aspectList;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package thaumicenergistics.client.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
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 thaumcraft.api.aspects.Aspect;
|
||||
import thaumicenergistics.client.gui.abstraction.ThEBaseGui;
|
||||
import thaumicenergistics.client.textures.GuiTextureManager;
|
||||
@@ -20,193 +20,220 @@ import thaumicenergistics.common.tiles.TileEssentiaVibrationChamber;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiEssentiaVibrationChamber
|
||||
extends ThEBaseGui
|
||||
{
|
||||
public class GuiEssentiaVibrationChamber extends ThEBaseGui {
|
||||
|
||||
/**
|
||||
* The width & height of the gui
|
||||
*/
|
||||
private static final int GUI_WIDTH = 176, GUI_HEIGHT = 82;
|
||||
/**
|
||||
* The width & height of the gui
|
||||
*/
|
||||
private static final int GUI_WIDTH = 176, GUI_HEIGHT = 82;
|
||||
|
||||
/**
|
||||
* Dimensions and location of the power bar.
|
||||
*/
|
||||
private static final int POWER_POS_X = 96, POWER_POS_Y = 32, POWER_TEX_U = 51, POWER_TEX_V = 83, POWER_WIDTH = 6, POWER_HEIGHT = 18;
|
||||
/**
|
||||
* Dimensions and location of the power bar.
|
||||
*/
|
||||
private static final int POWER_POS_X = 96,
|
||||
POWER_POS_Y = 32,
|
||||
POWER_TEX_U = 51,
|
||||
POWER_TEX_V = 83,
|
||||
POWER_WIDTH = 6,
|
||||
POWER_HEIGHT = 18;
|
||||
|
||||
/**
|
||||
* Dimensions and location of the essentia storage level bar.
|
||||
*/
|
||||
private static final int STORED_POS_X = 62, STORED_POS_Y = 16, STORED_TEX_X = 200, STORED_WIDTH = 8, STORED_HEIGHT = 48;
|
||||
/**
|
||||
* Dimensions and location of the essentia storage level bar.
|
||||
*/
|
||||
private static final int STORED_POS_X = 62,
|
||||
STORED_POS_Y = 16,
|
||||
STORED_TEX_X = 200,
|
||||
STORED_WIDTH = 8,
|
||||
STORED_HEIGHT = 48;
|
||||
|
||||
/**
|
||||
* Dimensions and location of the essentia storage vial.
|
||||
*/
|
||||
private static final int VIAL_POS_X = 61, VIAL_POS_Y = 12, VIAL_TEX_X = 232, VIAL_WIDTH = 11, VIAL_HEIGHT = 56;
|
||||
/**
|
||||
* Dimensions and location of the essentia storage vial.
|
||||
*/
|
||||
private static final int VIAL_POS_X = 61, VIAL_POS_Y = 12, VIAL_TEX_X = 232, VIAL_WIDTH = 11, VIAL_HEIGHT = 56;
|
||||
|
||||
/**
|
||||
* Dimensions and location of the progress fire.
|
||||
*/
|
||||
private static final int FIRE_POS_X = 78, FIRE_POS_Y = 30, FIRE_TEX_X = 177, FIRE_WIDTH = 15, FIRE_HEIGHT = 20;
|
||||
/**
|
||||
* Dimensions and location of the progress fire.
|
||||
*/
|
||||
private static final int FIRE_POS_X = 78, FIRE_POS_Y = 30, FIRE_TEX_X = 177, FIRE_WIDTH = 15, FIRE_HEIGHT = 20;
|
||||
|
||||
/**
|
||||
* Thaumcraft's alchemy furnace GUI texture
|
||||
*/
|
||||
private static final ResourceLocation alchemyFurnaceTexture = new ResourceLocation( "thaumcraft", "textures/gui/gui_alchemyfurnace.png" );
|
||||
/**
|
||||
* Thaumcraft's alchemy furnace GUI texture
|
||||
*/
|
||||
private static final ResourceLocation alchemyFurnaceTexture =
|
||||
new ResourceLocation("thaumcraft", "textures/gui/gui_alchemyfurnace.png");
|
||||
|
||||
/**
|
||||
* Reference to the container.
|
||||
*/
|
||||
private final ContainerEssentiaVibrationChamber container;
|
||||
/**
|
||||
* Reference to the container.
|
||||
*/
|
||||
private final ContainerEssentiaVibrationChamber container;
|
||||
|
||||
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 ) );
|
||||
this.container = (ContainerEssentiaVibrationChamber)this.inventorySlots;
|
||||
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));
|
||||
this.container = (ContainerEssentiaVibrationChamber) this.inventorySlots;
|
||||
|
||||
// Set the width and height
|
||||
this.xSize = GuiEssentiaVibrationChamber.GUI_WIDTH;
|
||||
this.ySize = GuiEssentiaVibrationChamber.GUI_HEIGHT;
|
||||
}
|
||||
// Set the width and height
|
||||
this.xSize = GuiEssentiaVibrationChamber.GUI_WIDTH;
|
||||
this.ySize = GuiEssentiaVibrationChamber.GUI_HEIGHT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws elements from the Thaumcraft texture.
|
||||
*/
|
||||
private void drawTC_Textures()
|
||||
{
|
||||
// Bind the alchemy furnace gui texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture( GuiEssentiaVibrationChamber.alchemyFurnaceTexture );
|
||||
/**
|
||||
* Draws elements from the Thaumcraft texture.
|
||||
*/
|
||||
private void drawTC_Textures() {
|
||||
// Bind the alchemy furnace gui texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(GuiEssentiaVibrationChamber.alchemyFurnaceTexture);
|
||||
|
||||
// Draw stored essentia amount underlay
|
||||
int storedHeightOffset = (int)( GuiEssentiaVibrationChamber.STORED_HEIGHT * this.container.getStoredEssentiaPercent() );
|
||||
// Draw stored essentia amount underlay
|
||||
int storedHeightOffset =
|
||||
(int) (GuiEssentiaVibrationChamber.STORED_HEIGHT * this.container.getStoredEssentiaPercent());
|
||||
|
||||
this.drawTexturedModalRect( this.guiLeft + GuiEssentiaVibrationChamber.STORED_POS_X, this.guiTop + GuiEssentiaVibrationChamber.STORED_POS_Y +
|
||||
storedHeightOffset,
|
||||
GuiEssentiaVibrationChamber.STORED_TEX_X, storedHeightOffset, GuiEssentiaVibrationChamber.STORED_WIDTH,
|
||||
GuiEssentiaVibrationChamber.STORED_HEIGHT - storedHeightOffset );
|
||||
this.drawTexturedModalRect(
|
||||
this.guiLeft + GuiEssentiaVibrationChamber.STORED_POS_X,
|
||||
this.guiTop + GuiEssentiaVibrationChamber.STORED_POS_Y + storedHeightOffset,
|
||||
GuiEssentiaVibrationChamber.STORED_TEX_X,
|
||||
storedHeightOffset,
|
||||
GuiEssentiaVibrationChamber.STORED_WIDTH,
|
||||
GuiEssentiaVibrationChamber.STORED_HEIGHT - storedHeightOffset);
|
||||
|
||||
// Enable alpha blending
|
||||
GL11.glEnable( GL11.GL_BLEND );
|
||||
// Enable alpha blending
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
// Set the blending mode
|
||||
GL11.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );
|
||||
// Set the blending mode
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
// Draw stored essentia amount overlay (Vial)
|
||||
this.drawTexturedModalRect( this.guiLeft + GuiEssentiaVibrationChamber.VIAL_POS_X, this.guiTop + GuiEssentiaVibrationChamber.VIAL_POS_Y,
|
||||
GuiEssentiaVibrationChamber.VIAL_TEX_X, 0, GuiEssentiaVibrationChamber.VIAL_WIDTH, GuiEssentiaVibrationChamber.VIAL_HEIGHT );
|
||||
// Draw stored essentia amount overlay (Vial)
|
||||
this.drawTexturedModalRect(
|
||||
this.guiLeft + GuiEssentiaVibrationChamber.VIAL_POS_X,
|
||||
this.guiTop + GuiEssentiaVibrationChamber.VIAL_POS_Y,
|
||||
GuiEssentiaVibrationChamber.VIAL_TEX_X,
|
||||
0,
|
||||
GuiEssentiaVibrationChamber.VIAL_WIDTH,
|
||||
GuiEssentiaVibrationChamber.VIAL_HEIGHT);
|
||||
|
||||
// Draw fire/progress
|
||||
int progressHeightOffset = (int)( GuiEssentiaVibrationChamber.FIRE_HEIGHT * this.container.getTicksRemainingPercent() );
|
||||
// Draw fire/progress
|
||||
int progressHeightOffset =
|
||||
(int) (GuiEssentiaVibrationChamber.FIRE_HEIGHT * this.container.getTicksRemainingPercent());
|
||||
|
||||
this.drawTexturedModalRect( this.guiLeft + GuiEssentiaVibrationChamber.FIRE_POS_X, this.guiTop + GuiEssentiaVibrationChamber.FIRE_POS_Y +
|
||||
progressHeightOffset,
|
||||
GuiEssentiaVibrationChamber.FIRE_TEX_X, progressHeightOffset, GuiEssentiaVibrationChamber.FIRE_WIDTH,
|
||||
GuiEssentiaVibrationChamber.FIRE_HEIGHT - progressHeightOffset );
|
||||
this.drawTexturedModalRect(
|
||||
this.guiLeft + GuiEssentiaVibrationChamber.FIRE_POS_X,
|
||||
this.guiTop + GuiEssentiaVibrationChamber.FIRE_POS_Y + progressHeightOffset,
|
||||
GuiEssentiaVibrationChamber.FIRE_TEX_X,
|
||||
progressHeightOffset,
|
||||
GuiEssentiaVibrationChamber.FIRE_WIDTH,
|
||||
GuiEssentiaVibrationChamber.FIRE_HEIGHT - progressHeightOffset);
|
||||
|
||||
// Disable blending
|
||||
GL11.glDisable( GL11.GL_BLEND );
|
||||
}
|
||||
// Disable blending
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws elements from the Thaumic Energistics texture.
|
||||
*/
|
||||
private void drawThE_Textures()
|
||||
{
|
||||
/**
|
||||
* Draws elements from the Thaumic Energistics texture.
|
||||
*/
|
||||
private void drawThE_Textures() {
|
||||
|
||||
// Bind the chamber gui texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture( GuiTextureManager.ESSENTIA_VIBRATION_CHAMBER.getTexture() );
|
||||
// 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 );
|
||||
// Draw the GUI
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
// Calculate the height
|
||||
int powerBarHeightOffset = (int)( GuiEssentiaVibrationChamber.POWER_HEIGHT * this.container.getPowerPercent() );
|
||||
// Calculate the height
|
||||
int powerBarHeightOffset = (int) (GuiEssentiaVibrationChamber.POWER_HEIGHT * this.container.getPowerPercent());
|
||||
|
||||
// Draw the power bar
|
||||
this.drawTexturedModalRect(
|
||||
this.guiLeft + GuiEssentiaVibrationChamber.POWER_POS_X,
|
||||
this.guiTop + GuiEssentiaVibrationChamber.POWER_POS_Y + powerBarHeightOffset,
|
||||
GuiEssentiaVibrationChamber.POWER_TEX_U,
|
||||
GuiEssentiaVibrationChamber.POWER_TEX_V + powerBarHeightOffset,
|
||||
GuiEssentiaVibrationChamber.POWER_WIDTH,
|
||||
GuiEssentiaVibrationChamber.POWER_HEIGHT - powerBarHeightOffset );
|
||||
// Draw the power bar
|
||||
this.drawTexturedModalRect(
|
||||
this.guiLeft + GuiEssentiaVibrationChamber.POWER_POS_X,
|
||||
this.guiTop + GuiEssentiaVibrationChamber.POWER_POS_Y + powerBarHeightOffset,
|
||||
GuiEssentiaVibrationChamber.POWER_TEX_U,
|
||||
GuiEssentiaVibrationChamber.POWER_TEX_V + powerBarHeightOffset,
|
||||
GuiEssentiaVibrationChamber.POWER_WIDTH,
|
||||
GuiEssentiaVibrationChamber.POWER_HEIGHT - powerBarHeightOffset);
|
||||
}
|
||||
|
||||
}
|
||||
@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);
|
||||
|
||||
@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 );
|
||||
// Draw from the thaumic energistics texture
|
||||
this.drawThE_Textures();
|
||||
|
||||
// Draw from the thaumic energistics texture
|
||||
this.drawThE_Textures();
|
||||
// Draw from the thaumcraft texture
|
||||
this.drawTC_Textures();
|
||||
}
|
||||
|
||||
// Draw from the thaumcraft texture
|
||||
this.drawTC_Textures();
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
|
||||
// Is the mouse over the essentia storage?
|
||||
if (ThEGuiHelper.INSTANCE.isPointInGuiRegion(
|
||||
GuiEssentiaVibrationChamber.VIAL_POS_Y,
|
||||
GuiEssentiaVibrationChamber.VIAL_POS_X,
|
||||
GuiEssentiaVibrationChamber.VIAL_HEIGHT,
|
||||
GuiEssentiaVibrationChamber.VIAL_WIDTH,
|
||||
mouseX,
|
||||
mouseY,
|
||||
this.guiLeft,
|
||||
this.guiTop)) {
|
||||
// Get the stored Aspect
|
||||
Aspect storedAspect = this.container.getStoredEssentiaAspect();
|
||||
|
||||
}
|
||||
// Get the stored amount
|
||||
int storedAmount = this.container.getStoredEssentiaAmount();
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer( final int mouseX, final int mouseY )
|
||||
{
|
||||
// Is the mouse over the essentia storage?
|
||||
if( ThEGuiHelper.INSTANCE.isPointInGuiRegion( GuiEssentiaVibrationChamber.VIAL_POS_Y, GuiEssentiaVibrationChamber.VIAL_POS_X,
|
||||
GuiEssentiaVibrationChamber.VIAL_HEIGHT, GuiEssentiaVibrationChamber.VIAL_WIDTH, mouseX, mouseY, this.guiLeft, this.guiTop ) )
|
||||
{
|
||||
// Get the stored Aspect
|
||||
Aspect storedAspect = this.container.getStoredEssentiaAspect();
|
||||
// Anything stored?
|
||||
if ((storedAmount > 0) && (storedAspect != null)) {
|
||||
// Add stored info
|
||||
this.tooltip.add(String.format("%s x %d", storedAspect.getName(), storedAmount));
|
||||
} else {
|
||||
// Empty
|
||||
this.tooltip.add("Empty");
|
||||
}
|
||||
}
|
||||
// Is the mouse over the fire?
|
||||
else if (ThEGuiHelper.INSTANCE.isPointInGuiRegion(
|
||||
GuiEssentiaVibrationChamber.FIRE_POS_Y,
|
||||
GuiEssentiaVibrationChamber.FIRE_POS_X,
|
||||
GuiEssentiaVibrationChamber.FIRE_HEIGHT,
|
||||
GuiEssentiaVibrationChamber.FIRE_WIDTH,
|
||||
mouseX,
|
||||
mouseY,
|
||||
this.guiLeft,
|
||||
this.guiTop)) {
|
||||
// Get the aspect being processed
|
||||
Aspect processingAspect = this.container.getProcessingAspect();
|
||||
|
||||
// Get the stored amount
|
||||
int storedAmount = this.container.getStoredEssentiaAmount();
|
||||
// Anything being processed?
|
||||
if (processingAspect != null) {
|
||||
// Calculate the seconds remaining
|
||||
float secondsRemaining = (this.container.getTicksRemaining() / 20.0F);
|
||||
|
||||
// Anything stored?
|
||||
if( ( storedAmount > 0 ) && ( storedAspect != null ) )
|
||||
{
|
||||
// Add stored info
|
||||
this.tooltip.add( String.format( "%s x %d", storedAspect.getName(), storedAmount ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Empty
|
||||
this.tooltip.add( "Empty" );
|
||||
}
|
||||
}
|
||||
// Is the mouse over the fire?
|
||||
else if( ThEGuiHelper.INSTANCE.isPointInGuiRegion( GuiEssentiaVibrationChamber.FIRE_POS_Y, GuiEssentiaVibrationChamber.FIRE_POS_X,
|
||||
GuiEssentiaVibrationChamber.FIRE_HEIGHT, GuiEssentiaVibrationChamber.FIRE_WIDTH, mouseX, mouseY, this.guiLeft, this.guiTop ) )
|
||||
{
|
||||
// Get the aspect being processed
|
||||
Aspect processingAspect = this.container.getProcessingAspect();
|
||||
// Add the aspect
|
||||
this.tooltip.add(String.format("Processing: %s", processingAspect.getName()));
|
||||
|
||||
// Anything being processed?
|
||||
if( processingAspect != null )
|
||||
{
|
||||
// Calculate the seconds remaining
|
||||
float secondsRemaining = ( this.container.getTicksRemaining() / 20.0F );
|
||||
|
||||
// Add the aspect
|
||||
this.tooltip.add( String.format( "Processing: %s", processingAspect.getName() ) );
|
||||
|
||||
// Add the time
|
||||
this.tooltip.add( String.format( "Time Remaining: %.0fs", secondsRemaining ) );
|
||||
}
|
||||
}
|
||||
// Is the mouse over the power bar?
|
||||
else if( ThEGuiHelper.INSTANCE.isPointInGuiRegion( GuiEssentiaVibrationChamber.POWER_POS_Y, GuiEssentiaVibrationChamber.POWER_POS_X,
|
||||
GuiEssentiaVibrationChamber.POWER_HEIGHT, GuiEssentiaVibrationChamber.POWER_WIDTH, mouseX, mouseY, this.guiLeft, this.guiTop ) )
|
||||
{
|
||||
// Add the power per tick
|
||||
this.tooltip.add( String.format( "%.0f AE/t", this.container.getPowerPerTick() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
// Call super
|
||||
super.initGui();
|
||||
}
|
||||
// Add the time
|
||||
this.tooltip.add(String.format("Time Remaining: %.0fs", secondsRemaining));
|
||||
}
|
||||
}
|
||||
// Is the mouse over the power bar?
|
||||
else if (ThEGuiHelper.INSTANCE.isPointInGuiRegion(
|
||||
GuiEssentiaVibrationChamber.POWER_POS_Y,
|
||||
GuiEssentiaVibrationChamber.POWER_POS_X,
|
||||
GuiEssentiaVibrationChamber.POWER_HEIGHT,
|
||||
GuiEssentiaVibrationChamber.POWER_WIDTH,
|
||||
mouseX,
|
||||
mouseY,
|
||||
this.guiLeft,
|
||||
this.guiTop)) {
|
||||
// Add the power per tick
|
||||
this.tooltip.add(String.format("%.0f AE/t", this.container.getPowerPerTick()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
// Call super
|
||||
super.initGui();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package thaumicenergistics.client.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -8,6 +7,7 @@ import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumicenergistics.client.gui.abstraction.ThEBaseGui;
|
||||
import thaumicenergistics.client.gui.buttons.GuiButtonClearCraftingGrid;
|
||||
import thaumicenergistics.client.gui.buttons.GuiButtonSaveDelete;
|
||||
@@ -26,267 +26,266 @@ import thaumicenergistics.common.tiles.TileKnowledgeInscriber;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiKnowledgeInscriber
|
||||
extends ThEBaseGui
|
||||
{
|
||||
/**
|
||||
* Gui size.
|
||||
*/
|
||||
private static final int GUI_WIDTH = 210;
|
||||
public class GuiKnowledgeInscriber extends ThEBaseGui {
|
||||
/**
|
||||
* Gui size.
|
||||
*/
|
||||
private static final int GUI_WIDTH = 210;
|
||||
|
||||
/**
|
||||
* Gui size.
|
||||
*/
|
||||
private static final int GUI_HEIGHT = 244;
|
||||
/**
|
||||
* Gui size.
|
||||
*/
|
||||
private static final int GUI_HEIGHT = 244;
|
||||
|
||||
/**
|
||||
* Save/Delete button position.
|
||||
*/
|
||||
private static final int BUTTON_SAVE_POS_X = 141;
|
||||
/**
|
||||
* Save/Delete button position.
|
||||
*/
|
||||
private static final int BUTTON_SAVE_POS_X = 141;
|
||||
|
||||
/**
|
||||
* Save/Delete button position.
|
||||
*/
|
||||
private static final int BUTTON_SAVE_POS_Y = 109;
|
||||
/**
|
||||
* Save/Delete button position.
|
||||
*/
|
||||
private static final int BUTTON_SAVE_POS_Y = 109;
|
||||
|
||||
/**
|
||||
* Clear button position.
|
||||
*/
|
||||
private static final int BUTTON_CLEAR_POS_X = 80;
|
||||
/**
|
||||
* Clear button position.
|
||||
*/
|
||||
private static final int BUTTON_CLEAR_POS_X = 80;
|
||||
|
||||
/**
|
||||
* Clear button position.
|
||||
*/
|
||||
private static final int BUTTON_CLEAR_POS_Y = 89;
|
||||
/**
|
||||
* Clear button position.
|
||||
*/
|
||||
private static final int BUTTON_CLEAR_POS_Y = 89;
|
||||
|
||||
/**
|
||||
* Position of the title string.
|
||||
*/
|
||||
private static final int TITLE_POS_X = 6;
|
||||
/**
|
||||
* Position of the title string.
|
||||
*/
|
||||
private static final int TITLE_POS_X = 6;
|
||||
|
||||
/**
|
||||
* Position of the title string.
|
||||
*/
|
||||
private static final int TITLE_POS_Y = 6;
|
||||
/**
|
||||
* Position of the title string.
|
||||
*/
|
||||
private static final int TITLE_POS_Y = 6;
|
||||
|
||||
/**
|
||||
* Player viewing the GUI.
|
||||
*/
|
||||
private final EntityPlayer player;
|
||||
/**
|
||||
* Player viewing the GUI.
|
||||
*/
|
||||
private final EntityPlayer player;
|
||||
|
||||
/**
|
||||
* Save particles
|
||||
*/
|
||||
private final GuiParticleAnimator[] particles;
|
||||
/**
|
||||
* Save particles
|
||||
*/
|
||||
private final GuiParticleAnimator[] particles;
|
||||
|
||||
/**
|
||||
* GUI Title
|
||||
*/
|
||||
private final String title;
|
||||
/**
|
||||
* GUI Title
|
||||
*/
|
||||
private final String title;
|
||||
|
||||
/**
|
||||
* Save / Delete button.
|
||||
*/
|
||||
private GuiButtonSaveDelete buttonSave;
|
||||
/**
|
||||
* Save / Delete button.
|
||||
*/
|
||||
private GuiButtonSaveDelete buttonSave;
|
||||
|
||||
/**
|
||||
* Clear grid button.
|
||||
*/
|
||||
private GuiButtonClearCraftingGrid buttonClear;
|
||||
/**
|
||||
* Clear grid button.
|
||||
*/
|
||||
private GuiButtonClearCraftingGrid buttonClear;
|
||||
|
||||
/**
|
||||
* State of the save button.
|
||||
*/
|
||||
private CoreSaveState saveState = CoreSaveState.Disabled_MissingCore;
|
||||
/**
|
||||
* State of the save button.
|
||||
*/
|
||||
private CoreSaveState saveState = CoreSaveState.Disabled_MissingCore;
|
||||
|
||||
/**
|
||||
* True if particles need to be drawn.
|
||||
*/
|
||||
private boolean hasParticlesToDraw = false;
|
||||
/**
|
||||
* True if particles need to be drawn.
|
||||
*/
|
||||
private boolean hasParticlesToDraw = false;
|
||||
|
||||
public GuiKnowledgeInscriber( final EntityPlayer player, final World world, final int x, final int y, final int z )
|
||||
{
|
||||
// Call super
|
||||
super( new ContainerKnowledgeInscriber( player, world, x, y, z ) );
|
||||
public GuiKnowledgeInscriber(final EntityPlayer player, final World world, final int x, final int y, final int z) {
|
||||
// Call super
|
||||
super(new ContainerKnowledgeInscriber(player, world, x, y, z));
|
||||
|
||||
// Set the player
|
||||
this.player = player;
|
||||
// Set the player
|
||||
this.player = player;
|
||||
|
||||
// Set the GUI size
|
||||
this.xSize = GuiKnowledgeInscriber.GUI_WIDTH;
|
||||
this.ySize = GuiKnowledgeInscriber.GUI_HEIGHT;
|
||||
// Set the GUI size
|
||||
this.xSize = GuiKnowledgeInscriber.GUI_WIDTH;
|
||||
this.ySize = GuiKnowledgeInscriber.GUI_HEIGHT;
|
||||
|
||||
// Set title
|
||||
this.title = ThEStrings.Block_KnowledgeInscriber.getLocalized();
|
||||
// Set title
|
||||
this.title = ThEStrings.Block_KnowledgeInscriber.getLocalized();
|
||||
|
||||
// Setup the particles
|
||||
this.particles = new GuiParticleAnimator[ContainerKnowledgeInscriber.CRAFTING_COLS * ContainerKnowledgeInscriber.CRAFTING_ROWS];
|
||||
for( int index = 0; index < this.particles.length; ++index )
|
||||
{
|
||||
this.particles[index] = this.createSaveParticle( index );
|
||||
}
|
||||
}
|
||||
// Setup the particles
|
||||
this.particles = new GuiParticleAnimator
|
||||
[ContainerKnowledgeInscriber.CRAFTING_COLS * ContainerKnowledgeInscriber.CRAFTING_ROWS];
|
||||
for (int index = 0; index < this.particles.length; ++index) {
|
||||
this.particles[index] = this.createSaveParticle(index);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a particle for the specified slot number.
|
||||
*
|
||||
* @param slotNumber
|
||||
* @return
|
||||
*/
|
||||
private GuiParticleAnimator createSaveParticle( final int slotNumber )
|
||||
{
|
||||
int startX = ContainerKnowledgeInscriber.CRAFTING_SLOT_X +
|
||||
( ( slotNumber % ContainerKnowledgeInscriber.CRAFTING_COLS ) * ContainerKnowledgeInscriber.CRAFTING_SLOT_SPACING );
|
||||
/**
|
||||
* Creates a particle for the specified slot number.
|
||||
*
|
||||
* @param slotNumber
|
||||
* @return
|
||||
*/
|
||||
private GuiParticleAnimator createSaveParticle(final int slotNumber) {
|
||||
int startX = ContainerKnowledgeInscriber.CRAFTING_SLOT_X
|
||||
+ ((slotNumber % ContainerKnowledgeInscriber.CRAFTING_COLS)
|
||||
* ContainerKnowledgeInscriber.CRAFTING_SLOT_SPACING);
|
||||
|
||||
int startY = ContainerKnowledgeInscriber.CRAFTING_SLOT_Y +
|
||||
( ( slotNumber / ContainerKnowledgeInscriber.CRAFTING_COLS ) * ContainerKnowledgeInscriber.CRAFTING_SLOT_SPACING );
|
||||
int startY = ContainerKnowledgeInscriber.CRAFTING_SLOT_Y
|
||||
+ ((slotNumber / ContainerKnowledgeInscriber.CRAFTING_COLS)
|
||||
* ContainerKnowledgeInscriber.CRAFTING_SLOT_SPACING);
|
||||
|
||||
// Create the animator
|
||||
GuiParticleAnimator gpa = new GuiParticleAnimator( startX, startY,
|
||||
ContainerKnowledgeInscriber.KCORE_SLOT_X, ContainerKnowledgeInscriber.KCORE_SLOT_Y,
|
||||
0.4f, EnumGuiParticles.Knowledge );
|
||||
// Create the animator
|
||||
GuiParticleAnimator gpa = new GuiParticleAnimator(
|
||||
startX,
|
||||
startY,
|
||||
ContainerKnowledgeInscriber.KCORE_SLOT_X,
|
||||
ContainerKnowledgeInscriber.KCORE_SLOT_Y,
|
||||
0.4f,
|
||||
EnumGuiParticles.Knowledge);
|
||||
|
||||
// Set color
|
||||
gpa.setColor( 0.2f, 0.5f, 1.0f );
|
||||
// Set color
|
||||
gpa.setColor(0.2f, 0.5f, 1.0f);
|
||||
|
||||
// Set delay
|
||||
gpa.setDelayTime( slotNumber * 50L );
|
||||
// Set delay
|
||||
gpa.setDelayTime(slotNumber * 50L);
|
||||
|
||||
return gpa;
|
||||
}
|
||||
return gpa;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws all save particles.
|
||||
*/
|
||||
private void drawSaveParticles()
|
||||
{
|
||||
// Assume all particles are drawn
|
||||
this.hasParticlesToDraw = false;
|
||||
/**
|
||||
* Draws all save particles.
|
||||
*/
|
||||
private void drawSaveParticles() {
|
||||
// Assume all particles are drawn
|
||||
this.hasParticlesToDraw = false;
|
||||
|
||||
EnumGuiParticles.Knowledge.prepareDraw();
|
||||
for( int index = 0; index < this.particles.length; ++index )
|
||||
{
|
||||
// Draw the particle
|
||||
this.hasParticlesToDraw |= this.particles[index].draw( this, false );
|
||||
}
|
||||
EnumGuiParticles.finishDraw();
|
||||
}
|
||||
EnumGuiParticles.Knowledge.prepareDraw();
|
||||
for (int index = 0; index < this.particles.length; ++index) {
|
||||
// Draw the particle
|
||||
this.hasParticlesToDraw |= this.particles[index].draw(this, false);
|
||||
}
|
||||
EnumGuiParticles.finishDraw();
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw background
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer( final float alpha, final int mouseX, final int mouseY )
|
||||
{
|
||||
// Calculate the color shifts
|
||||
long slowTime = ( System.currentTimeMillis() / 100 );
|
||||
float redBounce = Math.abs( 1.0F - ( ( ( slowTime % 50 ) / 50.0F ) * 2.0F ) );
|
||||
float greenBounce = 1.0F - redBounce;
|
||||
/**
|
||||
* Draw background
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(final float alpha, final int mouseX, final int mouseY) {
|
||||
// Calculate the color shifts
|
||||
long slowTime = (System.currentTimeMillis() / 100);
|
||||
float redBounce = Math.abs(1.0F - (((slowTime % 50) / 50.0F) * 2.0F));
|
||||
float greenBounce = 1.0F - redBounce;
|
||||
|
||||
// Shift color
|
||||
GL11.glColor4f( redBounce, greenBounce, 1.0F, 1.0F );
|
||||
// Shift color
|
||||
GL11.glColor4f(redBounce, greenBounce, 1.0F, 1.0F);
|
||||
|
||||
// Bind the research background
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture( new ResourceLocation( ThaumicEnergistics.MOD_ID,
|
||||
"textures/research/Research.Background.png" ) );
|
||||
// Bind the research background
|
||||
Minecraft.getMinecraft()
|
||||
.renderEngine
|
||||
.bindTexture(
|
||||
new ResourceLocation(ThaumicEnergistics.MOD_ID, "textures/research/Research.Background.png"));
|
||||
|
||||
// Calculate the X position
|
||||
int xpos = (int)( slowTime % 10 );
|
||||
// Calculate the X position
|
||||
int xpos = (int) (slowTime % 10);
|
||||
|
||||
// Draw the background
|
||||
this.drawTexturedModalRect( this.guiLeft + 80, this.guiTop + 106, 55 - xpos, 25, 35, 20 );
|
||||
// Draw the background
|
||||
this.drawTexturedModalRect(this.guiLeft + 80, this.guiTop + 106, 55 - xpos, 25, 35, 20);
|
||||
|
||||
// Full white
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
// Full white
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
// Bind the workbench gui texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture( GuiTextureManager.KNOWLEDGE_INSCRIBER.getTexture() );
|
||||
// Bind the workbench gui texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(GuiTextureManager.KNOWLEDGE_INSCRIBER.getTexture());
|
||||
|
||||
// Draw the gui texture
|
||||
this.drawTexturedModalRect( this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize );
|
||||
}
|
||||
// Draw the gui texture
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer( final int mouseX, final int mouseY )
|
||||
{
|
||||
// Draw the title
|
||||
this.fontRendererObj.drawString( this.title, GuiKnowledgeInscriber.TITLE_POS_X, GuiKnowledgeInscriber.TITLE_POS_Y, 0 );
|
||||
/**
|
||||
* Draw the foreground
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
|
||||
// Draw the title
|
||||
this.fontRendererObj.drawString(
|
||||
this.title, GuiKnowledgeInscriber.TITLE_POS_X, GuiKnowledgeInscriber.TITLE_POS_Y, 0);
|
||||
|
||||
// Any particles to draw?
|
||||
if( this.hasParticlesToDraw )
|
||||
{
|
||||
this.drawSaveParticles();
|
||||
}
|
||||
}
|
||||
// Any particles to draw?
|
||||
if (this.hasParticlesToDraw) {
|
||||
this.drawSaveParticles();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onButtonClicked( final GuiButton button, final int mouseButton )
|
||||
{
|
||||
// Was the clicked button the save button?
|
||||
if( button == this.buttonSave )
|
||||
{
|
||||
// Send the request to the server
|
||||
Packet_S_KnowledgeInscriber.sendSaveDelete( this.player );
|
||||
}
|
||||
else if( button == this.buttonClear )
|
||||
{
|
||||
// Send the request to the server
|
||||
Packet_S_KnowledgeInscriber.sendClearGrid( this.player );
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void onButtonClicked(final GuiButton button, final int mouseButton) {
|
||||
// Was the clicked button the save button?
|
||||
if (button == this.buttonSave) {
|
||||
// Send the request to the server
|
||||
Packet_S_KnowledgeInscriber.sendSaveDelete(this.player);
|
||||
} else if (button == this.buttonClear) {
|
||||
// Send the request to the server
|
||||
Packet_S_KnowledgeInscriber.sendClearGrid(this.player);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
// Call super
|
||||
super.initGui();
|
||||
@Override
|
||||
public void initGui() {
|
||||
// Call super
|
||||
super.initGui();
|
||||
|
||||
this.buttonList.clear();
|
||||
this.buttonList.clear();
|
||||
|
||||
// Create the save/delete button
|
||||
this.buttonSave = new GuiButtonSaveDelete( 0, this.guiLeft + GuiKnowledgeInscriber.BUTTON_SAVE_POS_X,
|
||||
this.guiTop + GuiKnowledgeInscriber.BUTTON_SAVE_POS_Y, this.saveState );
|
||||
this.buttonList.add( this.buttonSave );
|
||||
// Create the save/delete button
|
||||
this.buttonSave = new GuiButtonSaveDelete(
|
||||
0,
|
||||
this.guiLeft + GuiKnowledgeInscriber.BUTTON_SAVE_POS_X,
|
||||
this.guiTop + GuiKnowledgeInscriber.BUTTON_SAVE_POS_Y,
|
||||
this.saveState);
|
||||
this.buttonList.add(this.buttonSave);
|
||||
|
||||
// Create the clear grid button
|
||||
this.buttonClear = new GuiButtonClearCraftingGrid( 1, this.guiLeft + GuiKnowledgeInscriber.BUTTON_CLEAR_POS_X,
|
||||
this.guiTop + GuiKnowledgeInscriber.BUTTON_CLEAR_POS_Y, 8, 8, false );
|
||||
this.buttonList.add( this.buttonClear );
|
||||
// Create the clear grid button
|
||||
this.buttonClear = new GuiButtonClearCraftingGrid(
|
||||
1,
|
||||
this.guiLeft + GuiKnowledgeInscriber.BUTTON_CLEAR_POS_X,
|
||||
this.guiTop + GuiKnowledgeInscriber.BUTTON_CLEAR_POS_Y,
|
||||
8,
|
||||
8,
|
||||
false);
|
||||
this.buttonList.add(this.buttonClear);
|
||||
|
||||
// Request full update
|
||||
Packet_S_KnowledgeInscriber.sendFullUpdateRequest( this.player );
|
||||
}
|
||||
// Request full update
|
||||
Packet_S_KnowledgeInscriber.sendFullUpdateRequest(this.player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the server sends a change in the save/load button
|
||||
* functionality.
|
||||
*
|
||||
* @param saveState
|
||||
* @param justSaved
|
||||
*/
|
||||
public void onReceiveSaveState( final CoreSaveState saveState, final boolean justSaved )
|
||||
{
|
||||
// Set the state
|
||||
this.saveState = saveState;
|
||||
/**
|
||||
* Called when the server sends a change in the save/load button
|
||||
* functionality.
|
||||
*
|
||||
* @param saveState
|
||||
* @param justSaved
|
||||
*/
|
||||
public void onReceiveSaveState(final CoreSaveState saveState, final boolean justSaved) {
|
||||
// Set the state
|
||||
this.saveState = saveState;
|
||||
|
||||
// Update the button
|
||||
if( this.buttonSave != null )
|
||||
{
|
||||
this.buttonSave.setSaveState( saveState );
|
||||
}
|
||||
// Update the button
|
||||
if (this.buttonSave != null) {
|
||||
this.buttonSave.setSaveState(saveState);
|
||||
}
|
||||
|
||||
// Was a pattern just saved?
|
||||
if( justSaved )
|
||||
{
|
||||
// Reset all particles
|
||||
for( int index = 0; index < this.particles.length; ++index )
|
||||
{
|
||||
this.particles[index].reset();
|
||||
}
|
||||
this.hasParticlesToDraw = true;
|
||||
}
|
||||
}
|
||||
// Was a pattern just saved?
|
||||
if (justSaved) {
|
||||
// Reset all particles
|
||||
for (int index = 0; index < this.particles.length; ++index) {
|
||||
this.particles[index].reset();
|
||||
}
|
||||
this.hasParticlesToDraw = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package thaumicenergistics.client.gui;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import javax.annotation.Nonnull;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
|
||||
/**
|
||||
@@ -12,213 +12,204 @@ import net.minecraft.client.gui.Gui;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiParticleAnimator
|
||||
{
|
||||
/**
|
||||
* Distance from start to destination.
|
||||
*/
|
||||
private final int distanceX;
|
||||
public class GuiParticleAnimator {
|
||||
/**
|
||||
* Distance from start to destination.
|
||||
*/
|
||||
private final int distanceX;
|
||||
|
||||
/**
|
||||
* Distance from start to destination.
|
||||
*/
|
||||
private final int distanceY;
|
||||
/**
|
||||
* Distance from start to destination.
|
||||
*/
|
||||
private final int distanceY;
|
||||
|
||||
/**
|
||||
* The amount of time the particle is alive for.
|
||||
*/
|
||||
private final long timeToLive;
|
||||
/**
|
||||
* The amount of time the particle is alive for.
|
||||
*/
|
||||
private final long timeToLive;
|
||||
|
||||
/**
|
||||
* Time when the particle was created.
|
||||
*/
|
||||
private long epoch;
|
||||
/**
|
||||
* Time when the particle was created.
|
||||
*/
|
||||
private long epoch;
|
||||
|
||||
/**
|
||||
* How complete the animation is.
|
||||
*/
|
||||
private double percentComplete;
|
||||
/**
|
||||
* How complete the animation is.
|
||||
*/
|
||||
private double percentComplete;
|
||||
|
||||
/**
|
||||
* The number of MS to wait before starting the animation.
|
||||
*/
|
||||
private long delayTime = 0;
|
||||
/**
|
||||
* The number of MS to wait before starting the animation.
|
||||
*/
|
||||
private long delayTime = 0;
|
||||
|
||||
/**
|
||||
* Color of the particle.
|
||||
*/
|
||||
private float red = 1.0f;
|
||||
/**
|
||||
* Color of the particle.
|
||||
*/
|
||||
private float red = 1.0f;
|
||||
|
||||
/**
|
||||
* Color of the particle.
|
||||
*/
|
||||
private float green = 1.0f;
|
||||
/**
|
||||
* Color of the particle.
|
||||
*/
|
||||
private float green = 1.0f;
|
||||
|
||||
/**
|
||||
* Color of the particle.
|
||||
*/
|
||||
private float blue = 1.0f;
|
||||
/**
|
||||
* Color of the particle.
|
||||
*/
|
||||
private float blue = 1.0f;
|
||||
|
||||
/**
|
||||
* Particle frames per second.
|
||||
*/
|
||||
private int framesPerSecond = 1;
|
||||
/**
|
||||
* Particle frames per second.
|
||||
*/
|
||||
private int framesPerSecond = 1;
|
||||
|
||||
/**
|
||||
* Starting position.
|
||||
*/
|
||||
public final int startingX;
|
||||
/**
|
||||
* Starting position.
|
||||
*/
|
||||
public final int startingX;
|
||||
|
||||
/**
|
||||
* Starting position.
|
||||
*/
|
||||
public final int startingY;
|
||||
/**
|
||||
* Starting position.
|
||||
*/
|
||||
public final int startingY;
|
||||
|
||||
/**
|
||||
* Destination position.
|
||||
*/
|
||||
public final int destinationX;
|
||||
/**
|
||||
* Destination position.
|
||||
*/
|
||||
public final int destinationX;
|
||||
|
||||
/**
|
||||
* Destination position.
|
||||
*/
|
||||
public final int destinationY;
|
||||
/**
|
||||
* Destination position.
|
||||
*/
|
||||
public final int destinationY;
|
||||
|
||||
/**
|
||||
* The particle to draw.
|
||||
*/
|
||||
public final EnumGuiParticles theParticle;
|
||||
/**
|
||||
* The particle to draw.
|
||||
*/
|
||||
public final EnumGuiParticles theParticle;
|
||||
|
||||
public GuiParticleAnimator( final int startX, final int startY, final int destX, final int destY, final float time,
|
||||
@Nonnull final EnumGuiParticles particle )
|
||||
{
|
||||
// Set starting position
|
||||
this.startingX = startX;
|
||||
this.startingY = startY;
|
||||
public GuiParticleAnimator(
|
||||
final int startX,
|
||||
final int startY,
|
||||
final int destX,
|
||||
final int destY,
|
||||
final float time,
|
||||
@Nonnull final EnumGuiParticles particle) {
|
||||
// Set starting position
|
||||
this.startingX = startX;
|
||||
this.startingY = startY;
|
||||
|
||||
// Set destination
|
||||
this.destinationX = destX;
|
||||
this.destinationY = destY;
|
||||
// Set destination
|
||||
this.destinationX = destX;
|
||||
this.destinationY = destY;
|
||||
|
||||
// Set TTL
|
||||
this.timeToLive = (long)( time * 1000.0f );
|
||||
if( this.timeToLive <= 0 )
|
||||
{
|
||||
this.percentComplete = 1.0f;
|
||||
}
|
||||
// Set TTL
|
||||
this.timeToLive = (long) (time * 1000.0f);
|
||||
if (this.timeToLive <= 0) {
|
||||
this.percentComplete = 1.0f;
|
||||
}
|
||||
|
||||
// Set epoch
|
||||
this.epoch = System.currentTimeMillis();
|
||||
// Set epoch
|
||||
this.epoch = System.currentTimeMillis();
|
||||
|
||||
// Set particle
|
||||
this.theParticle = particle;
|
||||
// Set particle
|
||||
this.theParticle = particle;
|
||||
|
||||
// Calculate distance
|
||||
this.distanceX = destX - startX;
|
||||
this.distanceY = destY - startY;
|
||||
}
|
||||
// Calculate distance
|
||||
this.distanceX = destX - startX;
|
||||
this.distanceY = destY - startY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns false if the particle has reached the end of its life.
|
||||
*
|
||||
* @param gui
|
||||
* @param needsPrepare
|
||||
* @return
|
||||
*/
|
||||
public boolean draw( final Gui gui, final boolean needsPrepare )
|
||||
{
|
||||
// Check percentage
|
||||
if( this.percentComplete == 1.0f )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Returns false if the particle has reached the end of its life.
|
||||
*
|
||||
* @param gui
|
||||
* @param needsPrepare
|
||||
* @return
|
||||
*/
|
||||
public boolean draw(final Gui gui, final boolean needsPrepare) {
|
||||
// Check percentage
|
||||
if (this.percentComplete == 1.0f) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Calculate frame number
|
||||
int frame = (int)( System.currentTimeMillis() / ( 1000 / this.framesPerSecond ) );
|
||||
// Calculate frame number
|
||||
int frame = (int) (System.currentTimeMillis() / (1000 / this.framesPerSecond));
|
||||
|
||||
// Draw
|
||||
return this.draw( gui, frame, needsPrepare );
|
||||
}
|
||||
// Draw
|
||||
return this.draw(gui, frame, needsPrepare);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns false if the particle has reached the end of its life.
|
||||
*
|
||||
* @param gui
|
||||
* @param particleFrame
|
||||
* @param needsPrepare
|
||||
* @return
|
||||
*/
|
||||
public boolean draw( final Gui gui, final int particleFrame, final boolean needsPrepare )
|
||||
{
|
||||
// Check percentage
|
||||
if( this.percentComplete == 1.0f )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Returns false if the particle has reached the end of its life.
|
||||
*
|
||||
* @param gui
|
||||
* @param particleFrame
|
||||
* @param needsPrepare
|
||||
* @return
|
||||
*/
|
||||
public boolean draw(final Gui gui, final int particleFrame, final boolean needsPrepare) {
|
||||
// Check percentage
|
||||
if (this.percentComplete == 1.0f) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Calculate percentage
|
||||
this.percentComplete = ( ( System.currentTimeMillis() - this.epoch ) / (double)this.timeToLive );
|
||||
if( this.percentComplete > 1.0f )
|
||||
{
|
||||
this.percentComplete = 1.0f;
|
||||
}
|
||||
else if( this.percentComplete < 0 )
|
||||
{
|
||||
// Delayed
|
||||
return true;
|
||||
}
|
||||
// Calculate percentage
|
||||
this.percentComplete = ((System.currentTimeMillis() - this.epoch) / (double) this.timeToLive);
|
||||
if (this.percentComplete > 1.0f) {
|
||||
this.percentComplete = 1.0f;
|
||||
} else if (this.percentComplete < 0) {
|
||||
// Delayed
|
||||
return true;
|
||||
}
|
||||
|
||||
// Calculate position
|
||||
int posX = this.startingX + (int)( this.distanceX * this.percentComplete );
|
||||
int posY = this.startingY + (int)( this.distanceY * this.percentComplete );
|
||||
// Calculate position
|
||||
int posX = this.startingX + (int) (this.distanceX * this.percentComplete);
|
||||
int posY = this.startingY + (int) (this.distanceY * this.percentComplete);
|
||||
|
||||
// Draw the particle
|
||||
this.theParticle.drawParticle( gui, posX, posY, particleFrame, this.red, this.green, this.blue, needsPrepare );
|
||||
// Draw the particle
|
||||
this.theParticle.drawParticle(gui, posX, posY, particleFrame, this.red, this.green, this.blue, needsPrepare);
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the particle back to it's original state.
|
||||
*/
|
||||
public void reset()
|
||||
{
|
||||
this.epoch = System.currentTimeMillis() + this.delayTime;
|
||||
this.percentComplete = 0;
|
||||
}
|
||||
/**
|
||||
* Resets the particle back to it's original state.
|
||||
*/
|
||||
public void reset() {
|
||||
this.epoch = System.currentTimeMillis() + this.delayTime;
|
||||
this.percentComplete = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the color of the particle.
|
||||
*
|
||||
* @param red
|
||||
* @param green
|
||||
* @param blue
|
||||
*/
|
||||
public void setColor( final float red, final float green, final float blue )
|
||||
{
|
||||
this.red = red;
|
||||
this.green = green;
|
||||
this.blue = blue;
|
||||
}
|
||||
/**
|
||||
* Sets the color of the particle.
|
||||
*
|
||||
* @param red
|
||||
* @param green
|
||||
* @param blue
|
||||
*/
|
||||
public void setColor(final float red, final float green, final float blue) {
|
||||
this.red = red;
|
||||
this.green = green;
|
||||
this.blue = blue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the number of MS to wait before starting the animation.
|
||||
*
|
||||
* @param timeMS
|
||||
*/
|
||||
public void setDelayTime( final long timeMS )
|
||||
{
|
||||
this.delayTime = timeMS;
|
||||
this.epoch += this.delayTime;
|
||||
}
|
||||
/**
|
||||
* Sets the number of MS to wait before starting the animation.
|
||||
*
|
||||
* @param timeMS
|
||||
*/
|
||||
public void setDelayTime(final long timeMS) {
|
||||
this.delayTime = timeMS;
|
||||
this.epoch += this.delayTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the frames per second
|
||||
*
|
||||
* @param fps
|
||||
*/
|
||||
public void setFPS( final int fps )
|
||||
{
|
||||
this.framesPerSecond = fps;
|
||||
}
|
||||
/**
|
||||
* Sets the frames per second
|
||||
*
|
||||
* @param fps
|
||||
*/
|
||||
public void setFPS(final int fps) {
|
||||
this.framesPerSecond = fps;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package thaumicenergistics.client.gui;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.helpers.IPriorityHost;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -10,6 +8,8 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumicenergistics.client.gui.abstraction.ThEBaseGui;
|
||||
import thaumicenergistics.client.gui.buttons.GuiButtonAETab;
|
||||
import thaumicenergistics.client.gui.widget.DigitTextField;
|
||||
@@ -27,378 +27,359 @@ import thaumicenergistics.common.parts.ThEPartBase;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiPriority
|
||||
extends ThEBaseGui
|
||||
{
|
||||
private static class AdjustmentButtonDef
|
||||
{
|
||||
enum EnumButtonWidth
|
||||
{
|
||||
Small (25),
|
||||
Medium (35),
|
||||
Large (45);
|
||||
|
||||
public final int width;
|
||||
|
||||
private EnumButtonWidth( final int width )
|
||||
{
|
||||
this.width = width;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Height of all buttons
|
||||
*/
|
||||
private static final int BUTTON_HEIGHT = 20;
|
||||
|
||||
/**
|
||||
* Width of the button
|
||||
*/
|
||||
public final int width;
|
||||
|
||||
/**
|
||||
* Caption of the button
|
||||
*/
|
||||
public final String caption;
|
||||
|
||||
/**
|
||||
* Amount the button represents
|
||||
*/
|
||||
public final int amount;
|
||||
|
||||
/**
|
||||
* Creates the button definition
|
||||
*
|
||||
* @param buttonWidth
|
||||
* @param amount
|
||||
*/
|
||||
public AdjustmentButtonDef( final EnumButtonWidth buttonWidth, final int amount )
|
||||
{
|
||||
// Set the width
|
||||
this.width = buttonWidth.width;
|
||||
|
||||
// Set the caption
|
||||
this.caption = ( amount > 0 ? "+" : "" ) + Integer.toString( amount );
|
||||
|
||||
// Set the amount
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a GUI button based of this definition
|
||||
*
|
||||
* @param ID
|
||||
* @param xPosition
|
||||
* @param yPosition
|
||||
* @return
|
||||
*/
|
||||
public GuiButton makeButton( final int ID, final int xPosition, final int yPosition )
|
||||
{
|
||||
return new GuiButton( ID, xPosition, yPosition, this.width, AdjustmentButtonDef.BUTTON_HEIGHT, this.caption );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static final AdjustmentButtonDef[] ADJUSTMENT_BUTTONS = new AdjustmentButtonDef[] {
|
||||
new AdjustmentButtonDef( AdjustmentButtonDef.EnumButtonWidth.Small, 1 ),
|
||||
new AdjustmentButtonDef( AdjustmentButtonDef.EnumButtonWidth.Medium, 10 ),
|
||||
new AdjustmentButtonDef( AdjustmentButtonDef.EnumButtonWidth.Large, 100 ),
|
||||
new AdjustmentButtonDef( AdjustmentButtonDef.EnumButtonWidth.Small, -1 ),
|
||||
new AdjustmentButtonDef( AdjustmentButtonDef.EnumButtonWidth.Medium, -10 ),
|
||||
new AdjustmentButtonDef( AdjustmentButtonDef.EnumButtonWidth.Large, -100 ) };
|
||||
|
||||
/**
|
||||
* The width of the gui
|
||||
*/
|
||||
private static final int GUI_WIDTH = 176;
|
||||
|
||||
/**
|
||||
* The height of the gui
|
||||
*/
|
||||
private static final int GUI_HEIGHT = 107;
|
||||
|
||||
/**
|
||||
* ID of the switch tab
|
||||
*/
|
||||
private static final int PART_SWITCH_BUTTON_ID = 0;
|
||||
|
||||
/**
|
||||
* X position of the switch tab
|
||||
*/
|
||||
private static final int PART_SWITCH_BUTTON_X_POSITION = 154;
|
||||
|
||||
/**
|
||||
* Starting ID of the adjustment buttons
|
||||
*/
|
||||
private static final int ADJUSTMENT_BUTTONS_ID = 1;
|
||||
|
||||
/**
|
||||
* Starting X position for each row of buttons
|
||||
*/
|
||||
private static final int ADJUSTMENT_BUTTONS_X_POSITION = 35;
|
||||
|
||||
/**
|
||||
* Y position for each row
|
||||
*/
|
||||
private static final int[] ADJUSTMENT_BUTTONS_Y_POSITION = new int[] { 30, 70 };
|
||||
|
||||
/**
|
||||
* Amount of empty space between buttons
|
||||
*/
|
||||
private static final int ADJUSTMENT_BUTTONS_X_PADDING = 5;
|
||||
|
||||
/**
|
||||
* X offset for the amount field.
|
||||
*/
|
||||
private static final int AMOUNT_OFFSET_X = 61;
|
||||
|
||||
/**
|
||||
* Y offset for the amount field.
|
||||
*/
|
||||
private static final int AMOUNT_OFFSET_Y = 57;
|
||||
|
||||
/**
|
||||
* Width of the amount field.
|
||||
*/
|
||||
private static final int AMOUNT_WIDTH = 80;
|
||||
|
||||
/**
|
||||
* Height of the amount field.
|
||||
*/
|
||||
private static final int AMOUNT_HEIGHT = 10;
|
||||
|
||||
/**
|
||||
* The maximum number of characters that can be typed in the amount field.
|
||||
*/
|
||||
private static final int AMOUNT_MAX_CHARS = 8;
|
||||
|
||||
/**
|
||||
* X position of the title string.
|
||||
*/
|
||||
private static final int TITLE_POS_X = 6;
|
||||
|
||||
/**
|
||||
* Y position of the title string.
|
||||
*/
|
||||
private static final int TITLE_POS_Y = 6;
|
||||
|
||||
/**
|
||||
* The part we are adjusting the priority of
|
||||
*/
|
||||
private final ThEPartBase part;
|
||||
|
||||
/**
|
||||
* The player viewing the gui.
|
||||
*/
|
||||
private final EntityPlayer player;
|
||||
|
||||
/**
|
||||
* Title of the window
|
||||
*/
|
||||
private final String title;
|
||||
|
||||
/**
|
||||
* Amount text field
|
||||
*/
|
||||
private DigitTextField amountField;
|
||||
|
||||
/**
|
||||
* Create the gui.
|
||||
*
|
||||
* @param host
|
||||
* @param player
|
||||
*/
|
||||
public GuiPriority( final IPriorityHost host, final EntityPlayer player )
|
||||
{
|
||||
// Call super and pass the priority container
|
||||
super( new ContainerPriority( host, player ) );
|
||||
|
||||
// Get the part
|
||||
this.part = (ThEPartBase)host;
|
||||
|
||||
// Set the player
|
||||
this.player = player;
|
||||
|
||||
// Set the width and height
|
||||
this.xSize = GuiPriority.GUI_WIDTH;
|
||||
this.ySize = GuiPriority.GUI_HEIGHT;
|
||||
|
||||
// Set the title
|
||||
this.title = GuiText.Priority.getLocal();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer( final float alpha, final int mouseX, final int mouseY )
|
||||
{
|
||||
// Full white
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
|
||||
// Bind the priority gui texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture( GuiTextureManager.PRIORITY.getTexture() );
|
||||
|
||||
this.drawTexturedModalRect( this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer( final int mouseX, final int mouseY )
|
||||
{
|
||||
// Draw the title
|
||||
this.fontRendererObj.drawString( this.title, GuiPriority.TITLE_POS_X, GuiPriority.TITLE_POS_Y, 0 );
|
||||
|
||||
// Draw the text field
|
||||
this.amountField.drawTextBox();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the player types a key
|
||||
*/
|
||||
@Override
|
||||
protected void keyTyped( final char key, final int keyID )
|
||||
{
|
||||
// Pass to super
|
||||
super.keyTyped( key, keyID );
|
||||
|
||||
// Ensure the string isn't too long to parse
|
||||
if( this.amountField.getText().length() < GuiPriority.AMOUNT_MAX_CHARS )
|
||||
{
|
||||
// Pass to the amount field
|
||||
this.amountField.textboxKeyTyped( key, keyID );
|
||||
|
||||
// Check if they are intending to type a negative number
|
||||
if( this.amountField.getText().equals( "-" ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Convert the text field into a long
|
||||
int newPriority = 0;
|
||||
try
|
||||
{
|
||||
newPriority = Integer.parseInt( this.amountField.getText() );
|
||||
}
|
||||
catch( NumberFormatException e )
|
||||
{
|
||||
}
|
||||
|
||||
// Update the server
|
||||
Packet_S_Priority.sendPriority( newPriority, this.player );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button is clicked.
|
||||
*/
|
||||
@Override
|
||||
protected void onButtonClicked( final GuiButton button, final int mouseButton )
|
||||
{
|
||||
// Was the priority button clicked?
|
||||
if( button.id == GuiPriority.PART_SWITCH_BUTTON_ID )
|
||||
{
|
||||
// Get the storage buses host
|
||||
TileEntity host = this.part.getHostTile();
|
||||
|
||||
// Ask the server to change to the priority gui
|
||||
Packet_S_ChangeGui.sendGuiChangeToPart( this.part, this.player, host.getWorldObj(), host.xCoord, host.yCoord, host.zCoord );
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// Assume it was an adjustment button
|
||||
try
|
||||
{
|
||||
// Get the definition
|
||||
AdjustmentButtonDef abDef = GuiPriority.ADJUSTMENT_BUTTONS[button.id - GuiPriority.ADJUSTMENT_BUTTONS_ID];
|
||||
|
||||
// Send the adjustment to the server
|
||||
Packet_S_Priority.sendPriorityDelta( abDef.amount, this.player );
|
||||
}
|
||||
catch( IndexOutOfBoundsException e )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
// Call super
|
||||
super.initGui();
|
||||
|
||||
// Enable repeat keys
|
||||
Keyboard.enableRepeatEvents( true );
|
||||
|
||||
// Create the part switch button
|
||||
this.buttonList.add( new GuiButtonAETab( GuiPriority.PART_SWITCH_BUTTON_ID, this.guiLeft + GuiPriority.PART_SWITCH_BUTTON_X_POSITION,
|
||||
this.guiTop, AEStateIconsEnum.WRENCH, this.part.getUnlocalizedName() ) );
|
||||
|
||||
// Create the adjustment buttons
|
||||
int buttonXPosition = GuiPriority.ADJUSTMENT_BUTTONS_X_POSITION;
|
||||
int buttonYPosition = GuiPriority.ADJUSTMENT_BUTTONS_Y_POSITION[0];
|
||||
for( int adjustmentButtonIndex = 0; adjustmentButtonIndex < GuiPriority.ADJUSTMENT_BUTTONS.length; adjustmentButtonIndex++ )
|
||||
{
|
||||
// Get the button def
|
||||
AdjustmentButtonDef def = GuiPriority.ADJUSTMENT_BUTTONS[adjustmentButtonIndex];
|
||||
|
||||
// Calculate the ID
|
||||
int ID = GuiPriority.ADJUSTMENT_BUTTONS_ID + adjustmentButtonIndex;
|
||||
|
||||
// Are we moving into row 2?
|
||||
if( adjustmentButtonIndex == ( GuiPriority.ADJUSTMENT_BUTTONS.length / 2 ) )
|
||||
{
|
||||
// Reset X
|
||||
buttonXPosition = GuiPriority.ADJUSTMENT_BUTTONS_X_POSITION;
|
||||
|
||||
// Set Y
|
||||
buttonYPosition = GuiPriority.ADJUSTMENT_BUTTONS_Y_POSITION[1];
|
||||
}
|
||||
|
||||
// Add the button
|
||||
this.buttonList.add( def.makeButton( ID, this.guiLeft + buttonXPosition, this.guiTop + buttonYPosition ) );
|
||||
|
||||
// Increment X
|
||||
buttonXPosition += def.width + GuiPriority.ADJUSTMENT_BUTTONS_X_PADDING;
|
||||
}
|
||||
// Create the amount field
|
||||
this.amountField = new DigitTextField( this.fontRendererObj, GuiPriority.AMOUNT_OFFSET_X, GuiPriority.AMOUNT_OFFSET_Y,
|
||||
GuiPriority.AMOUNT_WIDTH, GuiPriority.AMOUNT_HEIGHT );
|
||||
|
||||
// Start focused
|
||||
this.amountField.setFocused( true );
|
||||
|
||||
// Draw in the forground
|
||||
this.amountField.setEnableBackgroundDrawing( false );
|
||||
|
||||
// Text color white
|
||||
this.amountField.setTextColor( 0xFFFFFFFF );
|
||||
|
||||
// Ask for the priority from the server
|
||||
Packet_S_Priority.sendPriorityRequest( this.player );
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the gui is closing.
|
||||
*/
|
||||
@Override
|
||||
public void onGuiClosed()
|
||||
{
|
||||
// Disable repeat keys
|
||||
Keyboard.enableRepeatEvents( false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the server sends the priority.
|
||||
*
|
||||
* @param priority
|
||||
*/
|
||||
public void onServerSendPriority( final int priority )
|
||||
{
|
||||
// Set the textbox text
|
||||
this.amountField.setText( Integer.toString( priority ) );
|
||||
}
|
||||
|
||||
public class GuiPriority extends ThEBaseGui {
|
||||
private static class AdjustmentButtonDef {
|
||||
enum EnumButtonWidth {
|
||||
Small(25),
|
||||
Medium(35),
|
||||
Large(45);
|
||||
|
||||
public final int width;
|
||||
|
||||
private EnumButtonWidth(final int width) {
|
||||
this.width = width;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Height of all buttons
|
||||
*/
|
||||
private static final int BUTTON_HEIGHT = 20;
|
||||
|
||||
/**
|
||||
* Width of the button
|
||||
*/
|
||||
public final int width;
|
||||
|
||||
/**
|
||||
* Caption of the button
|
||||
*/
|
||||
public final String caption;
|
||||
|
||||
/**
|
||||
* Amount the button represents
|
||||
*/
|
||||
public final int amount;
|
||||
|
||||
/**
|
||||
* Creates the button definition
|
||||
*
|
||||
* @param buttonWidth
|
||||
* @param amount
|
||||
*/
|
||||
public AdjustmentButtonDef(final EnumButtonWidth buttonWidth, final int amount) {
|
||||
// Set the width
|
||||
this.width = buttonWidth.width;
|
||||
|
||||
// Set the caption
|
||||
this.caption = (amount > 0 ? "+" : "") + Integer.toString(amount);
|
||||
|
||||
// Set the amount
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a GUI button based of this definition
|
||||
*
|
||||
* @param ID
|
||||
* @param xPosition
|
||||
* @param yPosition
|
||||
* @return
|
||||
*/
|
||||
public GuiButton makeButton(final int ID, final int xPosition, final int yPosition) {
|
||||
return new GuiButton(ID, xPosition, yPosition, this.width, AdjustmentButtonDef.BUTTON_HEIGHT, this.caption);
|
||||
}
|
||||
}
|
||||
|
||||
private static final AdjustmentButtonDef[] ADJUSTMENT_BUTTONS = new AdjustmentButtonDef[] {
|
||||
new AdjustmentButtonDef(AdjustmentButtonDef.EnumButtonWidth.Small, 1),
|
||||
new AdjustmentButtonDef(AdjustmentButtonDef.EnumButtonWidth.Medium, 10),
|
||||
new AdjustmentButtonDef(AdjustmentButtonDef.EnumButtonWidth.Large, 100),
|
||||
new AdjustmentButtonDef(AdjustmentButtonDef.EnumButtonWidth.Small, -1),
|
||||
new AdjustmentButtonDef(AdjustmentButtonDef.EnumButtonWidth.Medium, -10),
|
||||
new AdjustmentButtonDef(AdjustmentButtonDef.EnumButtonWidth.Large, -100)
|
||||
};
|
||||
|
||||
/**
|
||||
* The width of the gui
|
||||
*/
|
||||
private static final int GUI_WIDTH = 176;
|
||||
|
||||
/**
|
||||
* The height of the gui
|
||||
*/
|
||||
private static final int GUI_HEIGHT = 107;
|
||||
|
||||
/**
|
||||
* ID of the switch tab
|
||||
*/
|
||||
private static final int PART_SWITCH_BUTTON_ID = 0;
|
||||
|
||||
/**
|
||||
* X position of the switch tab
|
||||
*/
|
||||
private static final int PART_SWITCH_BUTTON_X_POSITION = 154;
|
||||
|
||||
/**
|
||||
* Starting ID of the adjustment buttons
|
||||
*/
|
||||
private static final int ADJUSTMENT_BUTTONS_ID = 1;
|
||||
|
||||
/**
|
||||
* Starting X position for each row of buttons
|
||||
*/
|
||||
private static final int ADJUSTMENT_BUTTONS_X_POSITION = 35;
|
||||
|
||||
/**
|
||||
* Y position for each row
|
||||
*/
|
||||
private static final int[] ADJUSTMENT_BUTTONS_Y_POSITION = new int[] {30, 70};
|
||||
|
||||
/**
|
||||
* Amount of empty space between buttons
|
||||
*/
|
||||
private static final int ADJUSTMENT_BUTTONS_X_PADDING = 5;
|
||||
|
||||
/**
|
||||
* X offset for the amount field.
|
||||
*/
|
||||
private static final int AMOUNT_OFFSET_X = 61;
|
||||
|
||||
/**
|
||||
* Y offset for the amount field.
|
||||
*/
|
||||
private static final int AMOUNT_OFFSET_Y = 57;
|
||||
|
||||
/**
|
||||
* Width of the amount field.
|
||||
*/
|
||||
private static final int AMOUNT_WIDTH = 80;
|
||||
|
||||
/**
|
||||
* Height of the amount field.
|
||||
*/
|
||||
private static final int AMOUNT_HEIGHT = 10;
|
||||
|
||||
/**
|
||||
* The maximum number of characters that can be typed in the amount field.
|
||||
*/
|
||||
private static final int AMOUNT_MAX_CHARS = 8;
|
||||
|
||||
/**
|
||||
* X position of the title string.
|
||||
*/
|
||||
private static final int TITLE_POS_X = 6;
|
||||
|
||||
/**
|
||||
* Y position of the title string.
|
||||
*/
|
||||
private static final int TITLE_POS_Y = 6;
|
||||
|
||||
/**
|
||||
* The part we are adjusting the priority of
|
||||
*/
|
||||
private final ThEPartBase part;
|
||||
|
||||
/**
|
||||
* The player viewing the gui.
|
||||
*/
|
||||
private final EntityPlayer player;
|
||||
|
||||
/**
|
||||
* Title of the window
|
||||
*/
|
||||
private final String title;
|
||||
|
||||
/**
|
||||
* Amount text field
|
||||
*/
|
||||
private DigitTextField amountField;
|
||||
|
||||
/**
|
||||
* Create the gui.
|
||||
*
|
||||
* @param host
|
||||
* @param player
|
||||
*/
|
||||
public GuiPriority(final IPriorityHost host, final EntityPlayer player) {
|
||||
// Call super and pass the priority container
|
||||
super(new ContainerPriority(host, player));
|
||||
|
||||
// Get the part
|
||||
this.part = (ThEPartBase) host;
|
||||
|
||||
// Set the player
|
||||
this.player = player;
|
||||
|
||||
// Set the width and height
|
||||
this.xSize = GuiPriority.GUI_WIDTH;
|
||||
this.ySize = GuiPriority.GUI_HEIGHT;
|
||||
|
||||
// Set the title
|
||||
this.title = GuiText.Priority.getLocal();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(final float alpha, final int mouseX, final int mouseY) {
|
||||
// Full white
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
// Bind the priority gui texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(GuiTextureManager.PRIORITY.getTexture());
|
||||
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
|
||||
// Draw the title
|
||||
this.fontRendererObj.drawString(this.title, GuiPriority.TITLE_POS_X, GuiPriority.TITLE_POS_Y, 0);
|
||||
|
||||
// Draw the text field
|
||||
this.amountField.drawTextBox();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the player types a key
|
||||
*/
|
||||
@Override
|
||||
protected void keyTyped(final char key, final int keyID) {
|
||||
// Pass to super
|
||||
super.keyTyped(key, keyID);
|
||||
|
||||
// Ensure the string isn't too long to parse
|
||||
if (this.amountField.getText().length() < GuiPriority.AMOUNT_MAX_CHARS) {
|
||||
// Pass to the amount field
|
||||
this.amountField.textboxKeyTyped(key, keyID);
|
||||
|
||||
// Check if they are intending to type a negative number
|
||||
if (this.amountField.getText().equals("-")) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Convert the text field into a long
|
||||
int newPriority = 0;
|
||||
try {
|
||||
newPriority = Integer.parseInt(this.amountField.getText());
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
|
||||
// Update the server
|
||||
Packet_S_Priority.sendPriority(newPriority, this.player);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button is clicked.
|
||||
*/
|
||||
@Override
|
||||
protected void onButtonClicked(final GuiButton button, final int mouseButton) {
|
||||
// Was the priority button clicked?
|
||||
if (button.id == GuiPriority.PART_SWITCH_BUTTON_ID) {
|
||||
// Get the storage buses host
|
||||
TileEntity host = this.part.getHostTile();
|
||||
|
||||
// Ask the server to change to the priority gui
|
||||
Packet_S_ChangeGui.sendGuiChangeToPart(
|
||||
this.part, this.player, host.getWorldObj(), host.xCoord, host.yCoord, host.zCoord);
|
||||
return;
|
||||
}
|
||||
|
||||
// Assume it was an adjustment button
|
||||
try {
|
||||
// Get the definition
|
||||
AdjustmentButtonDef abDef = GuiPriority.ADJUSTMENT_BUTTONS[button.id - GuiPriority.ADJUSTMENT_BUTTONS_ID];
|
||||
|
||||
// Send the adjustment to the server
|
||||
Packet_S_Priority.sendPriorityDelta(abDef.amount, this.player);
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
// Call super
|
||||
super.initGui();
|
||||
|
||||
// Enable repeat keys
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
|
||||
// Create the part switch button
|
||||
this.buttonList.add(new GuiButtonAETab(
|
||||
GuiPriority.PART_SWITCH_BUTTON_ID,
|
||||
this.guiLeft + GuiPriority.PART_SWITCH_BUTTON_X_POSITION,
|
||||
this.guiTop,
|
||||
AEStateIconsEnum.WRENCH,
|
||||
this.part.getUnlocalizedName()));
|
||||
|
||||
// Create the adjustment buttons
|
||||
int buttonXPosition = GuiPriority.ADJUSTMENT_BUTTONS_X_POSITION;
|
||||
int buttonYPosition = GuiPriority.ADJUSTMENT_BUTTONS_Y_POSITION[0];
|
||||
for (int adjustmentButtonIndex = 0;
|
||||
adjustmentButtonIndex < GuiPriority.ADJUSTMENT_BUTTONS.length;
|
||||
adjustmentButtonIndex++) {
|
||||
// Get the button def
|
||||
AdjustmentButtonDef def = GuiPriority.ADJUSTMENT_BUTTONS[adjustmentButtonIndex];
|
||||
|
||||
// Calculate the ID
|
||||
int ID = GuiPriority.ADJUSTMENT_BUTTONS_ID + adjustmentButtonIndex;
|
||||
|
||||
// Are we moving into row 2?
|
||||
if (adjustmentButtonIndex == (GuiPriority.ADJUSTMENT_BUTTONS.length / 2)) {
|
||||
// Reset X
|
||||
buttonXPosition = GuiPriority.ADJUSTMENT_BUTTONS_X_POSITION;
|
||||
|
||||
// Set Y
|
||||
buttonYPosition = GuiPriority.ADJUSTMENT_BUTTONS_Y_POSITION[1];
|
||||
}
|
||||
|
||||
// Add the button
|
||||
this.buttonList.add(def.makeButton(ID, this.guiLeft + buttonXPosition, this.guiTop + buttonYPosition));
|
||||
|
||||
// Increment X
|
||||
buttonXPosition += def.width + GuiPriority.ADJUSTMENT_BUTTONS_X_PADDING;
|
||||
}
|
||||
// Create the amount field
|
||||
this.amountField = new DigitTextField(
|
||||
this.fontRendererObj,
|
||||
GuiPriority.AMOUNT_OFFSET_X,
|
||||
GuiPriority.AMOUNT_OFFSET_Y,
|
||||
GuiPriority.AMOUNT_WIDTH,
|
||||
GuiPriority.AMOUNT_HEIGHT);
|
||||
|
||||
// Start focused
|
||||
this.amountField.setFocused(true);
|
||||
|
||||
// Draw in the forground
|
||||
this.amountField.setEnableBackgroundDrawing(false);
|
||||
|
||||
// Text color white
|
||||
this.amountField.setTextColor(0xFFFFFFFF);
|
||||
|
||||
// Ask for the priority from the server
|
||||
Packet_S_Priority.sendPriorityRequest(this.player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the gui is closing.
|
||||
*/
|
||||
@Override
|
||||
public void onGuiClosed() {
|
||||
// Disable repeat keys
|
||||
Keyboard.enableRepeatEvents(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the server sends the priority.
|
||||
*
|
||||
* @param priority
|
||||
*/
|
||||
public void onServerSendPriority(final int priority) {
|
||||
// Set the textbox text
|
||||
this.amountField.setText(Integer.toString(priority));
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
package thaumicenergistics.client.gui;
|
||||
|
||||
import java.util.HashMap;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.HashMap;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
|
||||
/**
|
||||
@@ -15,233 +15,222 @@ import thaumcraft.api.aspects.Aspect;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public final class ThEGuiHelper
|
||||
{
|
||||
public final class ThEGuiHelper {
|
||||
|
||||
/**
|
||||
* Singleton
|
||||
*/
|
||||
public static final ThEGuiHelper INSTANCE = new ThEGuiHelper();
|
||||
/**
|
||||
* Singleton
|
||||
*/
|
||||
public static final ThEGuiHelper INSTANCE = new ThEGuiHelper();
|
||||
|
||||
/**
|
||||
* Maps int -> mouse button
|
||||
*/
|
||||
public static final int MOUSE_BUTTON_LEFT = 0, MOUSE_BUTTON_RIGHT = 1, MOUSE_BUTTON_WHEEL = 2;
|
||||
/**
|
||||
* Maps int -> mouse button
|
||||
*/
|
||||
public static final int MOUSE_BUTTON_LEFT = 0, MOUSE_BUTTON_RIGHT = 1, MOUSE_BUTTON_WHEEL = 2;
|
||||
|
||||
/**
|
||||
* Special case representing not a click, but a motion of the mouse wheel
|
||||
*/
|
||||
public static final int MOUSE_WHEEL_MOTION = -2;
|
||||
/**
|
||||
* Special case representing not a click, but a motion of the mouse wheel
|
||||
*/
|
||||
public static final int MOUSE_WHEEL_MOTION = -2;
|
||||
|
||||
/**
|
||||
* Length of color arrays.
|
||||
*/
|
||||
private static final int COLOR_ARRAY_SIZE = 4;
|
||||
/**
|
||||
* Length of color arrays.
|
||||
*/
|
||||
private static final int COLOR_ARRAY_SIZE = 4;
|
||||
|
||||
/**
|
||||
* Bitshift amounts based on byte position
|
||||
*/
|
||||
private final int[] COLOR_SHIFT_AMOUNT = new int[] { 0, 8, 16, 24 };
|
||||
/**
|
||||
* Bitshift amounts based on byte position
|
||||
*/
|
||||
private final int[] COLOR_SHIFT_AMOUNT = new int[] {0, 8, 16, 24};
|
||||
|
||||
/**
|
||||
* Maps aspects to chat colors.
|
||||
*/
|
||||
private HashMap<Aspect, String> aspectChatColors = new HashMap<Aspect, String>();
|
||||
/**
|
||||
* Maps aspects to chat colors.
|
||||
*/
|
||||
private HashMap<Aspect, String> aspectChatColors = new HashMap<Aspect, String>();
|
||||
|
||||
/**
|
||||
* Private constructor.
|
||||
*/
|
||||
private ThEGuiHelper()
|
||||
{
|
||||
// Add the chat colors
|
||||
this.aspectChatColors.put( Aspect.AIR, EnumChatFormatting.YELLOW.toString() );
|
||||
this.aspectChatColors.put( Aspect.WATER, EnumChatFormatting.AQUA.toString() );
|
||||
this.aspectChatColors.put( Aspect.FIRE, EnumChatFormatting.RED.toString() );
|
||||
this.aspectChatColors.put( Aspect.ORDER, EnumChatFormatting.GRAY.toString() );
|
||||
this.aspectChatColors.put( Aspect.ENTROPY, EnumChatFormatting.DARK_GRAY.toString() );
|
||||
this.aspectChatColors.put( Aspect.EARTH, EnumChatFormatting.GREEN.toString() );
|
||||
/**
|
||||
* Private constructor.
|
||||
*/
|
||||
private ThEGuiHelper() {
|
||||
// Add the chat colors
|
||||
this.aspectChatColors.put(Aspect.AIR, EnumChatFormatting.YELLOW.toString());
|
||||
this.aspectChatColors.put(Aspect.WATER, EnumChatFormatting.AQUA.toString());
|
||||
this.aspectChatColors.put(Aspect.FIRE, EnumChatFormatting.RED.toString());
|
||||
this.aspectChatColors.put(Aspect.ORDER, EnumChatFormatting.GRAY.toString());
|
||||
this.aspectChatColors.put(Aspect.ENTROPY, EnumChatFormatting.DARK_GRAY.toString());
|
||||
this.aspectChatColors.put(Aspect.EARTH, EnumChatFormatting.GREEN.toString());
|
||||
}
|
||||
|
||||
}
|
||||
public static final void drawScaledText(
|
||||
final FontRenderer fontRenderer, final String text, final float scale, final float posX, final float posY) {
|
||||
// Disable lighting
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
public static final void drawScaledText( final FontRenderer fontRenderer, final String text, final float scale, final float posX,
|
||||
final float posY )
|
||||
{
|
||||
// Disable lighting
|
||||
GL11.glDisable( GL11.GL_LIGHTING );
|
||||
// Disable depth testing
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
|
||||
// Disable depth testing
|
||||
GL11.glDisable( GL11.GL_DEPTH_TEST );
|
||||
// Push the current matrix
|
||||
GL11.glPushMatrix();
|
||||
|
||||
// Push the current matrix
|
||||
GL11.glPushMatrix();
|
||||
// Scale the GUI
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
|
||||
// Scale the GUI
|
||||
GL11.glScaled( scale, scale, scale );
|
||||
// Calculate inverse scale
|
||||
float inverseScale = 1.0f / scale;
|
||||
|
||||
// Calculate inverse scale
|
||||
float inverseScale = 1.0f / scale;
|
||||
// Calculate final X position
|
||||
final int X = (int) ((posX - (fontRenderer.getStringWidth(text) * scale)) * inverseScale);
|
||||
|
||||
// Calculate final X position
|
||||
final int X = (int)( ( posX - ( fontRenderer.getStringWidth( text ) * scale ) ) * inverseScale );
|
||||
// Calculate final Y position
|
||||
final int Y = (int) ((posY - (7.0f * scale)) * inverseScale);
|
||||
|
||||
// Calculate final Y position
|
||||
final int Y = (int)( ( posY - ( 7.0f * scale ) ) * inverseScale );
|
||||
// Render
|
||||
fontRenderer.drawStringWithShadow(text, X, Y, 16777215);
|
||||
|
||||
// Render
|
||||
fontRenderer.drawStringWithShadow( text, X, Y, 16777215 );
|
||||
// Pop the matrix
|
||||
GL11.glPopMatrix();
|
||||
|
||||
// Pop the matrix
|
||||
GL11.glPopMatrix();
|
||||
// Enable lighting
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
// Enable lighting
|
||||
GL11.glEnable( GL11.GL_LIGHTING );
|
||||
// Enable depth testing
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
// Enable depth testing
|
||||
GL11.glEnable( GL11.GL_DEPTH_TEST );
|
||||
}
|
||||
public final byte[] convertPackedColorToARGBb(final int color) {
|
||||
byte[] colorBytes = new byte[COLOR_ARRAY_SIZE];
|
||||
|
||||
public final byte[] convertPackedColorToARGBb( final int color )
|
||||
{
|
||||
byte[] colorBytes = new byte[COLOR_ARRAY_SIZE];
|
||||
// Extract bytes
|
||||
for (int i = 0; i < COLOR_ARRAY_SIZE; i++) {
|
||||
// Get byte
|
||||
colorBytes[COLOR_ARRAY_SIZE - 1 - i] = (byte) ((color >> this.COLOR_SHIFT_AMOUNT[i]) & 0xFF);
|
||||
}
|
||||
|
||||
// Extract bytes
|
||||
for( int i = 0; i < COLOR_ARRAY_SIZE; i++ )
|
||||
{
|
||||
// Get byte
|
||||
colorBytes[COLOR_ARRAY_SIZE - 1 - i] = (byte)( ( color >> this.COLOR_SHIFT_AMOUNT[i] ) & 0xFF );
|
||||
}
|
||||
return colorBytes;
|
||||
}
|
||||
|
||||
return colorBytes;
|
||||
}
|
||||
public final float[] convertPackedColorToARGBf(final int color) {
|
||||
float[] colorFloats = new float[COLOR_ARRAY_SIZE];
|
||||
|
||||
public final float[] convertPackedColorToARGBf( final int color )
|
||||
{
|
||||
float[] colorFloats = new float[COLOR_ARRAY_SIZE];
|
||||
// Extract bytes
|
||||
for (int i = 0; i < COLOR_ARRAY_SIZE; i++) {
|
||||
// Get floats
|
||||
colorFloats[COLOR_ARRAY_SIZE - 1 - i] = ((color >> this.COLOR_SHIFT_AMOUNT[i]) & 0xFF) / 255.0f;
|
||||
}
|
||||
|
||||
// Extract bytes
|
||||
for( int i = 0; i < COLOR_ARRAY_SIZE; i++ )
|
||||
{
|
||||
// Get floats
|
||||
colorFloats[COLOR_ARRAY_SIZE - 1 - i] = ( ( color >> this.COLOR_SHIFT_AMOUNT[i] ) & 0xFF ) / 255.0f;
|
||||
}
|
||||
return colorFloats;
|
||||
}
|
||||
|
||||
return colorFloats;
|
||||
}
|
||||
public final int[] createColorGradient(final int fromColor, final int toColor, final int iterations) {
|
||||
// Is there enough iterations to create a gradient?
|
||||
if (iterations < 3) {
|
||||
return new int[] {fromColor, toColor};
|
||||
}
|
||||
|
||||
public final int[] createColorGradient( final int fromColor, final int toColor, final int iterations )
|
||||
{
|
||||
// Is there enough iterations to create a gradient?
|
||||
if( iterations < 3 )
|
||||
{
|
||||
return new int[] { fromColor, toColor };
|
||||
}
|
||||
// Holds the A,R,G,B bytes of each color
|
||||
int[] fromColorBytes = new int[COLOR_ARRAY_SIZE];
|
||||
int[] toColorBytes = new int[COLOR_ARRAY_SIZE];
|
||||
|
||||
// Holds the A,R,G,B bytes of each color
|
||||
int[] fromColorBytes = new int[COLOR_ARRAY_SIZE];
|
||||
int[] toColorBytes = new int[COLOR_ARRAY_SIZE];
|
||||
// Holds how much to change the color amount by for each iteration
|
||||
float[] stepAmount = new float[COLOR_ARRAY_SIZE];
|
||||
|
||||
// Holds how much to change the color amount by for each iteration
|
||||
float[] stepAmount = new float[COLOR_ARRAY_SIZE];
|
||||
// Holds the color 'bytes' as they change
|
||||
float[] currentColor = new float[COLOR_ARRAY_SIZE];
|
||||
|
||||
// Holds the color 'bytes' as they change
|
||||
float[] currentColor = new float[COLOR_ARRAY_SIZE];
|
||||
// Holds the final list of colors
|
||||
int[] gradient = new int[iterations];
|
||||
|
||||
// Holds the final list of colors
|
||||
int[] gradient = new int[iterations];
|
||||
// Extract bytes
|
||||
for (int i = 0; i < COLOR_ARRAY_SIZE; i++) {
|
||||
// Get fromColor byte
|
||||
fromColorBytes[i] = (fromColor >> this.COLOR_SHIFT_AMOUNT[i]) & 0xFF;
|
||||
|
||||
// Extract bytes
|
||||
for( int i = 0; i < COLOR_ARRAY_SIZE; i++ )
|
||||
{
|
||||
// Get fromColor byte
|
||||
fromColorBytes[i] = ( fromColor >> this.COLOR_SHIFT_AMOUNT[i] ) & 0xFF;
|
||||
// Get toColor byte
|
||||
toColorBytes[i] = ((toColor >> this.COLOR_SHIFT_AMOUNT[i]) & 0xFF);
|
||||
|
||||
// Get toColor byte
|
||||
toColorBytes[i] = ( ( toColor >> this.COLOR_SHIFT_AMOUNT[i] ) & 0xFF );
|
||||
// Calculate step amount
|
||||
stepAmount[i] = (toColorBytes[i] - fromColorBytes[i]) / (float) iterations;
|
||||
|
||||
// Calculate step amount
|
||||
stepAmount[i] = ( toColorBytes[i] - fromColorBytes[i] ) / (float)iterations;
|
||||
// Init the current color
|
||||
currentColor[i] = fromColorBytes[i];
|
||||
}
|
||||
|
||||
// Init the current color
|
||||
currentColor[i] = fromColorBytes[i];
|
||||
}
|
||||
// Set the first color
|
||||
gradient[0] = fromColor;
|
||||
|
||||
// Set the first color
|
||||
gradient[0] = fromColor;
|
||||
for (int iteration = 1; iteration < iterations; iteration++) {
|
||||
int result = 0;
|
||||
|
||||
for( int iteration = 1; iteration < iterations; iteration++ )
|
||||
{
|
||||
int result = 0;
|
||||
// Add the step amounts to the current color and incorporate into the result color
|
||||
for (int i = 0; i < COLOR_ARRAY_SIZE; i++) {
|
||||
// Add the step amount
|
||||
currentColor[i] += stepAmount[i];
|
||||
|
||||
// Add the step amounts to the current color and incorporate into the result color
|
||||
for( int i = 0; i < COLOR_ARRAY_SIZE; i++ )
|
||||
{
|
||||
// Add the step amount
|
||||
currentColor[i] += stepAmount[i];
|
||||
// Add to result color
|
||||
result += ((Math.round(currentColor[i]) & 0xFF) << this.COLOR_SHIFT_AMOUNT[i]);
|
||||
}
|
||||
|
||||
// Add to result color
|
||||
result += ( ( Math.round( currentColor[i] ) & 0xFF ) << this.COLOR_SHIFT_AMOUNT[i] );
|
||||
// Set gradient
|
||||
gradient[iteration] = result;
|
||||
}
|
||||
|
||||
}
|
||||
// Set the last color
|
||||
gradient[iterations - 1] = toColor;
|
||||
|
||||
// Set gradient
|
||||
gradient[iteration] = result;
|
||||
return gradient;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Gets the chat color associated with the specified aspect.
|
||||
*
|
||||
* @param aspect
|
||||
* @return
|
||||
*/
|
||||
public final String getAspectChatColor(final Aspect aspect) {
|
||||
if (this.aspectChatColors.containsKey(aspect)) {
|
||||
return this.aspectChatColors.get(aspect);
|
||||
}
|
||||
return EnumChatFormatting.WHITE.toString();
|
||||
}
|
||||
|
||||
// Set the last color
|
||||
gradient[iterations - 1] = toColor;
|
||||
/**
|
||||
* Checks if the specified point is within or on the bounds of a rectangle.
|
||||
* This version localizes the rectangle to the confounds of the current gui.
|
||||
*
|
||||
* @param top
|
||||
* @param left
|
||||
* @param height
|
||||
* @param width
|
||||
* @param pointX
|
||||
* @param pointY
|
||||
* @param guiLeft
|
||||
* @param guiTop
|
||||
* @return
|
||||
*/
|
||||
public final boolean isPointInGuiRegion(
|
||||
final int top,
|
||||
final int left,
|
||||
final int height,
|
||||
final int width,
|
||||
final int pointX,
|
||||
final int pointY,
|
||||
final int guiLeft,
|
||||
final int guiTop) {
|
||||
return this.isPointInRegion(top, left, height, width, pointX - guiLeft, pointY - guiTop);
|
||||
}
|
||||
|
||||
return gradient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the chat color associated with the specified aspect.
|
||||
*
|
||||
* @param aspect
|
||||
* @return
|
||||
*/
|
||||
public final String getAspectChatColor( final Aspect aspect )
|
||||
{
|
||||
if( this.aspectChatColors.containsKey( aspect ) )
|
||||
{
|
||||
return this.aspectChatColors.get( aspect );
|
||||
}
|
||||
return EnumChatFormatting.WHITE.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the specified point is within or on the bounds of a rectangle.
|
||||
* This version localizes the rectangle to the confounds of the current gui.
|
||||
*
|
||||
* @param top
|
||||
* @param left
|
||||
* @param height
|
||||
* @param width
|
||||
* @param pointX
|
||||
* @param pointY
|
||||
* @param guiLeft
|
||||
* @param guiTop
|
||||
* @return
|
||||
*/
|
||||
public final boolean isPointInGuiRegion( final int top, final int left, final int height, final int width, final int pointX, final int pointY,
|
||||
final int guiLeft, final int guiTop )
|
||||
{
|
||||
return this.isPointInRegion( top, left, height, width, pointX - guiLeft, pointY - guiTop );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the specified point is within or on the bounds of a rectangle
|
||||
*
|
||||
* @param top
|
||||
* @param left
|
||||
* @param height
|
||||
* @param width
|
||||
* @param pointX
|
||||
* @param pointY
|
||||
* @return
|
||||
*/
|
||||
public final boolean isPointInRegion( final int top, final int left, final int height, final int width, final int pointX, final int pointY )
|
||||
{
|
||||
return ( pointX >= left ) && ( pointX <= ( left + width ) ) && ( pointY >= top ) && ( pointY <= ( top + height ) );
|
||||
}
|
||||
/**
|
||||
* Checks if the specified point is within or on the bounds of a rectangle
|
||||
*
|
||||
* @param top
|
||||
* @param left
|
||||
* @param height
|
||||
* @param width
|
||||
* @param pointX
|
||||
* @param pointY
|
||||
* @return
|
||||
*/
|
||||
public final boolean isPointInRegion(
|
||||
final int top, final int left, final int height, final int width, final int pointX, final int pointY) {
|
||||
return (pointX >= left) && (pointX <= (left + width)) && (pointY >= top) && (pointY <= (top + height));
|
||||
}
|
||||
}
|
||||
@@ -12,217 +12,217 @@ import thaumicenergistics.client.gui.GuiArcaneCraftingTerminal;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract class GuiConstants_ACT
|
||||
extends ThEScrollbarGui
|
||||
{
|
||||
public abstract class GuiConstants_ACT extends ThEScrollbarGui {
|
||||
|
||||
/**
|
||||
* Starting X position for craft aspects
|
||||
*/
|
||||
protected static final int ASPECT_COST_POS_X = 136;
|
||||
/**
|
||||
* Starting X position for craft aspects
|
||||
*/
|
||||
protected static final int ASPECT_COST_POS_X = 136;
|
||||
|
||||
/**
|
||||
* Starting Y position for craft aspects
|
||||
*/
|
||||
protected static final int ASPECT_COST_POS_Y = 90;
|
||||
/**
|
||||
* Starting Y position for craft aspects
|
||||
*/
|
||||
protected static final int ASPECT_COST_POS_Y = 90;
|
||||
|
||||
/**
|
||||
* Distance between aspect icons
|
||||
*/
|
||||
protected static final int ASPECT_COST_SPACING = 18;
|
||||
/**
|
||||
* Distance between aspect icons
|
||||
*/
|
||||
protected static final int ASPECT_COST_SPACING = 18;
|
||||
|
||||
/**
|
||||
* Rate at which to blink the aspect if there is not enough in the wand.
|
||||
*/
|
||||
protected static final double ASPECT_COST_BLINK_SPEED = 0.5D;
|
||||
/**
|
||||
* Rate at which to blink the aspect if there is not enough in the wand.
|
||||
*/
|
||||
protected static final double ASPECT_COST_BLINK_SPEED = 0.5D;
|
||||
|
||||
/**
|
||||
* Minimum transparency of the aspect if there is not enough in the wand.
|
||||
*/
|
||||
protected static final float ASPECT_COST_MIN_ALPHA = 0.25F;
|
||||
/**
|
||||
* Minimum transparency of the aspect if there is not enough in the wand.
|
||||
*/
|
||||
protected static final float ASPECT_COST_MIN_ALPHA = 0.25F;
|
||||
|
||||
/**
|
||||
* Minimum transparency of the aspect if there is not enough in the wand.
|
||||
*/
|
||||
protected static final float ASPECT_COST_MAX_ALPHA = 0.75F;
|
||||
/**
|
||||
* Minimum transparency of the aspect if there is not enough in the wand.
|
||||
*/
|
||||
protected static final float ASPECT_COST_MAX_ALPHA = 0.75F;
|
||||
|
||||
/**
|
||||
* Clear grid button
|
||||
*/
|
||||
protected static final int BUTTON_CLEAR_GRID_ID = 0, BUTTON_CLEAR_GRID_POS_X = 98, BUTTON_CLEAR_GRID_POS_Y = 89;
|
||||
/**
|
||||
* Clear grid button
|
||||
*/
|
||||
protected static final int BUTTON_CLEAR_GRID_ID = 0, BUTTON_CLEAR_GRID_POS_X = 98, BUTTON_CLEAR_GRID_POS_Y = 89;
|
||||
|
||||
/**
|
||||
* Sort mode button
|
||||
*/
|
||||
protected static final int BUTTON_SORT_MODE_ID = 1, BUTTON_SORT_MODE_POS_X = -18, BUTTON_SORT_MODE_POS_Y = 8;
|
||||
/**
|
||||
* Sort mode button
|
||||
*/
|
||||
protected static final int BUTTON_SORT_MODE_ID = 1, BUTTON_SORT_MODE_POS_X = -18, BUTTON_SORT_MODE_POS_Y = 8;
|
||||
|
||||
/**
|
||||
* Sort direction button
|
||||
*/
|
||||
protected static final int BUTTON_SORT_DIR_ID = 2, BUTTON_SORT_DIR_POS_X = BUTTON_SORT_MODE_POS_X,
|
||||
BUTTON_SORT_DIR_POS_Y = BUTTON_SORT_MODE_POS_Y + 20;
|
||||
/**
|
||||
* Sort direction button
|
||||
*/
|
||||
protected static final int BUTTON_SORT_DIR_ID = 2,
|
||||
BUTTON_SORT_DIR_POS_X = BUTTON_SORT_MODE_POS_X,
|
||||
BUTTON_SORT_DIR_POS_Y = BUTTON_SORT_MODE_POS_Y + 20;
|
||||
|
||||
/**
|
||||
* View type button
|
||||
*/
|
||||
protected static final int BUTTON_VIEW_TYPE_ID = 3, BUTTON_VIEW_TYPE_POS_X = BUTTON_SORT_MODE_POS_X,
|
||||
BUTTON_VIEW_TYPE_POS_Y = BUTTON_SORT_DIR_POS_Y + 20;
|
||||
/**
|
||||
* View type button
|
||||
*/
|
||||
protected static final int BUTTON_VIEW_TYPE_ID = 3,
|
||||
BUTTON_VIEW_TYPE_POS_X = BUTTON_SORT_MODE_POS_X,
|
||||
BUTTON_VIEW_TYPE_POS_Y = BUTTON_SORT_DIR_POS_Y + 20;
|
||||
|
||||
/**
|
||||
* Swap armor button
|
||||
*/
|
||||
protected static final int BUTTON_SWAP_ARMOR_ID = 4, BUTTON_SWAP_ARMOR_POS_X = 26, BUTTON_SWAP_ARMOR_POS_Y = 112;
|
||||
/**
|
||||
* Swap armor button
|
||||
*/
|
||||
protected static final int BUTTON_SWAP_ARMOR_ID = 4, BUTTON_SWAP_ARMOR_POS_X = 26, BUTTON_SWAP_ARMOR_POS_Y = 112;
|
||||
|
||||
/**
|
||||
* Search mode
|
||||
*/
|
||||
protected static final int BUTTON_SEARCH_MODE_ID = 5, BUTTON_SEARCH_MODE_POS_X = BUTTON_SORT_MODE_POS_X,
|
||||
BUTTON_SEARCH_MODE_POS_Y = BUTTON_VIEW_TYPE_POS_Y + 20;
|
||||
/**
|
||||
* Search mode
|
||||
*/
|
||||
protected static final int BUTTON_SEARCH_MODE_ID = 5,
|
||||
BUTTON_SEARCH_MODE_POS_X = BUTTON_SORT_MODE_POS_X,
|
||||
BUTTON_SEARCH_MODE_POS_Y = BUTTON_VIEW_TYPE_POS_Y + 20;
|
||||
|
||||
/**
|
||||
* Terminal style button
|
||||
*/
|
||||
protected static final int BUTTON_TERM_STYLE_ID = 6, BUTTON_TERM_STYLE_POS_X = BUTTON_SORT_MODE_POS_X,
|
||||
BUTTON_TERM_STYLE_POS_Y = BUTTON_SEARCH_MODE_POS_Y + 20;
|
||||
/**
|
||||
* Terminal style button
|
||||
*/
|
||||
protected static final int BUTTON_TERM_STYLE_ID = 6,
|
||||
BUTTON_TERM_STYLE_POS_X = BUTTON_SORT_MODE_POS_X,
|
||||
BUTTON_TERM_STYLE_POS_Y = BUTTON_SEARCH_MODE_POS_Y + 20;
|
||||
|
||||
/**
|
||||
* Size of the AE buttons
|
||||
*/
|
||||
protected static final int BUTTON_AE_SIZE = 16;
|
||||
/**
|
||||
* Size of the AE buttons
|
||||
*/
|
||||
protected static final int BUTTON_AE_SIZE = 16;
|
||||
|
||||
/**
|
||||
* Size of the tiny buttons.
|
||||
*/
|
||||
protected static final int BUTTON_TINY_SIZE = 8;
|
||||
/**
|
||||
* Size of the tiny buttons.
|
||||
*/
|
||||
protected static final int BUTTON_TINY_SIZE = 8;
|
||||
|
||||
/**
|
||||
* The width of the gui
|
||||
*/
|
||||
protected static final int GUI_WIDTH = 230;
|
||||
/**
|
||||
* The width of the gui
|
||||
*/
|
||||
protected static final int GUI_WIDTH = 230;
|
||||
|
||||
/**
|
||||
* The height of the gui
|
||||
*/
|
||||
protected static final int GUI_HEIGHT = 243;
|
||||
/**
|
||||
* The height of the gui
|
||||
*/
|
||||
protected static final int GUI_HEIGHT = 243;
|
||||
|
||||
/**
|
||||
* Width of the view cell texture
|
||||
*/
|
||||
protected static final int GUI_VIEW_CELL_TEXTURE_WIDTH = 35;
|
||||
/**
|
||||
* Width of the view cell texture
|
||||
*/
|
||||
protected static final int GUI_VIEW_CELL_TEXTURE_WIDTH = 35;
|
||||
|
||||
/**
|
||||
* Height of the view cell texture
|
||||
*/
|
||||
protected static final int GUI_VIEW_CELL_TEXTURE_HEIGHT = 104;
|
||||
/**
|
||||
* Height of the view cell texture
|
||||
*/
|
||||
protected static final int GUI_VIEW_CELL_TEXTURE_HEIGHT = 104;
|
||||
|
||||
/**
|
||||
* Size of the upper portion of the GUI
|
||||
*/
|
||||
protected static final int GUI_UPPER_TEXTURE_HEIGHT = 35;
|
||||
/**
|
||||
* Size of the upper portion of the GUI
|
||||
*/
|
||||
protected static final int GUI_UPPER_TEXTURE_HEIGHT = 35;
|
||||
|
||||
/**
|
||||
* The V(y) location in the GUI texture to draw extra rows from.
|
||||
*/
|
||||
protected static final int GUI_TEXTURE_ROW_V = 35;
|
||||
/**
|
||||
* The V(y) location in the GUI texture to draw extra rows from.
|
||||
*/
|
||||
protected static final int GUI_TEXTURE_ROW_V = 35;
|
||||
|
||||
/**
|
||||
* Width of the main body of the texture.
|
||||
*/
|
||||
protected static final int GUI_MAIN_BODY_WIDTH = GUI_WIDTH - GUI_VIEW_CELL_TEXTURE_WIDTH;
|
||||
/**
|
||||
* Width of the main body of the texture.
|
||||
*/
|
||||
protected static final int GUI_MAIN_BODY_WIDTH = GUI_WIDTH - GUI_VIEW_CELL_TEXTURE_WIDTH;
|
||||
|
||||
/**
|
||||
* Default number of rows in the ME inventory grid.
|
||||
*/
|
||||
protected static final int ME_DEFAULT_ROWS = 3;
|
||||
/**
|
||||
* Default number of rows in the ME inventory grid.
|
||||
*/
|
||||
protected static final int ME_DEFAULT_ROWS = 3;
|
||||
|
||||
/**
|
||||
* Number of columns in the ME inventory grid.
|
||||
*/
|
||||
protected static final int ME_COLUMNS = 9;
|
||||
/**
|
||||
* Number of columns in the ME inventory grid.
|
||||
*/
|
||||
protected static final int ME_COLUMNS = 9;
|
||||
|
||||
/**
|
||||
* Starting X position of the items.
|
||||
*/
|
||||
protected static final int ME_ITEM_POS_X = 7;
|
||||
/**
|
||||
* Starting X position of the items.
|
||||
*/
|
||||
protected static final int ME_ITEM_POS_X = 7;
|
||||
|
||||
/**
|
||||
* Starting Y position of the items.
|
||||
*/
|
||||
protected static final int ME_ITEM_POS_Y = 17;
|
||||
/**
|
||||
* Starting Y position of the items.
|
||||
*/
|
||||
protected static final int ME_ITEM_POS_Y = 17;
|
||||
|
||||
/**
|
||||
* Total width of the ME item grid.
|
||||
*/
|
||||
protected static final int ME_GRID_WIDTH = 161;
|
||||
/**
|
||||
* Total width of the ME item grid.
|
||||
*/
|
||||
protected static final int ME_GRID_WIDTH = 161;
|
||||
|
||||
/**
|
||||
* Height of the extra row texture.
|
||||
*/
|
||||
protected static final int ME_ROW_HEIGHT = 18;
|
||||
/**
|
||||
* Height of the extra row texture.
|
||||
*/
|
||||
protected static final int ME_ROW_HEIGHT = 18;
|
||||
|
||||
/**
|
||||
* Height of the lower portion of the texture.
|
||||
*/
|
||||
protected static final int GUI_TEXTURE_LOWER_HEIGHT = GUI_HEIGHT - ME_ROW_HEIGHT - GUI_UPPER_TEXTURE_HEIGHT;
|
||||
/**
|
||||
* Height of the lower portion of the texture.
|
||||
*/
|
||||
protected static final int GUI_TEXTURE_LOWER_HEIGHT = GUI_HEIGHT - ME_ROW_HEIGHT - GUI_UPPER_TEXTURE_HEIGHT;
|
||||
|
||||
/**
|
||||
* X position of the scroll bar
|
||||
*/
|
||||
protected static final int SCROLLBAR_POS_X = 175;
|
||||
/**
|
||||
* X position of the scroll bar
|
||||
*/
|
||||
protected static final int SCROLLBAR_POS_X = 175;
|
||||
|
||||
/**
|
||||
* Y position of the scroll bar
|
||||
*/
|
||||
protected static final int SCROLLBAR_POS_Y = 18;
|
||||
/**
|
||||
* Y position of the scroll bar
|
||||
*/
|
||||
protected static final int SCROLLBAR_POS_Y = 18;
|
||||
|
||||
/**
|
||||
* Height of the scroll bar
|
||||
*/
|
||||
protected static final int SCROLLBAR_HEIGHT = 52;
|
||||
/**
|
||||
* Height of the scroll bar
|
||||
*/
|
||||
protected static final int SCROLLBAR_HEIGHT = 52;
|
||||
|
||||
/**
|
||||
* X offset to draw the search field.
|
||||
*/
|
||||
protected static final int SEARCH_POS_X = 98;
|
||||
/**
|
||||
* X offset to draw the search field.
|
||||
*/
|
||||
protected static final int SEARCH_POS_X = 98;
|
||||
|
||||
/**
|
||||
* Y offset to draw the search field.
|
||||
*/
|
||||
protected static final int SEARCH_POS_Y = 6;
|
||||
/**
|
||||
* Y offset to draw the search field.
|
||||
*/
|
||||
protected static final int SEARCH_POS_Y = 6;
|
||||
|
||||
/**
|
||||
* Width of the search field.
|
||||
*/
|
||||
protected static final int SEARCH_WIDTH = 65;
|
||||
/**
|
||||
* Width of the search field.
|
||||
*/
|
||||
protected static final int SEARCH_WIDTH = 65;
|
||||
|
||||
/**
|
||||
* Height of the search field.
|
||||
*/
|
||||
protected static final int SEARCH_HEIGHT = 10;
|
||||
/**
|
||||
* Height of the search field.
|
||||
*/
|
||||
protected static final int SEARCH_HEIGHT = 10;
|
||||
|
||||
/**
|
||||
* The maximum number of characters that can be typed in.
|
||||
*/
|
||||
protected static final int SEARCH_MAX_CHARS = 15;
|
||||
/**
|
||||
* The maximum number of characters that can be typed in.
|
||||
*/
|
||||
protected static final int SEARCH_MAX_CHARS = 15;
|
||||
|
||||
/**
|
||||
* X position of the title string
|
||||
*/
|
||||
protected static final int TITLE_POS_X = 8;
|
||||
/**
|
||||
* X position of the title string
|
||||
*/
|
||||
protected static final int TITLE_POS_X = 8;
|
||||
|
||||
/**
|
||||
* Y position of the title string
|
||||
*/
|
||||
protected static final int TITLE_POS_Y = 6;
|
||||
/**
|
||||
* Y position of the title string
|
||||
*/
|
||||
protected static final int TITLE_POS_Y = 6;
|
||||
|
||||
/**
|
||||
* Determines how often to update the tooltip when the mouse is not moving.
|
||||
*/
|
||||
protected static final long WIDGET_TOOLTIP_UPDATE_INTERVAL = 3000L;
|
||||
|
||||
public GuiConstants_ACT( final Container container )
|
||||
{
|
||||
super( container );
|
||||
}
|
||||
/**
|
||||
* Determines how often to update the tooltip when the mouse is not moving.
|
||||
*/
|
||||
protected static final long WIDGET_TOOLTIP_UPDATE_INTERVAL = 3000L;
|
||||
|
||||
public GuiConstants_ACT(final Container container) {
|
||||
super(container);
|
||||
}
|
||||
}
|
||||
@@ -12,77 +12,77 @@ import thaumicenergistics.client.gui.GuiEssentiaCellTerminal;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract class GuiConstants_ECT
|
||||
extends ThEScrollbarGui
|
||||
{
|
||||
/**
|
||||
* Sort mode button position.
|
||||
*/
|
||||
protected static final int BUTTON_SORT_MODE_POS_X = -18, BUTTON_SORT_MODE_POS_Y = 9;
|
||||
public abstract class GuiConstants_ECT extends ThEScrollbarGui {
|
||||
/**
|
||||
* Sort mode button position.
|
||||
*/
|
||||
protected static final int BUTTON_SORT_MODE_POS_X = -18, BUTTON_SORT_MODE_POS_Y = 9;
|
||||
|
||||
/**
|
||||
* View mode button.
|
||||
*/
|
||||
protected static final int BUTTON_VIEW_MODE_POS_X = -18, BUTTON_VIEW_MODE_POS_Y = GuiConstants_ECT.BUTTON_SORT_MODE_POS_Y + 20;
|
||||
/**
|
||||
* View mode button.
|
||||
*/
|
||||
protected static final int BUTTON_VIEW_MODE_POS_X = -18,
|
||||
BUTTON_VIEW_MODE_POS_Y = GuiConstants_ECT.BUTTON_SORT_MODE_POS_Y + 20;
|
||||
|
||||
/**
|
||||
* Size of the gui.
|
||||
*/
|
||||
protected static final int GUI_WIDTH = 195, GUI_HEIGHT = 204;
|
||||
/**
|
||||
* Size of the gui.
|
||||
*/
|
||||
protected static final int GUI_WIDTH = 195, GUI_HEIGHT = 204;
|
||||
|
||||
/**
|
||||
* Width and height of the mode buttons.
|
||||
*/
|
||||
protected static final int MODE_BUTTON_SIZE = 16;
|
||||
/**
|
||||
* Width and height of the mode buttons.
|
||||
*/
|
||||
protected static final int MODE_BUTTON_SIZE = 16;
|
||||
|
||||
/**
|
||||
* Search bar.
|
||||
*/
|
||||
protected static final int SEARCH_X_OFFSET = 98, SEARCH_Y_OFFSET = 6, SEARCH_WIDTH = 69, SEARCH_HEIGHT = 10;
|
||||
/**
|
||||
* Search bar.
|
||||
*/
|
||||
protected static final int SEARCH_X_OFFSET = 98, SEARCH_Y_OFFSET = 6, SEARCH_WIDTH = 69, SEARCH_HEIGHT = 10;
|
||||
|
||||
/**
|
||||
* The maximum number of displayable characters.
|
||||
*/
|
||||
protected static final int SEARCH_MAX_CHARS = 14;
|
||||
/**
|
||||
* The maximum number of displayable characters.
|
||||
*/
|
||||
protected static final int SEARCH_MAX_CHARS = 14;
|
||||
|
||||
/**
|
||||
* Scroll bar.
|
||||
*/
|
||||
protected static final int SCROLLBAR_POS_X = 175, SCROLLBAR_POS_Y = 18, SCROLLBAR_HEIGHT = 70;
|
||||
/**
|
||||
* Scroll bar.
|
||||
*/
|
||||
protected static final int SCROLLBAR_POS_X = 175, SCROLLBAR_POS_Y = 18, SCROLLBAR_HEIGHT = 70;
|
||||
|
||||
/**
|
||||
* Selected aspect info positions.
|
||||
*/
|
||||
protected static final int SELECTED_INFO_POS_X = 45, SELECTED_INFO_NAME_POS_Y = 91, SELECTED_INFO_AMOUNT_POS_Y = 101;
|
||||
/**
|
||||
* Selected aspect info positions.
|
||||
*/
|
||||
protected static final int SELECTED_INFO_POS_X = 45,
|
||||
SELECTED_INFO_NAME_POS_Y = 91,
|
||||
SELECTED_INFO_AMOUNT_POS_Y = 101;
|
||||
|
||||
/**
|
||||
* Position of the title.
|
||||
*/
|
||||
protected static final int TITLE_POS_X = 7, TITLE_POS_Y = 6;
|
||||
/**
|
||||
* Position of the title.
|
||||
*/
|
||||
protected static final int TITLE_POS_X = 7, TITLE_POS_Y = 6;
|
||||
|
||||
/**
|
||||
* Widget offsets.
|
||||
*/
|
||||
protected static final int WIDGET_OFFSET_X = 7, WIDGET_OFFSET_Y = 17;
|
||||
/**
|
||||
* Widget offsets.
|
||||
*/
|
||||
protected static final int WIDGET_OFFSET_X = 7, WIDGET_OFFSET_Y = 17;
|
||||
|
||||
/**
|
||||
* Number of widgets per row.
|
||||
*/
|
||||
protected static final int WIDGETS_PER_ROW = 9;
|
||||
/**
|
||||
* Number of widgets per row.
|
||||
*/
|
||||
protected static final int WIDGETS_PER_ROW = 9;
|
||||
|
||||
/**
|
||||
* Number of rows per page.
|
||||
*/
|
||||
protected static final int WIDGET_ROWS_PER_PAGE = 4;
|
||||
/**
|
||||
* Number of rows per page.
|
||||
*/
|
||||
protected static final int WIDGET_ROWS_PER_PAGE = 4;
|
||||
|
||||
/**
|
||||
* Number of widgets per page.
|
||||
*/
|
||||
protected static final int WIDGETS_PER_PAGE = GuiConstants_ECT.WIDGETS_PER_ROW * GuiConstants_ECT.WIDGET_ROWS_PER_PAGE;
|
||||
|
||||
public GuiConstants_ECT( final Container container )
|
||||
{
|
||||
super( container );
|
||||
}
|
||||
/**
|
||||
* Number of widgets per page.
|
||||
*/
|
||||
protected static final int WIDGETS_PER_PAGE =
|
||||
GuiConstants_ECT.WIDGETS_PER_ROW * GuiConstants_ECT.WIDGET_ROWS_PER_PAGE;
|
||||
|
||||
public GuiConstants_ECT(final Container container) {
|
||||
super(container);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
package thaumicenergistics.client.gui.abstraction;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.parts.automation.UpgradeInventory;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
@@ -27,264 +27,245 @@ import thaumicenergistics.common.container.slot.SlotNetworkTool;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract class ThEBaseGui
|
||||
extends GuiContainer
|
||||
implements IWidgetHost
|
||||
{
|
||||
private static final int upgradeU = AEStateIconsEnum.UPGRADE_CARD_BACKGROUND.getU();
|
||||
private static final int upgradeV = AEStateIconsEnum.UPGRADE_CARD_BACKGROUND.getV();
|
||||
private static final int upgradeWidth = AEStateIconsEnum.UPGRADE_CARD_BACKGROUND.getWidth();
|
||||
private static final int upgradeHeight = AEStateIconsEnum.UPGRADE_CARD_BACKGROUND.getHeight();
|
||||
public abstract class ThEBaseGui extends GuiContainer implements IWidgetHost {
|
||||
private static final int upgradeU = AEStateIconsEnum.UPGRADE_CARD_BACKGROUND.getU();
|
||||
private static final int upgradeV = AEStateIconsEnum.UPGRADE_CARD_BACKGROUND.getV();
|
||||
private static final int upgradeWidth = AEStateIconsEnum.UPGRADE_CARD_BACKGROUND.getWidth();
|
||||
private static final int upgradeHeight = AEStateIconsEnum.UPGRADE_CARD_BACKGROUND.getHeight();
|
||||
|
||||
/**
|
||||
* Lines to draw when drawTooltip is called.
|
||||
*/
|
||||
protected final List<String> tooltip = new ArrayList<String>();
|
||||
public ItemStack draggedStack;
|
||||
/**
|
||||
* Lines to draw when drawTooltip is called.
|
||||
*/
|
||||
protected final List<String> tooltip = new ArrayList<String>();
|
||||
|
||||
public ThEBaseGui( final Container container )
|
||||
{
|
||||
super( container );
|
||||
}
|
||||
public ItemStack draggedStack;
|
||||
|
||||
/**
|
||||
* Adds to the tooltip based on which button the mouse is over.
|
||||
*
|
||||
* @param mouseX
|
||||
* @param mouseY
|
||||
* @return True when a tooltip was added, false otherwise.
|
||||
*/
|
||||
private final boolean addTooltipFromButtons( final int mouseX, final int mouseY )
|
||||
{
|
||||
// Is the mouse over any buttons?
|
||||
for( Object obj : this.buttonList )
|
||||
{
|
||||
// Is it a base button?
|
||||
if( obj instanceof ThEGuiButtonBase )
|
||||
{
|
||||
// Cast
|
||||
ThEGuiButtonBase currentButton = (ThEGuiButtonBase)obj;
|
||||
public ThEBaseGui(final Container container) {
|
||||
super(container);
|
||||
}
|
||||
|
||||
// Is the mouse over it?
|
||||
if( currentButton.isMouseOverButton( mouseX, mouseY ) )
|
||||
{
|
||||
// Get the tooltip
|
||||
currentButton.getTooltip( this.tooltip );
|
||||
/**
|
||||
* Adds to the tooltip based on which button the mouse is over.
|
||||
*
|
||||
* @param mouseX
|
||||
* @param mouseY
|
||||
* @return True when a tooltip was added, false otherwise.
|
||||
*/
|
||||
private final boolean addTooltipFromButtons(final int mouseX, final int mouseY) {
|
||||
// Is the mouse over any buttons?
|
||||
for (Object obj : this.buttonList) {
|
||||
// Is it a base button?
|
||||
if (obj instanceof ThEGuiButtonBase) {
|
||||
// Cast
|
||||
ThEGuiButtonBase currentButton = (ThEGuiButtonBase) obj;
|
||||
|
||||
// And stop searching
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Is the mouse over it?
|
||||
if (currentButton.isMouseOverButton(mouseX, mouseY)) {
|
||||
// Get the tooltip
|
||||
currentButton.getTooltip(this.tooltip);
|
||||
|
||||
return false;
|
||||
}
|
||||
// And stop searching
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the specified point is within the bounds of the specified slot.
|
||||
*
|
||||
* @param slot
|
||||
* @param x
|
||||
* @param y
|
||||
* @return True if the point is within the slot, false otherwise.
|
||||
*/
|
||||
private final boolean isPointWithinSlot( final Slot slot, final int x, final int y )
|
||||
{
|
||||
return ThEGuiHelper.INSTANCE.isPointInGuiRegion( slot.yDisplayPosition, slot.xDisplayPosition, 16, 16, x, y, this.guiLeft, this.guiTop );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a not-left-click was on a button.<BR>
|
||||
* Left click is handled by GuiScreen.mouseClicked()
|
||||
*
|
||||
* @param mouseX
|
||||
* @param mouseY
|
||||
* @return True if click was handled.
|
||||
*/
|
||||
private final boolean nonLeftClickHandler_Buttons( final int mouseX, final int mouseY, final int mouseButton )
|
||||
{
|
||||
if( mouseButton != ThEGuiHelper.MOUSE_BUTTON_LEFT )
|
||||
{
|
||||
// Mouse over button?
|
||||
for( Object buttonObj : this.buttonList )
|
||||
{
|
||||
// Cast
|
||||
GuiButton button = (GuiButton)buttonObj;
|
||||
/**
|
||||
* Checks if the specified point is within the bounds of the specified slot.
|
||||
*
|
||||
* @param slot
|
||||
* @param x
|
||||
* @param y
|
||||
* @return True if the point is within the slot, false otherwise.
|
||||
*/
|
||||
private final boolean isPointWithinSlot(final Slot slot, final int x, final int y) {
|
||||
return ThEGuiHelper.INSTANCE.isPointInGuiRegion(
|
||||
slot.yDisplayPosition, slot.xDisplayPosition, 16, 16, x, y, this.guiLeft, this.guiTop);
|
||||
}
|
||||
|
||||
// Was mouse over the button?
|
||||
if( button.mousePressed( this.mc, mouseX, mouseY ) )
|
||||
{
|
||||
// Play clicky sound
|
||||
button.func_146113_a( this.mc.getSoundHandler() );
|
||||
/**
|
||||
* Checks if a not-left-click was on a button.<BR>
|
||||
* Left click is handled by GuiScreen.mouseClicked()
|
||||
*
|
||||
* @param mouseX
|
||||
* @param mouseY
|
||||
* @return True if click was handled.
|
||||
*/
|
||||
private final boolean nonLeftClickHandler_Buttons(final int mouseX, final int mouseY, final int mouseButton) {
|
||||
if (mouseButton != ThEGuiHelper.MOUSE_BUTTON_LEFT) {
|
||||
// Mouse over button?
|
||||
for (Object buttonObj : this.buttonList) {
|
||||
// Cast
|
||||
GuiButton button = (GuiButton) buttonObj;
|
||||
|
||||
// Call button click event
|
||||
this.onButtonClicked( button, mouseButton );
|
||||
// Was mouse over the button?
|
||||
if (button.mousePressed(this.mc, mouseX, mouseY)) {
|
||||
// Play clicky sound
|
||||
button.func_146113_a(this.mc.getSoundHandler());
|
||||
|
||||
// Handled
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Call button click event
|
||||
this.onButtonClicked(button, mouseButton);
|
||||
|
||||
return false;
|
||||
}
|
||||
// Handled
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the slot backgrounds for the network tool and upgrade slots.
|
||||
*
|
||||
* @param alpha
|
||||
* @param mouseX
|
||||
* @param mouseY
|
||||
*/
|
||||
protected final void drawAEToolAndUpgradeSlots( final float alpha, final int mouseX, final int mouseY )
|
||||
{
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture( AEStateIconsEnum.AE_STATES_TEXTURE );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Locate any upgrade or network slots
|
||||
for( int i = 0; i < this.inventorySlots.inventorySlots.size(); i++ )
|
||||
{
|
||||
// Get the slot
|
||||
Slot slot = (Slot)this.inventorySlots.inventorySlots.get( i );
|
||||
/**
|
||||
* Draws the slot backgrounds for the network tool and upgrade slots.
|
||||
*
|
||||
* @param alpha
|
||||
* @param mouseX
|
||||
* @param mouseY
|
||||
*/
|
||||
protected final void drawAEToolAndUpgradeSlots(final float alpha, final int mouseX, final int mouseY) {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(AEStateIconsEnum.AE_STATES_TEXTURE);
|
||||
|
||||
// Is it network or upgrade?
|
||||
if( ( slot instanceof SlotNetworkTool ) || ( slot.inventory instanceof UpgradeInventory ) )
|
||||
{
|
||||
// Draw background
|
||||
this.drawTexturedModalRect( this.guiLeft + slot.xDisplayPosition, this.guiTop + slot.yDisplayPosition, ThEBaseGui.upgradeU,
|
||||
ThEBaseGui.upgradeV, ThEBaseGui.upgradeWidth, ThEBaseGui.upgradeHeight );
|
||||
}
|
||||
}
|
||||
}
|
||||
// Locate any upgrade or network slots
|
||||
for (int i = 0; i < this.inventorySlots.inventorySlots.size(); i++) {
|
||||
// Get the slot
|
||||
Slot slot = (Slot) this.inventorySlots.inventorySlots.get(i);
|
||||
|
||||
/**
|
||||
* Gets the slot who contains the specified point.
|
||||
*
|
||||
* @param x
|
||||
* @param y
|
||||
* @return Slot the point is within, null if point is within no slots.
|
||||
*/
|
||||
protected final Slot getSlotAtMousePosition( final int x, final int y )
|
||||
{
|
||||
// Loop over all slots
|
||||
for( int i = 0; i < this.inventorySlots.inventorySlots.size(); i++ )
|
||||
{
|
||||
// Get the slot
|
||||
Slot slot = (Slot)this.inventorySlots.inventorySlots.get( i );
|
||||
// Is it network or upgrade?
|
||||
if ((slot instanceof SlotNetworkTool) || (slot.inventory instanceof UpgradeInventory)) {
|
||||
// Draw background
|
||||
this.drawTexturedModalRect(
|
||||
this.guiLeft + slot.xDisplayPosition,
|
||||
this.guiTop + slot.yDisplayPosition,
|
||||
ThEBaseGui.upgradeU,
|
||||
ThEBaseGui.upgradeV,
|
||||
ThEBaseGui.upgradeWidth,
|
||||
ThEBaseGui.upgradeHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Is the point within the slot?
|
||||
if( this.isPointWithinSlot( slot, x, y ) )
|
||||
{
|
||||
// Return the slot
|
||||
return slot;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Gets the slot who contains the specified point.
|
||||
*
|
||||
* @param x
|
||||
* @param y
|
||||
* @return Slot the point is within, null if point is within no slots.
|
||||
*/
|
||||
protected final Slot getSlotAtMousePosition(final int x, final int y) {
|
||||
// Loop over all slots
|
||||
for (int i = 0; i < this.inventorySlots.inventorySlots.size(); i++) {
|
||||
// Get the slot
|
||||
Slot slot = (Slot) this.inventorySlots.inventorySlots.get(i);
|
||||
|
||||
// Point was not within any slot
|
||||
return null;
|
||||
}
|
||||
// Is the point within the slot?
|
||||
if (this.isPointWithinSlot(slot, x, y)) {
|
||||
// Return the slot
|
||||
return slot;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the mouse is clicked.
|
||||
*/
|
||||
@Override
|
||||
protected void mouseClicked( final int mouseX, final int mouseY, final int mouseButton )
|
||||
{
|
||||
// Point was not within any slot
|
||||
return null;
|
||||
}
|
||||
|
||||
if( this.nonLeftClickHandler_Buttons( mouseX, mouseY, mouseButton ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Called when the mouse is clicked.
|
||||
*/
|
||||
@Override
|
||||
protected void mouseClicked(final int mouseX, final int mouseY, final int mouseButton) {
|
||||
|
||||
// Is this container one that could have a network tool?
|
||||
if( this.inventorySlots instanceof ContainerWithNetworkTool )
|
||||
{
|
||||
// Do we have a network tool?
|
||||
if( ( (ContainerWithNetworkTool)this.inventorySlots ).hasNetworkTool() )
|
||||
{
|
||||
// Get the slot the mouse was clicked over
|
||||
Slot slot = this.getSlotAtMousePosition( mouseX, mouseY );
|
||||
if (this.nonLeftClickHandler_Buttons(mouseX, mouseY, mouseButton)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Was the slot the network tool?
|
||||
if( ( slot != null ) && ( slot.getStack() != null ) &&
|
||||
( slot.getStack().isItemEqual( AEApi.instance().definitions().items().networkTool().maybeStack( 1 ).get() ) ) )
|
||||
{
|
||||
// Do not allow any interaction with the network tool slot.
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Is this container one that could have a network tool?
|
||||
if (this.inventorySlots instanceof ContainerWithNetworkTool) {
|
||||
// Do we have a network tool?
|
||||
if (((ContainerWithNetworkTool) this.inventorySlots).hasNetworkTool()) {
|
||||
// Get the slot the mouse was clicked over
|
||||
Slot slot = this.getSlotAtMousePosition(mouseX, mouseY);
|
||||
|
||||
// Pass to super
|
||||
super.mouseClicked( mouseX, mouseY, mouseButton );
|
||||
}
|
||||
// Was the slot the network tool?
|
||||
if ((slot != null)
|
||||
&& (slot.getStack() != null)
|
||||
&& (slot.getStack()
|
||||
.isItemEqual(AEApi.instance()
|
||||
.definitions()
|
||||
.items()
|
||||
.networkTool()
|
||||
.maybeStack(1)
|
||||
.get()))) {
|
||||
// Do not allow any interaction with the network tool slot.
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button is clicked. Includes which button was pressed.
|
||||
*
|
||||
* @param button
|
||||
* @param mouseButton
|
||||
*/
|
||||
protected void onButtonClicked( final GuiButton button, final int mouseButton )
|
||||
{
|
||||
}
|
||||
// Pass to super
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button is left-clicked<BR>
|
||||
* Note: Do not override, use {@link #onButtonClicked(GuiButton, int) onButtonClicked} instead.
|
||||
*
|
||||
* @see #onButtonClicked(GuiButton, int )
|
||||
*/
|
||||
@Override
|
||||
public final void actionPerformed( final GuiButton button )
|
||||
{
|
||||
this.onButtonClicked( button, ThEGuiHelper.MOUSE_BUTTON_LEFT );
|
||||
}
|
||||
/**
|
||||
* Called when a button is clicked. Includes which button was pressed.
|
||||
*
|
||||
* @param button
|
||||
* @param mouseButton
|
||||
*/
|
||||
protected void onButtonClicked(final GuiButton button, final int mouseButton) {}
|
||||
|
||||
@Override
|
||||
public void drawScreen( final int mouseX, final int mouseY, final float mouseButton )
|
||||
{
|
||||
// Call super
|
||||
super.drawScreen( mouseX, mouseY, mouseButton );
|
||||
/**
|
||||
* Called when a button is left-clicked<BR>
|
||||
* Note: Do not override, use {@link #onButtonClicked(GuiButton, int) onButtonClicked} instead.
|
||||
*
|
||||
* @see #onButtonClicked(GuiButton, int )
|
||||
*/
|
||||
@Override
|
||||
public final void actionPerformed(final GuiButton button) {
|
||||
this.onButtonClicked(button, ThEGuiHelper.MOUSE_BUTTON_LEFT);
|
||||
}
|
||||
|
||||
// Empty tooltip?
|
||||
if( this.tooltip.isEmpty() )
|
||||
{
|
||||
// Get the tooltip from the buttons
|
||||
this.addTooltipFromButtons( mouseX, mouseY );
|
||||
}
|
||||
@Override
|
||||
public void drawScreen(final int mouseX, final int mouseY, final float mouseButton) {
|
||||
// Call super
|
||||
super.drawScreen(mouseX, mouseY, mouseButton);
|
||||
|
||||
// Draw the tooltip
|
||||
if( !this.tooltip.isEmpty() )
|
||||
{
|
||||
// Draw
|
||||
this.drawHoveringText( this.tooltip, mouseX, mouseY, this.fontRendererObj );
|
||||
// Empty tooltip?
|
||||
if (this.tooltip.isEmpty()) {
|
||||
// Get the tooltip from the buttons
|
||||
this.addTooltipFromButtons(mouseX, mouseY);
|
||||
}
|
||||
|
||||
// Clear the tooltip
|
||||
this.tooltip.clear();
|
||||
}
|
||||
}
|
||||
// Draw the tooltip
|
||||
if (!this.tooltip.isEmpty()) {
|
||||
// Draw
|
||||
this.drawHoveringText(this.tooltip, mouseX, mouseY, this.fontRendererObj);
|
||||
|
||||
@Override
|
||||
public final FontRenderer getFontRenderer()
|
||||
{
|
||||
return this.fontRendererObj;
|
||||
}
|
||||
// Clear the tooltip
|
||||
this.tooltip.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the starting X position for the Gui.
|
||||
*/
|
||||
@Override
|
||||
public final int guiLeft()
|
||||
{
|
||||
return this.guiLeft;
|
||||
}
|
||||
@Override
|
||||
public final FontRenderer getFontRenderer() {
|
||||
return this.fontRendererObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the starting Y position for the Gui.
|
||||
*/
|
||||
@Override
|
||||
public final int guiTop()
|
||||
{
|
||||
return this.guiTop;
|
||||
}
|
||||
/**
|
||||
* Gets the starting X position for the Gui.
|
||||
*/
|
||||
@Override
|
||||
public final int guiLeft() {
|
||||
return this.guiLeft;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the starting Y position for the Gui.
|
||||
*/
|
||||
@Override
|
||||
public final int guiTop() {
|
||||
return this.guiTop;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
package thaumicenergistics.client.gui.abstraction;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import thaumicenergistics.client.gui.ThEGuiHelper;
|
||||
|
||||
/**
|
||||
@@ -17,339 +17,317 @@ import thaumicenergistics.client.gui.ThEGuiHelper;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract class ThEScrollbarGui
|
||||
extends ThEBaseGui
|
||||
{
|
||||
public class ScrollbarParams
|
||||
{
|
||||
/**
|
||||
* X position of the scroll bar
|
||||
*/
|
||||
int scrollbarPosX;
|
||||
public abstract class ThEScrollbarGui extends ThEBaseGui {
|
||||
public class ScrollbarParams {
|
||||
/**
|
||||
* X position of the scroll bar
|
||||
*/
|
||||
int scrollbarPosX;
|
||||
|
||||
/**
|
||||
* Y position of the scroll bar
|
||||
*/
|
||||
int scrollbarPosY;
|
||||
/**
|
||||
* Y position of the scroll bar
|
||||
*/
|
||||
int scrollbarPosY;
|
||||
|
||||
/**
|
||||
* Height of the scroll bar
|
||||
*/
|
||||
int scrollbarHeight;
|
||||
/**
|
||||
* Height of the scroll bar
|
||||
*/
|
||||
int scrollbarHeight;
|
||||
|
||||
/**
|
||||
* Position + Height of the scroll bar.
|
||||
*/
|
||||
int scrollbarVerticalBound;
|
||||
/**
|
||||
* Position + Height of the scroll bar.
|
||||
*/
|
||||
int scrollbarVerticalBound;
|
||||
|
||||
/**
|
||||
* Create the parameters
|
||||
*
|
||||
* @param x
|
||||
* @param y
|
||||
* @param height
|
||||
*/
|
||||
public ScrollbarParams( final int x, final int y, final int height )
|
||||
{
|
||||
this.scrollbarPosX = x;
|
||||
this.scrollbarPosY = y;
|
||||
this.setHeight( height );
|
||||
}
|
||||
/**
|
||||
* Create the parameters
|
||||
*
|
||||
* @param x
|
||||
* @param y
|
||||
* @param height
|
||||
*/
|
||||
public ScrollbarParams(final int x, final int y, final int height) {
|
||||
this.scrollbarPosX = x;
|
||||
this.scrollbarPosY = y;
|
||||
this.setHeight(height);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the height of the scrollbar
|
||||
*
|
||||
* @param height
|
||||
*/
|
||||
void setHeight( final int height )
|
||||
{
|
||||
this.scrollbarHeight = height;
|
||||
this.scrollbarVerticalBound = this.scrollbarHeight + this.scrollbarPosY;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Sets the height of the scrollbar
|
||||
*
|
||||
* @param height
|
||||
*/
|
||||
void setHeight(final int height) {
|
||||
this.scrollbarHeight = height;
|
||||
this.scrollbarVerticalBound = this.scrollbarHeight + this.scrollbarPosY;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scroll bar
|
||||
*/
|
||||
protected final GuiScrollbar scrollBar;
|
||||
/**
|
||||
* Scroll bar
|
||||
*/
|
||||
protected final GuiScrollbar scrollBar;
|
||||
|
||||
/**
|
||||
* Serves as a graphics call bridge for the scroll bar.
|
||||
*/
|
||||
private AEBaseGui aeGuiBridge;
|
||||
/**
|
||||
* True if the scroll bar has mouse focus.
|
||||
*/
|
||||
private boolean isScrollBarHeld = false;
|
||||
/**
|
||||
* The last Y position of the mouse when the scroll bar has mouse focus.
|
||||
*/
|
||||
private int scrollHeldPrevY = 0;
|
||||
/**
|
||||
* Serves as a graphics call bridge for the scroll bar.
|
||||
*/
|
||||
private AEBaseGui aeGuiBridge;
|
||||
/**
|
||||
* True if the scroll bar has mouse focus.
|
||||
*/
|
||||
private boolean isScrollBarHeld = false;
|
||||
/**
|
||||
* The last Y position of the mouse when the scroll bar has mouse focus.
|
||||
*/
|
||||
private int scrollHeldPrevY = 0;
|
||||
|
||||
/**
|
||||
* Scrollbar parameters
|
||||
*/
|
||||
private ScrollbarParams scrollParams;
|
||||
/**
|
||||
* Scrollbar parameters
|
||||
*/
|
||||
private ScrollbarParams scrollParams;
|
||||
|
||||
public ThEScrollbarGui( final Container container )
|
||||
{
|
||||
super( container );
|
||||
public ThEScrollbarGui(final Container container) {
|
||||
super(container);
|
||||
|
||||
// Create the scrollbar
|
||||
this.scrollBar = new GuiScrollbar();
|
||||
}
|
||||
// Create the scrollbar
|
||||
this.scrollBar = new GuiScrollbar();
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground layer.
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer( final int mouseX, final int mouseY )
|
||||
{
|
||||
// Call super
|
||||
super.drawGuiContainerForegroundLayer( mouseX, mouseY );
|
||||
/**
|
||||
* Draw the foreground layer.
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
|
||||
// Call super
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
|
||||
// Draw the scroll bar
|
||||
this.scrollBar.draw( this.aeGuiBridge );
|
||||
}
|
||||
// Draw the scroll bar
|
||||
this.scrollBar.draw(this.aeGuiBridge);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the scroll bar parameters from the subclass.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected abstract ScrollbarParams getScrollbarParameters();
|
||||
/**
|
||||
* Gets the scroll bar parameters from the subclass.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected abstract ScrollbarParams getScrollbarParameters();
|
||||
|
||||
/**
|
||||
* Called when the player types a key.
|
||||
*/
|
||||
@Override
|
||||
protected void keyTyped( final char key, final int keyID )
|
||||
{
|
||||
// Home Key
|
||||
if( keyID == Keyboard.KEY_HOME )
|
||||
{
|
||||
// Move the scroll all the way to home
|
||||
this.scrollBar.click( this.aeGuiBridge, this.scrollParams.scrollbarPosX + 1, this.scrollParams.scrollbarPosY + 1 );
|
||||
this.scrollBar.wheel( 1 );
|
||||
this.onScrollbarMoved();
|
||||
}
|
||||
// End Key
|
||||
else if( keyID == Keyboard.KEY_END )
|
||||
{
|
||||
// Move the scroll all the way to end
|
||||
this.scrollBar.click( this.aeGuiBridge, this.scrollParams.scrollbarPosX + 1, this.scrollParams.scrollbarVerticalBound );
|
||||
this.onScrollbarMoved();
|
||||
/**
|
||||
* Called when the player types a key.
|
||||
*/
|
||||
@Override
|
||||
protected void keyTyped(final char key, final int keyID) {
|
||||
// Home Key
|
||||
if (keyID == Keyboard.KEY_HOME) {
|
||||
// Move the scroll all the way to home
|
||||
this.scrollBar.click(
|
||||
this.aeGuiBridge, this.scrollParams.scrollbarPosX + 1, this.scrollParams.scrollbarPosY + 1);
|
||||
this.scrollBar.wheel(1);
|
||||
this.onScrollbarMoved();
|
||||
}
|
||||
// End Key
|
||||
else if (keyID == Keyboard.KEY_END) {
|
||||
// Move the scroll all the way to end
|
||||
this.scrollBar.click(
|
||||
this.aeGuiBridge, this.scrollParams.scrollbarPosX + 1, this.scrollParams.scrollbarVerticalBound);
|
||||
this.onScrollbarMoved();
|
||||
|
||||
}
|
||||
// Up Key
|
||||
else if( keyID == Keyboard.KEY_UP )
|
||||
{
|
||||
this.scrollBar.wheel( 1 );
|
||||
this.onScrollbarMoved();
|
||||
}
|
||||
// Down Key
|
||||
else if( keyID == Keyboard.KEY_DOWN )
|
||||
{
|
||||
this.scrollBar.wheel( -1 );
|
||||
this.onScrollbarMoved();
|
||||
}
|
||||
else
|
||||
{
|
||||
super.keyTyped( key, keyID );
|
||||
}
|
||||
}
|
||||
// Up Key
|
||||
else if (keyID == Keyboard.KEY_UP) {
|
||||
this.scrollBar.wheel(1);
|
||||
this.onScrollbarMoved();
|
||||
}
|
||||
// Down Key
|
||||
else if (keyID == Keyboard.KEY_DOWN) {
|
||||
this.scrollBar.wheel(-1);
|
||||
this.onScrollbarMoved();
|
||||
} else {
|
||||
super.keyTyped(key, keyID);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Called when the mouse is clicked while the gui is open
|
||||
*/
|
||||
@Override
|
||||
protected void mouseClicked(final int mouseX, final int mouseY, final int mouseButton) {
|
||||
// Is the mouse over the scroll bar area?
|
||||
if (ThEGuiHelper.INSTANCE.isPointInGuiRegion(
|
||||
this.scrollParams.scrollbarPosY,
|
||||
this.scrollParams.scrollbarPosX,
|
||||
this.scrollParams.scrollbarHeight,
|
||||
this.scrollBar.getWidth(),
|
||||
mouseX,
|
||||
mouseY,
|
||||
this.guiLeft,
|
||||
this.guiTop)) {
|
||||
// The scroll bar now has mouse focus
|
||||
this.isScrollBarHeld = true;
|
||||
|
||||
/**
|
||||
* Called when the mouse is clicked while the gui is open
|
||||
*/
|
||||
@Override
|
||||
protected void mouseClicked( final int mouseX, final int mouseY, final int mouseButton )
|
||||
{
|
||||
// Is the mouse over the scroll bar area?
|
||||
if( ThEGuiHelper.INSTANCE.isPointInGuiRegion( this.scrollParams.scrollbarPosY, this.scrollParams.scrollbarPosX,
|
||||
this.scrollParams.scrollbarHeight, this.scrollBar.getWidth(), mouseX, mouseY, this.guiLeft, this.guiTop ) )
|
||||
{
|
||||
// The scroll bar now has mouse focus
|
||||
this.isScrollBarHeld = true;
|
||||
// Mark this Y
|
||||
this.scrollHeldPrevY = mouseY;
|
||||
|
||||
// Mark this Y
|
||||
this.scrollHeldPrevY = mouseY;
|
||||
// Jump the scroll to the mouse
|
||||
this.scrollBar.click(this.aeGuiBridge, mouseX - this.guiLeft, mouseY - this.guiTop);
|
||||
|
||||
// Jump the scroll to the mouse
|
||||
this.scrollBar.click( this.aeGuiBridge, mouseX - this.guiLeft, mouseY - this.guiTop );
|
||||
// Update the subclass
|
||||
this.onScrollbarMoved();
|
||||
|
||||
// Update the subclass
|
||||
this.onScrollbarMoved();
|
||||
// Do not pass to super
|
||||
return;
|
||||
}
|
||||
|
||||
// Do not pass to super
|
||||
return;
|
||||
}
|
||||
// Call super
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
}
|
||||
|
||||
// Call super
|
||||
super.mouseClicked( mouseX, mouseY, mouseButton );
|
||||
}
|
||||
/**
|
||||
* Called when the mouse wheel is scrolled.
|
||||
*
|
||||
* @param deltaZ
|
||||
* @param mouseX
|
||||
* @param mouseY
|
||||
*/
|
||||
protected abstract void onMouseWheel(int deltaZ, int mouseX, int mouseY);
|
||||
|
||||
/**
|
||||
* Called when the mouse wheel is scrolled.
|
||||
*
|
||||
* @param deltaZ
|
||||
* @param mouseX
|
||||
* @param mouseY
|
||||
*/
|
||||
protected abstract void onMouseWheel( int deltaZ, int mouseX, int mouseY );
|
||||
/**
|
||||
* Called when the scroll bar has moved.
|
||||
*/
|
||||
protected abstract void onScrollbarMoved();
|
||||
|
||||
/**
|
||||
* Called when the scroll bar has moved.
|
||||
*/
|
||||
protected abstract void onScrollbarMoved();
|
||||
/**
|
||||
* Changes the height of the scroll bar.
|
||||
*
|
||||
* @param newHeight
|
||||
*/
|
||||
protected void setScrollBarHeight(final int newHeight) {
|
||||
this.scrollParams.setHeight(newHeight);
|
||||
this.scrollBar.setHeight(newHeight);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the height of the scroll bar.
|
||||
*
|
||||
* @param newHeight
|
||||
*/
|
||||
protected void setScrollBarHeight( final int newHeight )
|
||||
{
|
||||
this.scrollParams.setHeight( newHeight );
|
||||
this.scrollBar.setHeight( newHeight );
|
||||
}
|
||||
@Override
|
||||
public void drawScreen(final int mouseX, final int mouseY, final float mouseBtn) {
|
||||
// Call super
|
||||
super.drawScreen(mouseX, mouseY, mouseBtn);
|
||||
|
||||
@Override
|
||||
public void drawScreen( final int mouseX, final int mouseY, final float mouseBtn )
|
||||
{
|
||||
// Call super
|
||||
super.drawScreen( mouseX, mouseY, mouseBtn );
|
||||
// Is the mouse holding the scroll bar?
|
||||
if (this.isScrollBarHeld) {
|
||||
// Is the mouse button still being held down?
|
||||
if (Mouse.isButtonDown(ThEGuiHelper.MOUSE_BUTTON_LEFT)) {
|
||||
// Has the Y changed?
|
||||
if (mouseY == this.scrollHeldPrevY) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Is the mouse holding the scroll bar?
|
||||
if( this.isScrollBarHeld )
|
||||
{
|
||||
// Is the mouse button still being held down?
|
||||
if( Mouse.isButtonDown( ThEGuiHelper.MOUSE_BUTTON_LEFT ) )
|
||||
{
|
||||
// Has the Y changed?
|
||||
if( mouseY == this.scrollHeldPrevY )
|
||||
{
|
||||
return;
|
||||
}
|
||||
boolean correctForZero = false;
|
||||
|
||||
boolean correctForZero = false;
|
||||
// Mark the Y
|
||||
this.scrollHeldPrevY = mouseY;
|
||||
|
||||
// Mark the Y
|
||||
this.scrollHeldPrevY = mouseY;
|
||||
// Calculate the Y position for the scroll bar
|
||||
int repY = mouseY - this.guiTop;
|
||||
|
||||
// Calculate the Y position for the scroll bar
|
||||
int repY = mouseY - this.guiTop;
|
||||
// Has the mouse exceeded the 'upper' bound?
|
||||
if (repY > this.scrollParams.scrollbarVerticalBound) {
|
||||
repY = this.scrollParams.scrollbarVerticalBound;
|
||||
}
|
||||
// Has the mouse exceeded the 'lower' bound?
|
||||
else if (repY <= this.scrollParams.scrollbarPosY) {
|
||||
repY = this.scrollParams.scrollbarPosY;
|
||||
|
||||
// Has the mouse exceeded the 'upper' bound?
|
||||
if( repY > this.scrollParams.scrollbarVerticalBound )
|
||||
{
|
||||
repY = this.scrollParams.scrollbarVerticalBound;
|
||||
}
|
||||
// Has the mouse exceeded the 'lower' bound?
|
||||
else if( repY <= this.scrollParams.scrollbarPosY )
|
||||
{
|
||||
repY = this.scrollParams.scrollbarPosY;
|
||||
// We will have to correct for zero
|
||||
correctForZero = true;
|
||||
}
|
||||
|
||||
// We will have to correct for zero
|
||||
correctForZero = true;
|
||||
}
|
||||
// Update the scroll bar
|
||||
this.scrollBar.click(this.aeGuiBridge, this.scrollParams.scrollbarPosX + 1, repY);
|
||||
|
||||
// Update the scroll bar
|
||||
this.scrollBar.click( this.aeGuiBridge, this.scrollParams.scrollbarPosX + 1, repY );
|
||||
// Should we correct for zero?
|
||||
if (correctForZero) {
|
||||
this.scrollBar.wheel(1);
|
||||
}
|
||||
|
||||
// Should we correct for zero?
|
||||
if( correctForZero )
|
||||
{
|
||||
this.scrollBar.wheel( 1 );
|
||||
}
|
||||
// Inform the subclass the scrollbar has moved
|
||||
this.onScrollbarMoved();
|
||||
} else {
|
||||
// The scroll bar no longer has mouse focus
|
||||
this.isScrollBarHeld = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Inform the subclass the scrollbar has moved
|
||||
this.onScrollbarMoved();
|
||||
}
|
||||
else
|
||||
{
|
||||
// The scroll bar no longer has mouse focus
|
||||
this.isScrollBarHeld = false;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void handleMouseInput() {
|
||||
// Call super
|
||||
super.handleMouseInput();
|
||||
|
||||
}
|
||||
// Get the delta z for the scroll wheel
|
||||
int deltaZ = Mouse.getEventDWheel();
|
||||
|
||||
@Override
|
||||
public void handleMouseInput()
|
||||
{
|
||||
// Call super
|
||||
super.handleMouseInput();
|
||||
// Did it move?
|
||||
if (deltaZ != 0) {
|
||||
// Get the mouse position
|
||||
int mouseX = (Mouse.getEventX() * this.width) / this.mc.displayWidth;
|
||||
int mouseY = this.height - ((Mouse.getEventY() * this.height) / this.mc.displayHeight) - 1;
|
||||
|
||||
// Get the delta z for the scroll wheel
|
||||
int deltaZ = Mouse.getEventDWheel();
|
||||
// Call event
|
||||
this.onMouseWheel(deltaZ, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
// Did it move?
|
||||
if( deltaZ != 0 )
|
||||
{
|
||||
// Get the mouse position
|
||||
int mouseX = ( Mouse.getEventX() * this.width ) / this.mc.displayWidth;
|
||||
int mouseY = this.height - ( ( Mouse.getEventY() * this.height ) / this.mc.displayHeight ) - 1;
|
||||
/**
|
||||
* Sets the gui up.
|
||||
*/
|
||||
@Override
|
||||
public void initGui() {
|
||||
// Call super
|
||||
super.initGui();
|
||||
|
||||
// Call event
|
||||
this.onMouseWheel( deltaZ, mouseX, mouseY );
|
||||
}
|
||||
}
|
||||
// Get the params
|
||||
this.scrollParams = this.getScrollbarParameters();
|
||||
|
||||
/**
|
||||
* Sets the gui up.
|
||||
*/
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
// Call super
|
||||
super.initGui();
|
||||
// Setup the scroll bar
|
||||
this.scrollBar
|
||||
.setLeft(this.scrollParams.scrollbarPosX)
|
||||
.setTop(this.scrollParams.scrollbarPosY)
|
||||
.setHeight(this.scrollParams.scrollbarHeight);
|
||||
|
||||
// Get the params
|
||||
this.scrollParams = this.getScrollbarParameters();
|
||||
// No scrolling yet
|
||||
this.scrollBar.setRange(0, 0, 1);
|
||||
|
||||
// Setup the scroll bar
|
||||
this.scrollBar.setLeft( this.scrollParams.scrollbarPosX ).setTop( this.scrollParams.scrollbarPosY )
|
||||
.setHeight( this.scrollParams.scrollbarHeight );
|
||||
// Create the AE bridge
|
||||
this.aeGuiBridge = new AEBaseGui(this.inventorySlots) {
|
||||
@Override
|
||||
public void bindTexture(final String file) {
|
||||
this.bindTexture("appliedenergistics2", file);
|
||||
}
|
||||
|
||||
// No scrolling yet
|
||||
this.scrollBar.setRange( 0, 0, 1 );
|
||||
@Override
|
||||
public void bindTexture(final String base, final String file) {
|
||||
ThEScrollbarGui.this.mc.getTextureManager().bindTexture(new ResourceLocation(base, "textures/" + file));
|
||||
}
|
||||
|
||||
// Create the AE bridge
|
||||
this.aeGuiBridge = new AEBaseGui( this.inventorySlots )
|
||||
{
|
||||
@Override
|
||||
public void bindTexture( final String file )
|
||||
{
|
||||
this.bindTexture( "appliedenergistics2", file );
|
||||
}
|
||||
@Override
|
||||
public void drawBG(final int arg0, final int arg1, final int arg2, final int arg3) {
|
||||
// Ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindTexture( final String base, final String file )
|
||||
{
|
||||
ThEScrollbarGui.this.mc.getTextureManager().bindTexture( new ResourceLocation( base, "textures/" + file ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG( final int arg0, final int arg1, final int arg2, final int arg3 )
|
||||
{
|
||||
// Ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG( final int arg0, final int arg1, final int arg2, final int arg3 )
|
||||
{
|
||||
// Ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTexturedModalRect( final int posX, final int posY, final int sourceOffsetX, final int sourceOffsetY, final int width,
|
||||
final int height )
|
||||
{
|
||||
ThEScrollbarGui.this.drawTexturedModalRect( posX, posY, sourceOffsetX, sourceOffsetY, width, height );
|
||||
}
|
||||
};
|
||||
}
|
||||
@Override
|
||||
public void drawFG(final int arg0, final int arg1, final int arg2, final int arg3) {
|
||||
// Ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTexturedModalRect(
|
||||
final int posX,
|
||||
final int posY,
|
||||
final int sourceOffsetX,
|
||||
final int sourceOffsetY,
|
||||
final int width,
|
||||
final int height) {
|
||||
ThEScrollbarGui.this.drawTexturedModalRect(posX, posY, sourceOffsetX, sourceOffsetY, width, height);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
package thaumicenergistics.client.gui.buttons;
|
||||
|
||||
import java.util.List;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumicenergistics.client.textures.AEStateIconsEnum;
|
||||
import thaumicenergistics.client.textures.IStateIconTexture;
|
||||
|
||||
@@ -16,65 +16,80 @@ import thaumicenergistics.client.textures.IStateIconTexture;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiButtonAETab
|
||||
extends ThEStateButton
|
||||
{
|
||||
/**
|
||||
* Height of the button
|
||||
*/
|
||||
private static final int BUTTON_HEIGHT = AEStateIconsEnum.TAB_BUTTON.getHeight();
|
||||
public class GuiButtonAETab extends ThEStateButton {
|
||||
/**
|
||||
* Height of the button
|
||||
*/
|
||||
private static final int BUTTON_HEIGHT = AEStateIconsEnum.TAB_BUTTON.getHeight();
|
||||
|
||||
/**
|
||||
* Width of the button
|
||||
*/
|
||||
private static final int BUTTON_WIDTH = AEStateIconsEnum.TAB_BUTTON.getWidth();
|
||||
/**
|
||||
* Width of the button
|
||||
*/
|
||||
private static final int BUTTON_WIDTH = AEStateIconsEnum.TAB_BUTTON.getWidth();
|
||||
|
||||
private static int ICON_X_POSITION = 3;
|
||||
private static int ICON_X_POSITION = 3;
|
||||
|
||||
private static int ICON_Y_POSITION = 3;
|
||||
private static int ICON_Y_POSITION = 3;
|
||||
|
||||
private String tooltipMessageUnlocalized;
|
||||
private String tooltipMessageUnlocalized;
|
||||
|
||||
/**
|
||||
* Icon to draw on the button
|
||||
*/
|
||||
protected AEStateIconsEnum icon;
|
||||
/**
|
||||
* Icon to draw on the button
|
||||
*/
|
||||
protected AEStateIconsEnum icon;
|
||||
|
||||
public GuiButtonAETab( final int ID, final int xPosition, final int yPosition, final IStateIconTexture icon, final String unlocalizedTooltip )
|
||||
{
|
||||
// Call super
|
||||
super( ID, xPosition, yPosition, GuiButtonAETab.BUTTON_WIDTH, GuiButtonAETab.BUTTON_HEIGHT, icon, GuiButtonAETab.ICON_X_POSITION,
|
||||
GuiButtonAETab.ICON_Y_POSITION, AEStateIconsEnum.TAB_BUTTON );
|
||||
public GuiButtonAETab(
|
||||
final int ID,
|
||||
final int xPosition,
|
||||
final int yPosition,
|
||||
final IStateIconTexture icon,
|
||||
final String unlocalizedTooltip) {
|
||||
// Call super
|
||||
super(
|
||||
ID,
|
||||
xPosition,
|
||||
yPosition,
|
||||
GuiButtonAETab.BUTTON_WIDTH,
|
||||
GuiButtonAETab.BUTTON_HEIGHT,
|
||||
icon,
|
||||
GuiButtonAETab.ICON_X_POSITION,
|
||||
GuiButtonAETab.ICON_Y_POSITION,
|
||||
AEStateIconsEnum.TAB_BUTTON);
|
||||
|
||||
// Set the tooltip
|
||||
this.tooltipMessageUnlocalized = unlocalizedTooltip;
|
||||
}
|
||||
// Set the tooltip
|
||||
this.tooltipMessageUnlocalized = unlocalizedTooltip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton( final Minecraft minecraftInstance, final int x, final int y )
|
||||
{
|
||||
// Full white
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
@Override
|
||||
public void drawButton(final Minecraft minecraftInstance, final int x, final int y) {
|
||||
// Full white
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
// Draw the tab background
|
||||
this.drawIcon( minecraftInstance, AEStateIconsEnum.TAB_BUTTON, this.xPosition, this.yPosition, this.width, this.height );
|
||||
// Draw the tab background
|
||||
this.drawIcon(
|
||||
minecraftInstance,
|
||||
AEStateIconsEnum.TAB_BUTTON,
|
||||
this.xPosition,
|
||||
this.yPosition,
|
||||
this.width,
|
||||
this.height);
|
||||
|
||||
if( this.stateIcon != null )
|
||||
{
|
||||
// Draw the overlay icon
|
||||
this.drawIcon( minecraftInstance, this.stateIcon, this.xPosition, this.yPosition,
|
||||
AEStateIconsEnum.STANDARD_ICON_SIZE, AEStateIconsEnum.STANDARD_ICON_SIZE );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip( final List<String> tooltip )
|
||||
{
|
||||
if( !this.tooltipMessageUnlocalized.equals( "" ) )
|
||||
{
|
||||
tooltip.add( StatCollector.translateToLocal( this.tooltipMessageUnlocalized ) );
|
||||
}
|
||||
}
|
||||
if (this.stateIcon != null) {
|
||||
// Draw the overlay icon
|
||||
this.drawIcon(
|
||||
minecraftInstance,
|
||||
this.stateIcon,
|
||||
this.xPosition,
|
||||
this.yPosition,
|
||||
AEStateIconsEnum.STANDARD_ICON_SIZE,
|
||||
AEStateIconsEnum.STANDARD_ICON_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(final List<String> tooltip) {
|
||||
if (!this.tooltipMessageUnlocalized.equals("")) {
|
||||
tooltip.add(StatCollector.translateToLocal(this.tooltipMessageUnlocalized));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package thaumicenergistics.client.gui.buttons;
|
||||
|
||||
import java.util.List;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
@@ -20,111 +20,108 @@ import thaumicenergistics.common.registries.ThEStrings;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiButtonAllowVoid
|
||||
extends ThEGuiButtonBase
|
||||
{
|
||||
/**
|
||||
* Cache the render engine
|
||||
*/
|
||||
private static final TextureManager RENDER_ENGINE = Minecraft.getMinecraft().renderEngine;
|
||||
public class GuiButtonAllowVoid extends ThEGuiButtonBase {
|
||||
/**
|
||||
* Cache the render engine
|
||||
*/
|
||||
private static final TextureManager RENDER_ENGINE = Minecraft.getMinecraft().renderEngine;
|
||||
|
||||
/**
|
||||
* Cache the font renderer
|
||||
*/
|
||||
private static final FontRenderer FONT_RENDERER = Minecraft.getMinecraft().fontRenderer;
|
||||
/**
|
||||
* Cache the font renderer
|
||||
*/
|
||||
private static final FontRenderer FONT_RENDERER = Minecraft.getMinecraft().fontRenderer;
|
||||
|
||||
/**
|
||||
* Height and width of the button
|
||||
*/
|
||||
private static final int BUTTON_SIZE = 18;
|
||||
/**
|
||||
* Height and width of the button
|
||||
*/
|
||||
private static final int BUTTON_SIZE = 18;
|
||||
|
||||
/**
|
||||
* Height and width of the disabled icon.
|
||||
*/
|
||||
private static final int DISABLED_ICON_SIZE = 16;
|
||||
/**
|
||||
* Height and width of the disabled icon.
|
||||
*/
|
||||
private static final int DISABLED_ICON_SIZE = 16;
|
||||
|
||||
/**
|
||||
* Create an item renderer
|
||||
*/
|
||||
private static RenderItem itemRenderer = new RenderItem();
|
||||
/**
|
||||
* Create an item renderer
|
||||
*/
|
||||
private static RenderItem itemRenderer = new RenderItem();
|
||||
|
||||
/**
|
||||
* Void jar itemstack.
|
||||
*/
|
||||
private static ItemStack voidJar = null;
|
||||
/**
|
||||
* Void jar itemstack.
|
||||
*/
|
||||
private static ItemStack voidJar = null;
|
||||
|
||||
/**
|
||||
* Disabled icon from the AE sprite sheet.
|
||||
*/
|
||||
private AEStateIconsEnum disabledIcon = AEStateIconsEnum.DISABLED;
|
||||
/**
|
||||
* Disabled icon from the AE sprite sheet.
|
||||
*/
|
||||
private AEStateIconsEnum disabledIcon = AEStateIconsEnum.DISABLED;
|
||||
|
||||
/**
|
||||
* When false, draws the disabled icon over the jar
|
||||
*/
|
||||
private boolean isVoidAllowed = false;
|
||||
/**
|
||||
* When false, draws the disabled icon over the jar
|
||||
*/
|
||||
private boolean isVoidAllowed = false;
|
||||
|
||||
public GuiButtonAllowVoid( final int ID, final int xPosition, final int yPosition )
|
||||
{
|
||||
super( ID, xPosition, yPosition, GuiButtonAllowVoid.BUTTON_SIZE, GuiButtonAllowVoid.BUTTON_SIZE, "" );
|
||||
public GuiButtonAllowVoid(final int ID, final int xPosition, final int yPosition) {
|
||||
super(ID, xPosition, yPosition, GuiButtonAllowVoid.BUTTON_SIZE, GuiButtonAllowVoid.BUTTON_SIZE, "");
|
||||
|
||||
// Ensure we have made the void jar stack
|
||||
if( GuiButtonAllowVoid.voidJar == null )
|
||||
{
|
||||
GuiButtonAllowVoid.voidJar = new ItemStack( ConfigBlocks.blockJar, 1, 3 );
|
||||
}
|
||||
}
|
||||
// Ensure we have made the void jar stack
|
||||
if (GuiButtonAllowVoid.voidJar == null) {
|
||||
GuiButtonAllowVoid.voidJar = new ItemStack(ConfigBlocks.blockJar, 1, 3);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton( final Minecraft minecraftInstance, final int x, final int y )
|
||||
{
|
||||
// Draw the usual button
|
||||
super.drawButton( minecraftInstance, x, y );
|
||||
@Override
|
||||
public void drawButton(final Minecraft minecraftInstance, final int x, final int y) {
|
||||
// Draw the usual button
|
||||
super.drawButton(minecraftInstance, x, y);
|
||||
|
||||
// Draw the void jar
|
||||
GuiButtonAllowVoid.itemRenderer.renderItemIntoGUI( GuiButtonAllowVoid.FONT_RENDERER, GuiButtonAllowVoid.RENDER_ENGINE,
|
||||
GuiButtonAllowVoid.voidJar, this.xPosition + 1,
|
||||
this.yPosition + 1, false );
|
||||
// Draw the void jar
|
||||
GuiButtonAllowVoid.itemRenderer.renderItemIntoGUI(
|
||||
GuiButtonAllowVoid.FONT_RENDERER,
|
||||
GuiButtonAllowVoid.RENDER_ENGINE,
|
||||
GuiButtonAllowVoid.voidJar,
|
||||
this.xPosition + 1,
|
||||
this.yPosition + 1,
|
||||
false);
|
||||
|
||||
// Is void not allowed?
|
||||
if( !this.isVoidAllowed )
|
||||
{
|
||||
// Bind the AE states texture
|
||||
minecraftInstance.getTextureManager().bindTexture( AEStateIconsEnum.AE_STATES_TEXTURE );
|
||||
// Is void not allowed?
|
||||
if (!this.isVoidAllowed) {
|
||||
// Bind the AE states texture
|
||||
minecraftInstance.getTextureManager().bindTexture(AEStateIconsEnum.AE_STATES_TEXTURE);
|
||||
|
||||
// Draw the disabled icon
|
||||
this.drawTexturedModalRect( this.xPosition + 1, this.yPosition + 1, this.disabledIcon.getU(), this.disabledIcon.getV(),
|
||||
GuiButtonAllowVoid.DISABLED_ICON_SIZE, GuiButtonAllowVoid.DISABLED_ICON_SIZE );
|
||||
}
|
||||
}
|
||||
// Draw the disabled icon
|
||||
this.drawTexturedModalRect(
|
||||
this.xPosition + 1,
|
||||
this.yPosition + 1,
|
||||
this.disabledIcon.getU(),
|
||||
this.disabledIcon.getV(),
|
||||
GuiButtonAllowVoid.DISABLED_ICON_SIZE,
|
||||
GuiButtonAllowVoid.DISABLED_ICON_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip( final List<String> tooltip )
|
||||
{
|
||||
// Add the title
|
||||
tooltip.add( ThEStrings.TooltipButton_VoidHeader.getLocalized() );
|
||||
@Override
|
||||
public void getTooltip(final List<String> tooltip) {
|
||||
// Add the title
|
||||
tooltip.add(ThEStrings.TooltipButton_VoidHeader.getLocalized());
|
||||
|
||||
// Add allowed/disabled
|
||||
if( this.isVoidAllowed )
|
||||
{
|
||||
tooltip.add( EnumChatFormatting.GRAY + ThEStrings.TooltipButton_VoidAllow.getLocalized() );
|
||||
}
|
||||
else
|
||||
{
|
||||
tooltip.add( EnumChatFormatting.GRAY + ThEStrings.TooltipButton_VoidDisable.getLocalized() );
|
||||
}
|
||||
// Add allowed/disabled
|
||||
if (this.isVoidAllowed) {
|
||||
tooltip.add(EnumChatFormatting.GRAY + ThEStrings.TooltipButton_VoidAllow.getLocalized());
|
||||
} else {
|
||||
tooltip.add(EnumChatFormatting.GRAY + ThEStrings.TooltipButton_VoidDisable.getLocalized());
|
||||
}
|
||||
|
||||
// Add the note
|
||||
tooltip.add( EnumChatFormatting.ITALIC + ThEStrings.TooltipButton_VoidNote.getLocalized() );
|
||||
// Add the note
|
||||
tooltip.add(EnumChatFormatting.ITALIC + ThEStrings.TooltipButton_VoidNote.getLocalized());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Is void allowed?
|
||||
*
|
||||
* @param allowed
|
||||
*/
|
||||
public void setIsVoidAllowed( final boolean allowed )
|
||||
{
|
||||
this.isVoidAllowed = allowed;
|
||||
}
|
||||
/**
|
||||
* Is void allowed?
|
||||
*
|
||||
* @param allowed
|
||||
*/
|
||||
public void setIsVoidAllowed(final boolean allowed) {
|
||||
this.isVoidAllowed = allowed;
|
||||
}
|
||||
}
|
||||
+35
-28
@@ -1,8 +1,8 @@
|
||||
package thaumicenergistics.client.gui.buttons;
|
||||
|
||||
import java.util.List;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import thaumicenergistics.client.textures.AEStateIconsEnum;
|
||||
|
||||
@@ -13,34 +13,41 @@ import thaumicenergistics.client.textures.AEStateIconsEnum;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiButtonClearCellPartitioning
|
||||
extends ThEStateButton
|
||||
{
|
||||
public class GuiButtonClearCellPartitioning extends ThEStateButton {
|
||||
|
||||
/**
|
||||
* Clear icon
|
||||
*/
|
||||
private static final AEStateIconsEnum CLEAR_ICON = AEStateIconsEnum.CLEAR_GRID;
|
||||
/**
|
||||
* Clear icon
|
||||
*/
|
||||
private static final AEStateIconsEnum CLEAR_ICON = AEStateIconsEnum.CLEAR_GRID;
|
||||
|
||||
/**
|
||||
* Creates the button
|
||||
*
|
||||
* @param ID
|
||||
* @param xPosition
|
||||
* @param yPosition
|
||||
* @param width
|
||||
* @param height
|
||||
*/
|
||||
public GuiButtonClearCellPartitioning( final int ID, final int xPosition, final int yPosition )
|
||||
{
|
||||
super( ID, xPosition, yPosition, 16, 16, GuiButtonClearCellPartitioning.CLEAR_ICON, 0, 0, AEStateIconsEnum.REGULAR_BUTTON );
|
||||
}
|
||||
/**
|
||||
* Creates the button
|
||||
*
|
||||
* @param ID
|
||||
* @param xPosition
|
||||
* @param yPosition
|
||||
* @param width
|
||||
* @param height
|
||||
*/
|
||||
public GuiButtonClearCellPartitioning(final int ID, final int xPosition, final int yPosition) {
|
||||
super(
|
||||
ID,
|
||||
xPosition,
|
||||
yPosition,
|
||||
16,
|
||||
16,
|
||||
GuiButtonClearCellPartitioning.CLEAR_ICON,
|
||||
0,
|
||||
0,
|
||||
AEStateIconsEnum.REGULAR_BUTTON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip( final List<String> tooltip )
|
||||
{
|
||||
// Add the info
|
||||
this.addAboutToTooltip( tooltip, StatCollector.translateToLocal( "gui.tooltips.appliedenergistics2.Clear" ),
|
||||
StatCollector.translateToLocal( "gui.tooltips.appliedenergistics2.ClearSettings" ) );
|
||||
}
|
||||
@Override
|
||||
public void getTooltip(final List<String> tooltip) {
|
||||
// Add the info
|
||||
this.addAboutToTooltip(
|
||||
tooltip,
|
||||
StatCollector.translateToLocal("gui.tooltips.appliedenergistics2.Clear"),
|
||||
StatCollector.translateToLocal("gui.tooltips.appliedenergistics2.ClearSettings"));
|
||||
}
|
||||
}
|
||||
+46
-36
@@ -1,9 +1,9 @@
|
||||
package thaumicenergistics.client.gui.buttons;
|
||||
|
||||
import java.util.List;
|
||||
import appeng.core.localization.ButtonToolTips;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import thaumicenergistics.client.textures.AEStateIconsEnum;
|
||||
|
||||
@@ -14,43 +14,53 @@ import thaumicenergistics.client.textures.AEStateIconsEnum;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiButtonClearCraftingGrid
|
||||
extends ThEStateButton
|
||||
{
|
||||
/**
|
||||
* Clear grid icon
|
||||
*/
|
||||
private static final AEStateIconsEnum CLEAR_ICON = AEStateIconsEnum.CLEAR_GRID;
|
||||
public class GuiButtonClearCraftingGrid extends ThEStateButton {
|
||||
/**
|
||||
* Clear grid icon
|
||||
*/
|
||||
private static final AEStateIconsEnum CLEAR_ICON = AEStateIconsEnum.CLEAR_GRID;
|
||||
|
||||
private final boolean showTooltip;
|
||||
private final boolean showTooltip;
|
||||
|
||||
/**
|
||||
* Creates the button
|
||||
*
|
||||
* @param ID
|
||||
* @param xPosition
|
||||
* @param yPosition
|
||||
* @param width
|
||||
* @param height
|
||||
*/
|
||||
public GuiButtonClearCraftingGrid( final int ID, final int xPosition, final int yPosition, final int width, final int height,
|
||||
final boolean showTooltip )
|
||||
{
|
||||
// Call super
|
||||
super( ID, xPosition, yPosition, width, height, GuiButtonClearCraftingGrid.CLEAR_ICON, 0, 0, AEStateIconsEnum.REGULAR_BUTTON );
|
||||
/**
|
||||
* Creates the button
|
||||
*
|
||||
* @param ID
|
||||
* @param xPosition
|
||||
* @param yPosition
|
||||
* @param width
|
||||
* @param height
|
||||
*/
|
||||
public GuiButtonClearCraftingGrid(
|
||||
final int ID,
|
||||
final int xPosition,
|
||||
final int yPosition,
|
||||
final int width,
|
||||
final int height,
|
||||
final boolean showTooltip) {
|
||||
// Call super
|
||||
super(
|
||||
ID,
|
||||
xPosition,
|
||||
yPosition,
|
||||
width,
|
||||
height,
|
||||
GuiButtonClearCraftingGrid.CLEAR_ICON,
|
||||
0,
|
||||
0,
|
||||
AEStateIconsEnum.REGULAR_BUTTON);
|
||||
|
||||
// Set if the tooltip is shown or not
|
||||
this.showTooltip = showTooltip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip( final List<String> tooltip )
|
||||
{
|
||||
if( this.showTooltip )
|
||||
{
|
||||
this.addAboutToTooltip( tooltip, ButtonToolTips.Stash.getLocal(),
|
||||
EnumChatFormatting.GRAY.toString() + ButtonToolTips.StashDesc.getLocal() );
|
||||
}
|
||||
}
|
||||
// Set if the tooltip is shown or not
|
||||
this.showTooltip = showTooltip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(final List<String> tooltip) {
|
||||
if (this.showTooltip) {
|
||||
this.addAboutToTooltip(
|
||||
tooltip,
|
||||
ButtonToolTips.Stash.getLocal(),
|
||||
EnumChatFormatting.GRAY.toString() + ButtonToolTips.StashDesc.getLocal());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,30 +2,28 @@ package thaumicenergistics.client.gui.buttons;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import thaumicenergistics.client.textures.AEStateIconsEnum;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiButtonCraftingMode extends ThEStateButton
|
||||
{
|
||||
public class GuiButtonCraftingMode extends ThEStateButton {
|
||||
private static final String TOOLTIP_LOC_HEADER = "gui.tooltips.appliedenergistics2.";
|
||||
private boolean alwaysCraft = false;
|
||||
public GuiButtonCraftingMode(final int ID, final int xPos, final int yPos, final int width, final int height)
|
||||
{
|
||||
super( ID, xPos, yPos, width, height, AEStateIconsEnum.CRAFT_EITHER, 0, 0, AEStateIconsEnum.REGULAR_BUTTON );
|
||||
|
||||
public GuiButtonCraftingMode(final int ID, final int xPos, final int yPos, final int width, final int height) {
|
||||
super(ID, xPos, yPos, width, height, AEStateIconsEnum.CRAFT_EITHER, 0, 0, AEStateIconsEnum.REGULAR_BUTTON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip( final List<String> tooltip )
|
||||
{
|
||||
this.addAboutToTooltip( tooltip,
|
||||
StatCollector.translateToLocal( TOOLTIP_LOC_HEADER + "Craft" ),
|
||||
StatCollector.translateToLocal(
|
||||
TOOLTIP_LOC_HEADER + (alwaysCraft ? "CraftOnly" : "CraftEither" )) );
|
||||
public void getTooltip(final List<String> tooltip) {
|
||||
this.addAboutToTooltip(
|
||||
tooltip,
|
||||
StatCollector.translateToLocal(TOOLTIP_LOC_HEADER + "Craft"),
|
||||
StatCollector.translateToLocal(TOOLTIP_LOC_HEADER + (alwaysCraft ? "CraftOnly" : "CraftEither")));
|
||||
}
|
||||
public void setAlwaysCraft(boolean c)
|
||||
{
|
||||
|
||||
public void setAlwaysCraft(boolean c) {
|
||||
alwaysCraft = c;
|
||||
this.stateIcon = alwaysCraft ? AEStateIconsEnum.CRAFT_ONLY : AEStateIconsEnum.CRAFT_EITHER;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package thaumicenergistics.client.gui.buttons;
|
||||
|
||||
import java.util.List;
|
||||
import appeng.core.localization.ButtonToolTips;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import thaumicenergistics.client.textures.AEStateIconsEnum;
|
||||
|
||||
/**
|
||||
@@ -13,20 +13,15 @@ import thaumicenergistics.client.textures.AEStateIconsEnum;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiButtonEncodePattern
|
||||
extends ThEStateButton
|
||||
{
|
||||
public class GuiButtonEncodePattern extends ThEStateButton {
|
||||
|
||||
public GuiButtonEncodePattern( final int ID, final int posX, final int posY, final int width, final int height )
|
||||
{
|
||||
// Call super
|
||||
super( ID, posX, posY, width, height, AEStateIconsEnum.ARROW_DOWN, 0, 0, AEStateIconsEnum.REGULAR_BUTTON );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip( final List<String> tooltip )
|
||||
{
|
||||
this.addAboutToTooltip( tooltip, ButtonToolTips.Encode.getLocal(), ButtonToolTips.EncodeDescription.getLocal() );
|
||||
}
|
||||
public GuiButtonEncodePattern(final int ID, final int posX, final int posY, final int width, final int height) {
|
||||
// Call super
|
||||
super(ID, posX, posY, width, height, AEStateIconsEnum.ARROW_DOWN, 0, 0, AEStateIconsEnum.REGULAR_BUTTON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(final List<String> tooltip) {
|
||||
this.addAboutToTooltip(tooltip, ButtonToolTips.Encode.getLocal(), ButtonToolTips.EncodeDescription.getLocal());
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package thaumicenergistics.client.gui.buttons;
|
||||
|
||||
import java.util.List;
|
||||
import appeng.api.config.RedstoneMode;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import thaumicenergistics.client.textures.AEStateIconsEnum;
|
||||
|
||||
@@ -14,123 +14,123 @@ import thaumicenergistics.client.textures.AEStateIconsEnum;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiButtonRedstoneModes
|
||||
extends ThEStateButton
|
||||
{
|
||||
/**
|
||||
* Localization header string for tooltips
|
||||
*/
|
||||
private static final String TOOLTIP_LOC_HEADER = "gui.tooltips.appliedenergistics2.";
|
||||
public class GuiButtonRedstoneModes extends ThEStateButton {
|
||||
/**
|
||||
* Localization header string for tooltips
|
||||
*/
|
||||
private static final String TOOLTIP_LOC_HEADER = "gui.tooltips.appliedenergistics2.";
|
||||
|
||||
/**
|
||||
* Mode to represent
|
||||
*/
|
||||
private RedstoneMode redstoneMode;
|
||||
/**
|
||||
* Mode to represent
|
||||
*/
|
||||
private RedstoneMode redstoneMode;
|
||||
|
||||
/**
|
||||
* True when this button is attached to a level emitter
|
||||
*/
|
||||
private boolean emitter = false;
|
||||
/**
|
||||
* True when this button is attached to a level emitter
|
||||
*/
|
||||
private boolean emitter = false;
|
||||
|
||||
/**
|
||||
* Creates the button.
|
||||
*
|
||||
* @param ID
|
||||
* @param xPos
|
||||
* @param yPos
|
||||
* @param width
|
||||
* @param height
|
||||
* @param mode
|
||||
*/
|
||||
public GuiButtonRedstoneModes( final int ID, final int xPos, final int yPos, final int width, final int height, final RedstoneMode mode )
|
||||
{
|
||||
this( ID, xPos, yPos, width, height, mode, false );
|
||||
}
|
||||
/**
|
||||
* Creates the button.
|
||||
*
|
||||
* @param ID
|
||||
* @param xPos
|
||||
* @param yPos
|
||||
* @param width
|
||||
* @param height
|
||||
* @param mode
|
||||
*/
|
||||
public GuiButtonRedstoneModes(
|
||||
final int ID, final int xPos, final int yPos, final int width, final int height, final RedstoneMode mode) {
|
||||
this(ID, xPos, yPos, width, height, mode, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the button with argument for if this is an emitter.
|
||||
*
|
||||
* @param ID
|
||||
* @param xPos
|
||||
* @param yPos
|
||||
* @param width
|
||||
* @param height
|
||||
* @param mode
|
||||
* @param emitter
|
||||
*/
|
||||
public GuiButtonRedstoneModes( final int ID, final int xPos, final int yPos, final int width, final int height, final RedstoneMode mode,
|
||||
final boolean emitter )
|
||||
{
|
||||
// Call super
|
||||
super( ID, xPos, yPos, width, height, null, 0, 0, AEStateIconsEnum.REGULAR_BUTTON );
|
||||
/**
|
||||
* Creates the button with argument for if this is an emitter.
|
||||
*
|
||||
* @param ID
|
||||
* @param xPos
|
||||
* @param yPos
|
||||
* @param width
|
||||
* @param height
|
||||
* @param mode
|
||||
* @param emitter
|
||||
*/
|
||||
public GuiButtonRedstoneModes(
|
||||
final int ID,
|
||||
final int xPos,
|
||||
final int yPos,
|
||||
final int width,
|
||||
final int height,
|
||||
final RedstoneMode mode,
|
||||
final boolean emitter) {
|
||||
// Call super
|
||||
super(ID, xPos, yPos, width, height, null, 0, 0, AEStateIconsEnum.REGULAR_BUTTON);
|
||||
|
||||
// Set the if we are attached to an emitter
|
||||
this.emitter = emitter;
|
||||
// Set the if we are attached to an emitter
|
||||
this.emitter = emitter;
|
||||
|
||||
// Set the redstone mode
|
||||
this.setRedstoneMode( mode );
|
||||
}
|
||||
// Set the redstone mode
|
||||
this.setRedstoneMode(mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip( final List<String> tooltip )
|
||||
{
|
||||
// Get the explanation based on mode
|
||||
String explanation = "";
|
||||
switch ( this.redstoneMode )
|
||||
{
|
||||
case HIGH_SIGNAL:
|
||||
explanation = StatCollector.translateToLocal( this.emitter ? TOOLTIP_LOC_HEADER + "EmitLevelAbove" : TOOLTIP_LOC_HEADER +
|
||||
"ActiveWithSignal" );
|
||||
break;
|
||||
@Override
|
||||
public void getTooltip(final List<String> tooltip) {
|
||||
// Get the explanation based on mode
|
||||
String explanation = "";
|
||||
switch (this.redstoneMode) {
|
||||
case HIGH_SIGNAL:
|
||||
explanation = StatCollector.translateToLocal(
|
||||
this.emitter ? TOOLTIP_LOC_HEADER + "EmitLevelAbove" : TOOLTIP_LOC_HEADER + "ActiveWithSignal");
|
||||
break;
|
||||
|
||||
case IGNORE:
|
||||
explanation = StatCollector.translateToLocal( TOOLTIP_LOC_HEADER + "AlwaysActive" );
|
||||
break;
|
||||
case IGNORE:
|
||||
explanation = StatCollector.translateToLocal(TOOLTIP_LOC_HEADER + "AlwaysActive");
|
||||
break;
|
||||
|
||||
case LOW_SIGNAL:
|
||||
explanation = StatCollector.translateToLocal( this.emitter ? TOOLTIP_LOC_HEADER + "EmitLevelsBelow" : TOOLTIP_LOC_HEADER +
|
||||
"ActiveWithoutSignal" );
|
||||
break;
|
||||
case LOW_SIGNAL:
|
||||
explanation = StatCollector.translateToLocal(
|
||||
this.emitter
|
||||
? TOOLTIP_LOC_HEADER + "EmitLevelsBelow"
|
||||
: TOOLTIP_LOC_HEADER + "ActiveWithoutSignal");
|
||||
break;
|
||||
|
||||
case SIGNAL_PULSE:
|
||||
explanation = StatCollector.translateToLocal( TOOLTIP_LOC_HEADER + "ActiveOnPulse" );
|
||||
break;
|
||||
case SIGNAL_PULSE:
|
||||
explanation = StatCollector.translateToLocal(TOOLTIP_LOC_HEADER + "ActiveOnPulse");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
// Add info
|
||||
this.addAboutToTooltip(
|
||||
tooltip, StatCollector.translateToLocal(TOOLTIP_LOC_HEADER + "RedstoneMode"), explanation);
|
||||
}
|
||||
|
||||
// Add info
|
||||
this.addAboutToTooltip( tooltip, StatCollector.translateToLocal( TOOLTIP_LOC_HEADER + "RedstoneMode" ), explanation );
|
||||
/**
|
||||
* Sets the redstone mode this button represents.
|
||||
*
|
||||
* @param mode
|
||||
*/
|
||||
public void setRedstoneMode(final RedstoneMode mode) {
|
||||
// Set the mode
|
||||
this.redstoneMode = mode;
|
||||
|
||||
}
|
||||
// Set the icon
|
||||
switch (this.redstoneMode) {
|
||||
case HIGH_SIGNAL:
|
||||
this.stateIcon = AEStateIconsEnum.REDSTONE_HIGH;
|
||||
break;
|
||||
|
||||
/**
|
||||
* Sets the redstone mode this button represents.
|
||||
*
|
||||
* @param mode
|
||||
*/
|
||||
public void setRedstoneMode( final RedstoneMode mode )
|
||||
{
|
||||
// Set the mode
|
||||
this.redstoneMode = mode;
|
||||
case IGNORE:
|
||||
this.stateIcon = AEStateIconsEnum.REDSTONE_IGNORE;
|
||||
break;
|
||||
|
||||
// Set the icon
|
||||
switch ( this.redstoneMode )
|
||||
{
|
||||
case HIGH_SIGNAL:
|
||||
this.stateIcon = AEStateIconsEnum.REDSTONE_HIGH;
|
||||
break;
|
||||
case LOW_SIGNAL:
|
||||
this.stateIcon = AEStateIconsEnum.REDSTONE_LOW;
|
||||
break;
|
||||
|
||||
case IGNORE:
|
||||
this.stateIcon = AEStateIconsEnum.REDSTONE_IGNORE;
|
||||
break;
|
||||
|
||||
case LOW_SIGNAL:
|
||||
this.stateIcon = AEStateIconsEnum.REDSTONE_LOW;
|
||||
break;
|
||||
|
||||
case SIGNAL_PULSE:
|
||||
this.stateIcon = AEStateIconsEnum.REDSTONE_PULSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
case SIGNAL_PULSE:
|
||||
this.stateIcon = AEStateIconsEnum.REDSTONE_PULSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package thaumicenergistics.client.gui.buttons;
|
||||
|
||||
import java.util.List;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import thaumicenergistics.client.textures.AEStateIconsEnum;
|
||||
import thaumicenergistics.common.container.ContainerKnowledgeInscriber.CoreSaveState;
|
||||
import thaumicenergistics.common.registries.ThEStrings;
|
||||
@@ -14,65 +14,59 @@ import thaumicenergistics.common.registries.ThEStrings;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiButtonSaveDelete
|
||||
extends ThEStateButton
|
||||
{
|
||||
private String cachedTooltip;
|
||||
public class GuiButtonSaveDelete extends ThEStateButton {
|
||||
private String cachedTooltip;
|
||||
|
||||
public GuiButtonSaveDelete( final int ID, final int xPosition, final int yPosition, final CoreSaveState initialState )
|
||||
{
|
||||
// Call super
|
||||
super( ID, xPosition, yPosition, 16, 16, null, 0, 0, AEStateIconsEnum.REGULAR_BUTTON );
|
||||
public GuiButtonSaveDelete(
|
||||
final int ID, final int xPosition, final int yPosition, final CoreSaveState initialState) {
|
||||
// Call super
|
||||
super(ID, xPosition, yPosition, 16, 16, null, 0, 0, AEStateIconsEnum.REGULAR_BUTTON);
|
||||
|
||||
// Initial state
|
||||
this.setSaveState( initialState );
|
||||
}
|
||||
// Initial state
|
||||
this.setSaveState(initialState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip( final List<String> tooltip )
|
||||
{
|
||||
tooltip.add( this.cachedTooltip );
|
||||
}
|
||||
@Override
|
||||
public void getTooltip(final List<String> tooltip) {
|
||||
tooltip.add(this.cachedTooltip);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the save state of the button.
|
||||
*
|
||||
* @param saveState
|
||||
*/
|
||||
public void setSaveState( final CoreSaveState saveState )
|
||||
{
|
||||
switch ( saveState )
|
||||
{
|
||||
case Disabled_InvalidRecipe:
|
||||
this.enabled = false;
|
||||
this.stateIcon = null;
|
||||
this.cachedTooltip = ThEStrings.TooltipButton_InscriberInvalid.getLocalized();
|
||||
break;
|
||||
/**
|
||||
* Sets the save state of the button.
|
||||
*
|
||||
* @param saveState
|
||||
*/
|
||||
public void setSaveState(final CoreSaveState saveState) {
|
||||
switch (saveState) {
|
||||
case Disabled_InvalidRecipe:
|
||||
this.enabled = false;
|
||||
this.stateIcon = null;
|
||||
this.cachedTooltip = ThEStrings.TooltipButton_InscriberInvalid.getLocalized();
|
||||
break;
|
||||
|
||||
case Disabled_CoreFull:
|
||||
this.enabled = false;
|
||||
this.stateIcon = null;
|
||||
this.cachedTooltip = ThEStrings.TooltipButton_InscriberFull.getLocalized();
|
||||
break;
|
||||
case Disabled_CoreFull:
|
||||
this.enabled = false;
|
||||
this.stateIcon = null;
|
||||
this.cachedTooltip = ThEStrings.TooltipButton_InscriberFull.getLocalized();
|
||||
break;
|
||||
|
||||
case Enabled_Delete:
|
||||
this.enabled = true;
|
||||
this.stateIcon = AEStateIconsEnum.DELETE;
|
||||
this.cachedTooltip = ThEStrings.TooltipButton_InscriberDelete.getLocalized();
|
||||
break;
|
||||
case Enabled_Delete:
|
||||
this.enabled = true;
|
||||
this.stateIcon = AEStateIconsEnum.DELETE;
|
||||
this.cachedTooltip = ThEStrings.TooltipButton_InscriberDelete.getLocalized();
|
||||
break;
|
||||
|
||||
case Enabled_Save:
|
||||
this.enabled = true;
|
||||
this.stateIcon = AEStateIconsEnum.SAVE;
|
||||
this.cachedTooltip = ThEStrings.TooltipButton_InscriberSave.getLocalized();
|
||||
break;
|
||||
case Enabled_Save:
|
||||
this.enabled = true;
|
||||
this.stateIcon = AEStateIconsEnum.SAVE;
|
||||
this.cachedTooltip = ThEStrings.TooltipButton_InscriberSave.getLocalized();
|
||||
break;
|
||||
|
||||
case Disabled_MissingCore:
|
||||
this.enabled = false;
|
||||
this.stateIcon = null;
|
||||
this.cachedTooltip = ThEStrings.TooltipButton_InscriberMissing.getLocalized();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
case Disabled_MissingCore:
|
||||
this.enabled = false;
|
||||
this.stateIcon = null;
|
||||
this.cachedTooltip = ThEStrings.TooltipButton_InscriberMissing.getLocalized();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package thaumicenergistics.client.gui.buttons;
|
||||
|
||||
import java.util.List;
|
||||
import appeng.api.config.SearchBoxMode;
|
||||
import appeng.core.localization.ButtonToolTips;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import thaumicenergistics.client.textures.AEStateIconsEnum;
|
||||
|
||||
@@ -15,55 +15,53 @@ import thaumicenergistics.client.textures.AEStateIconsEnum;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiButtonSearchMode
|
||||
extends ThEStateButton
|
||||
{
|
||||
private String tooltipMode = "";
|
||||
public class GuiButtonSearchMode extends ThEStateButton {
|
||||
private String tooltipMode = "";
|
||||
|
||||
public GuiButtonSearchMode( final int ID, final int xPosition, final int yPosition, final int buttonWidth, final int buttonHeight,
|
||||
final SearchBoxMode currentMode )
|
||||
{
|
||||
super( ID, xPosition, yPosition, buttonWidth, buttonHeight, null, 0, 0, AEStateIconsEnum.REGULAR_BUTTON );
|
||||
public GuiButtonSearchMode(
|
||||
final int ID,
|
||||
final int xPosition,
|
||||
final int yPosition,
|
||||
final int buttonWidth,
|
||||
final int buttonHeight,
|
||||
final SearchBoxMode currentMode) {
|
||||
super(ID, xPosition, yPosition, buttonWidth, buttonHeight, null, 0, 0, AEStateIconsEnum.REGULAR_BUTTON);
|
||||
|
||||
this.setSearchMode( currentMode );
|
||||
}
|
||||
this.setSearchMode(currentMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip( final List<String> tooltip )
|
||||
{
|
||||
this.addAboutToTooltip( tooltip, ButtonToolTips.SearchMode.getLocal(), EnumChatFormatting.GRAY + this.tooltipMode );
|
||||
}
|
||||
@Override
|
||||
public void getTooltip(final List<String> tooltip) {
|
||||
this.addAboutToTooltip(
|
||||
tooltip, ButtonToolTips.SearchMode.getLocal(), EnumChatFormatting.GRAY + this.tooltipMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the icon and tooltip based on the specified mode.
|
||||
*
|
||||
* @param mode
|
||||
*/
|
||||
public void setSearchMode( final SearchBoxMode mode )
|
||||
{
|
||||
switch ( mode )
|
||||
{
|
||||
case AUTOSEARCH:
|
||||
this.tooltipMode = ButtonToolTips.SearchMode_Auto.getLocal();
|
||||
this.stateIcon = AEStateIconsEnum.SEARCH_MODE_AUTO;
|
||||
break;
|
||||
/**
|
||||
* Sets the icon and tooltip based on the specified mode.
|
||||
*
|
||||
* @param mode
|
||||
*/
|
||||
public void setSearchMode(final SearchBoxMode mode) {
|
||||
switch (mode) {
|
||||
case AUTOSEARCH:
|
||||
this.tooltipMode = ButtonToolTips.SearchMode_Auto.getLocal();
|
||||
this.stateIcon = AEStateIconsEnum.SEARCH_MODE_AUTO;
|
||||
break;
|
||||
|
||||
case MANUAL_SEARCH:
|
||||
this.tooltipMode = ButtonToolTips.SearchMode_Standard.getLocal();
|
||||
this.stateIcon = AEStateIconsEnum.SEARCH_MODE_MANUAL;
|
||||
break;
|
||||
case MANUAL_SEARCH:
|
||||
this.tooltipMode = ButtonToolTips.SearchMode_Standard.getLocal();
|
||||
this.stateIcon = AEStateIconsEnum.SEARCH_MODE_MANUAL;
|
||||
break;
|
||||
|
||||
case NEI_AUTOSEARCH:
|
||||
this.tooltipMode = ButtonToolTips.SearchMode_NEIAuto.getLocal();
|
||||
this.stateIcon = AEStateIconsEnum.SEARCH_MODE_NEI_AUTO;
|
||||
break;
|
||||
|
||||
case NEI_MANUAL_SEARCH:
|
||||
this.tooltipMode = ButtonToolTips.SearchMode_NEIStandard.getLocal();
|
||||
this.stateIcon = AEStateIconsEnum.SEARCH_MODE_NEI_MANUAL;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
case NEI_AUTOSEARCH:
|
||||
this.tooltipMode = ButtonToolTips.SearchMode_NEIAuto.getLocal();
|
||||
this.stateIcon = AEStateIconsEnum.SEARCH_MODE_NEI_AUTO;
|
||||
break;
|
||||
|
||||
case NEI_MANUAL_SEARCH:
|
||||
this.tooltipMode = ButtonToolTips.SearchMode_NEIStandard.getLocal();
|
||||
this.stateIcon = AEStateIconsEnum.SEARCH_MODE_NEI_MANUAL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
+35
-28
@@ -1,8 +1,8 @@
|
||||
package thaumicenergistics.client.gui.buttons;
|
||||
|
||||
import java.util.List;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import thaumicenergistics.client.textures.AEStateIconsEnum;
|
||||
|
||||
@@ -13,33 +13,40 @@ import thaumicenergistics.client.textures.AEStateIconsEnum;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiButtonSetCellPartitioningToCurrent
|
||||
extends ThEStateButton
|
||||
{
|
||||
/**
|
||||
* Wrench icon
|
||||
*/
|
||||
private static final AEStateIconsEnum WRENCH_ICON = AEStateIconsEnum.WRENCH;
|
||||
public class GuiButtonSetCellPartitioningToCurrent extends ThEStateButton {
|
||||
/**
|
||||
* Wrench icon
|
||||
*/
|
||||
private static final AEStateIconsEnum WRENCH_ICON = AEStateIconsEnum.WRENCH;
|
||||
|
||||
/**
|
||||
* Creates the button
|
||||
*
|
||||
* @param ID
|
||||
* @param xPosition
|
||||
* @param yPosition
|
||||
* @param width
|
||||
* @param height
|
||||
*/
|
||||
public GuiButtonSetCellPartitioningToCurrent( final int ID, final int xPosition, final int yPosition )
|
||||
{
|
||||
super( ID, xPosition, yPosition, 16, 16, GuiButtonSetCellPartitioningToCurrent.WRENCH_ICON, 0, 0, AEStateIconsEnum.REGULAR_BUTTON );
|
||||
}
|
||||
/**
|
||||
* Creates the button
|
||||
*
|
||||
* @param ID
|
||||
* @param xPosition
|
||||
* @param yPosition
|
||||
* @param width
|
||||
* @param height
|
||||
*/
|
||||
public GuiButtonSetCellPartitioningToCurrent(final int ID, final int xPosition, final int yPosition) {
|
||||
super(
|
||||
ID,
|
||||
xPosition,
|
||||
yPosition,
|
||||
16,
|
||||
16,
|
||||
GuiButtonSetCellPartitioningToCurrent.WRENCH_ICON,
|
||||
0,
|
||||
0,
|
||||
AEStateIconsEnum.REGULAR_BUTTON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip( final List<String> tooltip )
|
||||
{
|
||||
// Add the info
|
||||
this.addAboutToTooltip( tooltip, StatCollector.translateToLocal( "gui.tooltips.appliedenergistics2.PartitionStorage" ),
|
||||
StatCollector.translateToLocal( "gui.tooltips.appliedenergistics2.PartitionStorageHint" ) );
|
||||
}
|
||||
@Override
|
||||
public void getTooltip(final List<String> tooltip) {
|
||||
// Add the info
|
||||
this.addAboutToTooltip(
|
||||
tooltip,
|
||||
StatCollector.translateToLocal("gui.tooltips.appliedenergistics2.PartitionStorage"),
|
||||
StatCollector.translateToLocal("gui.tooltips.appliedenergistics2.PartitionStorageHint"));
|
||||
}
|
||||
}
|
||||
+32
-26
@@ -1,9 +1,9 @@
|
||||
package thaumicenergistics.client.gui.buttons;
|
||||
|
||||
import java.util.List;
|
||||
import appeng.api.config.SortDir;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import thaumicenergistics.client.textures.AEStateIconsEnum;
|
||||
|
||||
@@ -14,33 +14,39 @@ import thaumicenergistics.client.textures.AEStateIconsEnum;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiButtonSortingDirection
|
||||
extends ThEStateButton
|
||||
{
|
||||
public class GuiButtonSortingDirection extends ThEStateButton {
|
||||
|
||||
public GuiButtonSortingDirection( final int ID, final int xPosition, final int yPosition, final int width, final int height )
|
||||
{
|
||||
super( ID, xPosition, yPosition, width, height, AEStateIconsEnum.SORT_DIR_ASC, 0, 0, AEStateIconsEnum.REGULAR_BUTTON );
|
||||
}
|
||||
public GuiButtonSortingDirection(
|
||||
final int ID, final int xPosition, final int yPosition, final int width, final int height) {
|
||||
super(
|
||||
ID,
|
||||
xPosition,
|
||||
yPosition,
|
||||
width,
|
||||
height,
|
||||
AEStateIconsEnum.SORT_DIR_ASC,
|
||||
0,
|
||||
0,
|
||||
AEStateIconsEnum.REGULAR_BUTTON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip( final List<String> tooltip )
|
||||
{
|
||||
this.addAboutToTooltip( tooltip, StatCollector.translateToLocal( "gui.tooltips.appliedenergistics2.SortOrder" ),
|
||||
StatCollector.translateToLocal( "gui.tooltips.appliedenergistics2.ToggleSortDirection" ) );
|
||||
}
|
||||
@Override
|
||||
public void getTooltip(final List<String> tooltip) {
|
||||
this.addAboutToTooltip(
|
||||
tooltip,
|
||||
StatCollector.translateToLocal("gui.tooltips.appliedenergistics2.SortOrder"),
|
||||
StatCollector.translateToLocal("gui.tooltips.appliedenergistics2.ToggleSortDirection"));
|
||||
}
|
||||
|
||||
public void setSortingDirection( final SortDir direction )
|
||||
{
|
||||
switch ( direction )
|
||||
{
|
||||
case ASCENDING:
|
||||
this.stateIcon = AEStateIconsEnum.SORT_DIR_ASC;
|
||||
break;
|
||||
public void setSortingDirection(final SortDir direction) {
|
||||
switch (direction) {
|
||||
case ASCENDING:
|
||||
this.stateIcon = AEStateIconsEnum.SORT_DIR_ASC;
|
||||
break;
|
||||
|
||||
case DESCENDING:
|
||||
this.stateIcon = AEStateIconsEnum.SORT_DIR_DEC;
|
||||
break;
|
||||
}
|
||||
}
|
||||
case DESCENDING:
|
||||
this.stateIcon = AEStateIconsEnum.SORT_DIR_DEC;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package thaumicenergistics.client.gui.buttons;
|
||||
|
||||
import java.util.List;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.core.localization.ButtonToolTips;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import thaumicenergistics.client.textures.AEStateIconsEnum;
|
||||
@@ -17,69 +17,68 @@ import thaumicenergistics.common.storage.AspectStackComparator.AspectStackCompar
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiButtonSortingMode
|
||||
extends ThEStateButton
|
||||
{
|
||||
private String tooltipSortBy = "";
|
||||
public class GuiButtonSortingMode extends ThEStateButton {
|
||||
private String tooltipSortBy = "";
|
||||
|
||||
public GuiButtonSortingMode( final int ID, final int xPosition, final int yPosition, final int width, final int height )
|
||||
{
|
||||
super( ID, xPosition, yPosition, width, height, AEStateIconsEnum.SORT_MODE_ALPHABETIC, 0, 0, AEStateIconsEnum.REGULAR_BUTTON );
|
||||
}
|
||||
public GuiButtonSortingMode(
|
||||
final int ID, final int xPosition, final int yPosition, final int width, final int height) {
|
||||
super(
|
||||
ID,
|
||||
xPosition,
|
||||
yPosition,
|
||||
width,
|
||||
height,
|
||||
AEStateIconsEnum.SORT_MODE_ALPHABETIC,
|
||||
0,
|
||||
0,
|
||||
AEStateIconsEnum.REGULAR_BUTTON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip( final List<String> tooltip )
|
||||
{
|
||||
this.addAboutToTooltip( tooltip, ButtonToolTips.SortBy.getLocal(), EnumChatFormatting.GRAY + this.tooltipSortBy );
|
||||
}
|
||||
@Override
|
||||
public void getTooltip(final List<String> tooltip) {
|
||||
this.addAboutToTooltip(tooltip, ButtonToolTips.SortBy.getLocal(), EnumChatFormatting.GRAY + this.tooltipSortBy);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the buttons icon based on the specified comparator mode.
|
||||
*
|
||||
* @param mode
|
||||
*/
|
||||
public void setSortMode( final AspectStackComparatorMode mode )
|
||||
{
|
||||
switch ( mode )
|
||||
{
|
||||
case MODE_ALPHABETIC:
|
||||
this.stateIcon = AEStateIconsEnum.SORT_MODE_ALPHABETIC;
|
||||
this.tooltipSortBy = ButtonToolTips.ItemName.getLocal();
|
||||
break;
|
||||
/**
|
||||
* Sets the buttons icon based on the specified comparator mode.
|
||||
*
|
||||
* @param mode
|
||||
*/
|
||||
public void setSortMode(final AspectStackComparatorMode mode) {
|
||||
switch (mode) {
|
||||
case MODE_ALPHABETIC:
|
||||
this.stateIcon = AEStateIconsEnum.SORT_MODE_ALPHABETIC;
|
||||
this.tooltipSortBy = ButtonToolTips.ItemName.getLocal();
|
||||
break;
|
||||
|
||||
case MODE_AMOUNT:
|
||||
this.stateIcon = AEStateIconsEnum.SORT_MODE_AMOUNT;
|
||||
this.tooltipSortBy = ButtonToolTips.NumberOfItems.getLocal();
|
||||
break;
|
||||
case MODE_AMOUNT:
|
||||
this.stateIcon = AEStateIconsEnum.SORT_MODE_AMOUNT;
|
||||
this.tooltipSortBy = ButtonToolTips.NumberOfItems.getLocal();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public void setSortMode(final SortOrder order) {
|
||||
switch (order) {
|
||||
case AMOUNT:
|
||||
this.stateIcon = AEStateIconsEnum.SORT_MODE_AMOUNT;
|
||||
this.tooltipSortBy = StatCollector.translateToLocal("gui.tooltips.appliedenergistics2.NumberOfItems");
|
||||
break;
|
||||
|
||||
public void setSortMode( final SortOrder order )
|
||||
{
|
||||
switch ( order )
|
||||
{
|
||||
case AMOUNT:
|
||||
this.stateIcon = AEStateIconsEnum.SORT_MODE_AMOUNT;
|
||||
this.tooltipSortBy = StatCollector.translateToLocal( "gui.tooltips.appliedenergistics2.NumberOfItems" );
|
||||
break;
|
||||
case INVTWEAKS:
|
||||
this.stateIcon = AEStateIconsEnum.SORT_MODE_INVTWEAK;
|
||||
this.tooltipSortBy = StatCollector.translateToLocal("gui.tooltips.appliedenergistics2.InventoryTweaks");
|
||||
break;
|
||||
|
||||
case INVTWEAKS:
|
||||
this.stateIcon = AEStateIconsEnum.SORT_MODE_INVTWEAK;
|
||||
this.tooltipSortBy = StatCollector.translateToLocal( "gui.tooltips.appliedenergistics2.InventoryTweaks" );
|
||||
break;
|
||||
|
||||
case MOD:
|
||||
this.stateIcon = AEStateIconsEnum.SORT_MODE_MOD;
|
||||
this.tooltipSortBy = StatCollector.translateToLocal( "gui.tooltips.appliedenergistics2.Mod" );
|
||||
break;
|
||||
|
||||
case NAME:
|
||||
this.stateIcon = AEStateIconsEnum.SORT_MODE_ALPHABETIC;
|
||||
this.tooltipSortBy = StatCollector.translateToLocal( "gui.tooltips.appliedenergistics2.ItemName" );
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
case MOD:
|
||||
this.stateIcon = AEStateIconsEnum.SORT_MODE_MOD;
|
||||
this.tooltipSortBy = StatCollector.translateToLocal("gui.tooltips.appliedenergistics2.Mod");
|
||||
break;
|
||||
|
||||
case NAME:
|
||||
this.stateIcon = AEStateIconsEnum.SORT_MODE_ALPHABETIC;
|
||||
this.tooltipSortBy = StatCollector.translateToLocal("gui.tooltips.appliedenergistics2.ItemName");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package thaumicenergistics.client.gui.buttons;
|
||||
|
||||
import java.util.List;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import thaumicenergistics.client.textures.AEStateIconsEnum;
|
||||
import thaumicenergistics.client.textures.ThEStateIconsEnum;
|
||||
import thaumicenergistics.common.registries.ThEStrings;
|
||||
@@ -14,19 +14,27 @@ import thaumicenergistics.common.registries.ThEStrings;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiButtonSwapArmor
|
||||
extends ThEStateButton
|
||||
{
|
||||
public class GuiButtonSwapArmor extends ThEStateButton {
|
||||
|
||||
public GuiButtonSwapArmor( final int ID, final int xPosition, final int yPosition, final int buttonWidth, final int buttonHeight )
|
||||
{
|
||||
super( ID, xPosition, yPosition, buttonWidth, buttonHeight, ThEStateIconsEnum.SWAP, 0, 0, AEStateIconsEnum.REGULAR_BUTTON );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip( final List<String> tooltip )
|
||||
{
|
||||
this.addAboutToTooltip( tooltip, ThEStrings.TooltipButton_SwapArmor_Title.getLocalized(), ThEStrings.TooltipButton_SwapArmor.getLocalized() );
|
||||
}
|
||||
public GuiButtonSwapArmor(
|
||||
final int ID, final int xPosition, final int yPosition, final int buttonWidth, final int buttonHeight) {
|
||||
super(
|
||||
ID,
|
||||
xPosition,
|
||||
yPosition,
|
||||
buttonWidth,
|
||||
buttonHeight,
|
||||
ThEStateIconsEnum.SWAP,
|
||||
0,
|
||||
0,
|
||||
AEStateIconsEnum.REGULAR_BUTTON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(final List<String> tooltip) {
|
||||
this.addAboutToTooltip(
|
||||
tooltip,
|
||||
ThEStrings.TooltipButton_SwapArmor_Title.getLocalized(),
|
||||
ThEStrings.TooltipButton_SwapArmor.getLocalized());
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package thaumicenergistics.client.gui.buttons;
|
||||
|
||||
import java.util.List;
|
||||
import appeng.api.config.TerminalStyle;
|
||||
import appeng.core.localization.ButtonToolTips;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import thaumicenergistics.client.textures.AEStateIconsEnum;
|
||||
|
||||
@@ -15,44 +15,42 @@ import thaumicenergistics.client.textures.AEStateIconsEnum;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiButtonTerminalStyle
|
||||
extends ThEStateButton
|
||||
{
|
||||
private String tooltipStyle = "";
|
||||
public class GuiButtonTerminalStyle extends ThEStateButton {
|
||||
private String tooltipStyle = "";
|
||||
|
||||
public GuiButtonTerminalStyle( final int ID, final int xPosition, final int yPosition, final int buttonWidth, final int buttonHeight,
|
||||
final TerminalStyle currentStyle )
|
||||
{
|
||||
super( ID, xPosition, yPosition, buttonWidth, buttonHeight, null, 0, 0, AEStateIconsEnum.REGULAR_BUTTON );
|
||||
public GuiButtonTerminalStyle(
|
||||
final int ID,
|
||||
final int xPosition,
|
||||
final int yPosition,
|
||||
final int buttonWidth,
|
||||
final int buttonHeight,
|
||||
final TerminalStyle currentStyle) {
|
||||
super(ID, xPosition, yPosition, buttonWidth, buttonHeight, null, 0, 0, AEStateIconsEnum.REGULAR_BUTTON);
|
||||
|
||||
// Set the style
|
||||
this.setTerminalStyle( currentStyle );
|
||||
}
|
||||
// Set the style
|
||||
this.setTerminalStyle(currentStyle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip( final List<String> tooltip )
|
||||
{
|
||||
this.addAboutToTooltip( tooltip, ButtonToolTips.TerminalStyle.getLocal(), EnumChatFormatting.GRAY + this.tooltipStyle );
|
||||
}
|
||||
@Override
|
||||
public void getTooltip(final List<String> tooltip) {
|
||||
this.addAboutToTooltip(
|
||||
tooltip, ButtonToolTips.TerminalStyle.getLocal(), EnumChatFormatting.GRAY + this.tooltipStyle);
|
||||
}
|
||||
|
||||
public void setTerminalStyle( final TerminalStyle style )
|
||||
{
|
||||
switch ( style )
|
||||
{
|
||||
case SMALL:
|
||||
this.stateIcon = AEStateIconsEnum.TERM_STYLE_SMALL;
|
||||
this.tooltipStyle = ButtonToolTips.TerminalStyle_Small.getLocal();
|
||||
break;
|
||||
public void setTerminalStyle(final TerminalStyle style) {
|
||||
switch (style) {
|
||||
case SMALL:
|
||||
this.stateIcon = AEStateIconsEnum.TERM_STYLE_SMALL;
|
||||
this.tooltipStyle = ButtonToolTips.TerminalStyle_Small.getLocal();
|
||||
break;
|
||||
|
||||
case TALL:
|
||||
this.stateIcon = AEStateIconsEnum.TERM_STYLE_TALL;
|
||||
this.tooltipStyle = ButtonToolTips.TerminalStyle_Tall.getLocal();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
case TALL:
|
||||
this.stateIcon = AEStateIconsEnum.TERM_STYLE_TALL;
|
||||
this.tooltipStyle = ButtonToolTips.TerminalStyle_Tall.getLocal();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package thaumicenergistics.client.gui.buttons;
|
||||
|
||||
import java.util.List;
|
||||
import appeng.api.config.ViewItems;
|
||||
import appeng.core.localization.ButtonToolTips;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import thaumicenergistics.client.textures.AEStateIconsEnum;
|
||||
|
||||
@@ -15,59 +15,62 @@ import thaumicenergistics.client.textures.AEStateIconsEnum;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiButtonViewType
|
||||
extends ThEStateButton
|
||||
{
|
||||
/**
|
||||
* Cached tooltip for the buttons view mode.
|
||||
*/
|
||||
private String tooltipViewType = "";
|
||||
public class GuiButtonViewType extends ThEStateButton {
|
||||
/**
|
||||
* Cached tooltip for the buttons view mode.
|
||||
*/
|
||||
private String tooltipViewType = "";
|
||||
|
||||
/**
|
||||
* Creates the view button.
|
||||
*
|
||||
* @param ID
|
||||
* @param xPosition
|
||||
* @param yPosition
|
||||
* @param width
|
||||
* @param height
|
||||
*/
|
||||
public GuiButtonViewType( final int ID, final int xPosition, final int yPosition, final int width, final int height )
|
||||
{
|
||||
super( ID, xPosition, yPosition, width, height, AEStateIconsEnum.VIEW_TYPE_ALL, 0, 0, AEStateIconsEnum.REGULAR_BUTTON );
|
||||
this.setViewMode( ViewItems.ALL );
|
||||
}
|
||||
/**
|
||||
* Creates the view button.
|
||||
*
|
||||
* @param ID
|
||||
* @param xPosition
|
||||
* @param yPosition
|
||||
* @param width
|
||||
* @param height
|
||||
*/
|
||||
public GuiButtonViewType(
|
||||
final int ID, final int xPosition, final int yPosition, final int width, final int height) {
|
||||
super(
|
||||
ID,
|
||||
xPosition,
|
||||
yPosition,
|
||||
width,
|
||||
height,
|
||||
AEStateIconsEnum.VIEW_TYPE_ALL,
|
||||
0,
|
||||
0,
|
||||
AEStateIconsEnum.REGULAR_BUTTON);
|
||||
this.setViewMode(ViewItems.ALL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip( final List<String> tooltip )
|
||||
{
|
||||
this.addAboutToTooltip( tooltip, ButtonToolTips.View.getLocal(), EnumChatFormatting.GRAY + this.tooltipViewType );
|
||||
}
|
||||
@Override
|
||||
public void getTooltip(final List<String> tooltip) {
|
||||
this.addAboutToTooltip(tooltip, ButtonToolTips.View.getLocal(), EnumChatFormatting.GRAY + this.tooltipViewType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the icon based on the view mode.
|
||||
*
|
||||
* @param mode
|
||||
*/
|
||||
public void setViewMode( final ViewItems mode )
|
||||
{
|
||||
switch ( mode )
|
||||
{
|
||||
case ALL:
|
||||
this.tooltipViewType = ButtonToolTips.StoredCraftable.getLocal();
|
||||
this.stateIcon = AEStateIconsEnum.VIEW_TYPE_ALL;
|
||||
break;
|
||||
/**
|
||||
* Sets the icon based on the view mode.
|
||||
*
|
||||
* @param mode
|
||||
*/
|
||||
public void setViewMode(final ViewItems mode) {
|
||||
switch (mode) {
|
||||
case ALL:
|
||||
this.tooltipViewType = ButtonToolTips.StoredCraftable.getLocal();
|
||||
this.stateIcon = AEStateIconsEnum.VIEW_TYPE_ALL;
|
||||
break;
|
||||
|
||||
case CRAFTABLE:
|
||||
this.tooltipViewType = ButtonToolTips.Craftable.getLocal();
|
||||
this.stateIcon = AEStateIconsEnum.VIEW_TYPE_CRAFT;
|
||||
break;
|
||||
|
||||
case STORED:
|
||||
this.tooltipViewType = ButtonToolTips.StoredItems.getLocal();
|
||||
this.stateIcon = AEStateIconsEnum.VIEW_TYPE_STORED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
case CRAFTABLE:
|
||||
this.tooltipViewType = ButtonToolTips.Craftable.getLocal();
|
||||
this.stateIcon = AEStateIconsEnum.VIEW_TYPE_CRAFT;
|
||||
break;
|
||||
|
||||
case STORED:
|
||||
this.tooltipViewType = ButtonToolTips.StoredItems.getLocal();
|
||||
this.stateIcon = AEStateIconsEnum.VIEW_TYPE_STORED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package thaumicenergistics.client.gui.buttons;
|
||||
|
||||
import java.util.List;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import thaumicenergistics.client.gui.ThEGuiHelper;
|
||||
|
||||
@@ -13,37 +13,38 @@ import thaumicenergistics.client.gui.ThEGuiHelper;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract class ThEGuiButtonBase
|
||||
extends GuiButton
|
||||
{
|
||||
public ThEGuiButtonBase( final int ID, final int xPosition, final int yPosition, final int width, final int height, final String text )
|
||||
{
|
||||
super( ID, xPosition, yPosition, width, height, text );
|
||||
}
|
||||
public abstract class ThEGuiButtonBase extends GuiButton {
|
||||
public ThEGuiButtonBase(
|
||||
final int ID,
|
||||
final int xPosition,
|
||||
final int yPosition,
|
||||
final int width,
|
||||
final int height,
|
||||
final String text) {
|
||||
super(ID, xPosition, yPosition, width, height, text);
|
||||
}
|
||||
|
||||
public ThEGuiButtonBase( final int ID, final int xPosition, final int yPosition, final String text )
|
||||
{
|
||||
super( ID, xPosition, yPosition, text );
|
||||
}
|
||||
public ThEGuiButtonBase(final int ID, final int xPosition, final int yPosition, final String text) {
|
||||
super(ID, xPosition, yPosition, text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to get the tooltip for this button.
|
||||
*
|
||||
* @param tooltip
|
||||
* List to add tooltip string to.
|
||||
*/
|
||||
public abstract void getTooltip( final List<String> tooltip );
|
||||
|
||||
/**
|
||||
* Checks if the mouse is over this button.
|
||||
*
|
||||
* @param mouseX
|
||||
* @param mouseY
|
||||
* @return
|
||||
*/
|
||||
public boolean isMouseOverButton( final int mouseX, final int mouseY )
|
||||
{
|
||||
return ThEGuiHelper.INSTANCE.isPointInRegion( this.yPosition, this.xPosition, this.height, this.width, mouseX, mouseY );
|
||||
}
|
||||
/**
|
||||
* Called to get the tooltip for this button.
|
||||
*
|
||||
* @param tooltip
|
||||
* List to add tooltip string to.
|
||||
*/
|
||||
public abstract void getTooltip(final List<String> tooltip);
|
||||
|
||||
/**
|
||||
* Checks if the mouse is over this button.
|
||||
*
|
||||
* @param mouseX
|
||||
* @param mouseY
|
||||
* @return
|
||||
*/
|
||||
public boolean isMouseOverButton(final int mouseX, final int mouseY) {
|
||||
return ThEGuiHelper.INSTANCE.isPointInRegion(
|
||||
this.yPosition, this.xPosition, this.height, this.width, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
package thaumicenergistics.client.gui.buttons;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import com.google.common.base.Splitter;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumicenergistics.client.textures.IStateIconTexture;
|
||||
|
||||
/**
|
||||
@@ -18,158 +18,179 @@ import thaumicenergistics.client.textures.IStateIconTexture;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract class ThEStateButton
|
||||
extends ThEGuiButtonBase
|
||||
{
|
||||
/**
|
||||
* Button background
|
||||
*/
|
||||
private IStateIconTexture backgroundIcon;
|
||||
public abstract class ThEStateButton extends ThEGuiButtonBase {
|
||||
/**
|
||||
* Button background
|
||||
*/
|
||||
private IStateIconTexture backgroundIcon;
|
||||
|
||||
/**
|
||||
* Offset from the top-left corner of the button to draw the icon.
|
||||
*/
|
||||
private int iconXOffset = 0;
|
||||
/**
|
||||
* Offset from the top-left corner of the button to draw the icon.
|
||||
*/
|
||||
private int iconXOffset = 0;
|
||||
|
||||
/**
|
||||
* Offset from the top-left corner of the button to draw the icon.
|
||||
*/
|
||||
private int iconYOffset = 0;
|
||||
/**
|
||||
* Offset from the top-left corner of the button to draw the icon.
|
||||
*/
|
||||
private int iconYOffset = 0;
|
||||
|
||||
/**
|
||||
* Icon to draw on the button
|
||||
*/
|
||||
protected IStateIconTexture stateIcon;
|
||||
/**
|
||||
* Icon to draw on the button
|
||||
*/
|
||||
protected IStateIconTexture stateIcon;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ID
|
||||
* @param xPosition
|
||||
* @param yPosition
|
||||
* @param buttonWidth
|
||||
* @param buttonHeight
|
||||
* @param icon
|
||||
* @param iconXOffset
|
||||
* @param iconYOffset
|
||||
* @param backgroundIcon
|
||||
*/
|
||||
public ThEStateButton( final int ID, final int xPosition, final int yPosition, final int buttonWidth, final int buttonHeight,
|
||||
final IStateIconTexture icon, final int iconXOffset, final int iconYOffset, final IStateIconTexture backgroundIcon )
|
||||
{
|
||||
// Call super
|
||||
super( ID, xPosition, yPosition, buttonWidth, buttonHeight, "" );
|
||||
/**
|
||||
*
|
||||
* @param ID
|
||||
* @param xPosition
|
||||
* @param yPosition
|
||||
* @param buttonWidth
|
||||
* @param buttonHeight
|
||||
* @param icon
|
||||
* @param iconXOffset
|
||||
* @param iconYOffset
|
||||
* @param backgroundIcon
|
||||
*/
|
||||
public ThEStateButton(
|
||||
final int ID,
|
||||
final int xPosition,
|
||||
final int yPosition,
|
||||
final int buttonWidth,
|
||||
final int buttonHeight,
|
||||
final IStateIconTexture icon,
|
||||
final int iconXOffset,
|
||||
final int iconYOffset,
|
||||
final IStateIconTexture backgroundIcon) {
|
||||
// Call super
|
||||
super(ID, xPosition, yPosition, buttonWidth, buttonHeight, "");
|
||||
|
||||
// Set the icon
|
||||
this.stateIcon = icon;
|
||||
// Set the icon
|
||||
this.stateIcon = icon;
|
||||
|
||||
// Set the offsets
|
||||
this.iconXOffset = iconXOffset;
|
||||
this.iconYOffset = iconYOffset;
|
||||
// Set the offsets
|
||||
this.iconXOffset = iconXOffset;
|
||||
this.iconYOffset = iconYOffset;
|
||||
|
||||
// Set background
|
||||
this.backgroundIcon = backgroundIcon;
|
||||
}
|
||||
// Set background
|
||||
this.backgroundIcon = backgroundIcon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws a textured rectangle at the stored z-value, the texture will
|
||||
* be scaled to fit within the width and height
|
||||
*/
|
||||
private void drawScaledTexturedModalRect( final int xPosition, final int yPosition, final int u, final int v, final int width, final int height,
|
||||
final int textureWidth, final int textureHeight )
|
||||
{
|
||||
// No idea what this is
|
||||
float magic_number = 0.00390625F;
|
||||
/**
|
||||
* Draws a textured rectangle at the stored z-value, the texture will
|
||||
* be scaled to fit within the width and height
|
||||
*/
|
||||
private void drawScaledTexturedModalRect(
|
||||
final int xPosition,
|
||||
final int yPosition,
|
||||
final int u,
|
||||
final int v,
|
||||
final int width,
|
||||
final int height,
|
||||
final int textureWidth,
|
||||
final int textureHeight) {
|
||||
// No idea what this is
|
||||
float magic_number = 0.00390625F;
|
||||
|
||||
// Calculate the UV's
|
||||
float minU = u * magic_number;
|
||||
float maxU = ( u + textureWidth ) * magic_number;
|
||||
float minV = v * magic_number;
|
||||
float maxV = ( v + textureHeight ) * magic_number;
|
||||
double dHeight = height;
|
||||
double dWidth = width;
|
||||
// Calculate the UV's
|
||||
float minU = u * magic_number;
|
||||
float maxU = (u + textureWidth) * magic_number;
|
||||
float minV = v * magic_number;
|
||||
float maxV = (v + textureHeight) * magic_number;
|
||||
double dHeight = height;
|
||||
double dWidth = width;
|
||||
|
||||
// Get the tessellator
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
// Get the tessellator
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
// Start drawing
|
||||
tessellator.startDrawingQuads();
|
||||
// Start drawing
|
||||
tessellator.startDrawingQuads();
|
||||
|
||||
// Top left corner
|
||||
tessellator.addVertexWithUV( xPosition, yPosition + dHeight, this.zLevel, minU, maxV );
|
||||
// Top left corner
|
||||
tessellator.addVertexWithUV(xPosition, yPosition + dHeight, this.zLevel, minU, maxV);
|
||||
|
||||
// Top right corner
|
||||
tessellator.addVertexWithUV( xPosition + dWidth, yPosition + dHeight, this.zLevel, maxU, maxV );
|
||||
// Top right corner
|
||||
tessellator.addVertexWithUV(xPosition + dWidth, yPosition + dHeight, this.zLevel, maxU, maxV);
|
||||
|
||||
// Bottom right corner
|
||||
tessellator.addVertexWithUV( xPosition + dWidth, yPosition, this.zLevel, maxU, minV );
|
||||
// Bottom right corner
|
||||
tessellator.addVertexWithUV(xPosition + dWidth, yPosition, this.zLevel, maxU, minV);
|
||||
|
||||
// Bottom left corner
|
||||
tessellator.addVertexWithUV( xPosition, yPosition, this.zLevel, minU, minV );
|
||||
// Bottom left corner
|
||||
tessellator.addVertexWithUV(xPosition, yPosition, this.zLevel, minU, minV);
|
||||
|
||||
// Draw
|
||||
tessellator.draw();
|
||||
}
|
||||
// Draw
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds info to the tooltip as a white header, and grey body.
|
||||
* The body is broken down into lines of length 30.
|
||||
*
|
||||
* @param tooltip
|
||||
* @param title
|
||||
* @param text
|
||||
*/
|
||||
protected void addAboutToTooltip( final List<String> tooltip, final String title, final String text )
|
||||
{
|
||||
// Title
|
||||
tooltip.add( EnumChatFormatting.WHITE + title );
|
||||
/**
|
||||
* Adds info to the tooltip as a white header, and grey body.
|
||||
* The body is broken down into lines of length 30.
|
||||
*
|
||||
* @param tooltip
|
||||
* @param title
|
||||
* @param text
|
||||
*/
|
||||
protected void addAboutToTooltip(final List<String> tooltip, final String title, final String text) {
|
||||
// Title
|
||||
tooltip.add(EnumChatFormatting.WHITE + title);
|
||||
|
||||
// Body
|
||||
for( String line : Splitter.on( "\n" ).split( WordUtils.wrap( text, 30, "\n", false ) ) )
|
||||
{
|
||||
tooltip.add( EnumChatFormatting.GRAY + line.trim() );
|
||||
}
|
||||
}
|
||||
// Body
|
||||
for (String line : Splitter.on("\n").split(WordUtils.wrap(text, 30, "\n", false))) {
|
||||
tooltip.add(EnumChatFormatting.GRAY + line.trim());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws an icon to the screen.
|
||||
*
|
||||
* @param minecraftInstance
|
||||
* @param icon
|
||||
* @param xPos
|
||||
* @param yPos
|
||||
* @param iconWidth
|
||||
* @param iconHeight
|
||||
*/
|
||||
protected void drawIcon( final Minecraft minecraftInstance, final IStateIconTexture icon, final int xPos, final int yPos, final int iconWidth,
|
||||
final int iconHeight )
|
||||
{
|
||||
// Bind the sheet
|
||||
minecraftInstance.getTextureManager().bindTexture( icon.getTexture() );
|
||||
/**
|
||||
* Draws an icon to the screen.
|
||||
*
|
||||
* @param minecraftInstance
|
||||
* @param icon
|
||||
* @param xPos
|
||||
* @param yPos
|
||||
* @param iconWidth
|
||||
* @param iconHeight
|
||||
*/
|
||||
protected void drawIcon(
|
||||
final Minecraft minecraftInstance,
|
||||
final IStateIconTexture icon,
|
||||
final int xPos,
|
||||
final int yPos,
|
||||
final int iconWidth,
|
||||
final int iconHeight) {
|
||||
// Bind the sheet
|
||||
minecraftInstance.getTextureManager().bindTexture(icon.getTexture());
|
||||
|
||||
// Draw the icon
|
||||
this.drawScaledTexturedModalRect( xPos + this.iconXOffset, yPos + this.iconYOffset, icon.getU(), icon.getV(), iconWidth, iconHeight,
|
||||
icon.getWidth(), icon.getHeight() );
|
||||
}
|
||||
// Draw the icon
|
||||
this.drawScaledTexturedModalRect(
|
||||
xPos + this.iconXOffset,
|
||||
yPos + this.iconYOffset,
|
||||
icon.getU(),
|
||||
icon.getV(),
|
||||
iconWidth,
|
||||
iconHeight,
|
||||
icon.getWidth(),
|
||||
icon.getHeight());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton( final Minecraft minecraftInstance, final int x, final int y )
|
||||
{
|
||||
// Full white
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
@Override
|
||||
public void drawButton(final Minecraft minecraftInstance, final int x, final int y) {
|
||||
// Full white
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
if( this.backgroundIcon != null )
|
||||
{
|
||||
// Draw the background
|
||||
this.drawIcon( minecraftInstance, this.backgroundIcon, this.xPosition, this.yPosition, this.width, this.height );
|
||||
}
|
||||
|
||||
if( this.stateIcon != null )
|
||||
{
|
||||
// Draw the overlay icon
|
||||
this.drawIcon( minecraftInstance, this.stateIcon, this.xPosition + this.iconXOffset, this.yPosition + this.iconYOffset, this.width,
|
||||
this.height );
|
||||
}
|
||||
|
||||
}
|
||||
if (this.backgroundIcon != null) {
|
||||
// Draw the background
|
||||
this.drawIcon(
|
||||
minecraftInstance, this.backgroundIcon, this.xPosition, this.yPosition, this.width, this.height);
|
||||
}
|
||||
|
||||
if (this.stateIcon != null) {
|
||||
// Draw the overlay icon
|
||||
this.drawIcon(
|
||||
minecraftInstance,
|
||||
this.stateIcon,
|
||||
this.xPosition + this.iconXOffset,
|
||||
this.yPosition + this.iconYOffset,
|
||||
this.width,
|
||||
this.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
package thaumicenergistics.client.gui.widget;
|
||||
|
||||
import java.util.List;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.client.lib.UtilsFX;
|
||||
import thaumicenergistics.api.gui.IWidgetHost;
|
||||
@@ -24,275 +24,259 @@ import thaumicenergistics.common.storage.AspectStack;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract class AspectWidgetBase
|
||||
extends ThEWidget
|
||||
{
|
||||
/**
|
||||
* Icon to display if the aspect is unknown to the player
|
||||
*/
|
||||
private static final ResourceLocation UNKNOWN_TEXTURE = new ResourceLocation( "thaumcraft", "textures/aspects/_unknown.png" );
|
||||
public abstract class AspectWidgetBase extends ThEWidget {
|
||||
/**
|
||||
* Icon to display if the aspect is unknown to the player
|
||||
*/
|
||||
private static final ResourceLocation UNKNOWN_TEXTURE =
|
||||
new ResourceLocation("thaumcraft", "textures/aspects/_unknown.png");
|
||||
|
||||
/**
|
||||
* Stack this widget represents.
|
||||
*/
|
||||
private final IAspectStack aspectStack;
|
||||
/**
|
||||
* Stack this widget represents.
|
||||
*/
|
||||
private final IAspectStack aspectStack;
|
||||
|
||||
/**
|
||||
* True if the player has discovered the aspect.
|
||||
*/
|
||||
protected boolean hasDiscovered = false;
|
||||
/**
|
||||
* True if the player has discovered the aspect.
|
||||
*/
|
||||
protected boolean hasDiscovered = false;
|
||||
|
||||
/**
|
||||
* Cached aspect name.
|
||||
*/
|
||||
protected String aspectName = "";
|
||||
/**
|
||||
* Cached aspect name.
|
||||
*/
|
||||
protected String aspectName = "";
|
||||
|
||||
/**
|
||||
* Cached description of the aspect.
|
||||
*/
|
||||
protected String aspectDescription = "";
|
||||
/**
|
||||
* Cached description of the aspect.
|
||||
*/
|
||||
protected String aspectDescription = "";
|
||||
|
||||
/**
|
||||
* Cached footnote of the aspect.
|
||||
*/
|
||||
protected String aspectFootnote = "";
|
||||
/**
|
||||
* Cached footnote of the aspect.
|
||||
*/
|
||||
protected String aspectFootnote = "";
|
||||
|
||||
/**
|
||||
* The current player.
|
||||
*/
|
||||
private EntityPlayer player;
|
||||
/**
|
||||
* The current player.
|
||||
*/
|
||||
private EntityPlayer player;
|
||||
|
||||
/**
|
||||
* Color of the aspect as ARGB.
|
||||
*/
|
||||
private byte[] aspectColorBytes;
|
||||
/**
|
||||
* Color of the aspect as ARGB.
|
||||
*/
|
||||
private byte[] aspectColorBytes;
|
||||
|
||||
public AspectWidgetBase( final IWidgetHost hostGui, final IAspectStack stack, final int xPos, final int yPos, final EntityPlayer player )
|
||||
{
|
||||
// Call super
|
||||
super( hostGui, xPos, yPos );
|
||||
public AspectWidgetBase(
|
||||
final IWidgetHost hostGui,
|
||||
final IAspectStack stack,
|
||||
final int xPos,
|
||||
final int yPos,
|
||||
final EntityPlayer player) {
|
||||
// Call super
|
||||
super(hostGui, xPos, yPos);
|
||||
|
||||
// Set the player
|
||||
this.player = player;
|
||||
// Set the player
|
||||
this.player = player;
|
||||
|
||||
// Create the aspect stack
|
||||
this.aspectStack = new AspectStack();
|
||||
// Create the aspect stack
|
||||
this.aspectStack = new AspectStack();
|
||||
|
||||
// Set the aspect
|
||||
this.setAspect( stack );
|
||||
}
|
||||
// Set the aspect
|
||||
this.setAspect(stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the stack and optionally fires the on stack changed event.
|
||||
*
|
||||
* @param doUpdate
|
||||
*/
|
||||
protected void clearStack( final boolean doUpdate )
|
||||
{
|
||||
this.aspectStack.setAll( null, 0, false );
|
||||
this.aspectName = "";
|
||||
this.aspectDescription = "";
|
||||
this.aspectFootnote = "";
|
||||
this.hasDiscovered = false;
|
||||
/**
|
||||
* Clears the stack and optionally fires the on stack changed event.
|
||||
*
|
||||
* @param doUpdate
|
||||
*/
|
||||
protected void clearStack(final boolean doUpdate) {
|
||||
this.aspectStack.setAll(null, 0, false);
|
||||
this.aspectName = "";
|
||||
this.aspectDescription = "";
|
||||
this.aspectFootnote = "";
|
||||
this.hasDiscovered = false;
|
||||
|
||||
if( doUpdate )
|
||||
{
|
||||
this.onStackChanged();
|
||||
}
|
||||
}
|
||||
if (doUpdate) {
|
||||
this.onStackChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the aspect icon, or a question mark if not discovered.
|
||||
*/
|
||||
protected void drawAspect()
|
||||
{
|
||||
// Ensure there is an aspect to draw
|
||||
if( !this.aspectStack.hasAspect() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Draws the aspect icon, or a question mark if not discovered.
|
||||
*/
|
||||
protected void drawAspect() {
|
||||
// Ensure there is an aspect to draw
|
||||
if (!this.aspectStack.hasAspect()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Have they discovered this aspect?
|
||||
if( this.hasDiscovered )
|
||||
{
|
||||
// Ask Thaumcraft to draw the aspect
|
||||
UtilsFX.drawTag( this.xPosition + 1, this.yPosition + 1, this.aspectStack.getAspect(), 0, 0, this.zLevel );
|
||||
}
|
||||
// Draw the question mark
|
||||
else
|
||||
{
|
||||
// Bind the Thaumcraft question mark texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture( AspectWidgetBase.UNKNOWN_TEXTURE );
|
||||
// Have they discovered this aspect?
|
||||
if (this.hasDiscovered) {
|
||||
// Ask Thaumcraft to draw the aspect
|
||||
UtilsFX.drawTag(this.xPosition + 1, this.yPosition + 1, this.aspectStack.getAspect(), 0, 0, this.zLevel);
|
||||
}
|
||||
// Draw the question mark
|
||||
else {
|
||||
// Bind the Thaumcraft question mark texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(AspectWidgetBase.UNKNOWN_TEXTURE);
|
||||
|
||||
// Set the color
|
||||
GL11.glColor4ub( this.aspectColorBytes[1], this.aspectColorBytes[2], this.aspectColorBytes[3], this.aspectColorBytes[0] );
|
||||
// Set the color
|
||||
GL11.glColor4ub(
|
||||
this.aspectColorBytes[1],
|
||||
this.aspectColorBytes[2],
|
||||
this.aspectColorBytes[3],
|
||||
this.aspectColorBytes[0]);
|
||||
|
||||
// Enable blending
|
||||
GL11.glEnable( GL11.GL_BLEND );
|
||||
// Enable blending
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
// Set the blending mode
|
||||
GL11.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );
|
||||
// Set the blending mode
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
// Ask Thaumcraft to draw the question texture
|
||||
UtilsFX.drawTexturedQuadFull( this.xPosition + 1, this.yPosition + 1, this.zLevel );
|
||||
// Ask Thaumcraft to draw the question texture
|
||||
UtilsFX.drawTexturedQuadFull(this.xPosition + 1, this.yPosition + 1, this.zLevel);
|
||||
|
||||
// Disable blending
|
||||
GL11.glDisable( GL11.GL_BLEND );
|
||||
}
|
||||
}
|
||||
// Disable blending
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the stack changes.
|
||||
*/
|
||||
protected void onStackChanged()
|
||||
{
|
||||
// Is there an aspect?
|
||||
if( this.aspectStack.hasAspect() )
|
||||
{
|
||||
// Get the aspect name
|
||||
this.aspectName = this.aspectStack.getAspectName( this.player );
|
||||
/**
|
||||
* Called when the stack changes.
|
||||
*/
|
||||
protected void onStackChanged() {
|
||||
// Is there an aspect?
|
||||
if (this.aspectStack.hasAspect()) {
|
||||
// Get the aspect name
|
||||
this.aspectName = this.aspectStack.getAspectName(this.player);
|
||||
|
||||
// Get if the player has discovered this aspect
|
||||
this.hasDiscovered = this.aspectStack.hasPlayerDiscovered( this.player );
|
||||
if( this.hasDiscovered )
|
||||
{
|
||||
// Get the description
|
||||
this.aspectDescription = this.aspectStack.getAspectDescription();
|
||||
// Get if the player has discovered this aspect
|
||||
this.hasDiscovered = this.aspectStack.hasPlayerDiscovered(this.player);
|
||||
if (this.hasDiscovered) {
|
||||
// Get the description
|
||||
this.aspectDescription = this.aspectStack.getAspectDescription();
|
||||
|
||||
// Get the mod
|
||||
ModContainer mod = AspectHooks.aspectToMod.getOrDefault( this.aspectStack.getAspect(), null );
|
||||
// Get the mod
|
||||
ModContainer mod = AspectHooks.aspectToMod.getOrDefault(this.aspectStack.getAspect(), null);
|
||||
|
||||
// Set footnote
|
||||
if( mod != null )
|
||||
{
|
||||
this.aspectFootnote = mod.getName();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.aspectFootnote = "Unknown";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.aspectDescription = this.aspectName;
|
||||
this.aspectFootnote = "Unknown";
|
||||
}
|
||||
// Set footnote
|
||||
if (mod != null) {
|
||||
this.aspectFootnote = mod.getName();
|
||||
} else {
|
||||
this.aspectFootnote = "Unknown";
|
||||
}
|
||||
} else {
|
||||
this.aspectDescription = this.aspectName;
|
||||
this.aspectFootnote = "Unknown";
|
||||
}
|
||||
|
||||
// Get the color bytes
|
||||
this.aspectColorBytes = ThEGuiHelper.INSTANCE.convertPackedColorToARGBb( this.aspectStack.getAspect().getColor() );
|
||||
// Get the color bytes
|
||||
this.aspectColorBytes = ThEGuiHelper.INSTANCE.convertPackedColorToARGBb(
|
||||
this.aspectStack.getAspect().getColor());
|
||||
|
||||
// Set full alpha
|
||||
this.aspectColorBytes[0] = (byte)255;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Clear the info
|
||||
this.clearStack( false );
|
||||
}
|
||||
}
|
||||
// Set full alpha
|
||||
this.aspectColorBytes[0] = (byte) 255;
|
||||
} else {
|
||||
// Clear the info
|
||||
this.clearStack(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the stack.
|
||||
*/
|
||||
public void clearWidget()
|
||||
{
|
||||
this.clearStack( true );
|
||||
}
|
||||
/**
|
||||
* Clears the stack.
|
||||
*/
|
||||
public void clearWidget() {
|
||||
this.clearStack(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the stack size.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public long getAmount()
|
||||
{
|
||||
return this.aspectStack.getStackSize();
|
||||
}
|
||||
/**
|
||||
* Gets the stack size.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public long getAmount() {
|
||||
return this.aspectStack.getStackSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the aspect stack for this widget.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Aspect getAspect()
|
||||
{
|
||||
return this.aspectStack.getAspect();
|
||||
}
|
||||
/**
|
||||
* Gets the aspect stack for this widget.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Aspect getAspect() {
|
||||
return this.aspectStack.getAspect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether or not the stack is craftable.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean getCraftable()
|
||||
{
|
||||
return this.aspectStack.getCraftable();
|
||||
}
|
||||
/**
|
||||
* Gets whether or not the stack is craftable.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean getCraftable() {
|
||||
return this.aspectStack.getCraftable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the aspect stack.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public IAspectStack getStack()
|
||||
{
|
||||
return this.aspectStack;
|
||||
}
|
||||
/**
|
||||
* Returns the aspect stack.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public IAspectStack getStack() {
|
||||
return this.aspectStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the aspect name and amount
|
||||
*/
|
||||
@Override
|
||||
public void getTooltip( final List<String> tooltip )
|
||||
{
|
||||
if( this.hasAspect() )
|
||||
{
|
||||
// Add the name
|
||||
tooltip.add( this.aspectName );
|
||||
/**
|
||||
* Draws the aspect name and amount
|
||||
*/
|
||||
@Override
|
||||
public void getTooltip(final List<String> tooltip) {
|
||||
if (this.hasAspect()) {
|
||||
// Add the name
|
||||
tooltip.add(this.aspectName);
|
||||
|
||||
// Add aspect info
|
||||
tooltip.add( EnumChatFormatting.GRAY.toString() + this.aspectDescription );
|
||||
// Add aspect info
|
||||
tooltip.add(EnumChatFormatting.GRAY.toString() + this.aspectDescription);
|
||||
|
||||
// Add footnote
|
||||
tooltip.add( EnumChatFormatting.DARK_PURPLE.toString() + EnumChatFormatting.ITALIC.toString() + this.aspectFootnote );
|
||||
}
|
||||
}
|
||||
// Add footnote
|
||||
tooltip.add(EnumChatFormatting.DARK_PURPLE.toString()
|
||||
+ EnumChatFormatting.ITALIC.toString()
|
||||
+ this.aspectFootnote);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the widget has an aspect.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean hasAspect()
|
||||
{
|
||||
return this.aspectStack.hasAspect();
|
||||
}
|
||||
/**
|
||||
* Returns true if the widget has an aspect.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean hasAspect() {
|
||||
return this.aspectStack.hasAspect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set's the aspect stack based on the passed values.
|
||||
*
|
||||
* @param aspect
|
||||
* @param amount
|
||||
* @param isCraftable
|
||||
*/
|
||||
public void setAspect( final Aspect aspect, final long amount, final boolean isCraftable )
|
||||
{
|
||||
// Set the aspect
|
||||
this.aspectStack.setAll( aspect, amount, isCraftable );
|
||||
/**
|
||||
* Set's the aspect stack based on the passed values.
|
||||
*
|
||||
* @param aspect
|
||||
* @param amount
|
||||
* @param isCraftable
|
||||
*/
|
||||
public void setAspect(final Aspect aspect, final long amount, final boolean isCraftable) {
|
||||
// Set the aspect
|
||||
this.aspectStack.setAll(aspect, amount, isCraftable);
|
||||
|
||||
this.onStackChanged();
|
||||
}
|
||||
this.onStackChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the aspect based on the stack
|
||||
*
|
||||
* @param stack
|
||||
*/
|
||||
public void setAspect( final IAspectStack stack )
|
||||
{
|
||||
// Copy the values
|
||||
this.aspectStack.setAll( stack );
|
||||
/**
|
||||
* Sets the aspect based on the stack
|
||||
*
|
||||
* @param stack
|
||||
*/
|
||||
public void setAspect(final IAspectStack stack) {
|
||||
// Copy the values
|
||||
this.aspectStack.setAll(stack);
|
||||
|
||||
this.onStackChanged();
|
||||
}
|
||||
this.onStackChanged();
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package thaumicenergistics.client.gui.widget;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
/**
|
||||
* Text field that only allows numeric input.
|
||||
@@ -13,62 +13,54 @@ import net.minecraft.client.gui.GuiTextField;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class DigitTextField
|
||||
extends GuiTextField
|
||||
{
|
||||
public class DigitTextField extends GuiTextField {
|
||||
|
||||
/**
|
||||
* Creates the text field
|
||||
*
|
||||
* @param fontRenderer
|
||||
* @param x
|
||||
* @param y
|
||||
* @param length
|
||||
* @param height
|
||||
*/
|
||||
public DigitTextField( final FontRenderer fontRenderer, final int x, final int y, final int length, final int height )
|
||||
{
|
||||
super( fontRenderer, x, y, length, height );
|
||||
}
|
||||
/**
|
||||
* Creates the text field
|
||||
*
|
||||
* @param fontRenderer
|
||||
* @param x
|
||||
* @param y
|
||||
* @param length
|
||||
* @param height
|
||||
*/
|
||||
public DigitTextField(
|
||||
final FontRenderer fontRenderer, final int x, final int y, final int length, final int height) {
|
||||
super(fontRenderer, x, y, length, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean textboxKeyTyped( final char keyChar, final int keyID )
|
||||
{
|
||||
// Ensure we have focus
|
||||
if( this.isFocused() )
|
||||
{
|
||||
@Override
|
||||
public boolean textboxKeyTyped(final char keyChar, final int keyID) {
|
||||
// Ensure we have focus
|
||||
if (this.isFocused()) {
|
||||
|
||||
// Is the backspace key being pressed?
|
||||
if( keyID == Keyboard.KEY_BACK )
|
||||
{
|
||||
// Move the cursor back a character
|
||||
this.deleteFromCursor( -1 );
|
||||
return true;
|
||||
}
|
||||
// Is the backspace key being pressed?
|
||||
if (keyID == Keyboard.KEY_BACK) {
|
||||
// Move the cursor back a character
|
||||
this.deleteFromCursor(-1);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Is the typed character a numeric digit?
|
||||
if( Character.isDigit( keyChar ) )
|
||||
{
|
||||
// Append to the text
|
||||
this.writeText( Character.toString( keyChar ) );
|
||||
return true;
|
||||
}
|
||||
// Is the typed character a numeric digit?
|
||||
if (Character.isDigit(keyChar)) {
|
||||
// Append to the text
|
||||
this.writeText(Character.toString(keyChar));
|
||||
return true;
|
||||
}
|
||||
|
||||
// Is the text empty or the value of the text 0?
|
||||
if( this.getText().isEmpty() || this.getText().equals( "0" ) )
|
||||
{
|
||||
// Did the player type a minus sign?
|
||||
if( ( keyChar == '-' ) )
|
||||
{
|
||||
// Player intends for number to be negative
|
||||
this.setText( "-" );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Is the text empty or the value of the text 0?
|
||||
if (this.getText().isEmpty() || this.getText().equals("0")) {
|
||||
// Did the player type a minus sign?
|
||||
if ((keyChar == '-')) {
|
||||
// Player intends for number to be negative
|
||||
this.setText("-");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package thaumicenergistics.client.gui.widget;
|
||||
|
||||
import java.util.List;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumicenergistics.api.gui.IWidgetHost;
|
||||
import thaumicenergistics.client.gui.ThEGuiHelper;
|
||||
|
||||
@@ -15,64 +15,67 @@ import thaumicenergistics.client.gui.ThEGuiHelper;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract class ThEWidget
|
||||
extends Gui
|
||||
{
|
||||
/**
|
||||
* The width and height of the aspect
|
||||
*/
|
||||
public static final int WIDGET_SIZE = 18;
|
||||
public abstract class ThEWidget extends Gui {
|
||||
/**
|
||||
* The width and height of the aspect
|
||||
*/
|
||||
public static final int WIDGET_SIZE = 18;
|
||||
|
||||
protected int xPosition;
|
||||
protected int xPosition;
|
||||
|
||||
protected int yPosition;
|
||||
protected int yPosition;
|
||||
|
||||
protected IWidgetHost hostGUI;
|
||||
protected IWidgetHost hostGUI;
|
||||
|
||||
public ThEWidget( final IWidgetHost hostGUI, final int xPos, final int yPos )
|
||||
{
|
||||
this.hostGUI = hostGUI;
|
||||
public ThEWidget(final IWidgetHost hostGUI, final int xPos, final int yPos) {
|
||||
this.hostGUI = hostGUI;
|
||||
|
||||
this.xPosition = xPos;
|
||||
this.xPosition = xPos;
|
||||
|
||||
this.yPosition = yPos;
|
||||
}
|
||||
this.yPosition = yPos;
|
||||
}
|
||||
|
||||
public void drawMouseHoverUnderlay()
|
||||
{
|
||||
GL11.glDisable( GL11.GL_LIGHTING );
|
||||
public void drawMouseHoverUnderlay() {
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
GL11.glDisable( GL11.GL_DEPTH_TEST );
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
|
||||
this.drawGradientRect( this.xPosition + 1, this.yPosition + 1, this.xPosition + 17, this.yPosition + 17, 0x80FFFFFF, 0x80FFFFFF );
|
||||
this.drawGradientRect(
|
||||
this.xPosition + 1,
|
||||
this.yPosition + 1,
|
||||
this.xPosition + 17,
|
||||
this.yPosition + 17,
|
||||
0x80FFFFFF,
|
||||
0x80FFFFFF);
|
||||
|
||||
GL11.glEnable( GL11.GL_LIGHTING );
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
GL11.glEnable( GL11.GL_DEPTH_TEST );
|
||||
}
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
public abstract void drawWidget();
|
||||
public abstract void drawWidget();
|
||||
|
||||
public abstract void getTooltip( List<String> tooltip );
|
||||
public abstract void getTooltip(List<String> tooltip);
|
||||
|
||||
public boolean isMouseOverWidget( final int mouseX, final int mouseY )
|
||||
{
|
||||
return ThEGuiHelper.INSTANCE.isPointInGuiRegion(
|
||||
this.yPosition, this.xPosition,
|
||||
ThEWidget.WIDGET_SIZE - 1, ThEWidget.WIDGET_SIZE - 1,
|
||||
mouseX, mouseY,
|
||||
this.hostGUI.guiLeft(), this.hostGUI.guiTop() );
|
||||
}
|
||||
public boolean isMouseOverWidget(final int mouseX, final int mouseY) {
|
||||
return ThEGuiHelper.INSTANCE.isPointInGuiRegion(
|
||||
this.yPosition,
|
||||
this.xPosition,
|
||||
ThEWidget.WIDGET_SIZE - 1,
|
||||
ThEWidget.WIDGET_SIZE - 1,
|
||||
mouseX,
|
||||
mouseY,
|
||||
this.hostGUI.guiLeft(),
|
||||
this.hostGUI.guiTop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the mouse is clicked on the widget.
|
||||
*/
|
||||
public abstract void onMouseClicked();
|
||||
|
||||
public void setPosition( final int xPos, final int yPos )
|
||||
{
|
||||
this.xPosition = xPos;
|
||||
this.yPosition = yPos;
|
||||
}
|
||||
/**
|
||||
* Called when the mouse is clicked on the widget.
|
||||
*/
|
||||
public abstract void onMouseClicked();
|
||||
|
||||
public void setPosition(final int xPos, final int yPos) {
|
||||
this.xPosition = xPos;
|
||||
this.yPosition = yPos;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
package thaumicenergistics.client.gui.widget;
|
||||
|
||||
import java.util.List;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.render.AppEngRenderItem;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -20,150 +20,139 @@ import thaumicenergistics.api.gui.IWidgetHost;
|
||||
* TODO: Deprecated Remove in favor of MESlots
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class WidgetAEItem
|
||||
extends ThEWidget
|
||||
{
|
||||
/**
|
||||
* Cache of the minecraft instance
|
||||
*/
|
||||
private static final Minecraft MC = Minecraft.getMinecraft();
|
||||
public class WidgetAEItem extends ThEWidget {
|
||||
/**
|
||||
* Cache of the minecraft instance
|
||||
*/
|
||||
private static final Minecraft MC = Minecraft.getMinecraft();
|
||||
|
||||
/**
|
||||
* Cache of the minecraft texture manager
|
||||
*/
|
||||
private static final TextureManager TEXTURE_MANAGER = Minecraft.getMinecraft().getTextureManager();
|
||||
/**
|
||||
* Cache of the minecraft texture manager
|
||||
*/
|
||||
private static final TextureManager TEXTURE_MANAGER =
|
||||
Minecraft.getMinecraft().getTextureManager();
|
||||
|
||||
/**
|
||||
* Cache of the AE item renderer
|
||||
*/
|
||||
private final AppEngRenderItem aeItemRenderer;
|
||||
/**
|
||||
* Cache of the AE item renderer
|
||||
*/
|
||||
private final AppEngRenderItem aeItemRenderer;
|
||||
|
||||
/**
|
||||
* The itemstack this widget represents
|
||||
*/
|
||||
private IAEItemStack aeItemStack;
|
||||
/**
|
||||
* The itemstack this widget represents
|
||||
*/
|
||||
private IAEItemStack aeItemStack;
|
||||
|
||||
/**
|
||||
* Creates the widget
|
||||
*
|
||||
* @param hostGUI
|
||||
* @param xPos
|
||||
* @param yPos
|
||||
* @param aeItemRenderer
|
||||
*/
|
||||
public WidgetAEItem( final IWidgetHost hostGUI, final int xPos, final int yPos, final AppEngRenderItem aeItemRenderer )
|
||||
{
|
||||
super( hostGUI, xPos, yPos );
|
||||
/**
|
||||
* Creates the widget
|
||||
*
|
||||
* @param hostGUI
|
||||
* @param xPos
|
||||
* @param yPos
|
||||
* @param aeItemRenderer
|
||||
*/
|
||||
public WidgetAEItem(
|
||||
final IWidgetHost hostGUI, final int xPos, final int yPos, final AppEngRenderItem aeItemRenderer) {
|
||||
super(hostGUI, xPos, yPos);
|
||||
|
||||
this.aeItemRenderer = aeItemRenderer;
|
||||
}
|
||||
this.aeItemRenderer = aeItemRenderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the itemstack if there is one.
|
||||
*/
|
||||
@Override
|
||||
public void drawWidget()
|
||||
{
|
||||
try
|
||||
{
|
||||
if( this.aeItemStack != null )
|
||||
{
|
||||
// Set the z level
|
||||
this.zLevel = 2.0F;
|
||||
this.aeItemRenderer.zLevel = 2.0F;
|
||||
/**
|
||||
* Draws the itemstack if there is one.
|
||||
*/
|
||||
@Override
|
||||
public void drawWidget() {
|
||||
try {
|
||||
if (this.aeItemStack != null) {
|
||||
// Set the z level
|
||||
this.zLevel = 2.0F;
|
||||
this.aeItemRenderer.zLevel = 2.0F;
|
||||
|
||||
// Set the item
|
||||
this.aeItemRenderer.setAeStack( this.aeItemStack );
|
||||
// Set the item
|
||||
this.aeItemRenderer.setAeStack(this.aeItemStack);
|
||||
|
||||
// Draw the item
|
||||
this.aeItemRenderer.renderItemAndEffectIntoGUI( WidgetAEItem.MC.fontRenderer, WidgetAEItem.TEXTURE_MANAGER,
|
||||
this.aeItemStack.getItemStack(), this.xPosition + 1, this.yPosition + 1 );
|
||||
// Draw the item
|
||||
this.aeItemRenderer.renderItemAndEffectIntoGUI(
|
||||
WidgetAEItem.MC.fontRenderer,
|
||||
WidgetAEItem.TEXTURE_MANAGER,
|
||||
this.aeItemStack.getItemStack(),
|
||||
this.xPosition + 1,
|
||||
this.yPosition + 1);
|
||||
|
||||
// Draw the amount
|
||||
this.aeItemRenderer.renderItemOverlayIntoGUI( WidgetAEItem.MC.fontRenderer, WidgetAEItem.TEXTURE_MANAGER,
|
||||
this.aeItemStack.getItemStack(), this.xPosition + 1, this.yPosition + 1 );
|
||||
// Draw the amount
|
||||
this.aeItemRenderer.renderItemOverlayIntoGUI(
|
||||
WidgetAEItem.MC.fontRenderer,
|
||||
WidgetAEItem.TEXTURE_MANAGER,
|
||||
this.aeItemStack.getItemStack(),
|
||||
this.xPosition + 1,
|
||||
this.yPosition + 1);
|
||||
|
||||
// Reset the z level
|
||||
this.zLevel = 0.0F;
|
||||
this.aeItemRenderer.zLevel = 0.0F;
|
||||
}
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
// Silently ignore.
|
||||
}
|
||||
// Reset the z level
|
||||
this.zLevel = 0.0F;
|
||||
this.aeItemRenderer.zLevel = 0.0F;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// Silently ignore.
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Returns the itemstack this widget represents.
|
||||
*
|
||||
* @return IAEItemstack if the widget has one, null otherwise.
|
||||
*/
|
||||
public IAEItemStack getItemStack() {
|
||||
return this.aeItemStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the itemstack this widget represents.
|
||||
*
|
||||
* @return IAEItemstack if the widget has one, null otherwise.
|
||||
*/
|
||||
public IAEItemStack getItemStack()
|
||||
{
|
||||
return this.aeItemStack;
|
||||
}
|
||||
@Override
|
||||
public void getTooltip(final List<String> tooltip) {
|
||||
if (this.aeItemStack != null) {
|
||||
// Get the stack
|
||||
ItemStack stack = this.aeItemStack.getItemStack();
|
||||
|
||||
@Override
|
||||
public void getTooltip( final List<String> tooltip )
|
||||
{
|
||||
if( this.aeItemStack != null )
|
||||
{
|
||||
// Get the stack
|
||||
ItemStack stack = this.aeItemStack.getItemStack();
|
||||
// Get the tooltip list
|
||||
try {
|
||||
List<String> stackTooltip =
|
||||
stack.getTooltip(WidgetAEItem.MC.thePlayer, WidgetAEItem.MC.gameSettings.advancedItemTooltips);
|
||||
|
||||
// Get the tooltip list
|
||||
try
|
||||
{
|
||||
List<String> stackTooltip = stack.getTooltip( WidgetAEItem.MC.thePlayer, WidgetAEItem.MC.gameSettings.advancedItemTooltips );
|
||||
// Set colors and add
|
||||
for (int index = 0; index < stackTooltip.size(); index++) {
|
||||
if (index == 0) {
|
||||
// Item name based on rarity
|
||||
stackTooltip.set(index, stack.getRarity().rarityColor + stackTooltip.get(index));
|
||||
} else {
|
||||
// The rest grey
|
||||
stackTooltip.set(index, EnumChatFormatting.GRAY + stackTooltip.get(index));
|
||||
}
|
||||
|
||||
// Set colors and add
|
||||
for( int index = 0; index < stackTooltip.size(); index++ )
|
||||
{
|
||||
if( index == 0 )
|
||||
{
|
||||
// Item name based on rarity
|
||||
stackTooltip.set( index, stack.getRarity().rarityColor + stackTooltip.get( index ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// The rest grey
|
||||
stackTooltip.set( index, EnumChatFormatting.GRAY + stackTooltip.get( index ) );
|
||||
}
|
||||
// Add the item tooltip line
|
||||
tooltip.add(stackTooltip.get(index));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
tooltip.add(EnumChatFormatting.ITALIC + "<Unable to get item tooltip>");
|
||||
}
|
||||
|
||||
// Add the item tooltip line
|
||||
tooltip.add( stackTooltip.get( index ) );
|
||||
}
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
tooltip.add( EnumChatFormatting.ITALIC + "<Unable to get item tooltip>" );
|
||||
}
|
||||
// Get the mod name
|
||||
String modName = ((AEItemStack) this.aeItemStack).getModID();
|
||||
modName = modName.substring(0, 1).toUpperCase() + modName.substring(1);
|
||||
|
||||
// Get the mod name
|
||||
String modName = ( (AEItemStack)this.aeItemStack ).getModID();
|
||||
modName = modName.substring( 0, 1 ).toUpperCase() + modName.substring( 1 );
|
||||
// Add the mod name
|
||||
tooltip.add(EnumChatFormatting.BLUE + "" + EnumChatFormatting.ITALIC + modName);
|
||||
}
|
||||
}
|
||||
|
||||
// Add the mod name
|
||||
tooltip.add( EnumChatFormatting.BLUE + "" + EnumChatFormatting.ITALIC + modName );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClicked()
|
||||
{
|
||||
// Unused
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the itemstack this widget represents
|
||||
*
|
||||
* @param itemStack
|
||||
*/
|
||||
public void setItemStack( final IAEItemStack itemStack )
|
||||
{
|
||||
this.aeItemStack = itemStack;
|
||||
}
|
||||
@Override
|
||||
public void onMouseClicked() {
|
||||
// Unused
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the itemstack this widget represents
|
||||
*
|
||||
* @param itemStack
|
||||
*/
|
||||
public void setItemStack(final IAEItemStack itemStack) {
|
||||
this.aeItemStack = itemStack;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package thaumicenergistics.client.gui.widget;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.util.ReadableNumberConverter;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -8,6 +7,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumicenergistics.api.gui.IAspectSelectorGui;
|
||||
import thaumicenergistics.api.storage.IAspectStack;
|
||||
@@ -21,302 +21,284 @@ import thaumicenergistics.common.utils.ThEUtils;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class WidgetAspectSelector
|
||||
extends AspectWidgetBase
|
||||
{
|
||||
/**
|
||||
* Thickness of the selector outline.
|
||||
*/
|
||||
private static final int borderThickness = 1;
|
||||
public class WidgetAspectSelector extends AspectWidgetBase {
|
||||
/**
|
||||
* Thickness of the selector outline.
|
||||
*/
|
||||
private static final int borderThickness = 1;
|
||||
|
||||
/**
|
||||
* The number of iterations in the gradient
|
||||
*/
|
||||
private static final int GRADIENT_COUNT = 15;
|
||||
/**
|
||||
* The number of iterations in the gradient
|
||||
*/
|
||||
private static final int GRADIENT_COUNT = 15;
|
||||
|
||||
/**
|
||||
* Color of the border while aspect is selected
|
||||
*/
|
||||
private static final int selectorBorderColor = 0xFF00FFFF;
|
||||
/**
|
||||
* Color of the border while aspect is selected
|
||||
*/
|
||||
private static final int selectorBorderColor = 0xFF00FFFF;
|
||||
|
||||
/**
|
||||
* Array of colors that pulse behind the aspect
|
||||
*/
|
||||
private int[] backgroundPulseGradient;
|
||||
/**
|
||||
* Array of colors that pulse behind the aspect
|
||||
*/
|
||||
private int[] backgroundPulseGradient;
|
||||
|
||||
/**
|
||||
* If true the amount will not be drawn, also if the stack is craftable
|
||||
* it will show the crafting text.
|
||||
*/
|
||||
protected boolean hideAmount = false;
|
||||
/**
|
||||
* If true the amount will not be drawn, also if the stack is craftable
|
||||
* it will show the crafting text.
|
||||
*/
|
||||
protected boolean hideAmount = false;
|
||||
|
||||
public WidgetAspectSelector( final IAspectSelectorGui selectorGui, final IAspectStack stack, final int xPos, final int yPos,
|
||||
final EntityPlayer player )
|
||||
{
|
||||
// Call super
|
||||
super( selectorGui, stack, xPos, yPos, player );
|
||||
}
|
||||
public WidgetAspectSelector(
|
||||
final IAspectSelectorGui selectorGui,
|
||||
final IAspectStack stack,
|
||||
final int xPos,
|
||||
final int yPos,
|
||||
final EntityPlayer player) {
|
||||
// Call super
|
||||
super(selectorGui, stack, xPos, yPos, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the selector outline.
|
||||
*
|
||||
* @param posX
|
||||
* @param posY
|
||||
* @param width
|
||||
* @param height
|
||||
* @param color
|
||||
* @param thickness
|
||||
*/
|
||||
private void drawHollowRectWithCorners( final int posX, final int posY, final int width, final int height, final int color, final int thickness )
|
||||
{
|
||||
// Calculate points
|
||||
/**
|
||||
* Draws the selector outline.
|
||||
*
|
||||
* @param posX
|
||||
* @param posY
|
||||
* @param width
|
||||
* @param height
|
||||
* @param color
|
||||
* @param thickness
|
||||
*/
|
||||
private void drawHollowRectWithCorners(
|
||||
final int posX, final int posY, final int width, final int height, final int color, final int thickness) {
|
||||
// Calculate points
|
||||
|
||||
// Ending X point of the right line
|
||||
int rightXEnd = posX + width;
|
||||
// Ending X point of the right line
|
||||
int rightXEnd = posX + width;
|
||||
|
||||
// Beginning X point of the right line
|
||||
int rightXBegin = rightXEnd - thickness;
|
||||
// Beginning X point of the right line
|
||||
int rightXBegin = rightXEnd - thickness;
|
||||
|
||||
// Ending X point of the left line
|
||||
int leftXEnd = posX + thickness;
|
||||
// Ending X point of the left line
|
||||
int leftXEnd = posX + thickness;
|
||||
|
||||
// Ending Y point of the top line
|
||||
int topYEnd = posY + thickness;
|
||||
// Ending Y point of the top line
|
||||
int topYEnd = posY + thickness;
|
||||
|
||||
// Ending Y point of the bottom line
|
||||
int bottomYEnd = posY + height;
|
||||
// Ending Y point of the bottom line
|
||||
int bottomYEnd = posY + height;
|
||||
|
||||
// Beginning Y point of the bottom line
|
||||
int bottomYBegin = bottomYEnd - thickness;
|
||||
// Beginning Y point of the bottom line
|
||||
int bottomYBegin = bottomYEnd - thickness;
|
||||
|
||||
// Draw background gradient
|
||||
Gui.drawRect( posX, posY, rightXEnd, bottomYEnd, color );
|
||||
// Draw background gradient
|
||||
Gui.drawRect(posX, posY, rightXEnd, bottomYEnd, color);
|
||||
|
||||
// Draw notches
|
||||
// Draw notches
|
||||
|
||||
// Top-left notch
|
||||
Gui.drawRect( posX, posY, leftXEnd + 1, topYEnd + 1, selectorBorderColor );
|
||||
// Top-left notch
|
||||
Gui.drawRect(posX, posY, leftXEnd + 1, topYEnd + 1, selectorBorderColor);
|
||||
|
||||
// Top-right notch
|
||||
Gui.drawRect( rightXEnd, posY, rightXBegin - 1, topYEnd + 1, selectorBorderColor );
|
||||
// Top-right notch
|
||||
Gui.drawRect(rightXEnd, posY, rightXBegin - 1, topYEnd + 1, selectorBorderColor);
|
||||
|
||||
// Bottom-right notch
|
||||
Gui.drawRect( rightXEnd, bottomYEnd, rightXBegin - 1, bottomYBegin - 1, selectorBorderColor );
|
||||
// Bottom-right notch
|
||||
Gui.drawRect(rightXEnd, bottomYEnd, rightXBegin - 1, bottomYBegin - 1, selectorBorderColor);
|
||||
|
||||
// Bottom-left notch
|
||||
Gui.drawRect( posX, bottomYEnd, leftXEnd + 1, bottomYBegin - 1, selectorBorderColor );
|
||||
// Bottom-left notch
|
||||
Gui.drawRect(posX, bottomYEnd, leftXEnd + 1, bottomYBegin - 1, selectorBorderColor);
|
||||
|
||||
// Draw lines
|
||||
// Draw lines
|
||||
|
||||
// Top side
|
||||
Gui.drawRect( posX, posY, rightXEnd, topYEnd, selectorBorderColor );
|
||||
// Top side
|
||||
Gui.drawRect(posX, posY, rightXEnd, topYEnd, selectorBorderColor);
|
||||
|
||||
// Bottom side
|
||||
Gui.drawRect( posX, bottomYBegin, rightXEnd, bottomYEnd, selectorBorderColor );
|
||||
// Bottom side
|
||||
Gui.drawRect(posX, bottomYBegin, rightXEnd, bottomYEnd, selectorBorderColor);
|
||||
|
||||
// Left side
|
||||
Gui.drawRect( posX, posY, leftXEnd, bottomYEnd, selectorBorderColor );
|
||||
// Left side
|
||||
Gui.drawRect(posX, posY, leftXEnd, bottomYEnd, selectorBorderColor);
|
||||
|
||||
// Right side
|
||||
Gui.drawRect( rightXBegin, posY, rightXEnd, bottomYEnd, selectorBorderColor );
|
||||
}
|
||||
// Right side
|
||||
Gui.drawRect(rightXBegin, posY, rightXEnd, bottomYEnd, selectorBorderColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the background gradient color based on the current time.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private int getBackgroundColor()
|
||||
{
|
||||
// Get the current time, slowed down.
|
||||
int time = (int)( System.currentTimeMillis() / 45L );
|
||||
/**
|
||||
* Gets the background gradient color based on the current time.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private int getBackgroundColor() {
|
||||
// Get the current time, slowed down.
|
||||
int time = (int) (System.currentTimeMillis() / 45L);
|
||||
|
||||
// Lerp the index
|
||||
int index = Math.abs( Math.abs( time % ( GRADIENT_COUNT * 2 ) ) - GRADIENT_COUNT );
|
||||
// Lerp the index
|
||||
int index = Math.abs(Math.abs(time % (GRADIENT_COUNT * 2)) - GRADIENT_COUNT);
|
||||
|
||||
// Return the index
|
||||
return this.backgroundPulseGradient[index];
|
||||
}
|
||||
// Return the index
|
||||
return this.backgroundPulseGradient[index];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStackChanged()
|
||||
{
|
||||
// Call super
|
||||
super.onStackChanged();
|
||||
@Override
|
||||
protected void onStackChanged() {
|
||||
// Call super
|
||||
super.onStackChanged();
|
||||
|
||||
if( !this.hasAspect() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!this.hasAspect()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the aspect color
|
||||
int aspectColor = this.getStack().getAspect().getColor();
|
||||
// Get the aspect color
|
||||
int aspectColor = this.getStack().getAspect().getColor();
|
||||
|
||||
// Create the gradient using the aspect color, varying between opacities
|
||||
this.backgroundPulseGradient = ThEGuiHelper.INSTANCE
|
||||
.createColorGradient( 0x70000000 | aspectColor, 0x20000000 | aspectColor, GRADIENT_COUNT + 1 );
|
||||
}
|
||||
// Create the gradient using the aspect color, varying between opacities
|
||||
this.backgroundPulseGradient = ThEGuiHelper.INSTANCE.createColorGradient(
|
||||
0x70000000 | aspectColor, 0x20000000 | aspectColor, GRADIENT_COUNT + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the aspect icon and selector border if it is selected.
|
||||
*/
|
||||
@Override
|
||||
public void drawWidget()
|
||||
{
|
||||
// Is the widget empty?
|
||||
if( !this.hasAspect() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Disable lighting
|
||||
GL11.glDisable( GL11.GL_LIGHTING );
|
||||
/**
|
||||
* Draws the aspect icon and selector border if it is selected.
|
||||
*/
|
||||
@Override
|
||||
public void drawWidget() {
|
||||
// Is the widget empty?
|
||||
if (!this.hasAspect()) {
|
||||
return;
|
||||
}
|
||||
// Disable lighting
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
// Enable blending
|
||||
GL11.glEnable( GL11.GL_BLEND );
|
||||
// Enable blending
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
// Set the blending mode to blend alpha
|
||||
GL11.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );
|
||||
// Set the blending mode to blend alpha
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
// No tint
|
||||
GL11.glColor3f( 1.0F, 1.0F, 1.0F );
|
||||
// No tint
|
||||
GL11.glColor3f(1.0F, 1.0F, 1.0F);
|
||||
|
||||
// Get the selected aspect
|
||||
Aspect selectedAspect = ( (IAspectSelectorGui)this.hostGUI ).getSelectedAspect();
|
||||
// Get the selected aspect
|
||||
Aspect selectedAspect = ((IAspectSelectorGui) this.hostGUI).getSelectedAspect();
|
||||
|
||||
// Does the selected aspect match the widgets?
|
||||
if( selectedAspect == this.getAspect() )
|
||||
{
|
||||
// Draw the selection box
|
||||
this.drawHollowRectWithCorners( this.xPosition, this.yPosition,
|
||||
ThEWidget.WIDGET_SIZE, ThEWidget.WIDGET_SIZE,
|
||||
this.getBackgroundColor(), WidgetAspectSelector.borderThickness );
|
||||
}
|
||||
// Does the selected aspect match the widgets?
|
||||
if (selectedAspect == this.getAspect()) {
|
||||
// Draw the selection box
|
||||
this.drawHollowRectWithCorners(
|
||||
this.xPosition,
|
||||
this.yPosition,
|
||||
ThEWidget.WIDGET_SIZE,
|
||||
ThEWidget.WIDGET_SIZE,
|
||||
this.getBackgroundColor(),
|
||||
WidgetAspectSelector.borderThickness);
|
||||
}
|
||||
|
||||
// Draw the aspect
|
||||
this.drawAspect();
|
||||
// Draw the aspect
|
||||
this.drawAspect();
|
||||
|
||||
// Get the amount and crafting
|
||||
long stackSize = this.getAmount();
|
||||
// Get the amount and crafting
|
||||
long stackSize = this.getAmount();
|
||||
|
||||
// Is there anything to draw?
|
||||
if( ( ( stackSize > 0 ) && !this.hideAmount ) || this.getCraftable() )
|
||||
{
|
||||
// Text to draw
|
||||
String text;
|
||||
// Is there anything to draw?
|
||||
if (((stackSize > 0) && !this.hideAmount) || this.getCraftable()) {
|
||||
// Text to draw
|
||||
String text;
|
||||
|
||||
// Get the font renderer
|
||||
final FontRenderer fontRenderer = this.hostGUI.getFontRenderer();
|
||||
// Get the font renderer
|
||||
final FontRenderer fontRenderer = this.hostGUI.getFontRenderer();
|
||||
|
||||
// Disable unicode if enabled
|
||||
final boolean unicodeFlag = fontRenderer.getUnicodeFlag();
|
||||
fontRenderer.setUnicodeFlag( false );
|
||||
// Disable unicode if enabled
|
||||
final boolean unicodeFlag = fontRenderer.getUnicodeFlag();
|
||||
fontRenderer.setUnicodeFlag(false);
|
||||
|
||||
// Is the terminal using a large font?
|
||||
boolean largeFont = AEConfig.instance.useTerminalUseLargeFont();
|
||||
// Is the terminal using a large font?
|
||||
boolean largeFont = AEConfig.instance.useTerminalUseLargeFont();
|
||||
|
||||
// Set the scale
|
||||
float scale = largeFont ? 0.85f : 0.5f;
|
||||
// Set the scale
|
||||
float scale = largeFont ? 0.85f : 0.5f;
|
||||
|
||||
// Set the position offset
|
||||
float positionOffset = largeFont ? 0 : -1.0f;
|
||||
// Set the position offset
|
||||
float positionOffset = largeFont ? 0 : -1.0f;
|
||||
|
||||
// Calculate position
|
||||
float posX = this.xPosition + positionOffset + ThEWidget.WIDGET_SIZE;
|
||||
float posY = ( this.yPosition + positionOffset + ThEWidget.WIDGET_SIZE ) - 1;
|
||||
// Calculate position
|
||||
float posX = this.xPosition + positionOffset + ThEWidget.WIDGET_SIZE;
|
||||
float posY = (this.yPosition + positionOffset + ThEWidget.WIDGET_SIZE) - 1;
|
||||
|
||||
// Has amount to draw?
|
||||
if( ( ( stackSize > 0 ) && !this.hideAmount ) )
|
||||
{
|
||||
if( largeFont )
|
||||
{
|
||||
text = ReadableNumberConverter.INSTANCE.toWideReadableForm( stackSize );
|
||||
}
|
||||
else
|
||||
{
|
||||
text = ReadableNumberConverter.INSTANCE.toSlimReadableForm( stackSize );
|
||||
}
|
||||
}
|
||||
// Crafting
|
||||
else
|
||||
{
|
||||
// Get the "craftable" text from AE2
|
||||
if( largeFont )
|
||||
{
|
||||
text = appeng.core.localization.GuiText.LargeFontCraft.getLocal();
|
||||
}
|
||||
else
|
||||
{
|
||||
text = appeng.core.localization.GuiText.SmallFontCraft.getLocal();
|
||||
}
|
||||
}
|
||||
// Has amount to draw?
|
||||
if (((stackSize > 0) && !this.hideAmount)) {
|
||||
if (largeFont) {
|
||||
text = ReadableNumberConverter.INSTANCE.toWideReadableForm(stackSize);
|
||||
} else {
|
||||
text = ReadableNumberConverter.INSTANCE.toSlimReadableForm(stackSize);
|
||||
}
|
||||
}
|
||||
// Crafting
|
||||
else {
|
||||
// Get the "craftable" text from AE2
|
||||
if (largeFont) {
|
||||
text = appeng.core.localization.GuiText.LargeFontCraft.getLocal();
|
||||
} else {
|
||||
text = appeng.core.localization.GuiText.SmallFontCraft.getLocal();
|
||||
}
|
||||
}
|
||||
|
||||
// Draw it
|
||||
ThEGuiHelper.drawScaledText( fontRenderer, text, scale, posX, posY );
|
||||
// Draw it
|
||||
ThEGuiHelper.drawScaledText(fontRenderer, text, scale, posX, posY);
|
||||
|
||||
// Reset unicode status
|
||||
fontRenderer.setUnicodeFlag( unicodeFlag );
|
||||
}
|
||||
// Reset unicode status
|
||||
fontRenderer.setUnicodeFlag(unicodeFlag);
|
||||
}
|
||||
|
||||
// Enable lighting
|
||||
GL11.glEnable( GL11.GL_LIGHTING );
|
||||
// Enable lighting
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
// Disable blending
|
||||
GL11.glDisable( GL11.GL_BLEND );
|
||||
}
|
||||
// Disable blending
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the widget is clicked.
|
||||
*/
|
||||
@Override
|
||||
public void onMouseClicked()
|
||||
{
|
||||
// Get this aspect
|
||||
Aspect widgetAspect = this.getAspect();
|
||||
/**
|
||||
* Called when the widget is clicked.
|
||||
*/
|
||||
@Override
|
||||
public void onMouseClicked() {
|
||||
// Get this aspect
|
||||
Aspect widgetAspect = this.getAspect();
|
||||
|
||||
// Get the selected aspect
|
||||
Aspect selectedAspect = ( (IAspectSelectorGui)this.hostGUI ).getSelectedAspect();
|
||||
// Get the selected aspect
|
||||
Aspect selectedAspect = ((IAspectSelectorGui) this.hostGUI).getSelectedAspect();
|
||||
|
||||
// Did the selected aspect change?
|
||||
boolean changed = false;
|
||||
// Did the selected aspect change?
|
||||
boolean changed = false;
|
||||
|
||||
// Are both aspects the same?
|
||||
if( widgetAspect == selectedAspect )
|
||||
{
|
||||
// Is something selected?
|
||||
if( selectedAspect != null )
|
||||
{
|
||||
// Unselect
|
||||
selectedAspect = null;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set to the widget aspect
|
||||
selectedAspect = widgetAspect;
|
||||
changed = true;
|
||||
}
|
||||
// Are both aspects the same?
|
||||
if (widgetAspect == selectedAspect) {
|
||||
// Is something selected?
|
||||
if (selectedAspect != null) {
|
||||
// Unselect
|
||||
selectedAspect = null;
|
||||
changed = true;
|
||||
}
|
||||
} else {
|
||||
// Set to the widget aspect
|
||||
selectedAspect = widgetAspect;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
// Was the selected aspect changed?
|
||||
if( changed )
|
||||
{
|
||||
// Play clicky sound
|
||||
ThEUtils.playClientSound( null, "gui.button.press" );
|
||||
// Was the selected aspect changed?
|
||||
if (changed) {
|
||||
// Play clicky sound
|
||||
ThEUtils.playClientSound(null, "gui.button.press");
|
||||
|
||||
// Set the selected aspect
|
||||
( (IAspectSelectorGui)this.hostGUI ).getContainer().setSelectedAspect( selectedAspect );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether or not to show the amount.
|
||||
*
|
||||
* @param hide
|
||||
* @return
|
||||
*/
|
||||
public void setHideAmount( final boolean hide )
|
||||
{
|
||||
this.hideAmount = hide;
|
||||
}
|
||||
// Set the selected aspect
|
||||
((IAspectSelectorGui) this.hostGUI).getContainer().setSelectedAspect(selectedAspect);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether or not to show the amount.
|
||||
*
|
||||
* @param hide
|
||||
* @return
|
||||
*/
|
||||
public void setHideAmount(final boolean hide) {
|
||||
this.hideAmount = hide;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package thaumicenergistics.client.gui.widget;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumicenergistics.api.gui.IWidgetHost;
|
||||
import thaumicenergistics.client.textures.GuiTextureManager;
|
||||
@@ -18,99 +18,103 @@ import thaumicenergistics.common.network.packet.server.Packet_S_AspectSlot;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class WidgetAspectSlot
|
||||
extends AspectWidgetBase
|
||||
{
|
||||
public static interface IConfigurable
|
||||
{
|
||||
public byte getConfigState();
|
||||
}
|
||||
public class WidgetAspectSlot extends AspectWidgetBase {
|
||||
public static interface IConfigurable {
|
||||
public byte getConfigState();
|
||||
}
|
||||
|
||||
private int id;
|
||||
private IAspectSlotPart part;
|
||||
private EntityPlayer player;
|
||||
private IConfigurable configurable;
|
||||
private int id;
|
||||
private IAspectSlotPart part;
|
||||
private EntityPlayer player;
|
||||
private IConfigurable configurable;
|
||||
|
||||
private byte configOption;
|
||||
private byte configOption;
|
||||
|
||||
public WidgetAspectSlot( final IWidgetHost hostGui, final EntityPlayer player, final IAspectSlotPart part, final int posX, final int posY )
|
||||
{
|
||||
this( hostGui, player, part, 0, posX, posY, null, (byte)0 );
|
||||
}
|
||||
public WidgetAspectSlot(
|
||||
final IWidgetHost hostGui,
|
||||
final EntityPlayer player,
|
||||
final IAspectSlotPart part,
|
||||
final int posX,
|
||||
final int posY) {
|
||||
this(hostGui, player, part, 0, posX, posY, null, (byte) 0);
|
||||
}
|
||||
|
||||
public WidgetAspectSlot( final IWidgetHost hostGui, final EntityPlayer player, final IAspectSlotPart part, final int id, final int posX,
|
||||
final int posY )
|
||||
{
|
||||
this( hostGui, player, part, id, posX, posY, null, (byte)0 );
|
||||
}
|
||||
public WidgetAspectSlot(
|
||||
final IWidgetHost hostGui,
|
||||
final EntityPlayer player,
|
||||
final IAspectSlotPart part,
|
||||
final int id,
|
||||
final int posX,
|
||||
final int posY) {
|
||||
this(hostGui, player, part, id, posX, posY, null, (byte) 0);
|
||||
}
|
||||
|
||||
public WidgetAspectSlot( final IWidgetHost hostGui, final EntityPlayer player, final IAspectSlotPart part, final int id, final int posX,
|
||||
final int posY, final IConfigurable configurable, final byte configOption )
|
||||
{
|
||||
super( hostGui, null, posX, posY, player );
|
||||
this.player = player;
|
||||
this.part = part;
|
||||
this.id = id;
|
||||
this.configurable = configurable;
|
||||
this.configOption = configOption;
|
||||
}
|
||||
public WidgetAspectSlot(
|
||||
final IWidgetHost hostGui,
|
||||
final EntityPlayer player,
|
||||
final IAspectSlotPart part,
|
||||
final int id,
|
||||
final int posX,
|
||||
final int posY,
|
||||
final IConfigurable configurable,
|
||||
final byte configOption) {
|
||||
super(hostGui, null, posX, posY, player);
|
||||
this.player = player;
|
||||
this.part = part;
|
||||
this.id = id;
|
||||
this.configurable = configurable;
|
||||
this.configOption = configOption;
|
||||
}
|
||||
|
||||
public boolean canRender()
|
||||
{
|
||||
return ( this.configurable == null ) || ( this.configurable.getConfigState() >= this.configOption );
|
||||
}
|
||||
public boolean canRender() {
|
||||
return (this.configurable == null) || (this.configurable.getConfigState() >= this.configOption);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawWidget()
|
||||
{
|
||||
// Is this slot open?
|
||||
if( this.canRender() )
|
||||
{
|
||||
// Disable lighting
|
||||
GL11.glDisable( GL11.GL_LIGHTING );
|
||||
@Override
|
||||
public void drawWidget() {
|
||||
// Is this slot open?
|
||||
if (this.canRender()) {
|
||||
// Disable lighting
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
// Enable blending
|
||||
GL11.glEnable( GL11.GL_BLEND );
|
||||
// Enable blending
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
// Set the blend mode
|
||||
GL11.glBlendFunc( 770, 771 );
|
||||
// Set the blend mode
|
||||
GL11.glBlendFunc(770, 771);
|
||||
|
||||
// Full white
|
||||
GL11.glColor3f( 1.0F, 1.0F, 1.0F );
|
||||
// Full white
|
||||
GL11.glColor3f(1.0F, 1.0F, 1.0F);
|
||||
|
||||
// Bind to the gui texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture( GuiTextureManager.ESSENTIA_IO_BUS.getTexture() );
|
||||
// Bind to the gui texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(GuiTextureManager.ESSENTIA_IO_BUS.getTexture());
|
||||
|
||||
// Draw this slot just like the center slot of the gui
|
||||
this.drawTexturedModalRect( this.xPosition, this.yPosition, 79, 39, ThEWidget.WIDGET_SIZE, ThEWidget.WIDGET_SIZE );
|
||||
// Draw this slot just like the center slot of the gui
|
||||
this.drawTexturedModalRect(
|
||||
this.xPosition, this.yPosition, 79, 39, ThEWidget.WIDGET_SIZE, ThEWidget.WIDGET_SIZE);
|
||||
|
||||
// Do we have an aspect?
|
||||
if( this.getAspect() != null )
|
||||
{
|
||||
// Draw the aspect
|
||||
this.drawAspect();
|
||||
}
|
||||
// Do we have an aspect?
|
||||
if (this.getAspect() != null) {
|
||||
// Draw the aspect
|
||||
this.drawAspect();
|
||||
}
|
||||
|
||||
// Re-enable lighting
|
||||
GL11.glEnable( GL11.GL_LIGHTING );
|
||||
// Re-enable lighting
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
// Re-disable blending
|
||||
GL11.glDisable( GL11.GL_BLEND );
|
||||
// Re-disable blending
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public void mouseClicked(final Aspect withAspect) {
|
||||
this.setAspect(withAspect, 1, false);
|
||||
|
||||
}
|
||||
Packet_S_AspectSlot.sendAspectChange(this.part, this.id, this.getAspect(), this.player);
|
||||
}
|
||||
|
||||
public void mouseClicked( final Aspect withAspect )
|
||||
{
|
||||
this.setAspect( withAspect, 1, false );
|
||||
|
||||
Packet_S_AspectSlot.sendAspectChange( this.part, this.id, this.getAspect(), this.player );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClicked()
|
||||
{
|
||||
// Ignored
|
||||
}
|
||||
@Override
|
||||
public void onMouseClicked() {
|
||||
// Ignored
|
||||
}
|
||||
}
|
||||
@@ -13,19 +13,14 @@ import thaumicenergistics.common.tiles.TileEssentiaProvider;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderBlockEssentiaProvider
|
||||
extends RenderBlockProviderBase
|
||||
{
|
||||
public RenderBlockEssentiaProvider()
|
||||
{
|
||||
super( BlockTextureManager.ESSENTIA_PROVIDER );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId()
|
||||
{
|
||||
// Return the ID of the essentia provider
|
||||
return Renderers.EssentiaProviderRenderID;
|
||||
}
|
||||
public class RenderBlockEssentiaProvider extends RenderBlockProviderBase {
|
||||
public RenderBlockEssentiaProvider() {
|
||||
super(BlockTextureManager.ESSENTIA_PROVIDER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
// Return the ID of the essentia provider
|
||||
return Renderers.EssentiaProviderRenderID;
|
||||
}
|
||||
}
|
||||
@@ -13,19 +13,14 @@ import thaumicenergistics.common.tiles.TileInfusionProvider;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderBlockInfusionProvider
|
||||
extends RenderBlockProviderBase
|
||||
{
|
||||
public class RenderBlockInfusionProvider extends RenderBlockProviderBase {
|
||||
|
||||
public RenderBlockInfusionProvider()
|
||||
{
|
||||
super( BlockTextureManager.INFUSION_PROVIDER );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId()
|
||||
{
|
||||
return Renderers.InfusionProviderRenderID;
|
||||
}
|
||||
public RenderBlockInfusionProvider() {
|
||||
super(BlockTextureManager.INFUSION_PROVIDER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return Renderers.InfusionProviderRenderID;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package thaumicenergistics.client.render;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -10,6 +9,7 @@ import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumicenergistics.client.textures.BlockTextureManager;
|
||||
import thaumicenergistics.common.registries.Renderers;
|
||||
import thaumicenergistics.common.tiles.abstraction.TileProviderBase;
|
||||
@@ -23,212 +23,211 @@ import thaumicenergistics.common.tiles.abstraction.TileProviderBase;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract class RenderBlockProviderBase
|
||||
implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public abstract class RenderBlockProviderBase implements ISimpleBlockRenderingHandler {
|
||||
|
||||
/**
|
||||
* Side/Face array cache.
|
||||
*/
|
||||
private static ForgeDirection[] FACES = ForgeDirection.VALID_DIRECTIONS;
|
||||
/**
|
||||
* Side/Face array cache.
|
||||
*/
|
||||
private static ForgeDirection[] FACES = ForgeDirection.VALID_DIRECTIONS;
|
||||
|
||||
/**
|
||||
* Textures
|
||||
*/
|
||||
private BlockTextureManager textureSource;
|
||||
/**
|
||||
* Textures
|
||||
*/
|
||||
private BlockTextureManager textureSource;
|
||||
|
||||
/**
|
||||
* Creates the renderer.
|
||||
*
|
||||
* @param baseTexture
|
||||
* @param overlayTexture
|
||||
*/
|
||||
public RenderBlockProviderBase( final BlockTextureManager sourceTextures )
|
||||
{
|
||||
this.textureSource = sourceTextures;
|
||||
}
|
||||
/**
|
||||
* Creates the renderer.
|
||||
*
|
||||
* @param baseTexture
|
||||
* @param overlayTexture
|
||||
*/
|
||||
public RenderBlockProviderBase(final BlockTextureManager sourceTextures) {
|
||||
this.textureSource = sourceTextures;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders all faces of the provider.
|
||||
*
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param texture
|
||||
* @param glowAmount
|
||||
*/
|
||||
private void renderFaces( final IBlockAccess world, final int x, final int y, final int z, final IIcon texture, final int glowAmount )
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
/**
|
||||
* Renders all faces of the provider.
|
||||
*
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param texture
|
||||
* @param glowAmount
|
||||
*/
|
||||
private void renderFaces(
|
||||
final IBlockAccess world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z,
|
||||
final IIcon texture,
|
||||
final int glowAmount) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
// Get the UV's
|
||||
double minU = texture.getMinU();
|
||||
double maxU = texture.getMaxU();
|
||||
double minV = texture.getMinV();
|
||||
double maxV = texture.getMaxV();
|
||||
// Get the UV's
|
||||
double minU = texture.getMinU();
|
||||
double maxU = texture.getMaxU();
|
||||
double minV = texture.getMinV();
|
||||
double maxV = texture.getMaxV();
|
||||
|
||||
// Vertex +1 offsets
|
||||
int x1 = x + 1, y1 = y + 1, z1 = z + 1;
|
||||
// Vertex +1 offsets
|
||||
int x1 = x + 1, y1 = y + 1, z1 = z + 1;
|
||||
|
||||
for( ForgeDirection face : FACES )
|
||||
{
|
||||
// Calculate the brightness
|
||||
tessellator.setBrightness( world.getLightBrightnessForSkyBlocks( x + face.offsetX, y + face.offsetY, z - face.offsetZ, glowAmount ) );
|
||||
for (ForgeDirection face : FACES) {
|
||||
// Calculate the brightness
|
||||
tessellator.setBrightness(world.getLightBrightnessForSkyBlocks(
|
||||
x + face.offsetX, y + face.offsetY, z - face.offsetZ, glowAmount));
|
||||
|
||||
switch ( face )
|
||||
{
|
||||
case DOWN:
|
||||
tessellator.addVertexWithUV( x, y, z, minU, maxV );
|
||||
tessellator.addVertexWithUV( x1, y, z, maxU, maxV );
|
||||
tessellator.addVertexWithUV( x1, y, z1, maxU, minV );
|
||||
tessellator.addVertexWithUV( x, y, z1, minU, minV );
|
||||
break;
|
||||
switch (face) {
|
||||
case DOWN:
|
||||
tessellator.addVertexWithUV(x, y, z, minU, maxV);
|
||||
tessellator.addVertexWithUV(x1, y, z, maxU, maxV);
|
||||
tessellator.addVertexWithUV(x1, y, z1, maxU, minV);
|
||||
tessellator.addVertexWithUV(x, y, z1, minU, minV);
|
||||
break;
|
||||
|
||||
case EAST:
|
||||
tessellator.addVertexWithUV( x1, y, z, maxU, maxV );
|
||||
tessellator.addVertexWithUV( x1, y1, z, maxU, minV );
|
||||
tessellator.addVertexWithUV( x1, y1, z1, minU, minV );
|
||||
tessellator.addVertexWithUV( x1, y, z1, minU, maxV );
|
||||
break;
|
||||
case EAST:
|
||||
tessellator.addVertexWithUV(x1, y, z, maxU, maxV);
|
||||
tessellator.addVertexWithUV(x1, y1, z, maxU, minV);
|
||||
tessellator.addVertexWithUV(x1, y1, z1, minU, minV);
|
||||
tessellator.addVertexWithUV(x1, y, z1, minU, maxV);
|
||||
break;
|
||||
|
||||
case NORTH:
|
||||
tessellator.addVertexWithUV( x, y, z1, minU, maxV );
|
||||
tessellator.addVertexWithUV( x1, y, z1, maxU, maxV );
|
||||
tessellator.addVertexWithUV( x1, y1, z1, maxU, minV );
|
||||
tessellator.addVertexWithUV( x, y1, z1, minU, minV );
|
||||
break;
|
||||
case NORTH:
|
||||
tessellator.addVertexWithUV(x, y, z1, minU, maxV);
|
||||
tessellator.addVertexWithUV(x1, y, z1, maxU, maxV);
|
||||
tessellator.addVertexWithUV(x1, y1, z1, maxU, minV);
|
||||
tessellator.addVertexWithUV(x, y1, z1, minU, minV);
|
||||
break;
|
||||
|
||||
case SOUTH:
|
||||
tessellator.addVertexWithUV( x, y1, z, maxU, minV );
|
||||
tessellator.addVertexWithUV( x1, y1, z, minU, minV );
|
||||
tessellator.addVertexWithUV( x1, y, z, minU, maxV );
|
||||
tessellator.addVertexWithUV( x, y, z, maxU, maxV );
|
||||
break;
|
||||
case SOUTH:
|
||||
tessellator.addVertexWithUV(x, y1, z, maxU, minV);
|
||||
tessellator.addVertexWithUV(x1, y1, z, minU, minV);
|
||||
tessellator.addVertexWithUV(x1, y, z, minU, maxV);
|
||||
tessellator.addVertexWithUV(x, y, z, maxU, maxV);
|
||||
break;
|
||||
|
||||
case UP:
|
||||
tessellator.addVertexWithUV( x, y1, z1, maxU, minV );
|
||||
tessellator.addVertexWithUV( x1, y1, z1, minU, minV );
|
||||
tessellator.addVertexWithUV( x1, y1, z, minU, maxV );
|
||||
tessellator.addVertexWithUV( x, y1, z, maxU, maxV );
|
||||
break;
|
||||
case UP:
|
||||
tessellator.addVertexWithUV(x, y1, z1, maxU, minV);
|
||||
tessellator.addVertexWithUV(x1, y1, z1, minU, minV);
|
||||
tessellator.addVertexWithUV(x1, y1, z, minU, maxV);
|
||||
tessellator.addVertexWithUV(x, y1, z, maxU, maxV);
|
||||
break;
|
||||
|
||||
case WEST:
|
||||
tessellator.addVertexWithUV( x, y, z1, maxU, maxV );
|
||||
tessellator.addVertexWithUV( x, y1, z1, maxU, minV );
|
||||
tessellator.addVertexWithUV( x, y1, z, minU, minV );
|
||||
tessellator.addVertexWithUV( x, y, z, minU, maxV );
|
||||
break;
|
||||
case WEST:
|
||||
tessellator.addVertexWithUV(x, y, z1, maxU, maxV);
|
||||
tessellator.addVertexWithUV(x, y1, z1, maxU, minV);
|
||||
tessellator.addVertexWithUV(x, y1, z, minU, minV);
|
||||
tessellator.addVertexWithUV(x, y, z, minU, maxV);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Invalid side.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
default:
|
||||
// Invalid side.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the provider in the inventory.
|
||||
*/
|
||||
@Override
|
||||
public final void renderInventoryBlock( final Block block, final int metadata, final int modelId, final RenderBlocks renderer )
|
||||
{
|
||||
// Get the tessellator instance
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
/**
|
||||
* Renders the provider in the inventory.
|
||||
*/
|
||||
@Override
|
||||
public final void renderInventoryBlock(
|
||||
final Block block, final int metadata, final int modelId, final RenderBlocks renderer) {
|
||||
// Get the tessellator instance
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
IIcon texture = this.textureSource.getTextures()[0];
|
||||
IIcon texture = this.textureSource.getTextures()[0];
|
||||
|
||||
GL11.glTranslatef( -0.5F, -0.5F, -0.5F );
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.startDrawingQuads();
|
||||
|
||||
// Down
|
||||
tessellator.setNormal( 0.0F, -1.0F, 0.0F );
|
||||
renderer.renderFaceYNeg( block, 0.0D, 0.0D, 0.0D, texture );
|
||||
// Down
|
||||
tessellator.setNormal(0.0F, -1.0F, 0.0F);
|
||||
renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, texture);
|
||||
|
||||
// Up
|
||||
tessellator.setNormal( 0.0F, 1.0F, 0.0F );
|
||||
renderer.renderFaceYPos( block, 0.0D, 0.0D, 0.0D, texture );
|
||||
// Up
|
||||
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, texture);
|
||||
|
||||
// North
|
||||
tessellator.setNormal( 0.0F, 0.0F, -1.0F );
|
||||
renderer.renderFaceZNeg( block, 0.0D, 0.0D, 0.0D, texture );
|
||||
// North
|
||||
tessellator.setNormal(0.0F, 0.0F, -1.0F);
|
||||
renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, texture);
|
||||
|
||||
// South
|
||||
tessellator.setNormal( 0.0F, 0.0F, 1.0F );
|
||||
renderer.renderFaceZPos( block, 0.0D, 0.0D, 0.0D, texture );
|
||||
// South
|
||||
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, texture);
|
||||
|
||||
// West
|
||||
tessellator.setNormal( -1.0F, 0.0F, 0.0F );
|
||||
renderer.renderFaceXNeg( block, 0.0D, 0.0D, 0.0D, texture );
|
||||
// West
|
||||
tessellator.setNormal(-1.0F, 0.0F, 0.0F);
|
||||
renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, texture);
|
||||
|
||||
// East
|
||||
tessellator.setNormal( 1.0F, 0.0F, 0.0F );
|
||||
renderer.renderFaceXPos( block, 0.0D, 0.0D, 0.0D, texture );
|
||||
// East
|
||||
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, texture);
|
||||
|
||||
tessellator.draw();
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glTranslatef( 0.5F, 0.5F, 0.5F );
|
||||
}
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean renderWorldBlock( final IBlockAccess world, final int x, final int y, final int z, final Block block, final int modelId,
|
||||
final RenderBlocks renderer )
|
||||
{
|
||||
// Get the tessellator
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
@Override
|
||||
public final boolean renderWorldBlock(
|
||||
final IBlockAccess world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z,
|
||||
final Block block,
|
||||
final int modelId,
|
||||
final RenderBlocks renderer) {
|
||||
// Get the tessellator
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
// Texture
|
||||
IIcon texture;
|
||||
// Texture
|
||||
IIcon texture;
|
||||
|
||||
// The forced glow of the block
|
||||
int glow = 0;
|
||||
// The forced glow of the block
|
||||
int glow = 0;
|
||||
|
||||
// Is this the opaque pass?
|
||||
if( Renderers.currentRenderPass == Renderers.PASS_OPAQUE )
|
||||
{
|
||||
// Set the texture to the base
|
||||
texture = this.textureSource.getTextures()[0];
|
||||
// Is this the opaque pass?
|
||||
if (Renderers.currentRenderPass == Renderers.PASS_OPAQUE) {
|
||||
// Set the texture to the base
|
||||
texture = this.textureSource.getTextures()[0];
|
||||
|
||||
// Set the drawing color to full white
|
||||
tessellator.setColorRGBA( 255, 255, 255, 255 );
|
||||
// Set the drawing color to full white
|
||||
tessellator.setColorRGBA(255, 255, 255, 255);
|
||||
|
||||
}
|
||||
// This is the alpha pass.
|
||||
else
|
||||
{
|
||||
// Set the texture to the overlay
|
||||
texture = this.textureSource.getTextures()[1];
|
||||
}
|
||||
// This is the alpha pass.
|
||||
else {
|
||||
// Set the texture to the overlay
|
||||
texture = this.textureSource.getTextures()[1];
|
||||
|
||||
// Get the provider
|
||||
TileProviderBase provider = (TileProviderBase)world.getTileEntity( x, y, z );
|
||||
// Get the provider
|
||||
TileProviderBase provider = (TileProviderBase) world.getTileEntity(x, y, z);
|
||||
|
||||
// Is the provider active?
|
||||
if( provider.isActive() )
|
||||
{
|
||||
// Adjust overlay brightness
|
||||
glow = 15;
|
||||
// Is the provider active?
|
||||
if (provider.isActive()) {
|
||||
// Adjust overlay brightness
|
||||
glow = 15;
|
||||
|
||||
// Set the drawing color
|
||||
tessellator.setColorOpaque_I( provider.getColor().mediumVariant );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Inactive, set the drawing color to black
|
||||
tessellator.setColorRGBA( 0, 0, 0, 255 );
|
||||
}
|
||||
}
|
||||
// Set the drawing color
|
||||
tessellator.setColorOpaque_I(provider.getColor().mediumVariant);
|
||||
} else {
|
||||
// Inactive, set the drawing color to black
|
||||
tessellator.setColorRGBA(0, 0, 0, 255);
|
||||
}
|
||||
}
|
||||
|
||||
// Render the faces
|
||||
this.renderFaces( world, x, y, z, texture, glow );
|
||||
// Render the faces
|
||||
this.renderFaces(world, x, y, z, texture, glow);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean shouldRender3DInInventory( final int modelId )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean shouldRender3DInInventory(final int modelId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package thaumicenergistics.client.render;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -11,6 +10,7 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumicenergistics.api.ThEApi;
|
||||
import thaumicenergistics.client.render.model.ModelArcaneAssembler;
|
||||
import thaumicenergistics.common.ThaumicEnergistics;
|
||||
@@ -23,89 +23,85 @@ import thaumicenergistics.common.tiles.TileArcaneAssembler;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderTileArcaneAssembler
|
||||
extends TileEntitySpecialRenderer
|
||||
{
|
||||
public class RenderTileArcaneAssembler extends TileEntitySpecialRenderer {
|
||||
|
||||
/**
|
||||
* Assembler model.
|
||||
*/
|
||||
private final ModelArcaneAssembler assemblerModel = new ModelArcaneAssembler();
|
||||
/**
|
||||
* Assembler model.
|
||||
*/
|
||||
private final ModelArcaneAssembler assemblerModel = new ModelArcaneAssembler();
|
||||
|
||||
/**
|
||||
* Texture
|
||||
*/
|
||||
private final ResourceLocation assemblerTexture = new ResourceLocation( ThaumicEnergistics.MOD_ID, "textures/models/arcane.assembler.png" );
|
||||
/**
|
||||
* Texture
|
||||
*/
|
||||
private final ResourceLocation assemblerTexture =
|
||||
new ResourceLocation(ThaumicEnergistics.MOD_ID, "textures/models/arcane.assembler.png");
|
||||
|
||||
/**
|
||||
* Cache of the assembler block.
|
||||
*/
|
||||
private final Block assemblerBlock = ThEApi.instance().blocks().ArcaneAssembler.getBlock();
|
||||
/**
|
||||
* Cache of the assembler block.
|
||||
*/
|
||||
private final Block assemblerBlock =
|
||||
ThEApi.instance().blocks().ArcaneAssembler.getBlock();
|
||||
|
||||
private void renderAssembler( final TileArcaneAssembler assemblerTile, final World world, final int x, final int y, final int z )
|
||||
{
|
||||
// Ensure there is a world object
|
||||
if( world != null )
|
||||
{
|
||||
// Get the block lightning
|
||||
float mixedBrightness = this.assemblerBlock.getMixedBrightnessForBlock( world, x, y, z );
|
||||
int light = world.getLightBrightnessForSkyBlocks( x, y, z, 0 );
|
||||
private void renderAssembler(
|
||||
final TileArcaneAssembler assemblerTile, final World world, final int x, final int y, final int z) {
|
||||
// Ensure there is a world object
|
||||
if (world != null) {
|
||||
// Get the block lightning
|
||||
float mixedBrightness = this.assemblerBlock.getMixedBrightnessForBlock(world, x, y, z);
|
||||
int light = world.getLightBrightnessForSkyBlocks(x, y, z, 0);
|
||||
|
||||
int l1 = light % 65536;
|
||||
int l2 = light / 65536;
|
||||
int l1 = light % 65536;
|
||||
int l2 = light / 65536;
|
||||
|
||||
// Set the color based on the mixed brightness
|
||||
Tessellator.instance.setColorOpaque_F( mixedBrightness, mixedBrightness, mixedBrightness );
|
||||
// Set the color based on the mixed brightness
|
||||
Tessellator.instance.setColorOpaque_F(mixedBrightness, mixedBrightness, mixedBrightness);
|
||||
|
||||
// Set the lightmap coords
|
||||
OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, l1, l2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
// No world object, render at full brightness
|
||||
Tessellator.instance.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
|
||||
}
|
||||
// Set the lightmap coords
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, l1, l2);
|
||||
} else {
|
||||
// No world object, render at full brightness
|
||||
Tessellator.instance.setColorOpaque_F(1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
// Push the matrix
|
||||
GL11.glPushMatrix();
|
||||
// Push the matrix
|
||||
GL11.glPushMatrix();
|
||||
|
||||
// Center the model
|
||||
GL11.glTranslatef( 0.5F, 0.5F, 0.5F );
|
||||
// Center the model
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
|
||||
// Bind the model texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture( this.assemblerTexture );
|
||||
// Bind the model texture
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(this.assemblerTexture);
|
||||
|
||||
// Scale down
|
||||
GL11.glScalef( 0.047F, 0.047F, 0.047F );
|
||||
// Scale down
|
||||
GL11.glScalef(0.047F, 0.047F, 0.047F);
|
||||
|
||||
// Render the assembler
|
||||
this.assemblerModel.render( null, 0, 0, -0.1F, 0, 0, 0.625F );
|
||||
// Render the assembler
|
||||
this.assemblerModel.render(null, 0, 0, -0.1F, 0, 0, 0.625F);
|
||||
|
||||
// Pop the matrix
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
// Pop the matrix
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the assembler needs to be rendered.
|
||||
*/
|
||||
@Override
|
||||
public void renderTileEntityAt( final TileEntity tileEntity, final double d, final double d1, final double d2, final float f )
|
||||
{
|
||||
// Push the GL matrix
|
||||
GL11.glPushMatrix();
|
||||
/**
|
||||
* Called when the assembler needs to be rendered.
|
||||
*/
|
||||
@Override
|
||||
public void renderTileEntityAt(
|
||||
final TileEntity tileEntity, final double d, final double d1, final double d2, final float f) {
|
||||
// Push the GL matrix
|
||||
GL11.glPushMatrix();
|
||||
|
||||
// Computes the proper place to draw
|
||||
GL11.glTranslatef( (float)d, (float)d1, (float)d2 );
|
||||
// Computes the proper place to draw
|
||||
GL11.glTranslatef((float) d, (float) d1, (float) d2);
|
||||
|
||||
// Get the assembler
|
||||
TileArcaneAssembler assemblerTile = (TileArcaneAssembler)tileEntity;
|
||||
// Get the assembler
|
||||
TileArcaneAssembler assemblerTile = (TileArcaneAssembler) tileEntity;
|
||||
|
||||
// Render the gearbox
|
||||
this.renderAssembler( assemblerTile, tileEntity.getWorldObj(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord );
|
||||
|
||||
// Pop the GL matrix
|
||||
GL11.glPopMatrix();
|
||||
|
||||
}
|
||||
// Render the gearbox
|
||||
this.renderAssembler(
|
||||
assemblerTile, tileEntity.getWorldObj(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
|
||||
// Pop the GL matrix
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package thaumicenergistics.client.render;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -11,6 +10,7 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumicenergistics.api.ThEApi;
|
||||
import thaumicenergistics.client.render.model.ModelGearbox;
|
||||
import thaumicenergistics.common.ThaumicEnergistics;
|
||||
@@ -23,113 +23,106 @@ import thaumicenergistics.common.tiles.TileGearBox;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderTileGearbox
|
||||
extends TileEntitySpecialRenderer
|
||||
{
|
||||
/**
|
||||
* Gearbox model
|
||||
*/
|
||||
private final ModelGearbox gearboxModel = new ModelGearbox();
|
||||
public class RenderTileGearbox extends TileEntitySpecialRenderer {
|
||||
/**
|
||||
* Gearbox model
|
||||
*/
|
||||
private final ModelGearbox gearboxModel = new ModelGearbox();
|
||||
|
||||
/**
|
||||
* Textures
|
||||
*/
|
||||
private final ResourceLocation TEX_IRON = new ResourceLocation( ThaumicEnergistics.MOD_ID, "textures/models/gearbox.iron.png" ),
|
||||
TEX_THAUMIUM = new ResourceLocation( ThaumicEnergistics.MOD_ID, "textures/models/gearbox.thaumium.png" );
|
||||
/**
|
||||
* Textures
|
||||
*/
|
||||
private final ResourceLocation
|
||||
TEX_IRON = new ResourceLocation(ThaumicEnergistics.MOD_ID, "textures/models/gearbox.iron.png"),
|
||||
TEX_THAUMIUM = new ResourceLocation(ThaumicEnergistics.MOD_ID, "textures/models/gearbox.thaumium.png");
|
||||
|
||||
/**
|
||||
* Cache of the gearbox block.
|
||||
*/
|
||||
private final Block gearboxBlock = ThEApi.instance().blocks().IronGearBox.getBlock();
|
||||
/**
|
||||
* Cache of the gearbox block.
|
||||
*/
|
||||
private final Block gearboxBlock = ThEApi.instance().blocks().IronGearBox.getBlock();
|
||||
|
||||
/**
|
||||
* Renders the gearbox.
|
||||
*
|
||||
* @param gearboxTile
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param block
|
||||
*/
|
||||
private void renderGearbox( final TileGearBox gearboxTile, final World world, final int x, final int y, final int z )
|
||||
{
|
||||
// Ensure there is a world object
|
||||
if( world != null )
|
||||
{
|
||||
// Get the block lightning
|
||||
float mixedBrightness = this.gearboxBlock.getMixedBrightnessForBlock( world, x, y, z );
|
||||
int light = world.getLightBrightnessForSkyBlocks( x, y, z, 0 );
|
||||
/**
|
||||
* Renders the gearbox.
|
||||
*
|
||||
* @param gearboxTile
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param block
|
||||
*/
|
||||
private void renderGearbox(
|
||||
final TileGearBox gearboxTile, final World world, final int x, final int y, final int z) {
|
||||
// Ensure there is a world object
|
||||
if (world != null) {
|
||||
// Get the block lightning
|
||||
float mixedBrightness = this.gearboxBlock.getMixedBrightnessForBlock(world, x, y, z);
|
||||
int light = world.getLightBrightnessForSkyBlocks(x, y, z, 0);
|
||||
|
||||
int l1 = light % 65536;
|
||||
int l2 = light / 65536;
|
||||
int l1 = light % 65536;
|
||||
int l2 = light / 65536;
|
||||
|
||||
// Set the color based on the mixed brightness
|
||||
Tessellator.instance.setColorOpaque_F( mixedBrightness, mixedBrightness, mixedBrightness );
|
||||
// Set the color based on the mixed brightness
|
||||
Tessellator.instance.setColorOpaque_F(mixedBrightness, mixedBrightness, mixedBrightness);
|
||||
|
||||
// Set the lightmap coords
|
||||
OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, l1, l2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
// No world object, render at full brightness
|
||||
Tessellator.instance.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
|
||||
}
|
||||
// Set the lightmap coords
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, l1, l2);
|
||||
} else {
|
||||
// No world object, render at full brightness
|
||||
Tessellator.instance.setColorOpaque_F(1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
// Push the matrix
|
||||
GL11.glPushMatrix();
|
||||
// Push the matrix
|
||||
GL11.glPushMatrix();
|
||||
|
||||
// Center the model
|
||||
GL11.glTranslatef( 0.5F, 0.5F, 0.5F );
|
||||
// Center the model
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
|
||||
// Bind the model texture
|
||||
if( gearboxTile.isThaumiumGearbox() )
|
||||
{
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture( this.TEX_THAUMIUM );
|
||||
}
|
||||
else
|
||||
{
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture( this.TEX_IRON );
|
||||
}
|
||||
// Bind the model texture
|
||||
if (gearboxTile.isThaumiumGearbox()) {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(this.TEX_THAUMIUM);
|
||||
} else {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(this.TEX_IRON);
|
||||
}
|
||||
|
||||
// Scale down
|
||||
GL11.glScalef( 0.12F, 0.12F, 0.12F );
|
||||
// Scale down
|
||||
GL11.glScalef(0.12F, 0.12F, 0.12F);
|
||||
|
||||
// Update the model.
|
||||
this.gearboxModel.updateToTileEntity( gearboxTile );
|
||||
// Update the model.
|
||||
this.gearboxModel.updateToTileEntity(gearboxTile);
|
||||
|
||||
// Render the gearbox
|
||||
this.gearboxModel.render( null, 0, 0, -0.1F, 0, 0, 0.625F );
|
||||
// Render the gearbox
|
||||
this.gearboxModel.render(null, 0, 0, -0.1F, 0, 0, 0.625F);
|
||||
|
||||
// Pop the matrix
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
// Pop the matrix
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a gearbox tile entity needs to be rendered.
|
||||
*
|
||||
* @param tileEntity
|
||||
* @param d
|
||||
* @param d1
|
||||
* @param d2
|
||||
* @param f
|
||||
*/
|
||||
@Override
|
||||
public void renderTileEntityAt( final TileEntity tileEntity, final double d, final double d1, final double d2, final float f )
|
||||
{
|
||||
// Push the GL matrix
|
||||
GL11.glPushMatrix();
|
||||
/**
|
||||
* Called when a gearbox tile entity needs to be rendered.
|
||||
*
|
||||
* @param tileEntity
|
||||
* @param d
|
||||
* @param d1
|
||||
* @param d2
|
||||
* @param f
|
||||
*/
|
||||
@Override
|
||||
public void renderTileEntityAt(
|
||||
final TileEntity tileEntity, final double d, final double d1, final double d2, final float f) {
|
||||
// Push the GL matrix
|
||||
GL11.glPushMatrix();
|
||||
|
||||
// Computes the proper place to draw
|
||||
GL11.glTranslatef( (float)d, (float)d1, (float)d2 );
|
||||
// Computes the proper place to draw
|
||||
GL11.glTranslatef((float) d, (float) d1, (float) d2);
|
||||
|
||||
// Get the gearbox
|
||||
TileGearBox gearBox = (TileGearBox)tileEntity;
|
||||
// Get the gearbox
|
||||
TileGearBox gearBox = (TileGearBox) tileEntity;
|
||||
|
||||
// Render the gearbox
|
||||
this.renderGearbox( gearBox, tileEntity.getWorldObj(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord );
|
||||
// Render the gearbox
|
||||
this.renderGearbox(gearBox, tileEntity.getWorldObj(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
|
||||
// Pop the GL matrix
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
// Pop the GL matrix
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package thaumicenergistics.client.render;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.client.lib.UtilsFX;
|
||||
import thaumicenergistics.common.items.ItemCraftingAspect;
|
||||
@@ -18,74 +18,65 @@ import thaumicenergistics.common.items.ItemCraftingAspect;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RendererItemCraftingAspect
|
||||
implements IItemRenderer
|
||||
{
|
||||
public class RendererItemCraftingAspect implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType( final ItemStack item, final ItemRenderType type )
|
||||
{
|
||||
// Handle only inventory
|
||||
return( type == ItemRenderType.INVENTORY );
|
||||
}
|
||||
@Override
|
||||
public boolean handleRenderType(final ItemStack item, final ItemRenderType type) {
|
||||
// Handle only inventory
|
||||
return (type == ItemRenderType.INVENTORY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem( final ItemRenderType type, final ItemStack stack, final Object ... data )
|
||||
{
|
||||
boolean isKnown = false;
|
||||
Aspect aspect = null;
|
||||
@Override
|
||||
public void renderItem(final ItemRenderType type, final ItemStack stack, final Object... data) {
|
||||
boolean isKnown = false;
|
||||
Aspect aspect = null;
|
||||
|
||||
// Is the stack setup?
|
||||
if( ( stack.getItemDamage() == 0 ) && ( stack.hasTagCompound() ) )
|
||||
{
|
||||
// Get the player
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
// Is the stack setup?
|
||||
if ((stack.getItemDamage() == 0) && (stack.hasTagCompound())) {
|
||||
// Get the player
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
|
||||
// Get the aspect
|
||||
aspect = ItemCraftingAspect.getAspect( stack );
|
||||
// Get the aspect
|
||||
aspect = ItemCraftingAspect.getAspect(stack);
|
||||
|
||||
// Can the knowledge be checked?
|
||||
if( ( player != null ) && ( aspect != null ) )
|
||||
{
|
||||
isKnown = ItemCraftingAspect.canPlayerSeeAspect( player, aspect );
|
||||
}
|
||||
}
|
||||
// Can the knowledge be checked?
|
||||
if ((player != null) && (aspect != null)) {
|
||||
isKnown = ItemCraftingAspect.canPlayerSeeAspect(player, aspect);
|
||||
}
|
||||
}
|
||||
|
||||
// Is the aspect known?
|
||||
if( isKnown )
|
||||
{
|
||||
// Render aspect
|
||||
UtilsFX.drawTag( 0, 0, aspect, 0.0F, 0, 0.0D );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Render unknown
|
||||
// Is the aspect known?
|
||||
if (isKnown) {
|
||||
// Render aspect
|
||||
UtilsFX.drawTag(0, 0, aspect, 0.0F, 0, 0.0D);
|
||||
} else {
|
||||
// Render unknown
|
||||
|
||||
// Disable standard lighting
|
||||
GL11.glDisable( GL11.GL_LIGHTING );
|
||||
// Disable standard lighting
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
// Set the alpha function
|
||||
GL11.glAlphaFunc( GL11.GL_GREATER, 0.003921569F );
|
||||
// Set the alpha function
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
|
||||
|
||||
// Enable alpha blending
|
||||
GL11.glEnable( GL11.GL_BLEND );
|
||||
GL11.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE );
|
||||
// Enable alpha blending
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
|
||||
// Render
|
||||
UtilsFX.bindTexture( "textures/aspects/_unknown.png" );
|
||||
GL11.glColor4f( 0.5F, 0.5F, 0.5F, 0.5F );
|
||||
UtilsFX.drawTexturedQuadFull( 0, 0, 0.0D );
|
||||
// Render
|
||||
UtilsFX.bindTexture("textures/aspects/_unknown.png");
|
||||
GL11.glColor4f(0.5F, 0.5F, 0.5F, 0.5F);
|
||||
UtilsFX.drawTexturedQuadFull(0, 0, 0.0D);
|
||||
|
||||
// Restore
|
||||
GL11.glEnable( GL11.GL_LIGHTING );
|
||||
GL11.glDisable( GL11.GL_BLEND );
|
||||
}
|
||||
}
|
||||
// Restore
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper( final ItemRenderType type, final ItemStack item, final ItemRendererHelper helper )
|
||||
{
|
||||
// Do not use the helper
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(
|
||||
final ItemRenderType type, final ItemStack item, final ItemRendererHelper helper) {
|
||||
// Do not use the helper
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package thaumicenergistics.client.render;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
* Renders a tile entity as an item.
|
||||
@@ -15,71 +15,63 @@ import net.minecraftforge.client.IItemRenderer;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class TileAsItemRenderer
|
||||
implements IItemRenderer
|
||||
{
|
||||
public class TileAsItemRenderer implements IItemRenderer {
|
||||
|
||||
/**
|
||||
* Tile entity renderer.
|
||||
*/
|
||||
private TileEntitySpecialRenderer tileRenderer;
|
||||
/**
|
||||
* Tile entity renderer.
|
||||
*/
|
||||
private TileEntitySpecialRenderer tileRenderer;
|
||||
|
||||
/**
|
||||
* Fake tile entity used to render.
|
||||
*/
|
||||
private TileEntity fakeEntity;
|
||||
/**
|
||||
* Fake tile entity used to render.
|
||||
*/
|
||||
private TileEntity fakeEntity;
|
||||
|
||||
public TileAsItemRenderer( final TileEntitySpecialRenderer tileRenderer, final TileEntity fakeEntity )
|
||||
{
|
||||
// Set the renderer and entity
|
||||
this.tileRenderer = tileRenderer;
|
||||
this.fakeEntity = fakeEntity;
|
||||
}
|
||||
public TileAsItemRenderer(final TileEntitySpecialRenderer tileRenderer, final TileEntity fakeEntity) {
|
||||
// Set the renderer and entity
|
||||
this.tileRenderer = tileRenderer;
|
||||
this.fakeEntity = fakeEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType( final ItemStack item, final ItemRenderType type )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean handleRenderType(final ItemStack item, final ItemRenderType type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem( final ItemRenderType type, final ItemStack item, final Object ... data )
|
||||
{
|
||||
// Push the matrix
|
||||
GL11.glPushMatrix();
|
||||
@Override
|
||||
public void renderItem(final ItemRenderType type, final ItemStack item, final Object... data) {
|
||||
// Push the matrix
|
||||
GL11.glPushMatrix();
|
||||
|
||||
// Adjust position based on render type
|
||||
switch ( type )
|
||||
{
|
||||
case ENTITY:
|
||||
GL11.glTranslatef( -0.5F, -0.5F, -0.5F );
|
||||
break;
|
||||
// Adjust position based on render type
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
break;
|
||||
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
GL11.glTranslatef( 0.5F, 0.2F, 0.0F );
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
GL11.glTranslatef(0.5F, 0.2F, 0.0F);
|
||||
break;
|
||||
|
||||
case INVENTORY:
|
||||
GL11.glTranslatef( -0.5F, -0.5F, -0.5F );
|
||||
break;
|
||||
case INVENTORY:
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
break;
|
||||
|
||||
case FIRST_PERSON_MAP:
|
||||
case EQUIPPED:
|
||||
break;
|
||||
}
|
||||
case FIRST_PERSON_MAP:
|
||||
case EQUIPPED:
|
||||
break;
|
||||
}
|
||||
|
||||
// Render the entity
|
||||
this.tileRenderer.renderTileEntityAt( this.fakeEntity, 0, 0, 0, 0 );
|
||||
// Render the entity
|
||||
this.tileRenderer.renderTileEntityAt(this.fakeEntity, 0, 0, 0, 0);
|
||||
|
||||
// Pop the matrix
|
||||
GL11.glPopMatrix();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper( final ItemRenderType type, final ItemStack item, final ItemRendererHelper helper )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// Pop the matrix
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(
|
||||
final ItemRenderType type, final ItemStack item, final ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
package thaumicenergistics.client.render.model;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumicenergistics.common.tiles.TileArcaneAssembler;
|
||||
|
||||
/**
|
||||
@@ -15,206 +15,207 @@ import thaumicenergistics.common.tiles.TileArcaneAssembler;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ModelArcaneAssembler
|
||||
extends ModelBase
|
||||
{
|
||||
/**
|
||||
* 90 degrees
|
||||
*/
|
||||
private static final float HALF_TURN = 1.570796325F, FULL_TURN = HALF_TURN + HALF_TURN;
|
||||
public class ModelArcaneAssembler extends ModelBase {
|
||||
/**
|
||||
* 90 degrees
|
||||
*/
|
||||
private static final float HALF_TURN = 1.570796325F, FULL_TURN = HALF_TURN + HALF_TURN;
|
||||
|
||||
//fields
|
||||
private ModelRenderer OuterFrameTop;
|
||||
private ModelRenderer OuterFrameBottom;
|
||||
private ModelRenderer OuterFrameLeft;
|
||||
private ModelRenderer OuterFrameRight;
|
||||
private ModelRenderer Glass;
|
||||
private ModelRenderer InnerFrameTop;
|
||||
private ModelRenderer InnerFrameBottom;
|
||||
private ModelRenderer InnerFrameLeft;
|
||||
private ModelRenderer InnerFrameRight;
|
||||
// fields
|
||||
private ModelRenderer OuterFrameTop;
|
||||
private ModelRenderer OuterFrameBottom;
|
||||
private ModelRenderer OuterFrameLeft;
|
||||
private ModelRenderer OuterFrameRight;
|
||||
private ModelRenderer Glass;
|
||||
private ModelRenderer InnerFrameTop;
|
||||
private ModelRenderer InnerFrameBottom;
|
||||
private ModelRenderer InnerFrameLeft;
|
||||
private ModelRenderer InnerFrameRight;
|
||||
|
||||
public ModelArcaneAssembler()
|
||||
{
|
||||
this.textureWidth = 64;
|
||||
this.textureHeight = 64;
|
||||
public ModelArcaneAssembler() {
|
||||
this.textureWidth = 64;
|
||||
this.textureHeight = 64;
|
||||
|
||||
this.OuterFrameTop = new ModelRenderer( this, 0, 0 );
|
||||
this.OuterFrameTop.addBox( -17F, -17F, -15F, 34, 2, 2 );
|
||||
this.OuterFrameTop.setRotationPoint( 0F, 0F, 0F );
|
||||
this.OuterFrameTop.setTextureSize( 64, 64 );
|
||||
this.OuterFrameTop.mirror = true;
|
||||
this.OuterFrameTop = new ModelRenderer(this, 0, 0);
|
||||
this.OuterFrameTop.addBox(-17F, -17F, -15F, 34, 2, 2);
|
||||
this.OuterFrameTop.setRotationPoint(0F, 0F, 0F);
|
||||
this.OuterFrameTop.setTextureSize(64, 64);
|
||||
this.OuterFrameTop.mirror = true;
|
||||
|
||||
this.setRotation( this.OuterFrameTop, 0F, 0F, 0F );
|
||||
this.OuterFrameBottom = new ModelRenderer( this, 0, 0 );
|
||||
this.OuterFrameBottom.addBox( -17F, 15F, -15F, 34, 2, 2 );
|
||||
this.OuterFrameBottom.setRotationPoint( 0F, 0F, 0F );
|
||||
this.OuterFrameBottom.setTextureSize( 64, 64 );
|
||||
this.OuterFrameBottom.mirror = true;
|
||||
this.setRotation(this.OuterFrameTop, 0F, 0F, 0F);
|
||||
this.OuterFrameBottom = new ModelRenderer(this, 0, 0);
|
||||
this.OuterFrameBottom.addBox(-17F, 15F, -15F, 34, 2, 2);
|
||||
this.OuterFrameBottom.setRotationPoint(0F, 0F, 0F);
|
||||
this.OuterFrameBottom.setTextureSize(64, 64);
|
||||
this.OuterFrameBottom.mirror = true;
|
||||
|
||||
this.setRotation( this.OuterFrameBottom, 0F, 0F, 0F );
|
||||
this.OuterFrameLeft = new ModelRenderer( this, 0, 0 );
|
||||
this.OuterFrameLeft.addBox( -17F, -17F, -15F, 34, 2, 2 );
|
||||
this.OuterFrameLeft.setRotationPoint( 0F, 0F, 0F );
|
||||
this.OuterFrameLeft.setTextureSize( 64, 64 );
|
||||
this.OuterFrameLeft.mirror = true;
|
||||
this.setRotation( this.OuterFrameLeft, 0F, 0F, -1.570796F );
|
||||
this.setRotation(this.OuterFrameBottom, 0F, 0F, 0F);
|
||||
this.OuterFrameLeft = new ModelRenderer(this, 0, 0);
|
||||
this.OuterFrameLeft.addBox(-17F, -17F, -15F, 34, 2, 2);
|
||||
this.OuterFrameLeft.setRotationPoint(0F, 0F, 0F);
|
||||
this.OuterFrameLeft.setTextureSize(64, 64);
|
||||
this.OuterFrameLeft.mirror = true;
|
||||
this.setRotation(this.OuterFrameLeft, 0F, 0F, -1.570796F);
|
||||
|
||||
this.OuterFrameRight = new ModelRenderer( this, 0, 0 );
|
||||
this.OuterFrameRight.addBox( -17F, -17F, -15F, 34, 2, 2 );
|
||||
this.OuterFrameRight.setRotationPoint( 0F, 0F, 0F );
|
||||
this.OuterFrameRight.setTextureSize( 64, 64 );
|
||||
this.OuterFrameRight.mirror = true;
|
||||
this.setRotation( this.OuterFrameRight, 0F, 0F, 1.570796F );
|
||||
this.OuterFrameRight = new ModelRenderer(this, 0, 0);
|
||||
this.OuterFrameRight.addBox(-17F, -17F, -15F, 34, 2, 2);
|
||||
this.OuterFrameRight.setRotationPoint(0F, 0F, 0F);
|
||||
this.OuterFrameRight.setTextureSize(64, 64);
|
||||
this.OuterFrameRight.mirror = true;
|
||||
this.setRotation(this.OuterFrameRight, 0F, 0F, 1.570796F);
|
||||
|
||||
this.Glass = new ModelRenderer( this, 0, 37 );
|
||||
this.Glass.addBox( -13F, -13F, -14F, 26, 26, 1 );
|
||||
this.Glass.setRotationPoint( 0F, 0F, 0F );
|
||||
this.Glass.setTextureSize( 64, 64 );
|
||||
this.Glass.mirror = true;
|
||||
this.setRotation( this.Glass, 0F, 0F, 0F );
|
||||
this.Glass = new ModelRenderer(this, 0, 37);
|
||||
this.Glass.addBox(-13F, -13F, -14F, 26, 26, 1);
|
||||
this.Glass.setRotationPoint(0F, 0F, 0F);
|
||||
this.Glass.setTextureSize(64, 64);
|
||||
this.Glass.mirror = true;
|
||||
this.setRotation(this.Glass, 0F, 0F, 0F);
|
||||
|
||||
this.InnerFrameTop = new ModelRenderer( this, 0, 4 );
|
||||
this.InnerFrameTop.addBox( -15F, -15F, -15F, 30, 2, 2 );
|
||||
this.InnerFrameTop.setRotationPoint( 0F, 0F, 0F );
|
||||
this.InnerFrameTop.setTextureSize( 64, 64 );
|
||||
this.InnerFrameTop.mirror = true;
|
||||
this.setRotation( this.InnerFrameTop, 0F, 0F, 0F );
|
||||
this.InnerFrameTop = new ModelRenderer(this, 0, 4);
|
||||
this.InnerFrameTop.addBox(-15F, -15F, -15F, 30, 2, 2);
|
||||
this.InnerFrameTop.setRotationPoint(0F, 0F, 0F);
|
||||
this.InnerFrameTop.setTextureSize(64, 64);
|
||||
this.InnerFrameTop.mirror = true;
|
||||
this.setRotation(this.InnerFrameTop, 0F, 0F, 0F);
|
||||
|
||||
this.InnerFrameBottom = new ModelRenderer( this, 0, 4 );
|
||||
this.InnerFrameBottom.addBox( -15F, 13F, -15F, 30, 2, 2 );
|
||||
this.InnerFrameBottom.setRotationPoint( 0F, 0F, 0F );
|
||||
this.InnerFrameBottom.setTextureSize( 64, 64 );
|
||||
this.InnerFrameBottom.mirror = true;
|
||||
this.setRotation( this.InnerFrameBottom, 0F, 0F, 0F );
|
||||
this.InnerFrameBottom = new ModelRenderer(this, 0, 4);
|
||||
this.InnerFrameBottom.addBox(-15F, 13F, -15F, 30, 2, 2);
|
||||
this.InnerFrameBottom.setRotationPoint(0F, 0F, 0F);
|
||||
this.InnerFrameBottom.setTextureSize(64, 64);
|
||||
this.InnerFrameBottom.mirror = true;
|
||||
this.setRotation(this.InnerFrameBottom, 0F, 0F, 0F);
|
||||
|
||||
this.InnerFrameLeft = new ModelRenderer( this, 0, 4 );
|
||||
this.InnerFrameLeft.addBox( -15F, -15F, -15F, 30, 2, 2 );
|
||||
this.InnerFrameLeft.setRotationPoint( 0F, 0F, 0F );
|
||||
this.InnerFrameLeft.setTextureSize( 64, 64 );
|
||||
this.InnerFrameLeft.mirror = true;
|
||||
this.setRotation( this.InnerFrameLeft, 0F, 0F, -1.570796F );
|
||||
this.InnerFrameLeft = new ModelRenderer(this, 0, 4);
|
||||
this.InnerFrameLeft.addBox(-15F, -15F, -15F, 30, 2, 2);
|
||||
this.InnerFrameLeft.setRotationPoint(0F, 0F, 0F);
|
||||
this.InnerFrameLeft.setTextureSize(64, 64);
|
||||
this.InnerFrameLeft.mirror = true;
|
||||
this.setRotation(this.InnerFrameLeft, 0F, 0F, -1.570796F);
|
||||
|
||||
this.InnerFrameRight = new ModelRenderer( this, 0, 4 );
|
||||
this.InnerFrameRight.addBox( -15F, -15F, -15F, 30, 2, 2 );
|
||||
this.InnerFrameRight.setRotationPoint( 0F, 0F, 0F );
|
||||
this.InnerFrameRight.setTextureSize( 64, 64 );
|
||||
this.InnerFrameRight.mirror = true;
|
||||
this.setRotation( this.InnerFrameRight, 0F, 0F, 1.570796F );
|
||||
}
|
||||
this.InnerFrameRight = new ModelRenderer(this, 0, 4);
|
||||
this.InnerFrameRight.addBox(-15F, -15F, -15F, 30, 2, 2);
|
||||
this.InnerFrameRight.setRotationPoint(0F, 0F, 0F);
|
||||
this.InnerFrameRight.setTextureSize(64, 64);
|
||||
this.InnerFrameRight.mirror = true;
|
||||
this.setRotation(this.InnerFrameRight, 0F, 0F, 1.570796F);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the glass on one side of the block.
|
||||
*
|
||||
* @param YRotation
|
||||
* @param XRotation
|
||||
* @param f5
|
||||
*/
|
||||
private void renderGlassSide( final float YRotation, final float XRotation, final float f5 )
|
||||
{
|
||||
this.Glass.rotateAngleX = XRotation;
|
||||
this.Glass.rotateAngleY = YRotation;
|
||||
this.Glass.render( f5 );
|
||||
/**
|
||||
* Renders the glass on one side of the block.
|
||||
*
|
||||
* @param YRotation
|
||||
* @param XRotation
|
||||
* @param f5
|
||||
*/
|
||||
private void renderGlassSide(final float YRotation, final float XRotation, final float f5) {
|
||||
this.Glass.rotateAngleX = XRotation;
|
||||
this.Glass.rotateAngleY = YRotation;
|
||||
this.Glass.render(f5);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Renders the inner frame on one side of the block.
|
||||
*
|
||||
* @param YRotation
|
||||
* @param XRotation
|
||||
* @param f5
|
||||
*/
|
||||
private void renderInnerFrameSide(final float YRotation, final float XRotation, final float f5) {
|
||||
// Set the Y rotation
|
||||
this.InnerFrameTop.rotateAngleY = YRotation;
|
||||
this.InnerFrameBottom.rotateAngleY = YRotation;
|
||||
this.InnerFrameLeft.rotateAngleY = YRotation;
|
||||
this.InnerFrameRight.rotateAngleY = YRotation;
|
||||
|
||||
/**
|
||||
* Renders the inner frame on one side of the block.
|
||||
*
|
||||
* @param YRotation
|
||||
* @param XRotation
|
||||
* @param f5
|
||||
*/
|
||||
private void renderInnerFrameSide( final float YRotation, final float XRotation, final float f5 )
|
||||
{
|
||||
// Set the Y rotation
|
||||
this.InnerFrameTop.rotateAngleY = YRotation;
|
||||
this.InnerFrameBottom.rotateAngleY = YRotation;
|
||||
this.InnerFrameLeft.rotateAngleY = YRotation;
|
||||
this.InnerFrameRight.rotateAngleY = YRotation;
|
||||
// Set the X rotation
|
||||
this.InnerFrameTop.rotateAngleX = XRotation;
|
||||
this.InnerFrameBottom.rotateAngleX = XRotation;
|
||||
this.InnerFrameLeft.rotateAngleX = XRotation;
|
||||
this.InnerFrameRight.rotateAngleX = XRotation;
|
||||
|
||||
// Set the X rotation
|
||||
this.InnerFrameTop.rotateAngleX = XRotation;
|
||||
this.InnerFrameBottom.rotateAngleX = XRotation;
|
||||
this.InnerFrameLeft.rotateAngleX = XRotation;
|
||||
this.InnerFrameRight.rotateAngleX = XRotation;
|
||||
// Render the frame
|
||||
this.InnerFrameTop.render(f5);
|
||||
this.InnerFrameBottom.render(f5);
|
||||
this.InnerFrameLeft.render(f5);
|
||||
this.InnerFrameRight.render(f5);
|
||||
}
|
||||
|
||||
// Render the frame
|
||||
this.InnerFrameTop.render( f5 );
|
||||
this.InnerFrameBottom.render( f5 );
|
||||
this.InnerFrameLeft.render( f5 );
|
||||
this.InnerFrameRight.render( f5 );
|
||||
}
|
||||
/**
|
||||
* Renders the outer frame on one side of the block.
|
||||
*
|
||||
* @param rotation
|
||||
* @param f5
|
||||
*/
|
||||
private void renderOuterFrameSide(final float rotation, final float f5) {
|
||||
// Set the Y rotation
|
||||
this.OuterFrameTop.rotateAngleY = rotation;
|
||||
this.OuterFrameBottom.rotateAngleY = rotation;
|
||||
this.OuterFrameLeft.rotateAngleX = -rotation;
|
||||
this.OuterFrameRight.rotateAngleX = rotation;
|
||||
|
||||
/**
|
||||
* Renders the outer frame on one side of the block.
|
||||
*
|
||||
* @param rotation
|
||||
* @param f5
|
||||
*/
|
||||
private void renderOuterFrameSide( final float rotation, final float f5 )
|
||||
{
|
||||
// Set the Y rotation
|
||||
this.OuterFrameTop.rotateAngleY = rotation;
|
||||
this.OuterFrameBottom.rotateAngleY = rotation;
|
||||
this.OuterFrameLeft.rotateAngleX = -rotation;
|
||||
this.OuterFrameRight.rotateAngleX = rotation;
|
||||
// Render the frame
|
||||
this.OuterFrameTop.render(f5);
|
||||
this.OuterFrameBottom.render(f5);
|
||||
this.OuterFrameLeft.render(f5);
|
||||
this.OuterFrameRight.render(f5);
|
||||
}
|
||||
|
||||
// Render the frame
|
||||
this.OuterFrameTop.render( f5 );
|
||||
this.OuterFrameBottom.render( f5 );
|
||||
this.OuterFrameLeft.render( f5 );
|
||||
this.OuterFrameRight.render( f5 );
|
||||
}
|
||||
private void setRotation(final ModelRenderer model, final float x, final float y, final float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
private void setRotation( final ModelRenderer model, final float x, final float y, final float z )
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
@Override
|
||||
public void render(
|
||||
final Entity entity,
|
||||
final float f,
|
||||
final float f1,
|
||||
final float f2,
|
||||
final float f3,
|
||||
final float f4,
|
||||
final float f5) {
|
||||
|
||||
@Override
|
||||
public void render( final Entity entity, final float f, final float f1, final float f2, final float f3, final float f4, final float f5 )
|
||||
{
|
||||
// Render the outer frame
|
||||
|
||||
// Render the outer frame
|
||||
this.renderOuterFrameSide(0, f5);
|
||||
this.renderOuterFrameSide(ModelArcaneAssembler.HALF_TURN, f5);
|
||||
this.renderOuterFrameSide(-ModelArcaneAssembler.HALF_TURN, f5);
|
||||
this.renderOuterFrameSide(ModelArcaneAssembler.FULL_TURN, f5);
|
||||
|
||||
this.renderOuterFrameSide( 0, f5 );
|
||||
this.renderOuterFrameSide( ModelArcaneAssembler.HALF_TURN, f5 );
|
||||
this.renderOuterFrameSide( -ModelArcaneAssembler.HALF_TURN, f5 );
|
||||
this.renderOuterFrameSide( ModelArcaneAssembler.FULL_TURN, f5 );
|
||||
// Render the inner frame
|
||||
this.renderInnerFrameSide(0, 0, f5);
|
||||
this.renderInnerFrameSide(ModelArcaneAssembler.HALF_TURN, 0, f5);
|
||||
this.renderInnerFrameSide(-ModelArcaneAssembler.HALF_TURN, 0, f5);
|
||||
this.renderInnerFrameSide(ModelArcaneAssembler.FULL_TURN, 0, f5);
|
||||
this.renderInnerFrameSide(0, ModelArcaneAssembler.HALF_TURN, f5);
|
||||
this.renderInnerFrameSide(0, -ModelArcaneAssembler.HALF_TURN, f5);
|
||||
|
||||
// Render the inner frame
|
||||
this.renderInnerFrameSide( 0, 0, f5 );
|
||||
this.renderInnerFrameSide( ModelArcaneAssembler.HALF_TURN, 0, f5 );
|
||||
this.renderInnerFrameSide( -ModelArcaneAssembler.HALF_TURN, 0, f5 );
|
||||
this.renderInnerFrameSide( ModelArcaneAssembler.FULL_TURN, 0, f5 );
|
||||
this.renderInnerFrameSide( 0, ModelArcaneAssembler.HALF_TURN, f5 );
|
||||
this.renderInnerFrameSide( 0, -ModelArcaneAssembler.HALF_TURN, f5 );
|
||||
// Enable transparency
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
// Enable transparency
|
||||
GL11.glEnable( GL11.GL_BLEND );
|
||||
GL11.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );
|
||||
// Render the glass
|
||||
this.renderGlassSide(0, 0, f5);
|
||||
this.renderGlassSide(ModelArcaneAssembler.HALF_TURN, 0, f5);
|
||||
this.renderGlassSide(-ModelArcaneAssembler.HALF_TURN, 0, f5);
|
||||
this.renderGlassSide(ModelArcaneAssembler.FULL_TURN, 0, f5);
|
||||
this.renderGlassSide(0, ModelArcaneAssembler.HALF_TURN, f5);
|
||||
this.renderGlassSide(0, -ModelArcaneAssembler.HALF_TURN, f5);
|
||||
|
||||
// Render the glass
|
||||
this.renderGlassSide( 0, 0, f5 );
|
||||
this.renderGlassSide( ModelArcaneAssembler.HALF_TURN, 0, f5 );
|
||||
this.renderGlassSide( -ModelArcaneAssembler.HALF_TURN, 0, f5 );
|
||||
this.renderGlassSide( ModelArcaneAssembler.FULL_TURN, 0, f5 );
|
||||
this.renderGlassSide( 0, ModelArcaneAssembler.HALF_TURN, f5 );
|
||||
this.renderGlassSide( 0, -ModelArcaneAssembler.HALF_TURN, f5 );
|
||||
|
||||
// Disable transparency
|
||||
GL11.glDisable( GL11.GL_BLEND );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles( final float f, final float f1, final float f2, final float f3, final float f4, final float f5,
|
||||
final Entity entity )
|
||||
{
|
||||
super.setRotationAngles( f, f1, f2, f3, f4, f5, entity );
|
||||
}
|
||||
// Disable transparency
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles(
|
||||
final float f,
|
||||
final float f1,
|
||||
final float f2,
|
||||
final float f3,
|
||||
final float f4,
|
||||
final float f5,
|
||||
final Entity entity) {
|
||||
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
}
|
||||
}
|
||||
@@ -15,242 +15,242 @@ import thaumicenergistics.common.tiles.TileGearBox;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ModelGearbox
|
||||
extends ModelBase
|
||||
{
|
||||
private class SideTransformation
|
||||
{
|
||||
private static final float SPOKE_OFFSET = 1.2F;
|
||||
public class ModelGearbox extends ModelBase {
|
||||
private class SideTransformation {
|
||||
private static final float SPOKE_OFFSET = 1.2F;
|
||||
|
||||
/**
|
||||
* Common
|
||||
*/
|
||||
public final float rotateAngleY, rotateAngleZ;
|
||||
/**
|
||||
* Common
|
||||
*/
|
||||
public final float rotateAngleY, rotateAngleZ;
|
||||
|
||||
/**
|
||||
* Shaft
|
||||
*/
|
||||
public final float shaftOffsetX, shaftOffsetY, shaftOffsetZ;
|
||||
/**
|
||||
* Shaft
|
||||
*/
|
||||
public final float shaftOffsetX, shaftOffsetY, shaftOffsetZ;
|
||||
|
||||
/**
|
||||
* Spokes
|
||||
*/
|
||||
public final float spokeOffsetX, spokeOffsetY, spokeOffsetZ;
|
||||
/**
|
||||
* Spokes
|
||||
*/
|
||||
public final float spokeOffsetX, spokeOffsetY, spokeOffsetZ;
|
||||
|
||||
/**
|
||||
* Does this side have a shaft?
|
||||
*/
|
||||
boolean hasShaft = true;
|
||||
/**
|
||||
* Does this side have a shaft?
|
||||
*/
|
||||
boolean hasShaft = true;
|
||||
|
||||
/*
|
||||
* Does this side have a gear?
|
||||
*/
|
||||
boolean hasGear = false;
|
||||
/*
|
||||
* Does this side have a gear?
|
||||
*/
|
||||
boolean hasGear = false;
|
||||
|
||||
/**
|
||||
* Creates the transformation
|
||||
*
|
||||
* @param rotateAngleY
|
||||
* @param rotateAngleZ
|
||||
* @param offsetX
|
||||
* @param offsetY
|
||||
* @param offsetZ
|
||||
*/
|
||||
public SideTransformation( final float rotateAngleY, final float rotateAngleZ, final float offsetX, final float offsetY, final float offsetZ )
|
||||
{
|
||||
// Set common
|
||||
this.rotateAngleY = rotateAngleY;
|
||||
this.rotateAngleZ = rotateAngleZ;
|
||||
/**
|
||||
* Creates the transformation
|
||||
*
|
||||
* @param rotateAngleY
|
||||
* @param rotateAngleZ
|
||||
* @param offsetX
|
||||
* @param offsetY
|
||||
* @param offsetZ
|
||||
*/
|
||||
public SideTransformation(
|
||||
final float rotateAngleY,
|
||||
final float rotateAngleZ,
|
||||
final float offsetX,
|
||||
final float offsetY,
|
||||
final float offsetZ) {
|
||||
// Set common
|
||||
this.rotateAngleY = rotateAngleY;
|
||||
this.rotateAngleZ = rotateAngleZ;
|
||||
|
||||
// Set shaft
|
||||
this.shaftOffsetX = offsetX;
|
||||
this.shaftOffsetY = offsetY;
|
||||
this.shaftOffsetZ = offsetZ;
|
||||
// Set shaft
|
||||
this.shaftOffsetX = offsetX;
|
||||
this.shaftOffsetY = offsetY;
|
||||
this.shaftOffsetZ = offsetZ;
|
||||
|
||||
// Set spoke
|
||||
this.spokeOffsetX = offsetX * SideTransformation.SPOKE_OFFSET;
|
||||
this.spokeOffsetY = offsetY * SideTransformation.SPOKE_OFFSET;
|
||||
this.spokeOffsetZ = offsetZ * SideTransformation.SPOKE_OFFSET;
|
||||
// Set spoke
|
||||
this.spokeOffsetX = offsetX * SideTransformation.SPOKE_OFFSET;
|
||||
this.spokeOffsetY = offsetY * SideTransformation.SPOKE_OFFSET;
|
||||
this.spokeOffsetZ = offsetZ * SideTransformation.SPOKE_OFFSET;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Set what is rendered.
|
||||
*
|
||||
* @param shaft
|
||||
* @param gear
|
||||
*/
|
||||
public void setIsRendered(final boolean shaft, final boolean gear) {
|
||||
this.hasShaft = shaft;
|
||||
this.hasGear = gear;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set what is rendered.
|
||||
*
|
||||
* @param shaft
|
||||
* @param gear
|
||||
*/
|
||||
public void setIsRendered( final boolean shaft, final boolean gear )
|
||||
{
|
||||
this.hasShaft = shaft;
|
||||
this.hasGear = gear;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 90 degrees
|
||||
*/
|
||||
private static final float HALF_TURN = 1.570796325F;
|
||||
|
||||
/**
|
||||
* 90 degrees
|
||||
*/
|
||||
private static final float HALF_TURN = 1.570796325F;
|
||||
/**
|
||||
* 45 degrees
|
||||
*/
|
||||
private static final float QUARTER_TURN = 0.7853981625F;
|
||||
|
||||
/**
|
||||
* 45 degrees
|
||||
*/
|
||||
private static final float QUARTER_TURN = 0.7853981625F;
|
||||
/**
|
||||
* Distance to the edge from the center.
|
||||
*/
|
||||
private static final float EDGE_DISTANCE = 3.12F;
|
||||
|
||||
/**
|
||||
* Distance to the edge from the center.
|
||||
*/
|
||||
private static final float EDGE_DISTANCE = 3.12F;
|
||||
/**
|
||||
* Number of valid sides.
|
||||
*/
|
||||
private static final int SIDE_COUNT = ForgeDirection.VALID_DIRECTIONS.length;
|
||||
|
||||
/**
|
||||
* Number of valid sides.
|
||||
*/
|
||||
private static final int SIDE_COUNT = ForgeDirection.VALID_DIRECTIONS.length;
|
||||
/**
|
||||
* Models
|
||||
*/
|
||||
private final ModelRenderer Transmission, Shaft, Spoke;
|
||||
|
||||
/**
|
||||
* Models
|
||||
*/
|
||||
private final ModelRenderer Transmission, Shaft, Spoke;
|
||||
/**
|
||||
* Rotation angle of the shafts and gears.
|
||||
*/
|
||||
private float rotationAngle = 0.0F;
|
||||
|
||||
/**
|
||||
* Rotation angle of the shafts and gears.
|
||||
*/
|
||||
private float rotationAngle = 0.0F;
|
||||
/**
|
||||
* Describes how to render each sides shaft and gear.
|
||||
*/
|
||||
private final SideTransformation[] transformations;
|
||||
|
||||
/**
|
||||
* Describes how to render each sides shaft and gear.
|
||||
*/
|
||||
private final SideTransformation[] transformations;
|
||||
/**
|
||||
* Creates the model.
|
||||
*/
|
||||
public ModelGearbox() {
|
||||
this.textureWidth = 32;
|
||||
this.textureHeight = 32;
|
||||
|
||||
/**
|
||||
* Creates the model.
|
||||
*/
|
||||
public ModelGearbox()
|
||||
{
|
||||
this.textureWidth = 32;
|
||||
this.textureHeight = 32;
|
||||
// Create the transmission box
|
||||
this.Transmission = new ModelRenderer(this, 1, 0);
|
||||
this.Transmission.addBox(0F, 0F, 0F, 7, 7, 7);
|
||||
this.Transmission.setRotationPoint(-3.5F, -3.5F, -3.5F);
|
||||
this.Transmission.setTextureSize(64, 64);
|
||||
this.Transmission.mirror = true;
|
||||
|
||||
// Create the transmission box
|
||||
this.Transmission = new ModelRenderer( this, 1, 0 );
|
||||
this.Transmission.addBox( 0F, 0F, 0F, 7, 7, 7 );
|
||||
this.Transmission.setRotationPoint( -3.5F, -3.5F, -3.5F );
|
||||
this.Transmission.setTextureSize( 64, 64 );
|
||||
this.Transmission.mirror = true;
|
||||
// Create the shaft
|
||||
this.Shaft = new ModelRenderer(this, 1, 15);
|
||||
this.Shaft.addBox(-1.5F, -0.5F, -0.5F, 3, 1, 1);
|
||||
this.Shaft.setRotationPoint(0F, 0F, 0F);
|
||||
this.Shaft.setTextureSize(64, 64);
|
||||
this.Shaft.mirror = true;
|
||||
|
||||
// Create the shaft
|
||||
this.Shaft = new ModelRenderer( this, 1, 15 );
|
||||
this.Shaft.addBox( -1.5F, -0.5F, -0.5F, 3, 1, 1 );
|
||||
this.Shaft.setRotationPoint( 0F, 0F, 0F );
|
||||
this.Shaft.setTextureSize( 64, 64 );
|
||||
this.Shaft.mirror = true;
|
||||
// Create the gear spoke
|
||||
this.Spoke = new ModelRenderer(this, 1, 18);
|
||||
this.Spoke.addBox(-0.5F, -3.5F, -0.5F, 1, 7, 1);
|
||||
this.Spoke.setRotationPoint(0F, 0F, 0F);
|
||||
this.Spoke.setTextureSize(64, 64);
|
||||
this.Spoke.mirror = true;
|
||||
|
||||
// Create the gear spoke
|
||||
this.Spoke = new ModelRenderer( this, 1, 18 );
|
||||
this.Spoke.addBox( -0.5F, -3.5F, -0.5F, 1, 7, 1 );
|
||||
this.Spoke.setRotationPoint( 0F, 0F, 0F );
|
||||
this.Spoke.setTextureSize( 64, 64 );
|
||||
this.Spoke.mirror = true;
|
||||
// Set the shaft and spoke transformations
|
||||
this.transformations = new SideTransformation[ForgeDirection.VALID_DIRECTIONS.length];
|
||||
this.transformations[ForgeDirection.EAST.ordinal()] =
|
||||
new SideTransformation(0F, 0F, ModelGearbox.EDGE_DISTANCE, 0F, 0F);
|
||||
this.transformations[ForgeDirection.WEST.ordinal()] =
|
||||
new SideTransformation(0F, 0F, -ModelGearbox.EDGE_DISTANCE, 0F, 0F);
|
||||
this.transformations[ForgeDirection.UP.ordinal()] =
|
||||
new SideTransformation(0F, ModelGearbox.HALF_TURN, 0F, ModelGearbox.EDGE_DISTANCE, 0F);
|
||||
this.transformations[ForgeDirection.DOWN.ordinal()] =
|
||||
new SideTransformation(0F, ModelGearbox.HALF_TURN, 0F, -ModelGearbox.EDGE_DISTANCE, 0F);
|
||||
this.transformations[ForgeDirection.SOUTH.ordinal()] =
|
||||
new SideTransformation(ModelGearbox.HALF_TURN, 0F, 0F, 0F, ModelGearbox.EDGE_DISTANCE);
|
||||
this.transformations[ForgeDirection.NORTH.ordinal()] =
|
||||
new SideTransformation(ModelGearbox.HALF_TURN, 0F, 0F, 0F, -ModelGearbox.EDGE_DISTANCE);
|
||||
}
|
||||
|
||||
// Set the shaft and spoke transformations
|
||||
this.transformations = new SideTransformation[ForgeDirection.VALID_DIRECTIONS.length];
|
||||
this.transformations[ForgeDirection.EAST.ordinal()] = new SideTransformation( 0F, 0F, ModelGearbox.EDGE_DISTANCE, 0F, 0F );
|
||||
this.transformations[ForgeDirection.WEST.ordinal()] = new SideTransformation( 0F, 0F, -ModelGearbox.EDGE_DISTANCE, 0F, 0F );
|
||||
this.transformations[ForgeDirection.UP.ordinal()] = new SideTransformation( 0F, ModelGearbox.HALF_TURN, 0F, ModelGearbox.EDGE_DISTANCE, 0F );
|
||||
this.transformations[ForgeDirection.DOWN.ordinal()] = new SideTransformation( 0F, ModelGearbox.HALF_TURN, 0F, -ModelGearbox.EDGE_DISTANCE,
|
||||
0F );
|
||||
this.transformations[ForgeDirection.SOUTH.ordinal()] = new SideTransformation( ModelGearbox.HALF_TURN, 0F, 0F, 0F,
|
||||
ModelGearbox.EDGE_DISTANCE );
|
||||
this.transformations[ForgeDirection.NORTH.ordinal()] = new SideTransformation( ModelGearbox.HALF_TURN, 0F, 0F, 0F,
|
||||
-ModelGearbox.EDGE_DISTANCE );
|
||||
}
|
||||
/**
|
||||
* Renders a shaft on the specified side.
|
||||
*
|
||||
* @param side
|
||||
* @param withGear
|
||||
* @param withExtension
|
||||
* @param f5
|
||||
*/
|
||||
private void renderShaft(final int side, final float f5) {
|
||||
// Get the transform
|
||||
SideTransformation sideTransform = this.transformations[side];
|
||||
|
||||
/**
|
||||
* Renders a shaft on the specified side.
|
||||
*
|
||||
* @param side
|
||||
* @param withGear
|
||||
* @param withExtension
|
||||
* @param f5
|
||||
*/
|
||||
private void renderShaft( final int side, final float f5 )
|
||||
{
|
||||
// Get the transform
|
||||
SideTransformation sideTransform = this.transformations[side];
|
||||
if (sideTransform.hasShaft) {
|
||||
// Set shaft orientation
|
||||
this.Shaft.rotateAngleY = sideTransform.rotateAngleY;
|
||||
this.Shaft.rotateAngleZ = sideTransform.rotateAngleZ;
|
||||
|
||||
if( sideTransform.hasShaft )
|
||||
{
|
||||
// Set shaft orientation
|
||||
this.Shaft.rotateAngleY = sideTransform.rotateAngleY;
|
||||
this.Shaft.rotateAngleZ = sideTransform.rotateAngleZ;
|
||||
// Set shaft position
|
||||
this.Shaft.offsetX = sideTransform.shaftOffsetX;
|
||||
this.Shaft.offsetY = sideTransform.shaftOffsetY;
|
||||
this.Shaft.offsetZ = sideTransform.shaftOffsetZ;
|
||||
|
||||
// Set shaft position
|
||||
this.Shaft.offsetX = sideTransform.shaftOffsetX;
|
||||
this.Shaft.offsetY = sideTransform.shaftOffsetY;
|
||||
this.Shaft.offsetZ = sideTransform.shaftOffsetZ;
|
||||
// Render shaft
|
||||
this.Shaft.render(f5);
|
||||
|
||||
// Render shaft
|
||||
this.Shaft.render( f5 );
|
||||
if (sideTransform.hasGear) {
|
||||
// Set spoke orientation
|
||||
this.Spoke.rotateAngleY = sideTransform.rotateAngleY;
|
||||
this.Spoke.rotateAngleZ = sideTransform.rotateAngleZ;
|
||||
|
||||
if( sideTransform.hasGear )
|
||||
{
|
||||
// Set spoke orientation
|
||||
this.Spoke.rotateAngleY = sideTransform.rotateAngleY;
|
||||
this.Spoke.rotateAngleZ = sideTransform.rotateAngleZ;
|
||||
// Set spoke position
|
||||
this.Spoke.offsetX = sideTransform.spokeOffsetX;
|
||||
this.Spoke.offsetY = sideTransform.spokeOffsetY;
|
||||
this.Spoke.offsetZ = sideTransform.spokeOffsetZ;
|
||||
|
||||
// Set spoke position
|
||||
this.Spoke.offsetX = sideTransform.spokeOffsetX;
|
||||
this.Spoke.offsetY = sideTransform.spokeOffsetY;
|
||||
this.Spoke.offsetZ = sideTransform.spokeOffsetZ;
|
||||
// Render gear
|
||||
this.Spoke.rotateAngleX += ModelGearbox.QUARTER_TURN;
|
||||
this.Spoke.render(f5);
|
||||
this.Spoke.rotateAngleX += ModelGearbox.QUARTER_TURN;
|
||||
this.Spoke.render(f5);
|
||||
this.Spoke.rotateAngleX += ModelGearbox.QUARTER_TURN;
|
||||
this.Spoke.render(f5);
|
||||
this.Spoke.rotateAngleX += ModelGearbox.QUARTER_TURN;
|
||||
this.Spoke.render(f5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Render gear
|
||||
this.Spoke.rotateAngleX += ModelGearbox.QUARTER_TURN;
|
||||
this.Spoke.render( f5 );
|
||||
this.Spoke.rotateAngleX += ModelGearbox.QUARTER_TURN;
|
||||
this.Spoke.render( f5 );
|
||||
this.Spoke.rotateAngleX += ModelGearbox.QUARTER_TURN;
|
||||
this.Spoke.render( f5 );
|
||||
this.Spoke.rotateAngleX += ModelGearbox.QUARTER_TURN;
|
||||
this.Spoke.render( f5 );
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Renders the gearbox.
|
||||
*/
|
||||
@Override
|
||||
public void render(
|
||||
final Entity entity,
|
||||
final float f,
|
||||
final float f1,
|
||||
final float f2,
|
||||
final float f3,
|
||||
final float f4,
|
||||
final float f5) {
|
||||
// Render the transmission
|
||||
this.Transmission.render(f5);
|
||||
|
||||
/**
|
||||
* Renders the gearbox.
|
||||
*/
|
||||
@Override
|
||||
public void render( final Entity entity, final float f, final float f1, final float f2, final float f3, final float f4, final float f5 )
|
||||
{
|
||||
// Render the transmission
|
||||
this.Transmission.render( f5 );
|
||||
// Set all the shafts and gears to the same rotation angle.
|
||||
this.Shaft.rotateAngleX = this.rotationAngle;
|
||||
this.Spoke.rotateAngleX = this.rotationAngle;
|
||||
|
||||
// Set all the shafts and gears to the same rotation angle.
|
||||
this.Shaft.rotateAngleX = this.rotationAngle;
|
||||
this.Spoke.rotateAngleX = this.rotationAngle;
|
||||
// Render shafts
|
||||
for (int side = 0; side < ModelGearbox.SIDE_COUNT; side++) {
|
||||
this.renderShaft(side, f5);
|
||||
}
|
||||
}
|
||||
|
||||
// Render shafts
|
||||
for( int side = 0; side < ModelGearbox.SIDE_COUNT; side++ )
|
||||
{
|
||||
this.renderShaft( side, f5 );
|
||||
}
|
||||
/**
|
||||
* Updates the model to match the tile entity data.
|
||||
*
|
||||
* @param gearboxTile
|
||||
*/
|
||||
public void updateToTileEntity(final TileGearBox gearboxTile) {
|
||||
// Set if each shaft has a gear.
|
||||
for (int side = 0; side < ModelGearbox.SIDE_COUNT; side++) {
|
||||
boolean withGear = !(gearboxTile.sideIsFacingCrankable[side]);
|
||||
this.transformations[side].setIsRendered(true, withGear);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the model to match the tile entity data.
|
||||
*
|
||||
* @param gearboxTile
|
||||
*/
|
||||
public void updateToTileEntity( final TileGearBox gearboxTile )
|
||||
{
|
||||
// Set if each shaft has a gear.
|
||||
for( int side = 0; side < ModelGearbox.SIDE_COUNT; side++ )
|
||||
{
|
||||
boolean withGear = !( gearboxTile.sideIsFacingCrankable[side] );
|
||||
this.transformations[side].setIsRendered( true, withGear );
|
||||
}
|
||||
|
||||
// Set the rotation angle.
|
||||
this.rotationAngle = gearboxTile.shaftRotation;
|
||||
}
|
||||
// Set the rotation angle.
|
||||
this.rotationAngle = gearboxTile.shaftRotation;
|
||||
}
|
||||
}
|
||||
+141
-148
@@ -1,6 +1,5 @@
|
||||
package thaumicenergistics.client.render.model;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -9,6 +8,7 @@ import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.Entity;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumicenergistics.common.items.ItemGolemWirelessBackpack;
|
||||
import thaumicenergistics.common.items.ItemGolemWirelessBackpack.BackpackSkins;
|
||||
|
||||
@@ -19,184 +19,177 @@ import thaumicenergistics.common.items.ItemGolemWirelessBackpack.BackpackSkins;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ModelGolemWifiBackpack
|
||||
extends ModelBase
|
||||
{
|
||||
/**
|
||||
* Submodels
|
||||
*/
|
||||
private final ModelRenderer Antenna, PackBack, PackFront;
|
||||
public class ModelGolemWifiBackpack extends ModelBase {
|
||||
/**
|
||||
* Submodels
|
||||
*/
|
||||
private final ModelRenderer Antenna, PackBack, PackFront;
|
||||
|
||||
/**
|
||||
* Pearl UV coords.
|
||||
*/
|
||||
private final float pearl_MinU, pearl_MaxU, pearl_MinV, pearl_MaxV;
|
||||
/**
|
||||
* Pearl UV coords.
|
||||
*/
|
||||
private final float pearl_MinU, pearl_MaxU, pearl_MinV, pearl_MaxV;
|
||||
|
||||
/**
|
||||
* Scale of the fluix pearls
|
||||
*/
|
||||
private final float pearlScale = 0.2f;
|
||||
/**
|
||||
* Scale of the fluix pearls
|
||||
*/
|
||||
private final float pearlScale = 0.2f;
|
||||
|
||||
/**
|
||||
* Distance from edge to edge of the antenna
|
||||
*/
|
||||
private final float antennaWidth = 0.32f;
|
||||
/**
|
||||
* Distance from edge to edge of the antenna
|
||||
*/
|
||||
private final float antennaWidth = 0.32f;
|
||||
|
||||
/**
|
||||
* Distance from the antenna to render the pearl faces
|
||||
*/
|
||||
private final float pearl_FaceDistance, pearl_2FD;
|
||||
/**
|
||||
* Distance from the antenna to render the pearl faces
|
||||
*/
|
||||
private final float pearl_FaceDistance, pearl_2FD;
|
||||
|
||||
/**
|
||||
* True if the pearl display list is compiled
|
||||
*/
|
||||
private boolean isPearlCompiled = false;
|
||||
/**
|
||||
* True if the pearl display list is compiled
|
||||
*/
|
||||
private boolean isPearlCompiled = false;
|
||||
|
||||
/**
|
||||
* ID of the pearl display list.
|
||||
*/
|
||||
private int pearlDispListID = -1;
|
||||
/**
|
||||
* ID of the pearl display list.
|
||||
*/
|
||||
private int pearlDispListID = -1;
|
||||
|
||||
public ModelGolemWifiBackpack()
|
||||
{
|
||||
this.textureWidth = 16;
|
||||
this.textureHeight = 16;
|
||||
public ModelGolemWifiBackpack() {
|
||||
this.textureWidth = 16;
|
||||
this.textureHeight = 16;
|
||||
|
||||
this.Antenna = new ModelRenderer( this, 10, 0 );
|
||||
this.Antenna.addBox( -0.5f, -6f, -0.5f, 1, 3, 1 );
|
||||
this.Antenna.setRotationPoint( 0, 0, 0f );
|
||||
this.Antenna.setTextureSize( this.textureWidth, this.textureHeight );
|
||||
this.Antenna.mirror = true;
|
||||
this.setSubmodelRotation( this.Antenna, 3.14f, 0, 0 );
|
||||
this.Antenna = new ModelRenderer(this, 10, 0);
|
||||
this.Antenna.addBox(-0.5f, -6f, -0.5f, 1, 3, 1);
|
||||
this.Antenna.setRotationPoint(0, 0, 0f);
|
||||
this.Antenna.setTextureSize(this.textureWidth, this.textureHeight);
|
||||
this.Antenna.mirror = true;
|
||||
this.setSubmodelRotation(this.Antenna, 3.14f, 0, 0);
|
||||
|
||||
this.PackBack = new ModelRenderer( this, 0, 0 );
|
||||
this.PackBack.addBox( -1f, -3f, -3f, 2, 6, 6 );
|
||||
this.PackBack.setRotationPoint( 0, 0, 0f );
|
||||
this.PackBack.setTextureSize( this.textureWidth, this.textureHeight );
|
||||
this.PackBack.mirror = true;
|
||||
this.setSubmodelRotation( this.PackBack, 3.14f, 0, 0 );
|
||||
this.PackBack = new ModelRenderer(this, 0, 0);
|
||||
this.PackBack.addBox(-1f, -3f, -3f, 2, 6, 6);
|
||||
this.PackBack.setRotationPoint(0, 0, 0f);
|
||||
this.PackBack.setTextureSize(this.textureWidth, this.textureHeight);
|
||||
this.PackBack.mirror = true;
|
||||
this.setSubmodelRotation(this.PackBack, 3.14f, 0, 0);
|
||||
|
||||
this.PackFront = new ModelRenderer( this, 2, 0 );
|
||||
this.PackFront.addBox( -1.5f, -1f, -2f, 1, 2, 4 );
|
||||
this.PackFront.setRotationPoint( 0, 0, 0f );
|
||||
this.PackFront.setTextureSize( this.textureWidth, this.textureHeight );
|
||||
this.PackFront.mirror = true;
|
||||
this.setSubmodelRotation( this.PackFront, 3.14f, 0, 0 );
|
||||
this.PackFront = new ModelRenderer(this, 2, 0);
|
||||
this.PackFront.addBox(-1.5f, -1f, -2f, 1, 2, 4);
|
||||
this.PackFront.setRotationPoint(0, 0, 0f);
|
||||
this.PackFront.setTextureSize(this.textureWidth, this.textureHeight);
|
||||
this.PackFront.mirror = true;
|
||||
this.setSubmodelRotation(this.PackFront, 3.14f, 0, 0);
|
||||
|
||||
this.pearl_MinU = 8.0f / this.textureWidth;
|
||||
this.pearl_MaxU = 13.5f / this.textureWidth;
|
||||
this.pearl_MinV = 6.0f / this.textureHeight;
|
||||
this.pearl_MaxV = 11.5f / this.textureHeight;
|
||||
this.pearl_MinU = 8.0f / this.textureWidth;
|
||||
this.pearl_MaxU = 13.5f / this.textureWidth;
|
||||
this.pearl_MinV = 6.0f / this.textureHeight;
|
||||
this.pearl_MaxV = 11.5f / this.textureHeight;
|
||||
|
||||
this.pearl_FaceDistance = -0.013f / this.pearlScale;
|
||||
this.pearl_2FD = this.pearl_FaceDistance + this.pearl_FaceDistance;
|
||||
}
|
||||
this.pearl_FaceDistance = -0.013f / this.pearlScale;
|
||||
this.pearl_2FD = this.pearl_FaceDistance + this.pearl_FaceDistance;
|
||||
}
|
||||
|
||||
private void compilePearl()
|
||||
{
|
||||
// Create a new list
|
||||
this.pearlDispListID = GLAllocation.generateDisplayLists( 1 );
|
||||
GL11.glNewList( this.pearlDispListID, GL11.GL_COMPILE );
|
||||
private void compilePearl() {
|
||||
// Create a new list
|
||||
this.pearlDispListID = GLAllocation.generateDisplayLists(1);
|
||||
GL11.glNewList(this.pearlDispListID, GL11.GL_COMPILE);
|
||||
|
||||
// Get the tesselator
|
||||
Tessellator tess = Tessellator.instance;
|
||||
// Get the tesselator
|
||||
Tessellator tess = Tessellator.instance;
|
||||
|
||||
// Move to the left of the antenna
|
||||
GL11.glTranslatef( -0.0955f, 0.275f, -0.045f );
|
||||
// Move to the left of the antenna
|
||||
GL11.glTranslatef(-0.0955f, 0.275f, -0.045f);
|
||||
|
||||
// Scale down
|
||||
GL11.glScalef( this.pearlScale, this.pearlScale, this.pearlScale );
|
||||
// Scale down
|
||||
GL11.glScalef(this.pearlScale, this.pearlScale, this.pearlScale);
|
||||
|
||||
// Draw left
|
||||
this.drawPearlFaces( tess, this.pearl_MinU, this.pearl_MaxU );
|
||||
// Draw left
|
||||
this.drawPearlFaces(tess, this.pearl_MinU, this.pearl_MaxU);
|
||||
|
||||
// Move to the right of the antenna
|
||||
GL11.glTranslatef( 0.0f, 0.0f, this.antennaWidth - this.pearl_2FD );
|
||||
// Move to the right of the antenna
|
||||
GL11.glTranslatef(0.0f, 0.0f, this.antennaWidth - this.pearl_2FD);
|
||||
|
||||
// Draw right
|
||||
this.drawPearlFaces( tess, this.pearl_MaxU, this.pearl_MinU );
|
||||
// Draw right
|
||||
this.drawPearlFaces(tess, this.pearl_MaxU, this.pearl_MinU);
|
||||
|
||||
// Rotate 90
|
||||
GL11.glRotatef( 90.0f, 0.0f, 1.0f, 0.0f );
|
||||
// Rotate 90
|
||||
GL11.glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
|
||||
|
||||
// Move to the front of the antenna
|
||||
GL11.glTranslatef( -this.antennaWidth - this.pearl_FaceDistance, 0.0f, this.antennaWidth + this.pearl_FaceDistance );
|
||||
// Move to the front of the antenna
|
||||
GL11.glTranslatef(
|
||||
-this.antennaWidth - this.pearl_FaceDistance, 0.0f, this.antennaWidth + this.pearl_FaceDistance);
|
||||
|
||||
// Draw front
|
||||
this.drawPearlFaces( tess, this.pearl_MaxU, this.pearl_MinU );
|
||||
// Draw front
|
||||
this.drawPearlFaces(tess, this.pearl_MaxU, this.pearl_MinU);
|
||||
|
||||
// Move to the back of the antenna
|
||||
GL11.glTranslatef( 0.0f, 0.0f, this.antennaWidth - this.pearl_2FD );
|
||||
// Move to the back of the antenna
|
||||
GL11.glTranslatef(0.0f, 0.0f, this.antennaWidth - this.pearl_2FD);
|
||||
|
||||
// Draw back
|
||||
this.drawPearlFaces( tess, this.pearl_MinU, this.pearl_MaxU );
|
||||
// Draw back
|
||||
this.drawPearlFaces(tess, this.pearl_MinU, this.pearl_MaxU);
|
||||
|
||||
// End the list
|
||||
GL11.glEndList();
|
||||
this.isPearlCompiled = true;
|
||||
}
|
||||
// End the list
|
||||
GL11.glEndList();
|
||||
this.isPearlCompiled = true;
|
||||
}
|
||||
|
||||
private void drawPearlFaces( final Tessellator tess, final float minU, final float maxU )
|
||||
{
|
||||
tess.startDrawingQuads();
|
||||
// Face
|
||||
tess.addVertexWithUV( 0.0D, 0.0D, 0.0D, maxU, this.pearl_MaxV );
|
||||
tess.addVertexWithUV( 1.0D, 0.0D, 0.0D, minU, this.pearl_MaxV );
|
||||
tess.addVertexWithUV( 1.0D, 1.0D, 0.0D, minU, this.pearl_MinV );
|
||||
tess.addVertexWithUV( 0.0D, 1.0D, 0.0D, maxU, this.pearl_MinV );
|
||||
// Back-face
|
||||
tess.addVertexWithUV( 0.0D, 1.0D, 0.0D, maxU, this.pearl_MinV );
|
||||
tess.addVertexWithUV( 1.0D, 1.0D, 0.0D, minU, this.pearl_MinV );
|
||||
tess.addVertexWithUV( 1.0D, 0.0D, 0.0D, minU, this.pearl_MaxV );
|
||||
tess.addVertexWithUV( 0.0D, 0.0D, 0.0D, maxU, this.pearl_MaxV );
|
||||
tess.draw();
|
||||
}
|
||||
private void drawPearlFaces(final Tessellator tess, final float minU, final float maxU) {
|
||||
tess.startDrawingQuads();
|
||||
// Face
|
||||
tess.addVertexWithUV(0.0D, 0.0D, 0.0D, maxU, this.pearl_MaxV);
|
||||
tess.addVertexWithUV(1.0D, 0.0D, 0.0D, minU, this.pearl_MaxV);
|
||||
tess.addVertexWithUV(1.0D, 1.0D, 0.0D, minU, this.pearl_MinV);
|
||||
tess.addVertexWithUV(0.0D, 1.0D, 0.0D, maxU, this.pearl_MinV);
|
||||
// Back-face
|
||||
tess.addVertexWithUV(0.0D, 1.0D, 0.0D, maxU, this.pearl_MinV);
|
||||
tess.addVertexWithUV(1.0D, 1.0D, 0.0D, minU, this.pearl_MinV);
|
||||
tess.addVertexWithUV(1.0D, 0.0D, 0.0D, minU, this.pearl_MaxV);
|
||||
tess.addVertexWithUV(0.0D, 0.0D, 0.0D, maxU, this.pearl_MaxV);
|
||||
tess.draw();
|
||||
}
|
||||
|
||||
private void renderPearl( final float pearlRotation, final boolean inRange )
|
||||
{
|
||||
if( !inRange )
|
||||
{
|
||||
// Set red tint
|
||||
GL11.glColor3f( 1.0f, 0.0f, 0.0f );
|
||||
}
|
||||
private void renderPearl(final float pearlRotation, final boolean inRange) {
|
||||
if (!inRange) {
|
||||
// Set red tint
|
||||
GL11.glColor3f(1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
// Apply Y rotation
|
||||
GL11.glRotatef( pearlRotation, 0.0f, 1.0f, 0.0f );
|
||||
// Apply Y rotation
|
||||
GL11.glRotatef(pearlRotation, 0.0f, 1.0f, 0.0f);
|
||||
|
||||
// Is the pearl compiled?
|
||||
if( !this.isPearlCompiled )
|
||||
{
|
||||
// Compile the pearl
|
||||
this.compilePearl();
|
||||
}
|
||||
// Is the pearl compiled?
|
||||
if (!this.isPearlCompiled) {
|
||||
// Compile the pearl
|
||||
this.compilePearl();
|
||||
}
|
||||
|
||||
// Draw the pearl
|
||||
GL11.glCallList( this.pearlDispListID );
|
||||
// Draw the pearl
|
||||
GL11.glCallList(this.pearlDispListID);
|
||||
}
|
||||
|
||||
}
|
||||
private void setSubmodelRotation(final ModelRenderer model, final float x, final float y, final float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
private void setSubmodelRotation( final ModelRenderer model, final float x, final float y, final float z )
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render( final Entity entity, final float f, final float f1, final float f2, final float f3, final float f4,
|
||||
final float f5 )
|
||||
{
|
||||
this.render( 0.03f, f5, true, BackpackSkins.Thaumium );
|
||||
}
|
||||
|
||||
public void render( final float pearlRotation, final float f5, final boolean inRange, final BackpackSkins skin )
|
||||
{
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture( skin.getTextureLocation() );
|
||||
this.PackBack.render( f5 );
|
||||
this.PackFront.render( f5 );
|
||||
this.Antenna.render( f5 );
|
||||
this.renderPearl( pearlRotation, inRange );
|
||||
|
||||
}
|
||||
@Override
|
||||
public void render(
|
||||
final Entity entity,
|
||||
final float f,
|
||||
final float f1,
|
||||
final float f2,
|
||||
final float f3,
|
||||
final float f4,
|
||||
final float f5) {
|
||||
this.render(0.03f, f5, true, BackpackSkins.Thaumium);
|
||||
}
|
||||
|
||||
public void render(final float pearlRotation, final float f5, final boolean inRange, final BackpackSkins skin) {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(skin.getTextureLocation());
|
||||
this.PackBack.render(f5);
|
||||
this.PackFront.render(f5);
|
||||
this.Antenna.render(f5);
|
||||
this.renderPearl(pearlRotation, inRange);
|
||||
}
|
||||
}
|
||||
@@ -8,155 +8,145 @@ import net.minecraft.util.ResourceLocation;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public enum AEStateIconsEnum
|
||||
implements IStateIconTexture
|
||||
{
|
||||
// Redstone modes
|
||||
REDSTONE_LOW (0, 0),
|
||||
REDSTONE_HIGH (16, 0),
|
||||
REDSTONE_PULSE (32, 0),
|
||||
REDSTONE_IGNORE (48, 0),
|
||||
public enum AEStateIconsEnum implements IStateIconTexture {
|
||||
// Redstone modes
|
||||
REDSTONE_LOW(0, 0),
|
||||
REDSTONE_HIGH(16, 0),
|
||||
REDSTONE_PULSE(32, 0),
|
||||
REDSTONE_IGNORE(48, 0),
|
||||
|
||||
// Slot backgrounds
|
||||
VIEW_CELL_BACKGROUND (224, 64),
|
||||
UPGRADE_CARD_BACKGROUND (240, 208),
|
||||
ME_CELL_BACKGROUND (240, 0),
|
||||
PATTERN_CELL_BACKGROUND (240, 128),
|
||||
// Slot backgrounds
|
||||
VIEW_CELL_BACKGROUND(224, 64),
|
||||
UPGRADE_CARD_BACKGROUND(240, 208),
|
||||
ME_CELL_BACKGROUND(240, 0),
|
||||
PATTERN_CELL_BACKGROUND(240, 128),
|
||||
|
||||
// Buttons
|
||||
REGULAR_BUTTON (240, 240),
|
||||
TAB_BUTTON (208, 0, 22, 22),
|
||||
// Buttons
|
||||
REGULAR_BUTTON(240, 240),
|
||||
TAB_BUTTON(208, 0, 22, 22),
|
||||
|
||||
// Sorting modes
|
||||
SORT_MODE_ALPHABETIC (0, 64),
|
||||
SORT_MODE_AMOUNT (16, 64),
|
||||
SORT_MODE_MOD (80, 64),
|
||||
SORT_MODE_INVTWEAK (64, 64),
|
||||
// Sorting modes
|
||||
SORT_MODE_ALPHABETIC(0, 64),
|
||||
SORT_MODE_AMOUNT(16, 64),
|
||||
SORT_MODE_MOD(80, 64),
|
||||
SORT_MODE_INVTWEAK(64, 64),
|
||||
|
||||
// Sorting directions
|
||||
SORT_DIR_ASC (0, 48),
|
||||
SORT_DIR_DEC (16, 48),
|
||||
// Sorting directions
|
||||
SORT_DIR_ASC(0, 48),
|
||||
SORT_DIR_DEC(16, 48),
|
||||
|
||||
// View types
|
||||
VIEW_TYPE_STORED (0, 16),
|
||||
VIEW_TYPE_ALL (32, 16),
|
||||
VIEW_TYPE_CRAFT (48, 16),
|
||||
// View types
|
||||
VIEW_TYPE_STORED(0, 16),
|
||||
VIEW_TYPE_ALL(32, 16),
|
||||
VIEW_TYPE_CRAFT(48, 16),
|
||||
|
||||
// Terminal styles
|
||||
TERM_STYLE_TALL (0, 208),
|
||||
TERM_STYLE_SMALL (16, 208),
|
||||
// Terminal styles
|
||||
TERM_STYLE_TALL(0, 208),
|
||||
TERM_STYLE_SMALL(16, 208),
|
||||
|
||||
// Search modes
|
||||
SEARCH_MODE_AUTO (48, 32),
|
||||
SEARCH_MODE_MANUAL (64, 32),
|
||||
SEARCH_MODE_NEI_AUTO (80, 32),
|
||||
SEARCH_MODE_NEI_MANUAL (96, 32),
|
||||
// Search modes
|
||||
SEARCH_MODE_AUTO(48, 32),
|
||||
SEARCH_MODE_MANUAL(64, 32),
|
||||
SEARCH_MODE_NEI_AUTO(80, 32),
|
||||
SEARCH_MODE_NEI_MANUAL(96, 32),
|
||||
|
||||
// Misc
|
||||
WRENCH (32, 64),
|
||||
DISABLED (0, 128),
|
||||
ENABLED (16, 128),
|
||||
SAVE (0, 176),
|
||||
DELETE (0, 192),
|
||||
CLEAR_GRID (96, 0),
|
||||
ARROW_DOWN (128, 0),
|
||||
// Misc
|
||||
WRENCH(32, 64),
|
||||
DISABLED(0, 128),
|
||||
ENABLED(16, 128),
|
||||
SAVE(0, 176),
|
||||
DELETE(0, 192),
|
||||
CLEAR_GRID(96, 0),
|
||||
ARROW_DOWN(128, 0),
|
||||
|
||||
CRAFT_ONLY(48, 16),
|
||||
CRAFT_EITHER(32, 16);
|
||||
CRAFT_ONLY(48, 16),
|
||||
CRAFT_EITHER(32, 16);
|
||||
|
||||
/**
|
||||
* Location of the AE states texture
|
||||
*/
|
||||
public static final ResourceLocation AE_STATES_TEXTURE = new ResourceLocation( "appliedenergistics2", "textures/guis/states.png" );
|
||||
/**
|
||||
* Location of the AE states texture
|
||||
*/
|
||||
public static final ResourceLocation AE_STATES_TEXTURE =
|
||||
new ResourceLocation("appliedenergistics2", "textures/guis/states.png");
|
||||
|
||||
/**
|
||||
* Width and height of standard icons.
|
||||
*/
|
||||
public static final int STANDARD_ICON_SIZE = 16;
|
||||
/**
|
||||
* Width and height of standard icons.
|
||||
*/
|
||||
public static final int STANDARD_ICON_SIZE = 16;
|
||||
|
||||
/**
|
||||
* X position in the texture this icon is located at.
|
||||
*/
|
||||
private int minU;
|
||||
/**
|
||||
* X position in the texture this icon is located at.
|
||||
*/
|
||||
private int minU;
|
||||
|
||||
/**
|
||||
* Y position in the texture this icon is located at.
|
||||
*/
|
||||
private int minV;
|
||||
/**
|
||||
* Y position in the texture this icon is located at.
|
||||
*/
|
||||
private int minV;
|
||||
|
||||
/**
|
||||
* Width of the icon
|
||||
*/
|
||||
private int width;
|
||||
/**
|
||||
* Width of the icon
|
||||
*/
|
||||
private int width;
|
||||
|
||||
/**
|
||||
* Height of the icon
|
||||
*/
|
||||
private int height;
|
||||
/**
|
||||
* Height of the icon
|
||||
*/
|
||||
private int height;
|
||||
|
||||
/**
|
||||
* Standard icon constructor
|
||||
*
|
||||
* @param u
|
||||
* @param v
|
||||
*/
|
||||
private AEStateIconsEnum( final int u, final int v )
|
||||
{
|
||||
this( u, v, STANDARD_ICON_SIZE, STANDARD_ICON_SIZE );
|
||||
}
|
||||
/**
|
||||
* Standard icon constructor
|
||||
*
|
||||
* @param u
|
||||
* @param v
|
||||
*/
|
||||
private AEStateIconsEnum(final int u, final int v) {
|
||||
this(u, v, STANDARD_ICON_SIZE, STANDARD_ICON_SIZE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Icon constructor
|
||||
*
|
||||
* @param u
|
||||
* @param v
|
||||
* @param width
|
||||
* @param height
|
||||
*/
|
||||
private AEStateIconsEnum( final int u, final int v, final int width, final int height )
|
||||
{
|
||||
// Set the u
|
||||
this.minU = u;
|
||||
/**
|
||||
* Icon constructor
|
||||
*
|
||||
* @param u
|
||||
* @param v
|
||||
* @param width
|
||||
* @param height
|
||||
*/
|
||||
private AEStateIconsEnum(final int u, final int v, final int width, final int height) {
|
||||
// Set the u
|
||||
this.minU = u;
|
||||
|
||||
// Set the v
|
||||
this.minV = v;
|
||||
// Set the v
|
||||
this.minV = v;
|
||||
|
||||
// Set width
|
||||
this.width = width;
|
||||
// Set width
|
||||
this.width = width;
|
||||
|
||||
// Set height
|
||||
this.height = height;
|
||||
// Set height
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return this.height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight()
|
||||
{
|
||||
return this.height;
|
||||
}
|
||||
@Override
|
||||
public ResourceLocation getTexture() {
|
||||
return AEStateIconsEnum.AE_STATES_TEXTURE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture()
|
||||
{
|
||||
return AEStateIconsEnum.AE_STATES_TEXTURE;
|
||||
}
|
||||
@Override
|
||||
public int getU() {
|
||||
return this.minU;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getU()
|
||||
{
|
||||
return this.minU;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getV()
|
||||
{
|
||||
return this.minV;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth()
|
||||
{
|
||||
return this.width;
|
||||
}
|
||||
@Override
|
||||
public int getV() {
|
||||
return this.minV;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return this.width;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package thaumicenergistics.client.textures;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.util.IIcon;
|
||||
import thaumicenergistics.common.ThaumicEnergistics;
|
||||
@@ -16,101 +16,117 @@ import thaumicenergistics.common.ThaumicEnergistics;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public enum BlockTextureManager
|
||||
{
|
||||
BUS_COLOR (TextureTypes.Part, new String[] { "bus.color.border", "bus.color.light", "bus.color.side" }),
|
||||
public enum BlockTextureManager {
|
||||
BUS_COLOR(TextureTypes.Part, new String[] {"bus.color.border", "bus.color.light", "bus.color.side"}),
|
||||
|
||||
ESSENTIA_IMPORT_BUS (TextureTypes.Part, new String[] { "essentia.import.bus.face", "essentia.import.bus.overlay",
|
||||
"essentia.import.bus.chamber", "essentia.import.bus.side" }),
|
||||
ESSENTIA_IMPORT_BUS(TextureTypes.Part, new String[] {
|
||||
"essentia.import.bus.face",
|
||||
"essentia.import.bus.overlay",
|
||||
"essentia.import.bus.chamber",
|
||||
"essentia.import.bus.side"
|
||||
}),
|
||||
|
||||
ESSENTIA_LEVEL_EMITTER (TextureTypes.Part, new String[] { "essentia.level.emitter.base", "essentia.level.emitter.active",
|
||||
"essentia.level.emitter.inactive" }),
|
||||
ESSENTIA_LEVEL_EMITTER(TextureTypes.Part, new String[] {
|
||||
"essentia.level.emitter.base", "essentia.level.emitter.active", "essentia.level.emitter.inactive"
|
||||
}),
|
||||
|
||||
ESSENTIA_STORAGE_BUS (TextureTypes.Part, new String[] { "essentia.storage.bus.face", "essentia.storage.bus.overlay",
|
||||
"essentia.storage.bus.side" }),
|
||||
ESSENTIA_STORAGE_BUS(
|
||||
TextureTypes.Part,
|
||||
new String[] {"essentia.storage.bus.face", "essentia.storage.bus.overlay", "essentia.storage.bus.side"}),
|
||||
|
||||
ESSENTIA_EXPORT_BUS (TextureTypes.Part, new String[] { "essentia.export.bus.face", "essentia.export.bus.overlay",
|
||||
"essentia.export.bus.chamber", "essentia.export.bus.side" }),
|
||||
ESSENTIA_EXPORT_BUS(TextureTypes.Part, new String[] {
|
||||
"essentia.export.bus.face",
|
||||
"essentia.export.bus.overlay",
|
||||
"essentia.export.bus.chamber",
|
||||
"essentia.export.bus.side"
|
||||
}),
|
||||
|
||||
ESSENTIA_TERMINAL (TextureTypes.Part, new String[] { "essentia.terminal.overlay.dark", "essentia.terminal.overlay.medium",
|
||||
"essentia.terminal.overlay.light", "essentia.terminal.side", "essentia.termina.border" }),
|
||||
ESSENTIA_TERMINAL(TextureTypes.Part, new String[] {
|
||||
"essentia.terminal.overlay.dark",
|
||||
"essentia.terminal.overlay.medium",
|
||||
"essentia.terminal.overlay.light",
|
||||
"essentia.terminal.side",
|
||||
"essentia.termina.border"
|
||||
}),
|
||||
|
||||
ESSENTIA_PROVIDER (TextureTypes.Block, new String[] { "essentia.provider", "essentia.provider.overlay" }),
|
||||
ESSENTIA_PROVIDER(TextureTypes.Block, new String[] {"essentia.provider", "essentia.provider.overlay"}),
|
||||
|
||||
INFUSION_PROVIDER (TextureTypes.Block, new String[] { "infusion.provider", "infusion.provider.overlay" }),
|
||||
INFUSION_PROVIDER(TextureTypes.Block, new String[] {"infusion.provider", "infusion.provider.overlay"}),
|
||||
|
||||
ARCANE_CRAFTING_TERMINAL (TextureTypes.Part, new String[] { "arcane.crafting.overlay1", "arcane.crafting.overlay2",
|
||||
"arcane.crafting.overlay3", "arcane.crafting.side", "arcane.crafting.overlay4" }),
|
||||
ARCANE_CRAFTING_TERMINAL(TextureTypes.Part, new String[] {
|
||||
"arcane.crafting.overlay1",
|
||||
"arcane.crafting.overlay2",
|
||||
"arcane.crafting.overlay3",
|
||||
"arcane.crafting.side",
|
||||
"arcane.crafting.overlay4"
|
||||
}),
|
||||
|
||||
VIS_RELAY_INTERFACE (TextureTypes.Part, new String[] { "vis.interface", "vis.interface.runes", "vis.interface.side" }),
|
||||
VIS_RELAY_INTERFACE(TextureTypes.Part, new String[] {"vis.interface", "vis.interface.runes", "vis.interface.side"}),
|
||||
|
||||
GEAR_BOX (TextureTypes.Block, new String[] { "gear.box.fallback", "golem.gear.box.fallback" }),
|
||||
GEAR_BOX(TextureTypes.Block, new String[] {"gear.box.fallback", "golem.gear.box.fallback"}),
|
||||
|
||||
ESSENTIA_CELL_WORKBENCH (TextureTypes.Block, new String[] { "essentia.cell.workbench.top", "essentia.cell.workbench.bottom",
|
||||
"essentia.cell.workbench.side" }),
|
||||
ESSENTIA_CELL_WORKBENCH(TextureTypes.Block, new String[] {
|
||||
"essentia.cell.workbench.top", "essentia.cell.workbench.bottom", "essentia.cell.workbench.side"
|
||||
}),
|
||||
|
||||
GASEOUS_ESSENTIA (TextureTypes.Block, new String[] { "essentia.gas" }),
|
||||
GASEOUS_ESSENTIA(TextureTypes.Block, new String[] {"essentia.gas"}),
|
||||
|
||||
ARCANE_ASSEMBLER (TextureTypes.Block, new String[] { "arcane.assembler.fallback" }),
|
||||
ARCANE_ASSEMBLER(TextureTypes.Block, new String[] {"arcane.assembler.fallback"}),
|
||||
|
||||
KNOWLEDGE_INSCRIBER (TextureTypes.Block,
|
||||
new String[] { "knowledge.inscriber.side", "knowledge.inscriber.top", "knowledge.inscriber.bottom" }),
|
||||
KNOWLEDGE_INSCRIBER(
|
||||
TextureTypes.Block,
|
||||
new String[] {"knowledge.inscriber.side", "knowledge.inscriber.top", "knowledge.inscriber.bottom"}),
|
||||
|
||||
ESSENTIA_VIBRATION_CHAMBER (TextureTypes.Block, new String[] { "e.vibration.input", "e.vibration.face.off", "e.vibration.face.ignis",
|
||||
"e.vibration.face.potentia" }),
|
||||
ESSENTIA_VIBRATION_CHAMBER(TextureTypes.Block, new String[] {
|
||||
"e.vibration.input", "e.vibration.face.off", "e.vibration.face.ignis", "e.vibration.face.potentia"
|
||||
}),
|
||||
|
||||
DISTILLATION_ENCODER (TextureTypes.Block,
|
||||
new String[] { "knowledge.inscriber.side", "distillation.encoder.face", "knowledge.inscriber.bottom" });
|
||||
DISTILLATION_ENCODER(
|
||||
TextureTypes.Block,
|
||||
new String[] {"knowledge.inscriber.side", "distillation.encoder.face", "knowledge.inscriber.bottom"});
|
||||
|
||||
private enum TextureTypes
|
||||
{
|
||||
Block,
|
||||
Part;
|
||||
}
|
||||
private enum TextureTypes {
|
||||
Block,
|
||||
Part;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache of the enum values
|
||||
*/
|
||||
public static final List<BlockTextureManager> ALLVALUES = Collections.unmodifiableList( Arrays.asList( BlockTextureManager.values() ) );
|
||||
/**
|
||||
* Cache of the enum values
|
||||
*/
|
||||
public static final List<BlockTextureManager> ALLVALUES =
|
||||
Collections.unmodifiableList(Arrays.asList(BlockTextureManager.values()));
|
||||
|
||||
private TextureTypes textureType;
|
||||
private TextureTypes textureType;
|
||||
|
||||
private String[] textureNames;
|
||||
private String[] textureNames;
|
||||
|
||||
private IIcon[] textures;
|
||||
private IIcon[] textures;
|
||||
|
||||
private BlockTextureManager( final TextureTypes textureType, final String[] textureNames )
|
||||
{
|
||||
this.textureType = textureType;
|
||||
this.textureNames = textureNames;
|
||||
this.textures = new IIcon[this.textureNames.length];
|
||||
}
|
||||
private BlockTextureManager(final TextureTypes textureType, final String[] textureNames) {
|
||||
this.textureType = textureType;
|
||||
this.textureNames = textureNames;
|
||||
this.textures = new IIcon[this.textureNames.length];
|
||||
}
|
||||
|
||||
public IIcon getTexture()
|
||||
{
|
||||
return this.textures[0];
|
||||
}
|
||||
public IIcon getTexture() {
|
||||
return this.textures[0];
|
||||
}
|
||||
|
||||
public IIcon[] getTextures()
|
||||
{
|
||||
return this.textures;
|
||||
}
|
||||
public IIcon[] getTextures() {
|
||||
return this.textures;
|
||||
}
|
||||
|
||||
public void registerTexture( final TextureMap textureMap )
|
||||
{
|
||||
if( textureMap.getTextureType() == 0 )
|
||||
{
|
||||
String header = ThaumicEnergistics.MOD_ID + ":";
|
||||
public void registerTexture(final TextureMap textureMap) {
|
||||
if (textureMap.getTextureType() == 0) {
|
||||
String header = ThaumicEnergistics.MOD_ID + ":";
|
||||
|
||||
if( this.textureType == TextureTypes.Part )
|
||||
{
|
||||
header += "parts/";
|
||||
}
|
||||
if (this.textureType == TextureTypes.Part) {
|
||||
header += "parts/";
|
||||
}
|
||||
|
||||
for( int i = 0; i < this.textureNames.length; i++ )
|
||||
{
|
||||
this.textures[i] = textureMap.registerIcon( header + this.textureNames[i] );
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < this.textureNames.length; i++) {
|
||||
this.textures[i] = textureMap.registerIcon(header + this.textureNames[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,31 +12,27 @@ import thaumicenergistics.common.ThaumicEnergistics;
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public enum GuiTextureManager
|
||||
{
|
||||
ESSENTIA_LEVEL_EMITTER ("essentia.level.emitter"),
|
||||
ESSENTIA_STORAGE_BUS ("essentia.storage.bus"),
|
||||
ESSENTIA_TERMINAL ("essentia.terminal"),
|
||||
ESSENTIA_IO_BUS ("essentia.io.bus"),
|
||||
ARCANE_CRAFTING_TERMINAL ("arcane.crafting"),
|
||||
PRIORITY ("priority"),
|
||||
CELL_WORKBENCH ("essentia.cell.workbench"),
|
||||
ARCANE_ASSEMBLER ("arcane.assembler"),
|
||||
KNOWLEDGE_INSCRIBER ("knowledge.inscriber"),
|
||||
ESSENTIA_VIBRATION_CHAMBER ("essentia.vibration.chamber"),
|
||||
DISTILLATION_ENCODER ("distillation.encoder");
|
||||
public enum GuiTextureManager {
|
||||
ESSENTIA_LEVEL_EMITTER("essentia.level.emitter"),
|
||||
ESSENTIA_STORAGE_BUS("essentia.storage.bus"),
|
||||
ESSENTIA_TERMINAL("essentia.terminal"),
|
||||
ESSENTIA_IO_BUS("essentia.io.bus"),
|
||||
ARCANE_CRAFTING_TERMINAL("arcane.crafting"),
|
||||
PRIORITY("priority"),
|
||||
CELL_WORKBENCH("essentia.cell.workbench"),
|
||||
ARCANE_ASSEMBLER("arcane.assembler"),
|
||||
KNOWLEDGE_INSCRIBER("knowledge.inscriber"),
|
||||
ESSENTIA_VIBRATION_CHAMBER("essentia.vibration.chamber"),
|
||||
DISTILLATION_ENCODER("distillation.encoder");
|
||||
|
||||
private ResourceLocation texture;
|
||||
private ResourceLocation texture;
|
||||
|
||||
private GuiTextureManager( final String textureName )
|
||||
{
|
||||
// Create the resource location
|
||||
this.texture = new ResourceLocation( ThaumicEnergistics.MOD_ID, "textures/gui/" + textureName + ".png" );
|
||||
}
|
||||
|
||||
public ResourceLocation getTexture()
|
||||
{
|
||||
return this.texture;
|
||||
}
|
||||
private GuiTextureManager(final String textureName) {
|
||||
// Create the resource location
|
||||
this.texture = new ResourceLocation(ThaumicEnergistics.MOD_ID, "textures/gui/" + textureName + ".png");
|
||||
}
|
||||
|
||||
public ResourceLocation getTexture() {
|
||||
return this.texture;
|
||||
}
|
||||
}
|
||||
@@ -9,41 +9,40 @@ import net.minecraft.util.ResourceLocation;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public interface IStateIconTexture
|
||||
{
|
||||
/**
|
||||
* Height of the icon.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getHeight();
|
||||
public interface IStateIconTexture {
|
||||
/**
|
||||
* Height of the icon.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getHeight();
|
||||
|
||||
/**
|
||||
* Texture the icon is in.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
ResourceLocation getTexture();
|
||||
/**
|
||||
* Texture the icon is in.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
ResourceLocation getTexture();
|
||||
|
||||
/**
|
||||
* U coordinate of the icon.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getU();
|
||||
/**
|
||||
* U coordinate of the icon.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getU();
|
||||
|
||||
/**
|
||||
* V coordinate of the icon.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getV();
|
||||
/**
|
||||
* V coordinate of the icon.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getV();
|
||||
|
||||
/**
|
||||
* Width of the icon.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getWidth();
|
||||
/**
|
||||
* Width of the icon.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getWidth();
|
||||
}
|
||||
@@ -9,104 +9,94 @@ import thaumicenergistics.common.ThaumicEnergistics;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public enum ThEStateIconsEnum
|
||||
implements IStateIconTexture
|
||||
{
|
||||
SWAP (0, 0);
|
||||
public enum ThEStateIconsEnum implements IStateIconTexture {
|
||||
SWAP(0, 0);
|
||||
|
||||
/**
|
||||
* Location of the AE states texture
|
||||
*/
|
||||
public static final ResourceLocation THE_STATES_TEXTURE = new ResourceLocation( ThaumicEnergistics.MOD_ID, "textures/gui/states.png" );
|
||||
/**
|
||||
* Location of the AE states texture
|
||||
*/
|
||||
public static final ResourceLocation THE_STATES_TEXTURE =
|
||||
new ResourceLocation(ThaumicEnergistics.MOD_ID, "textures/gui/states.png");
|
||||
|
||||
/**
|
||||
* Width and height of standard icons.
|
||||
*/
|
||||
private static final int STANDARD_ICON_SIZE = 16;
|
||||
/**
|
||||
* Width and height of standard icons.
|
||||
*/
|
||||
private static final int STANDARD_ICON_SIZE = 16;
|
||||
|
||||
/**
|
||||
* X position in the texture this icon is located at.
|
||||
*/
|
||||
private int minU;
|
||||
/**
|
||||
* X position in the texture this icon is located at.
|
||||
*/
|
||||
private int minU;
|
||||
|
||||
/**
|
||||
* Y position in the texture this icon is located at.
|
||||
*/
|
||||
private int minV;
|
||||
/**
|
||||
* Y position in the texture this icon is located at.
|
||||
*/
|
||||
private int minV;
|
||||
|
||||
/**
|
||||
* Width of the icon
|
||||
*/
|
||||
private int width;
|
||||
/**
|
||||
* Width of the icon
|
||||
*/
|
||||
private int width;
|
||||
|
||||
/**
|
||||
* Height of the icon
|
||||
*/
|
||||
private int height;
|
||||
/**
|
||||
* Height of the icon
|
||||
*/
|
||||
private int height;
|
||||
|
||||
/**
|
||||
* Standard icon constructor
|
||||
*
|
||||
* @param u
|
||||
* @param v
|
||||
*/
|
||||
private ThEStateIconsEnum( final int u, final int v )
|
||||
{
|
||||
this( u, v, STANDARD_ICON_SIZE, STANDARD_ICON_SIZE );
|
||||
}
|
||||
/**
|
||||
* Standard icon constructor
|
||||
*
|
||||
* @param u
|
||||
* @param v
|
||||
*/
|
||||
private ThEStateIconsEnum(final int u, final int v) {
|
||||
this(u, v, STANDARD_ICON_SIZE, STANDARD_ICON_SIZE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Icon constructor
|
||||
*
|
||||
* @param u
|
||||
* @param v
|
||||
* @param width
|
||||
* @param height
|
||||
*/
|
||||
private ThEStateIconsEnum( final int u, final int v, final int width, final int height )
|
||||
{
|
||||
// Set the u
|
||||
this.minU = u;
|
||||
/**
|
||||
* Icon constructor
|
||||
*
|
||||
* @param u
|
||||
* @param v
|
||||
* @param width
|
||||
* @param height
|
||||
*/
|
||||
private ThEStateIconsEnum(final int u, final int v, final int width, final int height) {
|
||||
// Set the u
|
||||
this.minU = u;
|
||||
|
||||
// Set the v
|
||||
this.minV = v;
|
||||
// Set the v
|
||||
this.minV = v;
|
||||
|
||||
// Set width
|
||||
this.width = width;
|
||||
// Set width
|
||||
this.width = width;
|
||||
|
||||
// Set height
|
||||
this.height = height;
|
||||
// Set height
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return this.height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight()
|
||||
{
|
||||
return this.height;
|
||||
}
|
||||
@Override
|
||||
public ResourceLocation getTexture() {
|
||||
return ThEStateIconsEnum.THE_STATES_TEXTURE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture()
|
||||
{
|
||||
return ThEStateIconsEnum.THE_STATES_TEXTURE;
|
||||
}
|
||||
@Override
|
||||
public int getU() {
|
||||
return this.minU;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getU()
|
||||
{
|
||||
return this.minU;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getV()
|
||||
{
|
||||
return this.minV;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth()
|
||||
{
|
||||
return this.width;
|
||||
}
|
||||
@Override
|
||||
public int getV() {
|
||||
return this.minV;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return this.width;
|
||||
}
|
||||
}
|
||||
@@ -19,81 +19,69 @@ import thaumicenergistics.common.tiles.TileEnum;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public class CommonProxy
|
||||
{
|
||||
/**
|
||||
* Registers blocks with the game.
|
||||
*/
|
||||
public void registerBlocks()
|
||||
{
|
||||
for( BlockEnum block : BlockEnum.VALUES )
|
||||
{
|
||||
GameRegistry.registerBlock( block.getBlock(), block.itemBlockClass, block.getUnlocalizedName() );
|
||||
}
|
||||
}
|
||||
public class CommonProxy {
|
||||
/**
|
||||
* Registers blocks with the game.
|
||||
*/
|
||||
public void registerBlocks() {
|
||||
for (BlockEnum block : BlockEnum.VALUES) {
|
||||
GameRegistry.registerBlock(block.getBlock(), block.itemBlockClass, block.getUnlocalizedName());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers all ThE features
|
||||
*/
|
||||
public void registerFeatures()
|
||||
{
|
||||
FeatureRegistry.instance().registerFeatures();
|
||||
}
|
||||
/**
|
||||
* Registers all ThE features
|
||||
*/
|
||||
public void registerFeatures() {
|
||||
FeatureRegistry.instance().registerFeatures();
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers fluids with the game.
|
||||
*/
|
||||
public void registerFluids()
|
||||
{
|
||||
GaseousEssentia.registerGases();
|
||||
}
|
||||
/**
|
||||
* Registers fluids with the game.
|
||||
*/
|
||||
public void registerFluids() {
|
||||
GaseousEssentia.registerGases();
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers items with the game.
|
||||
*/
|
||||
public void registerItems()
|
||||
{
|
||||
for( ItemEnum item : ItemEnum.VALUES )
|
||||
{
|
||||
GameRegistry.registerItem( item.getItem(), item.getInternalName() );
|
||||
}
|
||||
/**
|
||||
* Registers items with the game.
|
||||
*/
|
||||
public void registerItems() {
|
||||
for (ItemEnum item : ItemEnum.VALUES) {
|
||||
GameRegistry.registerItem(item.getItem(), item.getInternalName());
|
||||
}
|
||||
|
||||
// Add iron gear to the oredic
|
||||
OreDictionary.registerOre( "gearIron", ItemMaterial.MaterialTypes.IRON_GEAR.getStack() );
|
||||
// Add iron gear to the oredic
|
||||
OreDictionary.registerOre("gearIron", ItemMaterial.MaterialTypes.IRON_GEAR.getStack());
|
||||
|
||||
// Add the shard from thaumcraft so that AE will suggest replacements.
|
||||
OreDictionary.registerOre( "materialAspectShard", new ItemStack( ConfigItems.itemShard, 1, OreDictionary.WILDCARD_VALUE ) );
|
||||
}
|
||||
// Add the shard from thaumcraft so that AE will suggest replacements.
|
||||
OreDictionary.registerOre(
|
||||
"materialAspectShard", new ItemStack(ConfigItems.itemShard, 1, OreDictionary.WILDCARD_VALUE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by client proxy
|
||||
*/
|
||||
public void registerRenderers()
|
||||
{
|
||||
// Ignored server side.
|
||||
}
|
||||
/**
|
||||
* Used by client proxy
|
||||
*/
|
||||
public void registerRenderers() {
|
||||
// Ignored server side.
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds tile entities to the AppEng2 SpatialIO whitelist
|
||||
*/
|
||||
public void registerSpatialIOMovables()
|
||||
{
|
||||
IMovableRegistry movableRegistry = AEApi.instance().registries().movable();
|
||||
for( TileEnum tile : TileEnum.values() )
|
||||
{
|
||||
movableRegistry.whiteListTileEntity( tile.getTileClass() );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers tile entities with the game.
|
||||
*/
|
||||
public void registerTileEntities()
|
||||
{
|
||||
for( TileEnum tile : TileEnum.values() )
|
||||
{
|
||||
GameRegistry.registerTileEntity( tile.getTileClass(), tile.getTileID() );
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Adds tile entities to the AppEng2 SpatialIO whitelist
|
||||
*/
|
||||
public void registerSpatialIOMovables() {
|
||||
IMovableRegistry movableRegistry = AEApi.instance().registries().movable();
|
||||
for (TileEnum tile : TileEnum.values()) {
|
||||
movableRegistry.whiteListTileEntity(tile.getTileClass());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers tile entities with the game.
|
||||
*/
|
||||
public void registerTileEntities() {
|
||||
for (TileEnum tile : TileEnum.values()) {
|
||||
GameRegistry.registerTileEntity(tile.getTileClass(), tile.getTileID());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,296 +10,287 @@ import thaumicenergistics.api.IThEConfig;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
class ConfigurationHandler
|
||||
implements IThEConfig
|
||||
{
|
||||
private static ConfigurationHandler INSTANCE;
|
||||
class ConfigurationHandler implements IThEConfig {
|
||||
private static ConfigurationHandler INSTANCE;
|
||||
|
||||
/**
|
||||
* Names of the categories.
|
||||
*/
|
||||
private static final String CATEGORY_CRAFTING = "crafting",
|
||||
CATEGORY_CLIENT = "client",
|
||||
CATEGORY_INTEGRATION = "integration";
|
||||
/**
|
||||
* Names of the categories.
|
||||
*/
|
||||
private static final String CATEGORY_CRAFTING = "crafting",
|
||||
CATEGORY_CLIENT = "client",
|
||||
CATEGORY_INTEGRATION = "integration";
|
||||
|
||||
/**
|
||||
* Default values.
|
||||
*/
|
||||
private static final int DFT_CONVERSION_EXPONENT = 7;
|
||||
private static final boolean DFT_CRAFT_ARCANE_ASSEMBLER = true,
|
||||
DFT_CRAFT_ARCANE_CRAFTING_TERM = true,
|
||||
DFT_CRAFT_DISTILLATION_PATTERN_ENCODER = true,
|
||||
DFT_CRAFT_ESSENTIA_CELLS = true,
|
||||
DFT_CRAFT_ESSENTIA_PROVIDER = true,
|
||||
DFT_CRAFT_ESSENTIA_VIBRATION_CHAMBER = true,
|
||||
DFT_CRAFT_GOLEM_BACKPACK = true,
|
||||
DFT_CRAFT_INFUSION_PROVIDER = true,
|
||||
DFT_CRAFT_IO_BUSES = true,
|
||||
DFT_CRAFT_VIS_RELAY_INTERFACE = true,
|
||||
DFT_CRAFT_WIRELESS_ESSENTIA_TERM = true,
|
||||
DFT_DISABLE_GEARBOX = false,
|
||||
DFT_ENABLE_QUARTZ_DUPE = true,
|
||||
DFT_ENABLE_WRENCH_FOCUS = true,
|
||||
DFT_EXTRACELLS_BLIST = true,
|
||||
DFT_FORCE_TC_FACADES = true;
|
||||
/**
|
||||
* Default values.
|
||||
*/
|
||||
private static final int DFT_CONVERSION_EXPONENT = 7;
|
||||
|
||||
/**
|
||||
* Mod configuration
|
||||
*/
|
||||
private Configuration configSettings;
|
||||
private static final boolean DFT_CRAFT_ARCANE_ASSEMBLER = true,
|
||||
DFT_CRAFT_ARCANE_CRAFTING_TERM = true,
|
||||
DFT_CRAFT_DISTILLATION_PATTERN_ENCODER = true,
|
||||
DFT_CRAFT_ESSENTIA_CELLS = true,
|
||||
DFT_CRAFT_ESSENTIA_PROVIDER = true,
|
||||
DFT_CRAFT_ESSENTIA_VIBRATION_CHAMBER = true,
|
||||
DFT_CRAFT_GOLEM_BACKPACK = true,
|
||||
DFT_CRAFT_INFUSION_PROVIDER = true,
|
||||
DFT_CRAFT_IO_BUSES = true,
|
||||
DFT_CRAFT_VIS_RELAY_INTERFACE = true,
|
||||
DFT_CRAFT_WIRELESS_ESSENTIA_TERM = true,
|
||||
DFT_DISABLE_GEARBOX = false,
|
||||
DFT_ENABLE_QUARTZ_DUPE = true,
|
||||
DFT_ENABLE_WRENCH_FOCUS = true,
|
||||
DFT_EXTRACELLS_BLIST = true,
|
||||
DFT_FORCE_TC_FACADES = true;
|
||||
|
||||
/**
|
||||
* Controls the conversion ratio of essentia/fluid. <BR>
|
||||
* 1 essentia unit is converted to this many mb's of fluid.
|
||||
*/
|
||||
private int conversionMultiplier = (int)Math.pow( 2, DFT_CONVERSION_EXPONENT );
|
||||
/**
|
||||
* Mod configuration
|
||||
*/
|
||||
private Configuration configSettings;
|
||||
|
||||
private boolean craft_Arcane_Assembler = DFT_CRAFT_ARCANE_ASSEMBLER,
|
||||
craft_Arcane_Crafting_Term = DFT_CRAFT_ARCANE_CRAFTING_TERM,
|
||||
craft_Distillation_Pattern_Encoder = DFT_CRAFT_DISTILLATION_PATTERN_ENCODER,
|
||||
craft_Essentia_Cells = DFT_CRAFT_ESSENTIA_CELLS,
|
||||
craft_Essentia_Provider = DFT_CRAFT_ESSENTIA_PROVIDER,
|
||||
craft_Essentia_Vibration_Chamber = DFT_CRAFT_ESSENTIA_VIBRATION_CHAMBER,
|
||||
craft_GolemBackpack = DFT_CRAFT_GOLEM_BACKPACK,
|
||||
craft_Infusion_Provider = DFT_CRAFT_INFUSION_PROVIDER,
|
||||
craft_IO_Buses = DFT_CRAFT_IO_BUSES,
|
||||
craft_Vis_Relay_Interface = DFT_CRAFT_VIS_RELAY_INTERFACE,
|
||||
craft_Wireless_Essentia_Term = DFT_CRAFT_WIRELESS_ESSENTIA_TERM,
|
||||
disable_Gearbox = DFT_DISABLE_GEARBOX,
|
||||
enable_Quartz_Dupe = DFT_ENABLE_QUARTZ_DUPE,
|
||||
enable_Wrench_Focus = DFT_ENABLE_WRENCH_FOCUS,
|
||||
extracells_Blist = DFT_EXTRACELLS_BLIST,
|
||||
force_TC_Facades = DFT_FORCE_TC_FACADES;
|
||||
/**
|
||||
* Controls the conversion ratio of essentia/fluid. <BR>
|
||||
* 1 essentia unit is converted to this many mb's of fluid.
|
||||
*/
|
||||
private int conversionMultiplier = (int) Math.pow(2, DFT_CONVERSION_EXPONENT);
|
||||
|
||||
private ConfigurationHandler( final Configuration config )
|
||||
{
|
||||
this.configSettings = config;
|
||||
this.synchronizeConfigFile();
|
||||
}
|
||||
private boolean craft_Arcane_Assembler = DFT_CRAFT_ARCANE_ASSEMBLER,
|
||||
craft_Arcane_Crafting_Term = DFT_CRAFT_ARCANE_CRAFTING_TERM,
|
||||
craft_Distillation_Pattern_Encoder = DFT_CRAFT_DISTILLATION_PATTERN_ENCODER,
|
||||
craft_Essentia_Cells = DFT_CRAFT_ESSENTIA_CELLS,
|
||||
craft_Essentia_Provider = DFT_CRAFT_ESSENTIA_PROVIDER,
|
||||
craft_Essentia_Vibration_Chamber = DFT_CRAFT_ESSENTIA_VIBRATION_CHAMBER,
|
||||
craft_GolemBackpack = DFT_CRAFT_GOLEM_BACKPACK,
|
||||
craft_Infusion_Provider = DFT_CRAFT_INFUSION_PROVIDER,
|
||||
craft_IO_Buses = DFT_CRAFT_IO_BUSES,
|
||||
craft_Vis_Relay_Interface = DFT_CRAFT_VIS_RELAY_INTERFACE,
|
||||
craft_Wireless_Essentia_Term = DFT_CRAFT_WIRELESS_ESSENTIA_TERM,
|
||||
disable_Gearbox = DFT_DISABLE_GEARBOX,
|
||||
enable_Quartz_Dupe = DFT_ENABLE_QUARTZ_DUPE,
|
||||
enable_Wrench_Focus = DFT_ENABLE_WRENCH_FOCUS,
|
||||
extracells_Blist = DFT_EXTRACELLS_BLIST,
|
||||
force_TC_Facades = DFT_FORCE_TC_FACADES;
|
||||
|
||||
/**
|
||||
* Loads and synchronizes the config file.
|
||||
*
|
||||
* @param configFile
|
||||
*/
|
||||
public static IThEConfig loadAndSyncConfigFile( final File configFile )
|
||||
{
|
||||
if( ConfigurationHandler.INSTANCE == null )
|
||||
{
|
||||
ConfigurationHandler.INSTANCE = new ConfigurationHandler( new Configuration( configFile ) );
|
||||
}
|
||||
return ConfigurationHandler.INSTANCE;
|
||||
}
|
||||
private ConfigurationHandler(final Configuration config) {
|
||||
this.configSettings = config;
|
||||
this.synchronizeConfigFile();
|
||||
}
|
||||
|
||||
/**
|
||||
* Synchronizes the config file and the settings.
|
||||
*/
|
||||
private void synchronizeConfigFile()
|
||||
{
|
||||
// General =========================================================
|
||||
int fluidPow = this.configSettings
|
||||
.getInt(
|
||||
"Essentia Fluid Ratio Exponent",
|
||||
Configuration.CATEGORY_GENERAL,
|
||||
ConfigurationHandler.DFT_CONVERSION_EXPONENT,
|
||||
1,
|
||||
11,
|
||||
"Controls the conversion ratio of essentia/fluid. 1 essentia is converted to (2^this) milibuckets of fluid. " +
|
||||
"Please be aware that this value effects how much fluid is transferred through the AE system, which also effects transfer speed and power consumption. " +
|
||||
"Values above 11 make it impossible to use fluid transfer devices such as the ME IO Port, or anything from EC2." );
|
||||
this.conversionMultiplier = (int)Math.pow( 2, Math.min( fluidPow, 11 ) );
|
||||
/**
|
||||
* Loads and synchronizes the config file.
|
||||
*
|
||||
* @param configFile
|
||||
*/
|
||||
public static IThEConfig loadAndSyncConfigFile(final File configFile) {
|
||||
if (ConfigurationHandler.INSTANCE == null) {
|
||||
ConfigurationHandler.INSTANCE = new ConfigurationHandler(new Configuration(configFile));
|
||||
}
|
||||
return ConfigurationHandler.INSTANCE;
|
||||
}
|
||||
|
||||
// Crafting ========================================================
|
||||
this.craft_Arcane_Assembler = this.configSettings.getBoolean(
|
||||
"Arcane Assembler",
|
||||
CATEGORY_CRAFTING, DFT_CRAFT_ARCANE_ASSEMBLER,
|
||||
"Controls if the Arcane Assembler can be crafted." );
|
||||
/**
|
||||
* Synchronizes the config file and the settings.
|
||||
*/
|
||||
private void synchronizeConfigFile() {
|
||||
// General =========================================================
|
||||
int fluidPow = this.configSettings.getInt(
|
||||
"Essentia Fluid Ratio Exponent",
|
||||
Configuration.CATEGORY_GENERAL,
|
||||
ConfigurationHandler.DFT_CONVERSION_EXPONENT,
|
||||
1,
|
||||
11,
|
||||
"Controls the conversion ratio of essentia/fluid. 1 essentia is converted to (2^this) milibuckets of fluid. "
|
||||
+ "Please be aware that this value effects how much fluid is transferred through the AE system, which also effects transfer speed and power consumption. "
|
||||
+ "Values above 11 make it impossible to use fluid transfer devices such as the ME IO Port, or anything from EC2.");
|
||||
this.conversionMultiplier = (int) Math.pow(2, Math.min(fluidPow, 11));
|
||||
|
||||
this.craft_Arcane_Crafting_Term = this.configSettings.getBoolean(
|
||||
"Arcane Crafting Terminal",
|
||||
CATEGORY_CRAFTING, DFT_CRAFT_ARCANE_CRAFTING_TERM,
|
||||
"Controls if the Arcane Crafting Terminal can be crafted." );
|
||||
// Crafting ========================================================
|
||||
this.craft_Arcane_Assembler = this.configSettings.getBoolean(
|
||||
"Arcane Assembler",
|
||||
CATEGORY_CRAFTING,
|
||||
DFT_CRAFT_ARCANE_ASSEMBLER,
|
||||
"Controls if the Arcane Assembler can be crafted.");
|
||||
|
||||
this.craft_Distillation_Pattern_Encoder = this.configSettings.getBoolean(
|
||||
"Distillation Pattern Encoder.",
|
||||
CATEGORY_CRAFTING, DFT_CRAFT_DISTILLATION_PATTERN_ENCODER,
|
||||
"Controls if the Distillation Pattern Encoder can be crafted." );
|
||||
this.craft_Arcane_Crafting_Term = this.configSettings.getBoolean(
|
||||
"Arcane Crafting Terminal",
|
||||
CATEGORY_CRAFTING,
|
||||
DFT_CRAFT_ARCANE_CRAFTING_TERM,
|
||||
"Controls if the Arcane Crafting Terminal can be crafted.");
|
||||
|
||||
this.craft_Essentia_Cells = this.configSettings.getBoolean(
|
||||
"Essentia Cells",
|
||||
CATEGORY_CRAFTING, DFT_CRAFT_ESSENTIA_CELLS,
|
||||
"Controls if Essentia Cells and Components can be crafted." );
|
||||
this.craft_Distillation_Pattern_Encoder = this.configSettings.getBoolean(
|
||||
"Distillation Pattern Encoder.",
|
||||
CATEGORY_CRAFTING,
|
||||
DFT_CRAFT_DISTILLATION_PATTERN_ENCODER,
|
||||
"Controls if the Distillation Pattern Encoder can be crafted.");
|
||||
|
||||
this.craft_Essentia_Provider = this.configSettings.getBoolean(
|
||||
"Essentia Provider",
|
||||
CATEGORY_CRAFTING, DFT_CRAFT_ESSENTIA_PROVIDER,
|
||||
"Controls if the Essentia Provider can be crafted." );
|
||||
this.craft_Essentia_Cells = this.configSettings.getBoolean(
|
||||
"Essentia Cells",
|
||||
CATEGORY_CRAFTING,
|
||||
DFT_CRAFT_ESSENTIA_CELLS,
|
||||
"Controls if Essentia Cells and Components can be crafted.");
|
||||
|
||||
this.craft_Essentia_Vibration_Chamber = this.configSettings.getBoolean(
|
||||
"Essentia Vibration Chamber",
|
||||
CATEGORY_CRAFTING, DFT_CRAFT_ESSENTIA_VIBRATION_CHAMBER,
|
||||
"Controlls if the Essentia Vibration Chamber can be crafted." );
|
||||
this.craft_Essentia_Provider = this.configSettings.getBoolean(
|
||||
"Essentia Provider",
|
||||
CATEGORY_CRAFTING,
|
||||
DFT_CRAFT_ESSENTIA_PROVIDER,
|
||||
"Controls if the Essentia Provider can be crafted.");
|
||||
|
||||
this.craft_GolemBackpack = this.configSettings.getBoolean(
|
||||
"Golem Wifi Backpack",
|
||||
CATEGORY_CRAFTING, DFT_CRAFT_GOLEM_BACKPACK,
|
||||
"Controls if the Golem Wifi Backpack can be crafted." );
|
||||
this.craft_Essentia_Vibration_Chamber = this.configSettings.getBoolean(
|
||||
"Essentia Vibration Chamber",
|
||||
CATEGORY_CRAFTING,
|
||||
DFT_CRAFT_ESSENTIA_VIBRATION_CHAMBER,
|
||||
"Controlls if the Essentia Vibration Chamber can be crafted.");
|
||||
|
||||
this.craft_Infusion_Provider = this.configSettings.getBoolean(
|
||||
"Infusion Provider",
|
||||
CATEGORY_CRAFTING, DFT_CRAFT_INFUSION_PROVIDER,
|
||||
"Controls if the Infusion Provider can be crafted." );
|
||||
this.craft_GolemBackpack = this.configSettings.getBoolean(
|
||||
"Golem Wifi Backpack",
|
||||
CATEGORY_CRAFTING,
|
||||
DFT_CRAFT_GOLEM_BACKPACK,
|
||||
"Controls if the Golem Wifi Backpack can be crafted.");
|
||||
|
||||
this.craft_IO_Buses = this.configSettings.getBoolean(
|
||||
"IO Buses",
|
||||
CATEGORY_CRAFTING, DFT_CRAFT_IO_BUSES,
|
||||
"Controls if the import and export buses can be crafted." );
|
||||
this.craft_Infusion_Provider = this.configSettings.getBoolean(
|
||||
"Infusion Provider",
|
||||
CATEGORY_CRAFTING,
|
||||
DFT_CRAFT_INFUSION_PROVIDER,
|
||||
"Controls if the Infusion Provider can be crafted.");
|
||||
|
||||
this.craft_Vis_Relay_Interface = this.configSettings.getBoolean(
|
||||
"Vis Relay Interface",
|
||||
CATEGORY_CRAFTING, DFT_CRAFT_VIS_RELAY_INTERFACE,
|
||||
"Controls if the Vis Relay Interface can be crafted." );
|
||||
this.craft_IO_Buses = this.configSettings.getBoolean(
|
||||
"IO Buses",
|
||||
CATEGORY_CRAFTING,
|
||||
DFT_CRAFT_IO_BUSES,
|
||||
"Controls if the import and export buses can be crafted.");
|
||||
|
||||
this.craft_Wireless_Essentia_Term = this.configSettings.getBoolean(
|
||||
"Allow Crafting Wireless Essentia Terminal",
|
||||
CATEGORY_CRAFTING, DFT_CRAFT_WIRELESS_ESSENTIA_TERM,
|
||||
"Controls if the Wireless Essentia Terminal can be crafted." );
|
||||
this.craft_Vis_Relay_Interface = this.configSettings.getBoolean(
|
||||
"Vis Relay Interface",
|
||||
CATEGORY_CRAFTING,
|
||||
DFT_CRAFT_VIS_RELAY_INTERFACE,
|
||||
"Controls if the Vis Relay Interface can be crafted.");
|
||||
|
||||
this.enable_Quartz_Dupe = this.configSettings.getBoolean(
|
||||
"Certus Quartz Duplication",
|
||||
CATEGORY_CRAFTING, DFT_ENABLE_QUARTZ_DUPE,
|
||||
"Controls if Certus Quartz can be duplicated in the crucible." );
|
||||
this.craft_Wireless_Essentia_Term = this.configSettings.getBoolean(
|
||||
"Allow Crafting Wireless Essentia Terminal",
|
||||
CATEGORY_CRAFTING,
|
||||
DFT_CRAFT_WIRELESS_ESSENTIA_TERM,
|
||||
"Controls if the Wireless Essentia Terminal can be crafted.");
|
||||
|
||||
this.enable_Wrench_Focus = this.configSettings.getBoolean(
|
||||
"Wrench Focus",
|
||||
CATEGORY_CRAFTING, DFT_ENABLE_WRENCH_FOCUS,
|
||||
"Controls if the Wrench Focus is enabled and craftable." );
|
||||
this.enable_Quartz_Dupe = this.configSettings.getBoolean(
|
||||
"Certus Quartz Duplication",
|
||||
CATEGORY_CRAFTING,
|
||||
DFT_ENABLE_QUARTZ_DUPE,
|
||||
"Controls if Certus Quartz can be duplicated in the crucible.");
|
||||
|
||||
this.force_TC_Facades = this.configSettings.getBoolean(
|
||||
"Force TC Facades",
|
||||
CATEGORY_CRAFTING, DFT_FORCE_TC_FACADES,
|
||||
"When enabled, overwrites the AE2 facade settings for some Thaumcraft blocks, allowing their facades to be crafted." );
|
||||
this.enable_Wrench_Focus = this.configSettings.getBoolean(
|
||||
"Wrench Focus",
|
||||
CATEGORY_CRAFTING,
|
||||
DFT_ENABLE_WRENCH_FOCUS,
|
||||
"Controls if the Wrench Focus is enabled and craftable.");
|
||||
|
||||
// Client ==========================================================
|
||||
this.disable_Gearbox = this.configSettings.getBoolean(
|
||||
"Disable Gearbox Model",
|
||||
CATEGORY_CLIENT, DFT_DISABLE_GEARBOX,
|
||||
"The iron and thaumium gearboxes will be rendered as a standard block." );
|
||||
this.force_TC_Facades = this.configSettings.getBoolean(
|
||||
"Force TC Facades",
|
||||
CATEGORY_CRAFTING,
|
||||
DFT_FORCE_TC_FACADES,
|
||||
"When enabled, overwrites the AE2 facade settings for some Thaumcraft blocks, allowing their facades to be crafted.");
|
||||
|
||||
// Integration =====================================================
|
||||
this.extracells_Blist = this.configSettings.getBoolean(
|
||||
"ExtraCells Blacklist",
|
||||
CATEGORY_INTEGRATION, DFT_EXTRACELLS_BLIST,
|
||||
"Prevents extra cells from interacting with essentia gas" );
|
||||
// Client ==========================================================
|
||||
this.disable_Gearbox = this.configSettings.getBoolean(
|
||||
"Disable Gearbox Model",
|
||||
CATEGORY_CLIENT,
|
||||
DFT_DISABLE_GEARBOX,
|
||||
"The iron and thaumium gearboxes will be rendered as a standard block.");
|
||||
|
||||
// Has the config file changed?
|
||||
if( this.configSettings.hasChanged() )
|
||||
{
|
||||
// Save it
|
||||
this.configSettings.save();
|
||||
}
|
||||
}
|
||||
// Integration =====================================================
|
||||
this.extracells_Blist = this.configSettings.getBoolean(
|
||||
"ExtraCells Blacklist",
|
||||
CATEGORY_INTEGRATION,
|
||||
DFT_EXTRACELLS_BLIST,
|
||||
"Prevents extra cells from interacting with essentia gas");
|
||||
|
||||
@Override
|
||||
public boolean blacklistEssentiaFluidInExtraCells()
|
||||
{
|
||||
return this.extracells_Blist;
|
||||
}
|
||||
// Has the config file changed?
|
||||
if (this.configSettings.hasChanged()) {
|
||||
// Save it
|
||||
this.configSettings.save();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int conversionMultiplier()
|
||||
{
|
||||
return this.conversionMultiplier;
|
||||
}
|
||||
@Override
|
||||
public boolean blacklistEssentiaFluidInExtraCells() {
|
||||
return this.extracells_Blist;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean craftArcaneAssembler()
|
||||
{
|
||||
return this.craft_Arcane_Assembler;
|
||||
}
|
||||
@Override
|
||||
public int conversionMultiplier() {
|
||||
return this.conversionMultiplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean craftArcaneCraftingTerminal()
|
||||
{
|
||||
return this.craft_Arcane_Crafting_Term;
|
||||
}
|
||||
@Override
|
||||
public boolean craftArcaneAssembler() {
|
||||
return this.craft_Arcane_Assembler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean craftDistillationPatternEncoder()
|
||||
{
|
||||
return this.craft_Distillation_Pattern_Encoder;
|
||||
}
|
||||
@Override
|
||||
public boolean craftArcaneCraftingTerminal() {
|
||||
return this.craft_Arcane_Crafting_Term;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean craftEssentiaCells()
|
||||
{
|
||||
return this.craft_Essentia_Cells;
|
||||
}
|
||||
@Override
|
||||
public boolean craftDistillationPatternEncoder() {
|
||||
return this.craft_Distillation_Pattern_Encoder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean craftEssentiaProvider()
|
||||
{
|
||||
return this.craft_Essentia_Provider;
|
||||
}
|
||||
@Override
|
||||
public boolean craftEssentiaCells() {
|
||||
return this.craft_Essentia_Cells;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean craftEssentiaVibrationChamber()
|
||||
{
|
||||
return this.craft_Essentia_Vibration_Chamber;
|
||||
}
|
||||
@Override
|
||||
public boolean craftEssentiaProvider() {
|
||||
return this.craft_Essentia_Provider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean craftGolemWifiBackpack()
|
||||
{
|
||||
return this.craft_GolemBackpack;
|
||||
}
|
||||
@Override
|
||||
public boolean craftEssentiaVibrationChamber() {
|
||||
return this.craft_Essentia_Vibration_Chamber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean craftInfusionProvider()
|
||||
{
|
||||
return this.craft_Infusion_Provider;
|
||||
}
|
||||
@Override
|
||||
public boolean craftGolemWifiBackpack() {
|
||||
return this.craft_GolemBackpack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean craftIOBuses()
|
||||
{
|
||||
return this.craft_IO_Buses;
|
||||
}
|
||||
@Override
|
||||
public boolean craftInfusionProvider() {
|
||||
return this.craft_Infusion_Provider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean craftVisRelayInterface()
|
||||
{
|
||||
return this.craft_Vis_Relay_Interface;
|
||||
}
|
||||
@Override
|
||||
public boolean craftIOBuses() {
|
||||
return this.craft_IO_Buses;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean craftWirelessEssentiaTerminal()
|
||||
{
|
||||
return this.craft_Wireless_Essentia_Term;
|
||||
}
|
||||
@Override
|
||||
public boolean craftVisRelayInterface() {
|
||||
return this.craft_Vis_Relay_Interface;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean disableGearboxModel()
|
||||
{
|
||||
return this.disable_Gearbox;
|
||||
}
|
||||
@Override
|
||||
public boolean craftWirelessEssentiaTerminal() {
|
||||
return this.craft_Wireless_Essentia_Term;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean enableCertusQuartzDupe()
|
||||
{
|
||||
return this.enable_Quartz_Dupe;
|
||||
}
|
||||
@Override
|
||||
public boolean disableGearboxModel() {
|
||||
return this.disable_Gearbox;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean enableWrenchFocus()
|
||||
{
|
||||
return this.enable_Wrench_Focus;
|
||||
}
|
||||
@Override
|
||||
public boolean enableCertusQuartzDupe() {
|
||||
return this.enable_Quartz_Dupe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean forceTCFacades()
|
||||
{
|
||||
return this.force_TC_Facades;
|
||||
}
|
||||
@Override
|
||||
public boolean enableWrenchFocus() {
|
||||
return this.enable_Wrench_Focus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean forceTCFacades() {
|
||||
return this.force_TC_Facades;
|
||||
}
|
||||
}
|
||||
@@ -23,433 +23,419 @@ import thaumicenergistics.common.parts.ThEPartBase;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public class ThEGuiHandler
|
||||
implements IGuiHandler
|
||||
{
|
||||
// ID's between 0 and this number indicate that they are AE parts
|
||||
private static final int DIRECTION_OFFSET = ForgeDirection.values().length;
|
||||
|
||||
// ID's must increase in values of 10
|
||||
private static final int ID_STEP_VALUE = 10;
|
||||
|
||||
/**
|
||||
* Singular ID of the essentia cell gui
|
||||
*/
|
||||
public static final int ESSENTIA_CELL_ID = ThEGuiHandler.ID_STEP_VALUE * 1;
|
||||
|
||||
/**
|
||||
* Base ID of the priority gui.
|
||||
* Add the ForgeDirection's side ordinal to this value.
|
||||
*/
|
||||
public static final int PRIORITY_ID = ThEGuiHandler.ID_STEP_VALUE * 2;
|
||||
|
||||
/**
|
||||
* ID of the essentia cell workbench
|
||||
*/
|
||||
public static final int CELL_WORKBENCH_ID = ThEGuiHandler.ID_STEP_VALUE * 3;
|
||||
|
||||
/**
|
||||
* ID of the wireless terminal gui.
|
||||
*/
|
||||
public static final int WIRELESS_TERMINAL_ID = ThEGuiHandler.ID_STEP_VALUE * 4;
|
||||
|
||||
/**
|
||||
* ID of the arcane assembler gui.
|
||||
*/
|
||||
public static final int ARCANE_ASSEMBLER_ID = ThEGuiHandler.ID_STEP_VALUE * 5;
|
||||
|
||||
/**
|
||||
* ID of the knowledge inscriber gui.
|
||||
*/
|
||||
public static final int KNOWLEDGE_INSCRIBER = ThEGuiHandler.ID_STEP_VALUE * 6;
|
||||
|
||||
/**
|
||||
* ID of the knowledge inscriber gui.
|
||||
*/
|
||||
public static final int ESSENTIA_VIBRATION_CHAMBER = ThEGuiHandler.ID_STEP_VALUE * 7;
|
||||
|
||||
/**
|
||||
* ID of the auto crafting amount bridge.
|
||||
* When calling this make sure the current container implements ICraftingIssuerContainer,
|
||||
* or extends AEBaseContainer with the target set to an ICraftingIssuerHost.
|
||||
*/
|
||||
public static final int AUTO_CRAFTING_AMOUNT = ThEGuiHandler.ID_STEP_VALUE * 8;
|
||||
|
||||
/**
|
||||
* ID of the auto crafting confirm bridge.
|
||||
* When calling this make sure the current container extends
|
||||
* AEBaseContainer with the target set to an ICraftingIssuerHost.
|
||||
*/
|
||||
public static final int AUTO_CRAFTING_CONFIRM = ThEGuiHandler.ID_STEP_VALUE * 9;
|
||||
|
||||
/**
|
||||
* ID of the distillation encoder.
|
||||
*/
|
||||
public static final int DISTILLATION_ENCODER = ThEGuiHandler.ID_STEP_VALUE * 10;
|
||||
|
||||
/**
|
||||
* Extra data used for some GUI calls.
|
||||
*/
|
||||
private static Object[] extraData = null;
|
||||
|
||||
/**
|
||||
* Gets the crafting issuer host or null.
|
||||
*
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
private static ICraftingIssuerHost getCraftingIssuerHost( final EntityPlayer player )
|
||||
{
|
||||
// Is the currently opened container a crafting issuer container?
|
||||
if( player.openContainer instanceof ICraftingIssuerContainer )
|
||||
{
|
||||
// Return the issuer
|
||||
return ( (ICraftingIssuerContainer)player.openContainer ).getCraftingHost();
|
||||
}
|
||||
|
||||
// Is the currently opened container an AE base container?
|
||||
if( player.openContainer instanceof AEBaseContainer )
|
||||
{
|
||||
// Get the target
|
||||
Object target = ( (AEBaseContainer)player.openContainer ).getTarget();
|
||||
|
||||
// Is the target an ICraftingIssuerHost?
|
||||
if( target instanceof ICraftingIssuerHost )
|
||||
{
|
||||
return (ICraftingIssuerHost)target;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the AE part at the specified location.
|
||||
*
|
||||
* @param tileSide
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @return
|
||||
*/
|
||||
private static IPart getPart( final ForgeDirection tileSide, final World world, final int x, final int y, final int z )
|
||||
{
|
||||
// Get the host at the specified position
|
||||
IPartHost partHost = (IPartHost)( world.getTileEntity( x, y, z ) );
|
||||
|
||||
// Ensure we got a host
|
||||
if( partHost == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Get the part from the host
|
||||
return( partHost.getPart( tileSide ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sided part for the GUI ID.
|
||||
*
|
||||
* @param ID
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @return
|
||||
*/
|
||||
private static IPart getPartFromSidedID( final int ID, final World world, final int x, final int y, final int z )
|
||||
{
|
||||
ForgeDirection side = ForgeDirection.getOrientation( ID % ThEGuiHandler.ID_STEP_VALUE );
|
||||
return ThEGuiHandler.getPart( side, world, x, y, z );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the gui element for the AE part at the specified location
|
||||
*
|
||||
* @param tileSide
|
||||
* @param player
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param isServerSide
|
||||
* @return
|
||||
*/
|
||||
private static Object getPartGuiElement( final ForgeDirection tileSide, final EntityPlayer player, final World world, final int x, final int y,
|
||||
final int z, final boolean isServerSide )
|
||||
{
|
||||
// Get the part
|
||||
ThEPartBase part = (ThEPartBase)ThEGuiHandler.getPart( tileSide, world, x, y, z );
|
||||
|
||||
// Ensure we got the part
|
||||
if( part == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Is this server side?
|
||||
if( isServerSide )
|
||||
{
|
||||
// Ask the part for its server element
|
||||
return part.getServerGuiElement( player );
|
||||
}
|
||||
|
||||
// Ask the part for its client element
|
||||
return part.getClientGuiElement( player );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the specified ID is within the base range.
|
||||
*
|
||||
* @param BaseID
|
||||
* @param ID
|
||||
* @return
|
||||
*/
|
||||
private static boolean isIDInRange( final int ID, final int BaseID )
|
||||
{
|
||||
return( ( ID >= BaseID ) && ( ID < ( BaseID + ThEGuiHandler.ID_STEP_VALUE ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to properly generate a GUI ID that
|
||||
* includes a forge direction.
|
||||
*
|
||||
* @param ID
|
||||
* @param side
|
||||
* @return
|
||||
*/
|
||||
public static int generateSidedID( final int ID, final ForgeDirection side )
|
||||
{
|
||||
return ID + side.ordinal();
|
||||
}
|
||||
|
||||
/**
|
||||
* Launches a non AE part gui.
|
||||
*
|
||||
* @param ID
|
||||
* @param player
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
*/
|
||||
public static void launchGui( final int ID, final EntityPlayer player, final World world, final int x, final int y, final int z )
|
||||
{
|
||||
player.openGui( ThaumicEnergistics.INSTANCE, ID + ThEGuiHandler.DIRECTION_OFFSET, world, x, y, z );
|
||||
}
|
||||
|
||||
/**
|
||||
* Launches a non AE part gui with the specified extra data.
|
||||
*
|
||||
* @param ID
|
||||
* @param player
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param extraData
|
||||
*/
|
||||
public static void launchGui( final int ID, final EntityPlayer player, final World world, final int x, final int y, final int z,
|
||||
final Object[] extraData )
|
||||
{
|
||||
ThEGuiHandler.extraData = extraData;
|
||||
player.openGui( ThaumicEnergistics.INSTANCE, ID + ThEGuiHandler.DIRECTION_OFFSET, world, x, y, z );
|
||||
ThEGuiHandler.extraData = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Launches an AE part gui
|
||||
*
|
||||
* @param part
|
||||
* @param player
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
*/
|
||||
public static void launchGui( final ThEPartBase part, final EntityPlayer player, final World world, final int x, final int y, final int z )
|
||||
{
|
||||
// Ensure the player is allowed to open the gui
|
||||
if( part.isPartUseableByPlayer( player ) )
|
||||
{
|
||||
player.openGui( ThaumicEnergistics.INSTANCE, part.getSide().ordinal(), world, x, y, z );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement( int ID, final EntityPlayer player, final World world, final int x, final int y, final int z )
|
||||
{
|
||||
// Is the ID a forge direction?
|
||||
ForgeDirection side = ForgeDirection.getOrientation( ID );
|
||||
|
||||
// Do we have a world and side?
|
||||
if( ( world != null ) && ( side != ForgeDirection.UNKNOWN ) )
|
||||
{
|
||||
// This is an AE part, get its gui
|
||||
return ThEGuiHandler.getPartGuiElement( side, player, world, x, y, z, false );
|
||||
}
|
||||
|
||||
// This is not an AE part, adjust the ID
|
||||
ID -= ThEGuiHandler.DIRECTION_OFFSET;
|
||||
|
||||
// Check basic ID's
|
||||
switch ( ID )
|
||||
{
|
||||
// Is this the essentia cell?
|
||||
case ThEGuiHandler.ESSENTIA_CELL_ID:
|
||||
return GuiEssentiaCellTerminal.NewEssentiaCellGui( player, world, x, y, z );
|
||||
|
||||
// Is this the cell workbench?
|
||||
case ThEGuiHandler.CELL_WORKBENCH_ID:
|
||||
return new GuiEssentiaCellWorkbench( player, world, x, y, z );
|
||||
|
||||
// Is this the wireless gui?
|
||||
case ThEGuiHandler.WIRELESS_TERMINAL_ID:
|
||||
return GuiEssentiaCellTerminal.NewWirelessEssentiaTerminalGui( player );
|
||||
|
||||
// Is this the arcane assembler?
|
||||
case ThEGuiHandler.ARCANE_ASSEMBLER_ID:
|
||||
return new GuiArcaneAssembler( 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 );
|
||||
|
||||
// Distillation encoder?
|
||||
case ThEGuiHandler.DISTILLATION_ENCODER:
|
||||
return new GuiDistillationPatternEncoder( player, world, x, y, z );
|
||||
|
||||
// AE2 Autocrafting Amount?
|
||||
case ThEGuiHandler.AUTO_CRAFTING_AMOUNT:
|
||||
ICraftingIssuerHost amountHost = ThEGuiHandler.getCraftingIssuerHost( player );
|
||||
if( amountHost != null )
|
||||
{
|
||||
return new GuiCraftAmountBridge( player, amountHost );
|
||||
}
|
||||
return null;
|
||||
|
||||
// AE2 Autocrafting Confirm?
|
||||
case ThEGuiHandler.AUTO_CRAFTING_CONFIRM:
|
||||
ICraftingIssuerHost confirmHost = ThEGuiHandler.getCraftingIssuerHost( player );
|
||||
if( confirmHost != null )
|
||||
{
|
||||
return new GuiCraftConfirmBridge( player, confirmHost );
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
// Is this the priority window?
|
||||
if( ThEGuiHandler.isIDInRange( ID, ThEGuiHandler.PRIORITY_ID ) )
|
||||
{
|
||||
// Get the part
|
||||
IPart part = ThEGuiHandler.getPartFromSidedID( ID, world, x, y, z );
|
||||
|
||||
// Ensure we got the part, and that it implements IPriortyHost
|
||||
if( ( part == null ) || !( part instanceof IPriorityHost ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return the gui
|
||||
return new GuiPriority( (IPriorityHost)part, player );
|
||||
}
|
||||
|
||||
// No matching GUI element found
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement( int ID, final EntityPlayer player, final World world, final int x, final int y, final int z )
|
||||
{
|
||||
// Is the ID a forge Direction?
|
||||
ForgeDirection side = ForgeDirection.getOrientation( ID );
|
||||
|
||||
// Do we have a world and side?
|
||||
if( ( world != null ) && ( side != ForgeDirection.UNKNOWN ) )
|
||||
{
|
||||
// This is an AE part, get its gui
|
||||
return ThEGuiHandler.getPartGuiElement( side, player, world, x, y, z, true );
|
||||
}
|
||||
|
||||
// This is not an AE part, adjust the ID
|
||||
ID -= ThEGuiHandler.DIRECTION_OFFSET;
|
||||
|
||||
switch ( ID )
|
||||
{
|
||||
// Is this the essentia cell?
|
||||
case ThEGuiHandler.ESSENTIA_CELL_ID:
|
||||
return new ContainerEssentiaCell( player, world, x, y, z );
|
||||
|
||||
// Is this the cell workbench?
|
||||
case ThEGuiHandler.CELL_WORKBENCH_ID:
|
||||
return new ContainerEssentiaCellWorkbench( player, world, x, y, z );
|
||||
|
||||
// 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?
|
||||
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 );
|
||||
|
||||
// Distillation encoder?
|
||||
case ThEGuiHandler.DISTILLATION_ENCODER:
|
||||
return new ContainerDistillationPatternEncoder( player, world, x, y, z );
|
||||
|
||||
// AE2 Autocrafting Amount?
|
||||
case ThEGuiHandler.AUTO_CRAFTING_AMOUNT:
|
||||
ICraftingIssuerHost amountHost = ThEGuiHandler.getCraftingIssuerHost( player );
|
||||
if( amountHost != null )
|
||||
{
|
||||
return new ContainerCraftAmount( player.inventory, amountHost );
|
||||
}
|
||||
return null;
|
||||
|
||||
// AE2 Autocrafting Confirm?
|
||||
case ThEGuiHandler.AUTO_CRAFTING_CONFIRM:
|
||||
ICraftingIssuerHost confirmHost = ThEGuiHandler.getCraftingIssuerHost( player );
|
||||
if( confirmHost != null )
|
||||
{
|
||||
return new ContainerCraftConfirm( player.inventory, confirmHost );
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
// Is this the priority window?
|
||||
if( ThEGuiHandler.isIDInRange( ID, ThEGuiHandler.PRIORITY_ID ) )
|
||||
{
|
||||
// Get the part
|
||||
IPart part = ThEGuiHandler.getPartFromSidedID( ID, world, x, y, z );
|
||||
|
||||
// Ensure we got the part, and that it implements IPriortyHost
|
||||
if( ( part == null ) || !( part instanceof IPriorityHost ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return the container
|
||||
return new ContainerPriority( (IPriorityHost)part, player );
|
||||
|
||||
}
|
||||
|
||||
// No matching GUI element found
|
||||
return null;
|
||||
}
|
||||
public class ThEGuiHandler implements IGuiHandler {
|
||||
// ID's between 0 and this number indicate that they are AE parts
|
||||
private static final int DIRECTION_OFFSET = ForgeDirection.values().length;
|
||||
|
||||
// ID's must increase in values of 10
|
||||
private static final int ID_STEP_VALUE = 10;
|
||||
|
||||
/**
|
||||
* Singular ID of the essentia cell gui
|
||||
*/
|
||||
public static final int ESSENTIA_CELL_ID = ThEGuiHandler.ID_STEP_VALUE * 1;
|
||||
|
||||
/**
|
||||
* Base ID of the priority gui.
|
||||
* Add the ForgeDirection's side ordinal to this value.
|
||||
*/
|
||||
public static final int PRIORITY_ID = ThEGuiHandler.ID_STEP_VALUE * 2;
|
||||
|
||||
/**
|
||||
* ID of the essentia cell workbench
|
||||
*/
|
||||
public static final int CELL_WORKBENCH_ID = ThEGuiHandler.ID_STEP_VALUE * 3;
|
||||
|
||||
/**
|
||||
* ID of the wireless terminal gui.
|
||||
*/
|
||||
public static final int WIRELESS_TERMINAL_ID = ThEGuiHandler.ID_STEP_VALUE * 4;
|
||||
|
||||
/**
|
||||
* ID of the arcane assembler gui.
|
||||
*/
|
||||
public static final int ARCANE_ASSEMBLER_ID = ThEGuiHandler.ID_STEP_VALUE * 5;
|
||||
|
||||
/**
|
||||
* ID of the knowledge inscriber gui.
|
||||
*/
|
||||
public static final int KNOWLEDGE_INSCRIBER = ThEGuiHandler.ID_STEP_VALUE * 6;
|
||||
|
||||
/**
|
||||
* ID of the knowledge inscriber gui.
|
||||
*/
|
||||
public static final int ESSENTIA_VIBRATION_CHAMBER = ThEGuiHandler.ID_STEP_VALUE * 7;
|
||||
|
||||
/**
|
||||
* ID of the auto crafting amount bridge.
|
||||
* When calling this make sure the current container implements ICraftingIssuerContainer,
|
||||
* or extends AEBaseContainer with the target set to an ICraftingIssuerHost.
|
||||
*/
|
||||
public static final int AUTO_CRAFTING_AMOUNT = ThEGuiHandler.ID_STEP_VALUE * 8;
|
||||
|
||||
/**
|
||||
* ID of the auto crafting confirm bridge.
|
||||
* When calling this make sure the current container extends
|
||||
* AEBaseContainer with the target set to an ICraftingIssuerHost.
|
||||
*/
|
||||
public static final int AUTO_CRAFTING_CONFIRM = ThEGuiHandler.ID_STEP_VALUE * 9;
|
||||
|
||||
/**
|
||||
* ID of the distillation encoder.
|
||||
*/
|
||||
public static final int DISTILLATION_ENCODER = ThEGuiHandler.ID_STEP_VALUE * 10;
|
||||
|
||||
/**
|
||||
* Extra data used for some GUI calls.
|
||||
*/
|
||||
private static Object[] extraData = null;
|
||||
|
||||
/**
|
||||
* Gets the crafting issuer host or null.
|
||||
*
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
private static ICraftingIssuerHost getCraftingIssuerHost(final EntityPlayer player) {
|
||||
// Is the currently opened container a crafting issuer container?
|
||||
if (player.openContainer instanceof ICraftingIssuerContainer) {
|
||||
// Return the issuer
|
||||
return ((ICraftingIssuerContainer) player.openContainer).getCraftingHost();
|
||||
}
|
||||
|
||||
// Is the currently opened container an AE base container?
|
||||
if (player.openContainer instanceof AEBaseContainer) {
|
||||
// Get the target
|
||||
Object target = ((AEBaseContainer) player.openContainer).getTarget();
|
||||
|
||||
// Is the target an ICraftingIssuerHost?
|
||||
if (target instanceof ICraftingIssuerHost) {
|
||||
return (ICraftingIssuerHost) target;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the AE part at the specified location.
|
||||
*
|
||||
* @param tileSide
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @return
|
||||
*/
|
||||
private static IPart getPart(
|
||||
final ForgeDirection tileSide, final World world, final int x, final int y, final int z) {
|
||||
// Get the host at the specified position
|
||||
IPartHost partHost = (IPartHost) (world.getTileEntity(x, y, z));
|
||||
|
||||
// Ensure we got a host
|
||||
if (partHost == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Get the part from the host
|
||||
return (partHost.getPart(tileSide));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sided part for the GUI ID.
|
||||
*
|
||||
* @param ID
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @return
|
||||
*/
|
||||
private static IPart getPartFromSidedID(final int ID, final World world, final int x, final int y, final int z) {
|
||||
ForgeDirection side = ForgeDirection.getOrientation(ID % ThEGuiHandler.ID_STEP_VALUE);
|
||||
return ThEGuiHandler.getPart(side, world, x, y, z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the gui element for the AE part at the specified location
|
||||
*
|
||||
* @param tileSide
|
||||
* @param player
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param isServerSide
|
||||
* @return
|
||||
*/
|
||||
private static Object getPartGuiElement(
|
||||
final ForgeDirection tileSide,
|
||||
final EntityPlayer player,
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z,
|
||||
final boolean isServerSide) {
|
||||
// Get the part
|
||||
ThEPartBase part = (ThEPartBase) ThEGuiHandler.getPart(tileSide, world, x, y, z);
|
||||
|
||||
// Ensure we got the part
|
||||
if (part == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Is this server side?
|
||||
if (isServerSide) {
|
||||
// Ask the part for its server element
|
||||
return part.getServerGuiElement(player);
|
||||
}
|
||||
|
||||
// Ask the part for its client element
|
||||
return part.getClientGuiElement(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the specified ID is within the base range.
|
||||
*
|
||||
* @param BaseID
|
||||
* @param ID
|
||||
* @return
|
||||
*/
|
||||
private static boolean isIDInRange(final int ID, final int BaseID) {
|
||||
return ((ID >= BaseID) && (ID < (BaseID + ThEGuiHandler.ID_STEP_VALUE)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to properly generate a GUI ID that
|
||||
* includes a forge direction.
|
||||
*
|
||||
* @param ID
|
||||
* @param side
|
||||
* @return
|
||||
*/
|
||||
public static int generateSidedID(final int ID, final ForgeDirection side) {
|
||||
return ID + side.ordinal();
|
||||
}
|
||||
|
||||
/**
|
||||
* Launches a non AE part gui.
|
||||
*
|
||||
* @param ID
|
||||
* @param player
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
*/
|
||||
public static void launchGui(
|
||||
final int ID, final EntityPlayer player, final World world, final int x, final int y, final int z) {
|
||||
player.openGui(ThaumicEnergistics.INSTANCE, ID + ThEGuiHandler.DIRECTION_OFFSET, world, x, y, z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Launches a non AE part gui with the specified extra data.
|
||||
*
|
||||
* @param ID
|
||||
* @param player
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param extraData
|
||||
*/
|
||||
public static void launchGui(
|
||||
final int ID,
|
||||
final EntityPlayer player,
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z,
|
||||
final Object[] extraData) {
|
||||
ThEGuiHandler.extraData = extraData;
|
||||
player.openGui(ThaumicEnergistics.INSTANCE, ID + ThEGuiHandler.DIRECTION_OFFSET, world, x, y, z);
|
||||
ThEGuiHandler.extraData = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Launches an AE part gui
|
||||
*
|
||||
* @param part
|
||||
* @param player
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
*/
|
||||
public static void launchGui(
|
||||
final ThEPartBase part,
|
||||
final EntityPlayer player,
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z) {
|
||||
// Ensure the player is allowed to open the gui
|
||||
if (part.isPartUseableByPlayer(player)) {
|
||||
player.openGui(ThaumicEnergistics.INSTANCE, part.getSide().ordinal(), world, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(
|
||||
int ID, final EntityPlayer player, final World world, final int x, final int y, final int z) {
|
||||
// Is the ID a forge direction?
|
||||
ForgeDirection side = ForgeDirection.getOrientation(ID);
|
||||
|
||||
// Do we have a world and side?
|
||||
if ((world != null) && (side != ForgeDirection.UNKNOWN)) {
|
||||
// This is an AE part, get its gui
|
||||
return ThEGuiHandler.getPartGuiElement(side, player, world, x, y, z, false);
|
||||
}
|
||||
|
||||
// This is not an AE part, adjust the ID
|
||||
ID -= ThEGuiHandler.DIRECTION_OFFSET;
|
||||
|
||||
// Check basic ID's
|
||||
switch (ID) {
|
||||
// Is this the essentia cell?
|
||||
case ThEGuiHandler.ESSENTIA_CELL_ID:
|
||||
return GuiEssentiaCellTerminal.NewEssentiaCellGui(player, world, x, y, z);
|
||||
|
||||
// Is this the cell workbench?
|
||||
case ThEGuiHandler.CELL_WORKBENCH_ID:
|
||||
return new GuiEssentiaCellWorkbench(player, world, x, y, z);
|
||||
|
||||
// Is this the wireless gui?
|
||||
case ThEGuiHandler.WIRELESS_TERMINAL_ID:
|
||||
return GuiEssentiaCellTerminal.NewWirelessEssentiaTerminalGui(player);
|
||||
|
||||
// Is this the arcane assembler?
|
||||
case ThEGuiHandler.ARCANE_ASSEMBLER_ID:
|
||||
return new GuiArcaneAssembler(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);
|
||||
|
||||
// Distillation encoder?
|
||||
case ThEGuiHandler.DISTILLATION_ENCODER:
|
||||
return new GuiDistillationPatternEncoder(player, world, x, y, z);
|
||||
|
||||
// AE2 Autocrafting Amount?
|
||||
case ThEGuiHandler.AUTO_CRAFTING_AMOUNT:
|
||||
ICraftingIssuerHost amountHost = ThEGuiHandler.getCraftingIssuerHost(player);
|
||||
if (amountHost != null) {
|
||||
return new GuiCraftAmountBridge(player, amountHost);
|
||||
}
|
||||
return null;
|
||||
|
||||
// AE2 Autocrafting Confirm?
|
||||
case ThEGuiHandler.AUTO_CRAFTING_CONFIRM:
|
||||
ICraftingIssuerHost confirmHost = ThEGuiHandler.getCraftingIssuerHost(player);
|
||||
if (confirmHost != null) {
|
||||
return new GuiCraftConfirmBridge(player, confirmHost);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Is this the priority window?
|
||||
if (ThEGuiHandler.isIDInRange(ID, ThEGuiHandler.PRIORITY_ID)) {
|
||||
// Get the part
|
||||
IPart part = ThEGuiHandler.getPartFromSidedID(ID, world, x, y, z);
|
||||
|
||||
// Ensure we got the part, and that it implements IPriortyHost
|
||||
if ((part == null) || !(part instanceof IPriorityHost)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return the gui
|
||||
return new GuiPriority((IPriorityHost) part, player);
|
||||
}
|
||||
|
||||
// No matching GUI element found
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(
|
||||
int ID, final EntityPlayer player, final World world, final int x, final int y, final int z) {
|
||||
// Is the ID a forge Direction?
|
||||
ForgeDirection side = ForgeDirection.getOrientation(ID);
|
||||
|
||||
// Do we have a world and side?
|
||||
if ((world != null) && (side != ForgeDirection.UNKNOWN)) {
|
||||
// This is an AE part, get its gui
|
||||
return ThEGuiHandler.getPartGuiElement(side, player, world, x, y, z, true);
|
||||
}
|
||||
|
||||
// This is not an AE part, adjust the ID
|
||||
ID -= ThEGuiHandler.DIRECTION_OFFSET;
|
||||
|
||||
switch (ID) {
|
||||
// Is this the essentia cell?
|
||||
case ThEGuiHandler.ESSENTIA_CELL_ID:
|
||||
return new ContainerEssentiaCell(player, world, x, y, z);
|
||||
|
||||
// Is this the cell workbench?
|
||||
case ThEGuiHandler.CELL_WORKBENCH_ID:
|
||||
return new ContainerEssentiaCellWorkbench(player, world, x, y, z);
|
||||
|
||||
// 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?
|
||||
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);
|
||||
|
||||
// Distillation encoder?
|
||||
case ThEGuiHandler.DISTILLATION_ENCODER:
|
||||
return new ContainerDistillationPatternEncoder(player, world, x, y, z);
|
||||
|
||||
// AE2 Autocrafting Amount?
|
||||
case ThEGuiHandler.AUTO_CRAFTING_AMOUNT:
|
||||
ICraftingIssuerHost amountHost = ThEGuiHandler.getCraftingIssuerHost(player);
|
||||
if (amountHost != null) {
|
||||
return new ContainerCraftAmount(player.inventory, amountHost);
|
||||
}
|
||||
return null;
|
||||
|
||||
// AE2 Autocrafting Confirm?
|
||||
case ThEGuiHandler.AUTO_CRAFTING_CONFIRM:
|
||||
ICraftingIssuerHost confirmHost = ThEGuiHandler.getCraftingIssuerHost(player);
|
||||
if (confirmHost != null) {
|
||||
return new ContainerCraftConfirm(player.inventory, confirmHost);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Is this the priority window?
|
||||
if (ThEGuiHandler.isIDInRange(ID, ThEGuiHandler.PRIORITY_ID)) {
|
||||
// Get the part
|
||||
IPart part = ThEGuiHandler.getPartFromSidedID(ID, world, x, y, z);
|
||||
|
||||
// Ensure we got the part, and that it implements IPriortyHost
|
||||
if ((part == null) || !(part instanceof IPriorityHost)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return the container
|
||||
return new ContainerPriority((IPriorityHost) part, player);
|
||||
}
|
||||
|
||||
// No matching GUI element found
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -33,177 +33,173 @@ import thaumicenergistics.common.utils.ThELog;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
@Mod(modid = ThaumicEnergistics.MOD_ID, name = "Thaumic Energistics", version = ThaumicEnergistics.VERSION, dependencies = "required-after:ThE-core;required-after:appliedenergistics2@[rv3-beta-116,);required-after:Thaumcraft@[4.2.3.5,);after:Waila;after:extracells")
|
||||
public class ThaumicEnergistics
|
||||
{
|
||||
/**
|
||||
* What loading state Thaumic Energistics has completed.
|
||||
*/
|
||||
private static LoaderState ThEState = LoaderState.NOINIT;
|
||||
@Mod(
|
||||
modid = ThaumicEnergistics.MOD_ID,
|
||||
name = "Thaumic Energistics",
|
||||
version = ThaumicEnergistics.VERSION,
|
||||
dependencies =
|
||||
"required-after:ThE-core;required-after:appliedenergistics2@[rv3-beta-116,);required-after:Thaumcraft@[4.2.3.5,);after:Waila;after:extracells")
|
||||
public class ThaumicEnergistics {
|
||||
/**
|
||||
* What loading state Thaumic Energistics has completed.
|
||||
*/
|
||||
private static LoaderState ThEState = LoaderState.NOINIT;
|
||||
|
||||
/**
|
||||
* String ID of the mod.
|
||||
*/
|
||||
public static final String MOD_ID = "thaumicenergistics";
|
||||
/**
|
||||
* String ID of the mod.
|
||||
*/
|
||||
public static final String MOD_ID = "thaumicenergistics";
|
||||
|
||||
/**
|
||||
* Current version of the mod.
|
||||
*/
|
||||
public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
/**
|
||||
* Current version of the mod.
|
||||
*/
|
||||
public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
|
||||
/**
|
||||
* Singleton instance
|
||||
*/
|
||||
@Instance(value = ThaumicEnergistics.MOD_ID)
|
||||
public static ThaumicEnergistics INSTANCE;
|
||||
/**
|
||||
* Singleton instance
|
||||
*/
|
||||
@Instance(value = ThaumicEnergistics.MOD_ID)
|
||||
public static ThaumicEnergistics INSTANCE;
|
||||
|
||||
// Says where the client and server 'proxy' code is loaded.
|
||||
@SidedProxy(clientSide = "thaumicenergistics.client.ClientProxy", serverSide = "thaumicenergistics.common.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
// Says where the client and server 'proxy' code is loaded.
|
||||
@SidedProxy(
|
||||
clientSide = "thaumicenergistics.client.ClientProxy",
|
||||
serverSide = "thaumicenergistics.common.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
/**
|
||||
* Configuration.
|
||||
*/
|
||||
public static IThEConfig config;
|
||||
/**
|
||||
* Configuration.
|
||||
*/
|
||||
public static IThEConfig config;
|
||||
|
||||
/**
|
||||
* Creative tab.
|
||||
*/
|
||||
public static CreativeTabs ThETab = new CreativeTabs( "ThaumicEnergistics" )
|
||||
{
|
||||
/**
|
||||
* Creative tab.
|
||||
*/
|
||||
public static CreativeTabs ThETab = new CreativeTabs("ThaumicEnergistics") {
|
||||
|
||||
@Override
|
||||
public ItemStack getIconItemStack()
|
||||
{
|
||||
return ThEApi.instance().blocks().InfusionProvider.getStack();
|
||||
}
|
||||
@Override
|
||||
public ItemStack getIconItemStack() {
|
||||
return ThEApi.instance().blocks().InfusionProvider.getStack();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getTabIconItem()
|
||||
{
|
||||
return ThEApi.instance().blocks().InfusionProvider.getItem();
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public Item getTabIconItem() {
|
||||
return ThEApi.instance().blocks().InfusionProvider.getItem();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets what state/phase of loading that ThE has <strong>completed</strong>.<br>
|
||||
* NOINIT: PreInit has not yet been called<br>
|
||||
* PREINITIALIZATION: PreInit has finished.<br>
|
||||
* INITIALIZATION: Load has finished.<br>
|
||||
* POSTINITIALIZATION: PostInit has finished, ThE is fully loaded.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static LoaderState getLoaderState()
|
||||
{
|
||||
return ThaumicEnergistics.ThEState;
|
||||
}
|
||||
/**
|
||||
* Gets what state/phase of loading that ThE has <strong>completed</strong>.<br>
|
||||
* NOINIT: PreInit has not yet been called<br>
|
||||
* PREINITIALIZATION: PreInit has finished.<br>
|
||||
* INITIALIZATION: Load has finished.<br>
|
||||
* POSTINITIALIZATION: PostInit has finished, ThE is fully loaded.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static LoaderState getLoaderState() {
|
||||
return ThaumicEnergistics.ThEState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the preInit event, and before the post init event.
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
@EventHandler
|
||||
public void load( final FMLInitializationEvent event )
|
||||
{
|
||||
// Mark that ThE is in Init
|
||||
long startTime = ThELog.beginSection( "Load" );
|
||||
/**
|
||||
* Called after the preInit event, and before the post init event.
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
@EventHandler
|
||||
public void load(final FMLInitializationEvent event) {
|
||||
// Mark that ThE is in Init
|
||||
long startTime = ThELog.beginSection("Load");
|
||||
|
||||
// Register block renderers
|
||||
ThaumicEnergistics.proxy.registerRenderers();
|
||||
// Register block renderers
|
||||
ThaumicEnergistics.proxy.registerRenderers();
|
||||
|
||||
// Register tile entities
|
||||
ThaumicEnergistics.proxy.registerTileEntities();
|
||||
// Register tile entities
|
||||
ThaumicEnergistics.proxy.registerTileEntities();
|
||||
|
||||
// Register packets
|
||||
NetworkHandler.registerPackets();
|
||||
// Register packets
|
||||
NetworkHandler.registerPackets();
|
||||
|
||||
// Register integration
|
||||
IntegrationCore.init();
|
||||
// Register integration
|
||||
IntegrationCore.init();
|
||||
|
||||
// Register the essentia grid cache
|
||||
AEApi.instance().registries().gridCache().registerGridCache( IEssentiaGrid.class, GridEssentiaCache.class );
|
||||
// Register the essentia grid cache
|
||||
AEApi.instance().registries().gridCache().registerGridCache(IEssentiaGrid.class, GridEssentiaCache.class);
|
||||
|
||||
// Register the wireless golem handler
|
||||
ThEApi.instance().interact().registerGolemHookHandler( WirelessGolemHandler.getInstance() );
|
||||
// Register the wireless golem handler
|
||||
ThEApi.instance().interact().registerGolemHookHandler(WirelessGolemHandler.getInstance());
|
||||
|
||||
// Mark that ThE has finished Init
|
||||
ThELog.endSection( "Load", startTime );
|
||||
ThaumicEnergistics.ThEState = LoaderState.INITIALIZATION;
|
||||
}
|
||||
// Mark that ThE has finished Init
|
||||
ThELog.endSection("Load", startTime);
|
||||
ThaumicEnergistics.ThEState = LoaderState.INITIALIZATION;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the load event.
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
@EventHandler
|
||||
public void postInit( final FMLPostInitializationEvent event )
|
||||
{
|
||||
// Mark that ThE is in PostInit
|
||||
long startTime = ThELog.beginSection( "PostInit" );
|
||||
/**
|
||||
* Called after the load event.
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
@EventHandler
|
||||
public void postInit(final FMLPostInitializationEvent event) {
|
||||
// Mark that ThE is in PostInit
|
||||
long startTime = ThELog.beginSection("PostInit");
|
||||
|
||||
// Register the standard thaumcraft container items and tiles
|
||||
EssentiaTileContainerHelper.INSTANCE.registerDefaultContainers();
|
||||
EssentiaItemContainerHelper.INSTANCE.registerDefaultContainers();
|
||||
// Register the standard thaumcraft container items and tiles
|
||||
EssentiaTileContainerHelper.INSTANCE.registerDefaultContainers();
|
||||
EssentiaItemContainerHelper.INSTANCE.registerDefaultContainers();
|
||||
|
||||
// Register features
|
||||
ThaumicEnergistics.proxy.registerFeatures();
|
||||
// Register features
|
||||
ThaumicEnergistics.proxy.registerFeatures();
|
||||
|
||||
// Register my tiles with SpatialIO
|
||||
ThaumicEnergistics.proxy.registerSpatialIOMovables();
|
||||
// Register my tiles with SpatialIO
|
||||
ThaumicEnergistics.proxy.registerSpatialIOMovables();
|
||||
|
||||
// Register fluids
|
||||
ThaumicEnergistics.proxy.registerFluids();
|
||||
// Register fluids
|
||||
ThaumicEnergistics.proxy.registerFluids();
|
||||
|
||||
// Give AE items aspects
|
||||
try
|
||||
{
|
||||
AEAspectRegister.INSTANCE.registerAEAspects();
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
ThELog.warning( "Unable to finish aspect registration due to exception:%n%s%n", e.getMessage() );
|
||||
}
|
||||
// Give AE items aspects
|
||||
try {
|
||||
AEAspectRegister.INSTANCE.registerAEAspects();
|
||||
} catch (Exception e) {
|
||||
ThELog.warning("Unable to finish aspect registration due to exception:%n%s%n", e.getMessage());
|
||||
}
|
||||
|
||||
// Mark that ThE has finished PostInit
|
||||
ThELog.endSection( "PostInit", startTime );
|
||||
ThaumicEnergistics.ThEState = LoaderState.POSTINITIALIZATION;
|
||||
}
|
||||
// Mark that ThE has finished PostInit
|
||||
ThELog.endSection("PostInit", startTime);
|
||||
ThaumicEnergistics.ThEState = LoaderState.POSTINITIALIZATION;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called before the load event.
|
||||
*
|
||||
* @param event
|
||||
* @throws Exception
|
||||
*/
|
||||
@EventHandler
|
||||
public void preInit( final FMLPreInitializationEvent event ) throws Exception
|
||||
{
|
||||
// Mark that ThE is in PreInit
|
||||
long startTime = ThELog.beginSection( "PreInit" );
|
||||
/**
|
||||
* Called before the load event.
|
||||
*
|
||||
* @param event
|
||||
* @throws Exception
|
||||
*/
|
||||
@EventHandler
|
||||
public void preInit(final FMLPreInitializationEvent event) throws Exception {
|
||||
// Mark that ThE is in PreInit
|
||||
long startTime = ThELog.beginSection("PreInit");
|
||||
|
||||
// Set the instance
|
||||
ThaumicEnergistics.INSTANCE = this;
|
||||
// Set the instance
|
||||
ThaumicEnergistics.INSTANCE = this;
|
||||
|
||||
// Sync with config
|
||||
ThaumicEnergistics.config = ConfigurationHandler.loadAndSyncConfigFile( event.getSuggestedConfigurationFile() );
|
||||
// Sync with config
|
||||
ThaumicEnergistics.config = ConfigurationHandler.loadAndSyncConfigFile(event.getSuggestedConfigurationFile());
|
||||
|
||||
// Register the gui handler
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler( this, new ThEGuiHandler() );
|
||||
// Register the gui handler
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(this, new ThEGuiHandler());
|
||||
|
||||
// Register items
|
||||
ThaumicEnergistics.proxy.registerItems();
|
||||
// Register items
|
||||
ThaumicEnergistics.proxy.registerItems();
|
||||
|
||||
// Register blocks
|
||||
ThaumicEnergistics.proxy.registerBlocks();
|
||||
// Register blocks
|
||||
ThaumicEnergistics.proxy.registerBlocks();
|
||||
|
||||
// Mark that ThE has finished PreInit
|
||||
ThELog.endSection( "PreInit", startTime );
|
||||
ThaumicEnergistics.ThEState = LoaderState.PREINITIALIZATION;
|
||||
}
|
||||
// Mark that ThE has finished PreInit
|
||||
ThELog.endSection("PreInit", startTime);
|
||||
ThaumicEnergistics.ThEState = LoaderState.PREINITIALIZATION;
|
||||
}
|
||||
|
||||
// TODO: General: Sync server configs
|
||||
// TODO: General: Sync server configs
|
||||
|
||||
}
|
||||
@@ -13,93 +13,89 @@ import net.minecraft.world.World;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractBlockAEWrenchable
|
||||
extends BlockContainer
|
||||
{
|
||||
public abstract class AbstractBlockAEWrenchable extends BlockContainer {
|
||||
|
||||
protected AbstractBlockAEWrenchable( final Material material )
|
||||
{
|
||||
super( material );
|
||||
}
|
||||
protected AbstractBlockAEWrenchable(final Material material) {
|
||||
super(material);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the block is right-clicked
|
||||
*
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
protected boolean onBlockActivated( final World world, final int x, final int y, final int z, final EntityPlayer player )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Called when the block is right-clicked
|
||||
*
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
protected boolean onBlockActivated(
|
||||
final World world, final int x, final int y, final int z, final EntityPlayer player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the block is being removed via AE wrench.
|
||||
* Return an itemstack that represents the block. Can be null.
|
||||
*/
|
||||
protected ItemStack onDismantled( final World world, final int x, final int y, final int z )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Called when the block is being removed via AE wrench.
|
||||
* Return an itemstack that represents the block. Can be null.
|
||||
*/
|
||||
protected ItemStack onDismantled(final World world, final int x, final int y, final int z) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returning false will cancel onBlockActivated.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean canPlayerInteract( final EntityPlayer player )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Returning false will cancel onBlockActivated.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean canPlayerInteract(final EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The block was right-clicked
|
||||
*/
|
||||
@Override
|
||||
public final boolean onBlockActivated( final World world, final int x, final int y, final int z, final EntityPlayer player, final int side,
|
||||
final float hitX, final float hitY, final float hitZ )
|
||||
{
|
||||
// Can the player interact with the block?
|
||||
if( !this.canPlayerInteract( player ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* The block was right-clicked
|
||||
*/
|
||||
@Override
|
||||
public final boolean onBlockActivated(
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z,
|
||||
final EntityPlayer player,
|
||||
final int side,
|
||||
final float hitX,
|
||||
final float hitY,
|
||||
final float hitZ) {
|
||||
// Can the player interact with the block?
|
||||
if (!this.canPlayerInteract(player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Is the player holding an AE wrench item?
|
||||
if( Platform.isWrench( player, player.getHeldItem(), x, y, z ) )
|
||||
{
|
||||
// Is the player sneaking?
|
||||
if( player.isSneaking() )
|
||||
{
|
||||
// Call on dismantled
|
||||
ItemStack representitive = this.onDismantled( world, x, y, z );
|
||||
// Is the player holding an AE wrench item?
|
||||
if (Platform.isWrench(player, player.getHeldItem(), x, y, z)) {
|
||||
// Is the player sneaking?
|
||||
if (player.isSneaking()) {
|
||||
// Call on dismantled
|
||||
ItemStack representitive = this.onDismantled(world, x, y, z);
|
||||
|
||||
// Call break
|
||||
this.breakBlock( world, x, y, z, this, world.getBlockMetadata( x, y, z ) );
|
||||
// Call break
|
||||
this.breakBlock(world, x, y, z, this, world.getBlockMetadata(x, y, z));
|
||||
|
||||
// Is there an representative itemstack?
|
||||
if( representitive == null )
|
||||
{
|
||||
// Create a basic stack.
|
||||
representitive = new ItemStack( this );
|
||||
}
|
||||
// Is there an representative itemstack?
|
||||
if (representitive == null) {
|
||||
// Create a basic stack.
|
||||
representitive = new ItemStack(this);
|
||||
}
|
||||
|
||||
// Drop the itemstack
|
||||
this.dropBlockAsItem( world, x, y, z, representitive );
|
||||
// Drop the itemstack
|
||||
this.dropBlockAsItem(world, x, y, z, representitive);
|
||||
|
||||
// Set the block to air
|
||||
world.setBlockToAir( x, y, z );
|
||||
}
|
||||
// Set the block to air
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return this.onBlockActivated( world, x, y, z, player );
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return this.onBlockActivated(world, x, y, z, player);
|
||||
}
|
||||
}
|
||||
@@ -22,159 +22,145 @@ import thaumicenergistics.common.tiles.TileGearBox;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractBlockGearBoxBase
|
||||
extends AbstractBlockAEWrenchable
|
||||
{
|
||||
/**
|
||||
* Determines if thaumcraft golems are allowed to interact with the gearbox.
|
||||
*/
|
||||
protected boolean allowGolemInteraction = false;
|
||||
public abstract class AbstractBlockGearBoxBase extends AbstractBlockAEWrenchable {
|
||||
/**
|
||||
* Determines if thaumcraft golems are allowed to interact with the gearbox.
|
||||
*/
|
||||
protected boolean allowGolemInteraction = false;
|
||||
|
||||
/**
|
||||
* Creates the block.
|
||||
*/
|
||||
public AbstractBlockGearBoxBase()
|
||||
{
|
||||
// Set material type
|
||||
super( Material.ground );
|
||||
/**
|
||||
* Creates the block.
|
||||
*/
|
||||
public AbstractBlockGearBoxBase() {
|
||||
// Set material type
|
||||
super(Material.ground);
|
||||
|
||||
// Set creative tab
|
||||
this.setCreativeTab( ThaumicEnergistics.ThETab );
|
||||
// Set creative tab
|
||||
this.setCreativeTab(ThaumicEnergistics.ThETab);
|
||||
|
||||
// Set sound type
|
||||
this.setStepSound( Block.soundTypeStone );
|
||||
// Set sound type
|
||||
this.setStepSound(Block.soundTypeStone);
|
||||
|
||||
// Set hardness
|
||||
this.setHardness( 0.6F );
|
||||
// Set hardness
|
||||
this.setHardness(0.6F);
|
||||
|
||||
// Set bounding box
|
||||
this.setBlockBounds( 0.23F, 0.23F, 0.23F, 0.77F, 0.77F, 0.77F );
|
||||
}
|
||||
// Set bounding box
|
||||
this.setBlockBounds(0.23F, 0.23F, 0.23F, 0.77F, 0.77F, 0.77F);
|
||||
}
|
||||
|
||||
/**
|
||||
* Crank the gearbox.
|
||||
*/
|
||||
@Override
|
||||
protected boolean onBlockActivated( final World world, final int x, final int y, final int z, final EntityPlayer player )
|
||||
{
|
||||
/**
|
||||
* Crank the gearbox.
|
||||
*/
|
||||
@Override
|
||||
protected boolean onBlockActivated(
|
||||
final World world, final int x, final int y, final int z, final EntityPlayer player) {
|
||||
|
||||
// Get the tile
|
||||
TileGearBox gearBox = (TileGearBox)world.getTileEntity( x, y, z );
|
||||
// Get the tile
|
||||
TileGearBox gearBox = (TileGearBox) world.getTileEntity(x, y, z);
|
||||
|
||||
// Crank it
|
||||
return gearBox.crankGearbox();
|
||||
}
|
||||
// Crank it
|
||||
return gearBox.crankGearbox();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlayerInteract( final EntityPlayer player )
|
||||
{
|
||||
// Fake player?
|
||||
if( player instanceof FakePlayer )
|
||||
{
|
||||
// Are golems allowed to interact?
|
||||
if( !this.allowGolemInteraction )
|
||||
{
|
||||
// Golem interaction not allowed
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean canPlayerInteract(final EntityPlayer player) {
|
||||
// Fake player?
|
||||
if (player instanceof FakePlayer) {
|
||||
// Are golems allowed to interact?
|
||||
if (!this.allowGolemInteraction) {
|
||||
// Golem interaction not allowed
|
||||
return false;
|
||||
}
|
||||
|
||||
// Is the fake player a golem?
|
||||
if( !player.getGameProfile().getName().equalsIgnoreCase( "FakeThaumcraftGolem" ) )
|
||||
{
|
||||
// Not a golem
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Is the fake player a golem?
|
||||
if (!player.getGameProfile().getName().equalsIgnoreCase("FakeThaumcraftGolem")) {
|
||||
// Not a golem
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the gear box tile.
|
||||
*/
|
||||
@Override
|
||||
public TileEntity createNewTileEntity( final World w, final int meta )
|
||||
{
|
||||
return new TileGearBox();
|
||||
}
|
||||
/**
|
||||
* Creates the gear box tile.
|
||||
*/
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World w, final int meta) {
|
||||
return new TileGearBox();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the icon from subclass.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public abstract IIcon getIcon( final int side, final int meta );
|
||||
/**
|
||||
* Get the icon from subclass.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public abstract IIcon getIcon(final int side, final int meta);
|
||||
|
||||
/**
|
||||
* Get the name from subclass.
|
||||
*/
|
||||
@Override
|
||||
public abstract String getUnlocalizedName();
|
||||
/**
|
||||
* Get the name from subclass.
|
||||
*/
|
||||
@Override
|
||||
public abstract String getUnlocalizedName();
|
||||
|
||||
/**
|
||||
* Is not opaque.
|
||||
*/
|
||||
@Override
|
||||
public final boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Is not opaque.
|
||||
*/
|
||||
@Override
|
||||
public final boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dependent on config setting.
|
||||
*/
|
||||
@Override
|
||||
public final boolean isSideSolid( final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection side )
|
||||
{
|
||||
return ThEApi.instance().config().disableGearboxModel();
|
||||
}
|
||||
/**
|
||||
* Dependent on config setting.
|
||||
*/
|
||||
@Override
|
||||
public final boolean isSideSolid(
|
||||
final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection side) {
|
||||
return ThEApi.instance().config().disableGearboxModel();
|
||||
}
|
||||
|
||||
/**
|
||||
* One of the adjacent blocks has changed.
|
||||
*/
|
||||
@Override
|
||||
public void onNeighborBlockChange( final World w, final int x, final int y, final int z, final Block neighbor )
|
||||
{
|
||||
// Get the tile
|
||||
TileEntity gearBox = w.getTileEntity( x, y, z );
|
||||
/**
|
||||
* One of the adjacent blocks has changed.
|
||||
*/
|
||||
@Override
|
||||
public void onNeighborBlockChange(final World w, final int x, final int y, final int z, final Block neighbor) {
|
||||
// Get the tile
|
||||
TileEntity gearBox = w.getTileEntity(x, y, z);
|
||||
|
||||
// Update it
|
||||
if( gearBox instanceof TileGearBox )
|
||||
{
|
||||
( (TileGearBox)gearBox ).updateCrankables();
|
||||
// Update it
|
||||
if (gearBox instanceof TileGearBox) {
|
||||
((TileGearBox) gearBox).updateCrankables();
|
||||
|
||||
// Update the client tile entity
|
||||
w.markBlockForUpdate( x, y, z );
|
||||
}
|
||||
}
|
||||
// Update the client tile entity
|
||||
w.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Taken care of by texture manager
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public final void registerBlockIcons( final IIconRegister register )
|
||||
{
|
||||
// Ignored
|
||||
}
|
||||
/**
|
||||
* Taken care of by texture manager
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public final void registerBlockIcons(final IIconRegister register) {
|
||||
// Ignored
|
||||
}
|
||||
|
||||
/**
|
||||
* Dependent on config setting.
|
||||
*/
|
||||
@Override
|
||||
public final boolean renderAsNormalBlock()
|
||||
{
|
||||
return ThEApi.instance().config().disableGearboxModel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevents MC from using the default block renderer.
|
||||
* Dependent on config setting.
|
||||
*/
|
||||
@Override
|
||||
public boolean shouldSideBeRendered( final IBlockAccess iblockaccess, final int i, final int j, final int k, final int l )
|
||||
{
|
||||
return ThEApi.instance().config().disableGearboxModel();
|
||||
}
|
||||
/**
|
||||
* Dependent on config setting.
|
||||
*/
|
||||
@Override
|
||||
public final boolean renderAsNormalBlock() {
|
||||
return ThEApi.instance().config().disableGearboxModel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevents MC from using the default block renderer.
|
||||
* Dependent on config setting.
|
||||
*/
|
||||
@Override
|
||||
public boolean shouldSideBeRendered(
|
||||
final IBlockAccess iblockaccess, final int i, final int j, final int k, final int l) {
|
||||
return ThEApi.instance().config().disableGearboxModel();
|
||||
}
|
||||
}
|
||||
@@ -18,161 +18,159 @@ import thaumicenergistics.common.registries.EnumCache;
|
||||
import thaumicenergistics.common.registries.Renderers;
|
||||
import thaumicenergistics.common.tiles.abstraction.TileProviderBase;
|
||||
|
||||
public abstract class AbstractBlockProviderBase
|
||||
extends AbstractBlockAEWrenchable
|
||||
{
|
||||
public abstract class AbstractBlockProviderBase extends AbstractBlockAEWrenchable {
|
||||
|
||||
protected AbstractBlockProviderBase( final Material material )
|
||||
{
|
||||
super( material );
|
||||
protected AbstractBlockProviderBase(final Material material) {
|
||||
super(material);
|
||||
|
||||
// Place in our creative tab
|
||||
this.setCreativeTab( ThaumicEnergistics.ThETab );
|
||||
}
|
||||
// Place in our creative tab
|
||||
this.setCreativeTab(ThaumicEnergistics.ThETab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock( final World world, final int x, final int y, final int z, final Block block, final int metadata )
|
||||
{
|
||||
// Get tile entity
|
||||
TileEntity tileProvider = world.getTileEntity( x, y, z );
|
||||
@Override
|
||||
public void breakBlock(
|
||||
final World world, final int x, final int y, final int z, final Block block, final int metadata) {
|
||||
// Get tile entity
|
||||
TileEntity tileProvider = world.getTileEntity(x, y, z);
|
||||
|
||||
// Is there still have a tile?
|
||||
if( tileProvider instanceof TileProviderBase )
|
||||
{
|
||||
// Inform it that its going away
|
||||
( (TileProviderBase)tileProvider ).onBreakBlock();
|
||||
}
|
||||
// Is there still have a tile?
|
||||
if (tileProvider instanceof TileProviderBase) {
|
||||
// Inform it that its going away
|
||||
((TileProviderBase) tileProvider).onBreakBlock();
|
||||
}
|
||||
|
||||
// Pass to super
|
||||
super.breakBlock( world, x, y, z, block, metadata );
|
||||
}
|
||||
// Pass to super
|
||||
super.breakBlock(world, x, y, z, block, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean canRenderInPass( final int pass )
|
||||
{
|
||||
// Mark the current pass
|
||||
Renderers.currentRenderPass = pass;
|
||||
@Override
|
||||
public final boolean canRenderInPass(final int pass) {
|
||||
// Mark the current pass
|
||||
Renderers.currentRenderPass = pass;
|
||||
|
||||
// We render during both passes
|
||||
return true;
|
||||
}
|
||||
// We render during both passes
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract TileEntity createNewTileEntity( World world, int metaData );
|
||||
@Override
|
||||
public abstract TileEntity createNewTileEntity(World world, int metaData);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public abstract IIcon getIcon( int side, int metaData );
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public abstract IIcon getIcon(int side, int metaData);
|
||||
|
||||
/* Colored Lights Core Test Code
|
||||
@Override
|
||||
public int getLightValue( final IBlockAccess world, final int x, final int y, final int z )
|
||||
{
|
||||
// Get tile entity
|
||||
TileEntity tileProvider = world.getTileEntity( x, y, z );
|
||||
|
||||
// Is there still have a tile?
|
||||
if( tileProvider instanceof TileProviderBase )
|
||||
{
|
||||
|
||||
float r = 0;
|
||||
float g = 0;
|
||||
float b = 0;
|
||||
|
||||
if( ( (TileProviderBase)tileProvider ).isActive() )
|
||||
{
|
||||
int mv = ( (TileProviderBase)tileProvider ).getColor().mediumVariant;
|
||||
|
||||
r = ( ( mv >> 16 ) & 0xff ) / 255.0F;
|
||||
g = ( ( mv >> 8 ) & 0xff ) / 255.0F;
|
||||
b = ( ( mv ) & 0xff ) / 255.0F;
|
||||
return CLApi.makeRGBLightValue( r, g, b );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return super.getLightValue( world, x, y, z );
|
||||
|
||||
}
|
||||
*/
|
||||
/* Colored Lights Core Test Code
|
||||
@Override
|
||||
public int getLightValue( final IBlockAccess world, final int x, final int y, final int z )
|
||||
{
|
||||
// Get tile entity
|
||||
TileEntity tileProvider = world.getTileEntity( x, y, z );
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public final int getRenderBlockPass()
|
||||
{
|
||||
// Ensure the alpha pass is rendered
|
||||
return Renderers.PASS_ALPHA;
|
||||
}
|
||||
// Is there still have a tile?
|
||||
if( tileProvider instanceof TileProviderBase )
|
||||
{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public abstract int getRenderType();
|
||||
float r = 0;
|
||||
float g = 0;
|
||||
float b = 0;
|
||||
|
||||
@Override
|
||||
public abstract String getUnlocalizedName();
|
||||
if( ( (TileProviderBase)tileProvider ).isActive() )
|
||||
{
|
||||
int mv = ( (TileProviderBase)tileProvider ).getColor().mediumVariant;
|
||||
|
||||
@Override
|
||||
public final boolean isOpaqueCube()
|
||||
{
|
||||
// Occlude adjoining faces.
|
||||
return true;
|
||||
}
|
||||
r = ( ( mv >> 16 ) & 0xff ) / 255.0F;
|
||||
g = ( ( mv >> 8 ) & 0xff ) / 255.0F;
|
||||
b = ( ( mv ) & 0xff ) / 255.0F;
|
||||
return CLApi.makeRGBLightValue( r, g, b );
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isSideSolid( final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection side )
|
||||
{
|
||||
// This is a solid cube
|
||||
return true;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Sets the metadata for the block based on which side of the neighbor block they clicked on.
|
||||
@Override
|
||||
public final int onBlockPlaced( final World world, final int x, final int y, final int z, final int side, final float hitX, final float hitY,
|
||||
final float hitZ, final int metaData )
|
||||
{
|
||||
// Get the opposite face and return it
|
||||
return ForgeDirection.OPPOSITES[side];
|
||||
}
|
||||
return super.getLightValue( world, x, y, z );
|
||||
|
||||
@Override
|
||||
public final void onBlockPlacedBy( final World world, final int x, final int y, final int z, final EntityLivingBase entity,
|
||||
final ItemStack itemstack )
|
||||
{
|
||||
// Set the owner
|
||||
if( entity instanceof EntityPlayer )
|
||||
{
|
||||
TileEntity tileProvider = world.getTileEntity( x, y, z );
|
||||
if( tileProvider instanceof TileProviderBase )
|
||||
{
|
||||
( (TileProviderBase)tileProvider ).setOwner( (EntityPlayer)entity );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public abstract void onNeighborBlockChange( World world, int x, int y, int z, Block neighbor );
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public final int getRenderBlockPass() {
|
||||
// Ensure the alpha pass is rendered
|
||||
return Renderers.PASS_ALPHA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean recolourBlock( final World world, final int x, final int y, final int z, final ForgeDirection side, final int color )
|
||||
{
|
||||
return ( (TileProviderBase)world.getTileEntity( x, y, z ) ).recolourBlock( side, EnumCache.AE_COLOR[color], null );
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public abstract int getRenderType();
|
||||
|
||||
}
|
||||
@Override
|
||||
public abstract String getUnlocalizedName();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public final void registerBlockIcons( final IIconRegister register )
|
||||
{
|
||||
// Ignored
|
||||
@Override
|
||||
public final boolean isOpaqueCube() {
|
||||
// Occlude adjoining faces.
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public final boolean isSideSolid(
|
||||
final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection side) {
|
||||
// This is a solid cube
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean renderAsNormalBlock()
|
||||
{
|
||||
// We have a custom renderer for this block
|
||||
return false;
|
||||
}
|
||||
// Sets the metadata for the block based on which side of the neighbor block they clicked on.
|
||||
@Override
|
||||
public final int onBlockPlaced(
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z,
|
||||
final int side,
|
||||
final float hitX,
|
||||
final float hitY,
|
||||
final float hitZ,
|
||||
final int metaData) {
|
||||
// Get the opposite face and return it
|
||||
return ForgeDirection.OPPOSITES[side];
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onBlockPlacedBy(
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z,
|
||||
final EntityLivingBase entity,
|
||||
final ItemStack itemstack) {
|
||||
// Set the owner
|
||||
if (entity instanceof EntityPlayer) {
|
||||
TileEntity tileProvider = world.getTileEntity(x, y, z);
|
||||
if (tileProvider instanceof TileProviderBase) {
|
||||
((TileProviderBase) tileProvider).setOwner((EntityPlayer) entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor);
|
||||
|
||||
@Override
|
||||
public boolean recolourBlock(
|
||||
final World world, final int x, final int y, final int z, final ForgeDirection side, final int color) {
|
||||
return ((TileProviderBase) world.getTileEntity(x, y, z)).recolourBlock(side, EnumCache.AE_COLOR[color], null);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public final void registerBlockIcons(final IIconRegister register) {
|
||||
// Ignored
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean renderAsNormalBlock() {
|
||||
// We have a custom renderer for this block
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package thaumicenergistics.common.blocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import appeng.api.implementations.items.IMemoryCard;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -29,216 +29,198 @@ import thaumicenergistics.common.utils.EffectiveSide;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public class BlockArcaneAssembler
|
||||
extends AbstractBlockAEWrenchable
|
||||
{
|
||||
public class BlockArcaneAssembler extends AbstractBlockAEWrenchable {
|
||||
|
||||
public static final int MAX_SPEED_UPGRADES = 4;
|
||||
public static final int MAX_SPEED_UPGRADES = 4;
|
||||
|
||||
public BlockArcaneAssembler()
|
||||
{
|
||||
// Call super with material machine (iron)
|
||||
super( Material.iron );
|
||||
public BlockArcaneAssembler() {
|
||||
// Call super with material machine (iron)
|
||||
super(Material.iron);
|
||||
|
||||
// Basic hardness
|
||||
this.setHardness( 1.0f );
|
||||
// Basic hardness
|
||||
this.setHardness(1.0f);
|
||||
|
||||
// Sound of metal
|
||||
this.setStepSound( Block.soundTypeMetal );
|
||||
// Sound of metal
|
||||
this.setStepSound(Block.soundTypeMetal);
|
||||
|
||||
// Place in the ThE creative tab
|
||||
this.setCreativeTab( ThaumicEnergistics.ThETab );
|
||||
}
|
||||
// Place in the ThE creative tab
|
||||
this.setCreativeTab(ThaumicEnergistics.ThETab);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the assembler is right-clicked
|
||||
*
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected boolean onBlockActivated( final World world, final int x, final int y, final int z, final EntityPlayer player )
|
||||
{
|
||||
// Get what the player is holding
|
||||
ItemStack playerHolding = player.inventory.getCurrentItem();
|
||||
/**
|
||||
* Called when the assembler is right-clicked
|
||||
*
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected boolean onBlockActivated(
|
||||
final World world, final int x, final int y, final int z, final EntityPlayer player) {
|
||||
// Get what the player is holding
|
||||
ItemStack playerHolding = player.inventory.getCurrentItem();
|
||||
|
||||
// Get the tile
|
||||
TileEntity tileAssembler = world.getTileEntity( x, y, z );
|
||||
// Get the tile
|
||||
TileEntity tileAssembler = world.getTileEntity(x, y, z);
|
||||
|
||||
if( tileAssembler instanceof TileArcaneAssembler )
|
||||
{
|
||||
// Are they holding a memory card?
|
||||
if( ( playerHolding != null ) && ( playerHolding.getItem() instanceof IMemoryCard ) )
|
||||
{
|
||||
// Inform the tile of the event
|
||||
( (TileArcaneAssembler)tileAssembler ).onMemoryCardActivate( player, (IMemoryCard)playerHolding.getItem(), playerHolding );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Can the player interact with the assembler?
|
||||
if( ( (TileArcaneAssembler)tileAssembler ).isUseableByPlayer( player ) )
|
||||
{
|
||||
// Launch the gui.
|
||||
ThEGuiHandler.launchGui( ThEGuiHandler.ARCANE_ASSEMBLER_ID, player, world, x, y, z );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tileAssembler instanceof TileArcaneAssembler) {
|
||||
// Are they holding a memory card?
|
||||
if ((playerHolding != null) && (playerHolding.getItem() instanceof IMemoryCard)) {
|
||||
// Inform the tile of the event
|
||||
((TileArcaneAssembler) tileAssembler)
|
||||
.onMemoryCardActivate(player, (IMemoryCard) playerHolding.getItem(), playerHolding);
|
||||
} else {
|
||||
// Can the player interact with the assembler?
|
||||
if (((TileArcaneAssembler) tileAssembler).isUseableByPlayer(player)) {
|
||||
// Launch the gui.
|
||||
ThEGuiHandler.launchGui(ThEGuiHandler.ARCANE_ASSEMBLER_ID, player, world, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the assembler is dismantled via wrench.
|
||||
*/
|
||||
@Override
|
||||
protected ItemStack onDismantled( final World world, final int x, final int y, final int z )
|
||||
{
|
||||
// Create the itemstack
|
||||
ItemStack itemStack = new ItemStack( this );
|
||||
/**
|
||||
* Called when the assembler is dismantled via wrench.
|
||||
*/
|
||||
@Override
|
||||
protected ItemStack onDismantled(final World world, final int x, final int y, final int z) {
|
||||
// Create the itemstack
|
||||
ItemStack itemStack = new ItemStack(this);
|
||||
|
||||
// Get the tile
|
||||
TileEntity tileAssembler = world.getTileEntity( x, y, z );
|
||||
// Get the tile
|
||||
TileEntity tileAssembler = world.getTileEntity(x, y, z);
|
||||
|
||||
if( tileAssembler instanceof TileArcaneAssembler )
|
||||
{
|
||||
// Create a compound tag
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
if (tileAssembler instanceof TileArcaneAssembler) {
|
||||
// Create a compound tag
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
|
||||
// Save the vis levels
|
||||
( (TileArcaneAssembler)tileAssembler ).writeVisLevelsToNBT( data );
|
||||
// Save the vis levels
|
||||
((TileArcaneAssembler) tileAssembler).writeVisLevelsToNBT(data);
|
||||
|
||||
// Set the itemstack tag
|
||||
if( !data.hasNoTags() )
|
||||
{
|
||||
itemStack.setTagCompound( data );
|
||||
}
|
||||
}
|
||||
// Set the itemstack tag
|
||||
if (!data.hasNoTags()) {
|
||||
itemStack.setTagCompound(data);
|
||||
}
|
||||
}
|
||||
|
||||
return itemStack;
|
||||
}
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the block is broken.
|
||||
*/
|
||||
@Override
|
||||
public void breakBlock( final World world, final int x, final int y, final int z, final Block block, final int metaData )
|
||||
{
|
||||
// Is this server side?
|
||||
if( EffectiveSide.isServerSide() )
|
||||
{
|
||||
// Get the tile
|
||||
TileEntity tileAssembler = world.getTileEntity( x, y, z );
|
||||
/**
|
||||
* Called when the block is broken.
|
||||
*/
|
||||
@Override
|
||||
public void breakBlock(
|
||||
final World world, final int x, final int y, final int z, final Block block, final int metaData) {
|
||||
// Is this server side?
|
||||
if (EffectiveSide.isServerSide()) {
|
||||
// Get the tile
|
||||
TileEntity tileAssembler = world.getTileEntity(x, y, z);
|
||||
|
||||
if( tileAssembler instanceof TileArcaneAssembler )
|
||||
{
|
||||
// Get the drops
|
||||
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
( (TileArcaneAssembler)tileAssembler ).getDrops( world, x, y, z, drops );
|
||||
if (tileAssembler instanceof TileArcaneAssembler) {
|
||||
// Get the drops
|
||||
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
((TileArcaneAssembler) tileAssembler).getDrops(world, x, y, z, drops);
|
||||
|
||||
for( ItemStack drop : drops )
|
||||
{
|
||||
world.spawnEntityInWorld( new EntityItem( world, 0.5 + x, 0.5 + y, 0.2 + z, drop ) );
|
||||
}
|
||||
for (ItemStack drop : drops) {
|
||||
world.spawnEntityInWorld(new EntityItem(world, 0.5 + x, 0.5 + y, 0.2 + z, drop));
|
||||
}
|
||||
|
||||
// Inform the tile it is being broken
|
||||
( (TileArcaneAssembler)tileAssembler ).onBreak();
|
||||
}
|
||||
}
|
||||
// Inform the tile it is being broken
|
||||
((TileArcaneAssembler) tileAssembler).onBreak();
|
||||
}
|
||||
}
|
||||
|
||||
// Call super
|
||||
super.breakBlock( world, x, y, z, block, metaData );
|
||||
}
|
||||
// Call super
|
||||
super.breakBlock(world, x, y, z, block, metaData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Arcane Assembler tile
|
||||
*/
|
||||
@Override
|
||||
public TileEntity createNewTileEntity( final World world, final int metadata )
|
||||
{
|
||||
return new TileArcaneAssembler();
|
||||
}
|
||||
/**
|
||||
* Creates a new Arcane Assembler tile
|
||||
*/
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World world, final int metadata) {
|
||||
return new TileArcaneAssembler();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the standard block icon.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon( final int side, final int meta )
|
||||
{
|
||||
// Sides
|
||||
return BlockTextureManager.ARCANE_ASSEMBLER.getTexture();
|
||||
}
|
||||
/**
|
||||
* Gets the standard block icon.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon(final int side, final int meta) {
|
||||
// Sides
|
||||
return BlockTextureManager.ARCANE_ASSEMBLER.getTexture();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the unlocalized name of the block.
|
||||
*/
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
return BlockEnum.ARCANE_ASSEMBLER.getUnlocalizedName();
|
||||
}
|
||||
/**
|
||||
* Gets the unlocalized name of the block.
|
||||
*/
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return BlockEnum.ARCANE_ASSEMBLER.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public final boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isSideSolid( final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection side )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public final boolean isSideSolid(
|
||||
final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy( final World world, final int x, final int y, final int z, final EntityLivingBase player, final ItemStack itemStack )
|
||||
{
|
||||
// Get the tile
|
||||
TileEntity tileAssembler = world.getTileEntity( x, y, z );
|
||||
@Override
|
||||
public void onBlockPlacedBy(
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z,
|
||||
final EntityLivingBase player,
|
||||
final ItemStack itemStack) {
|
||||
// Get the tile
|
||||
TileEntity tileAssembler = world.getTileEntity(x, y, z);
|
||||
|
||||
if( tileAssembler instanceof TileArcaneAssembler )
|
||||
{
|
||||
if( itemStack.hasTagCompound() )
|
||||
{
|
||||
// Load the vis data
|
||||
( (TileArcaneAssembler)tileAssembler ).readVisLevelsFromNBT( itemStack.getTagCompound() );
|
||||
}
|
||||
if (tileAssembler instanceof TileArcaneAssembler) {
|
||||
if (itemStack.hasTagCompound()) {
|
||||
// Load the vis data
|
||||
((TileArcaneAssembler) tileAssembler).readVisLevelsFromNBT(itemStack.getTagCompound());
|
||||
}
|
||||
|
||||
if( player instanceof EntityPlayer )
|
||||
{
|
||||
// Set the owner
|
||||
( (TileArcaneAssembler)tileAssembler ).setOwner( (EntityPlayer)player );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (player instanceof EntityPlayer) {
|
||||
// Set the owner
|
||||
((TileArcaneAssembler) tileAssembler).setOwner((EntityPlayer) player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Taken care of by texture manager
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public final void registerBlockIcons( final IIconRegister register )
|
||||
{
|
||||
// Ignored
|
||||
}
|
||||
/**
|
||||
* Taken care of by texture manager
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public final void registerBlockIcons(final IIconRegister register) {
|
||||
// Ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevents MC from using the default block renderer.
|
||||
*/
|
||||
@Override
|
||||
public boolean shouldSideBeRendered( final IBlockAccess iblockaccess, final int i, final int j, final int k, final int l )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public final boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevents MC from using the default block renderer.
|
||||
*/
|
||||
@Override
|
||||
public boolean shouldSideBeRendered(
|
||||
final IBlockAccess iblockaccess, final int i, final int j, final int k, final int l) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package thaumicenergistics.common.blocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -27,174 +27,161 @@ import thaumicenergistics.common.utils.EffectiveSide;
|
||||
* @author Nividica
|
||||
*
|
||||
*/
|
||||
public class BlockDistillationEncoder
|
||||
extends AbstractBlockAEWrenchable
|
||||
{
|
||||
public BlockDistillationEncoder()
|
||||
{
|
||||
// Call super with material machine (iron)
|
||||
super( Material.iron );
|
||||
public class BlockDistillationEncoder extends AbstractBlockAEWrenchable {
|
||||
public BlockDistillationEncoder() {
|
||||
// Call super with material machine (iron)
|
||||
super(Material.iron);
|
||||
|
||||
// Basic hardness
|
||||
this.setHardness( 1.0f );
|
||||
// Basic hardness
|
||||
this.setHardness(1.0f);
|
||||
|
||||
// Sound of metal
|
||||
this.setStepSound( Block.soundTypeMetal );
|
||||
// Sound of metal
|
||||
this.setStepSound(Block.soundTypeMetal);
|
||||
|
||||
// Place in the ThE creative tab
|
||||
this.setCreativeTab( ThaumicEnergistics.ThETab );
|
||||
}
|
||||
// Place in the ThE creative tab
|
||||
this.setCreativeTab(ThaumicEnergistics.ThETab);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final boolean onBlockActivated( final World world, final int x, final int y, final int z, final EntityPlayer player )
|
||||
{
|
||||
// Launch the gui.
|
||||
ThEGuiHandler.launchGui( ThEGuiHandler.DISTILLATION_ENCODER, player, world, x, y, z );
|
||||
@Override
|
||||
protected final boolean onBlockActivated(
|
||||
final World world, final int x, final int y, final int z, final EntityPlayer player) {
|
||||
// Launch the gui.
|
||||
ThEGuiHandler.launchGui(ThEGuiHandler.DISTILLATION_ENCODER, player, world, x, y, z);
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the block is broken.
|
||||
*/
|
||||
@Override
|
||||
public void breakBlock( final World world, final int x, final int y, final int z, final Block block, final int metaData )
|
||||
{
|
||||
// Is this server side?
|
||||
if( EffectiveSide.isServerSide() )
|
||||
{
|
||||
// Get the tile
|
||||
TileEntity tile = world.getTileEntity( x, y, z );
|
||||
/**
|
||||
* Called when the block is broken.
|
||||
*/
|
||||
@Override
|
||||
public void breakBlock(
|
||||
final World world, final int x, final int y, final int z, final Block block, final int metaData) {
|
||||
// Is this server side?
|
||||
if (EffectiveSide.isServerSide()) {
|
||||
// Get the tile
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if( tile instanceof TileDistillationPatternEncoder )
|
||||
{
|
||||
// Cast
|
||||
TileDistillationPatternEncoder tileDE = (TileDistillationPatternEncoder)tile;
|
||||
if (tile instanceof TileDistillationPatternEncoder) {
|
||||
// Cast
|
||||
TileDistillationPatternEncoder tileDE = (TileDistillationPatternEncoder) tile;
|
||||
|
||||
// Does it have patterns?
|
||||
if( tileDE.hasPatterns() )
|
||||
{
|
||||
// Get the drops
|
||||
ArrayList<ItemStack> drops = tileDE.getDrops( new ArrayList<ItemStack>() );
|
||||
for( ItemStack drop : drops )
|
||||
{
|
||||
// Spawn in the world
|
||||
world.spawnEntityInWorld( new EntityItem( world, 0.5 + x, 0.5 + y, 0.2 + z, drop ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Does it have patterns?
|
||||
if (tileDE.hasPatterns()) {
|
||||
// Get the drops
|
||||
ArrayList<ItemStack> drops = tileDE.getDrops(new ArrayList<ItemStack>());
|
||||
for (ItemStack drop : drops) {
|
||||
// Spawn in the world
|
||||
world.spawnEntityInWorld(new EntityItem(world, 0.5 + x, 0.5 + y, 0.2 + z, drop));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Call super
|
||||
super.breakBlock( world, x, y, z, block, metaData );
|
||||
}
|
||||
// Call super
|
||||
super.breakBlock(world, x, y, z, block, metaData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the tile entity associated with the block.
|
||||
*/
|
||||
@Override
|
||||
public TileEntity createNewTileEntity( final World world, final int metaData )
|
||||
{
|
||||
return new TileDistillationPatternEncoder();
|
||||
}
|
||||
/**
|
||||
* Creates the tile entity associated with the block.
|
||||
*/
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World world, final int metaData) {
|
||||
return new TileDistillationPatternEncoder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the standard block icon.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon( final int side, final int meta )
|
||||
{
|
||||
// Face?
|
||||
if( side == ForgeDirection.OPPOSITES[meta] )
|
||||
{
|
||||
// Face texture
|
||||
return BlockTextureManager.DISTILLATION_ENCODER.getTextures()[1];
|
||||
}
|
||||
/**
|
||||
* Gets the standard block icon.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon(final int side, final int meta) {
|
||||
// Face?
|
||||
if (side == ForgeDirection.OPPOSITES[meta]) {
|
||||
// Face texture
|
||||
return BlockTextureManager.DISTILLATION_ENCODER.getTextures()[1];
|
||||
}
|
||||
|
||||
// Top or bottom?
|
||||
if( ( ForgeDirection.VALID_DIRECTIONS[side] == ForgeDirection.UP ) || ( ForgeDirection.VALID_DIRECTIONS[side] == ForgeDirection.DOWN ) )
|
||||
{
|
||||
// Bottom texture
|
||||
return BlockTextureManager.DISTILLATION_ENCODER.getTextures()[2];
|
||||
// Top or bottom?
|
||||
if ((ForgeDirection.VALID_DIRECTIONS[side] == ForgeDirection.UP)
|
||||
|| (ForgeDirection.VALID_DIRECTIONS[side] == ForgeDirection.DOWN)) {
|
||||
// Bottom texture
|
||||
return BlockTextureManager.DISTILLATION_ENCODER.getTextures()[2];
|
||||
}
|
||||
|
||||
}
|
||||
// Sides
|
||||
return BlockTextureManager.DISTILLATION_ENCODER.getTextures()[0];
|
||||
}
|
||||
|
||||
// Sides
|
||||
return BlockTextureManager.DISTILLATION_ENCODER.getTextures()[0];
|
||||
}
|
||||
/**
|
||||
* Gets the unlocalized name of the block.
|
||||
*/
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return BlockEnum.DISTILLATION_ENCODER.getUnlocalizedName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the unlocalized name of the block.
|
||||
*/
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
return BlockEnum.DISTILLATION_ENCODER.getUnlocalizedName();
|
||||
}
|
||||
/**
|
||||
* Is opaque.
|
||||
*/
|
||||
@Override
|
||||
public final boolean isOpaqueCube() {
|
||||
// Occlude adjoining faces.
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is opaque.
|
||||
*/
|
||||
@Override
|
||||
public final boolean isOpaqueCube()
|
||||
{
|
||||
// Occlude adjoining faces.
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Is solid.
|
||||
*/
|
||||
@Override
|
||||
public final boolean isSideSolid(
|
||||
final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection side) {
|
||||
// This is a solid cube
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is solid.
|
||||
*/
|
||||
@Override
|
||||
public final boolean isSideSolid( final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection side )
|
||||
{
|
||||
// This is a solid cube
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void onBlockPlacedBy(
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z,
|
||||
final EntityLivingBase player,
|
||||
final ItemStack itemStack) {
|
||||
// Set the metadata to up
|
||||
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy( final World world, final int x, final int y, final int z, final EntityLivingBase player, final ItemStack itemStack )
|
||||
{
|
||||
// Set the metadata to up
|
||||
world.setBlockMetadataWithNotify( x, y, z, 0, 2 );
|
||||
}
|
||||
/**
|
||||
* Taken care of by texture manager
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public final void registerBlockIcons(final IIconRegister register) {
|
||||
// Ignored
|
||||
}
|
||||
|
||||
/**
|
||||
* Taken care of by texture manager
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public final void registerBlockIcons( final IIconRegister register )
|
||||
{
|
||||
// Ignored
|
||||
}
|
||||
/**
|
||||
* Normal renderer.
|
||||
*/
|
||||
@Override
|
||||
public final boolean renderAsNormalBlock() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Normal renderer.
|
||||
*/
|
||||
@Override
|
||||
public final boolean renderAsNormalBlock()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean rotateBlock(final World world, final int x, final int y, final int z, final ForgeDirection side) {
|
||||
// Get and increment the meta data
|
||||
int metaData = world.getBlockMetadata(x, y, z) + 1;
|
||||
|
||||
@Override
|
||||
public boolean rotateBlock( final World world, final int x, final int y, final int z, final ForgeDirection side )
|
||||
{
|
||||
// Get and increment the meta data
|
||||
int metaData = world.getBlockMetadata( x, y, z ) + 1;
|
||||
// Bounds check
|
||||
if (metaData >= ForgeDirection.VALID_DIRECTIONS.length) {
|
||||
metaData = 0;
|
||||
}
|
||||
|
||||
// Bounds check
|
||||
if( metaData >= ForgeDirection.VALID_DIRECTIONS.length )
|
||||
{
|
||||
metaData = 0;
|
||||
}
|
||||
|
||||
// Set the meta data
|
||||
world.setBlockMetadataWithNotify( x, y, z, metaData, 3 );
|
||||
|
||||
return true;
|
||||
}
|
||||
// Set the meta data
|
||||
world.setBlockMetadataWithNotify(x, y, z, metaData, 3);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Loaded 100 of 309 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user