More optimization of the codebase

This commit is contained in:
pahimar 2014-01-02 16:09:59 -05:00
parent ea3fcd11b7
commit 6efe7ebe9a
12 changed files with 9 additions and 157 deletions

View file

@ -1,58 +0,0 @@
package com.pahimar.ee3.client.gui.inventory;
import com.pahimar.ee3.helper.ItemStackNBTHelper;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.lib.Textures;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
/**
* Equivalent-Exchange-3
* <p/>
* GuiPortableTransmutation
*
* @author pahimar
*/
@SideOnly(Side.CLIENT)
public class GuiPortableTransmutation extends GuiContainer
{
public GuiPortableTransmutation(Container par1Container)
{
super(par1Container);
}
@Override
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(Textures.GUI_PORTABLE_TRANSMUTATION);
int var5 = (width - xSize) / 2;
int var6 = (height - ySize) / 2;
this.drawTexturedModalRect(var5, var6, 0, 0, xSize, ySize);
}
@Override
public void onGuiClosed()
{
super.onGuiClosed();
if (mc.thePlayer != null)
{
for (ItemStack itemStack : mc.thePlayer.inventory.mainInventory)
{
if (itemStack != null)
{
if (ItemStackNBTHelper.hasTag(itemStack, Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN))
{
ItemStackNBTHelper.removeTag(itemStack, Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN);
}
}
}
}
}
}

View file

@ -3,7 +3,6 @@ package com.pahimar.ee3.command;
import com.pahimar.ee3.configuration.ConfigurationSettings;
import com.pahimar.ee3.configuration.GeneralConfiguration;
import com.pahimar.ee3.lib.Commands;
import com.pahimar.ee3.lib.Strings;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.util.ChatMessageComponent;
@ -60,7 +59,7 @@ public class CommandOverlay
{
ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION = true;
GeneralConfiguration.set(GeneralConfiguration.CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_CONFIGNAME, Strings.TRUE);
GeneralConfiguration.set(GeneralConfiguration.CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_CONFIGNAME, "true");
commandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey(Commands.COMMAND_OVERLAY_TURNED_ON));
}
@ -68,7 +67,7 @@ public class CommandOverlay
{
ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION = false;
GeneralConfiguration.set(GeneralConfiguration.CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_CONFIGNAME, Strings.FALSE);
GeneralConfiguration.set(GeneralConfiguration.CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_CONFIGNAME, "false");
commandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey(Commands.COMMAND_OVERLAY_TURNED_OFF));
}

View file

@ -3,7 +3,6 @@ package com.pahimar.ee3.command;
import com.pahimar.ee3.configuration.ConfigurationSettings;
import com.pahimar.ee3.configuration.GeneralConfiguration;
import com.pahimar.ee3.lib.Commands;
import com.pahimar.ee3.lib.Strings;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.util.ChatMessageComponent;
@ -50,7 +49,7 @@ public class CommandParticles
{
ConfigurationSettings.ENABLE_PARTICLE_FX = true;
GeneralConfiguration.set(GeneralConfiguration.CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_PARTICLE_FX_CONFIGNAME, Strings.TRUE);
GeneralConfiguration.set(GeneralConfiguration.CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_PARTICLE_FX_CONFIGNAME, "true");
commandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey(Commands.COMMAND_PARTICLES_TURNED_ON));
}
@ -58,7 +57,7 @@ public class CommandParticles
{
ConfigurationSettings.ENABLE_PARTICLE_FX = false;
GeneralConfiguration.set(GeneralConfiguration.CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_PARTICLE_FX_CONFIGNAME, Strings.FALSE);
GeneralConfiguration.set(GeneralConfiguration.CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_PARTICLE_FX_CONFIGNAME, "false");
commandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey(Commands.COMMAND_PARTICLES_TURNED_OFF));
}
}

View file

@ -21,10 +21,6 @@ public class GuiHandler implements IGuiHandler
{
return new ContainerPortableCrafting(player.inventory, world, x, y, z);
}
else if (ID == GuiIds.PORTABLE_TRANSMUTATION)
{
return new ContainerPortableTransmutation();
}
else if (ID == GuiIds.CALCINATOR)
{
TileCalcinator tileCalcinator = (TileCalcinator) world.getBlockTileEntity(x, y, z);
@ -62,10 +58,6 @@ public class GuiHandler implements IGuiHandler
{
return new GuiPortableCrafting(player, world, x, y, z);
}
else if (ID == GuiIds.PORTABLE_TRANSMUTATION)
{
return new GuiPortableTransmutation(null);
}
else if (ID == GuiIds.CALCINATOR)
{
TileCalcinator tileCalcinator = (TileCalcinator) world.getBlockTileEntity(x, y, z);

View file

@ -4,7 +4,6 @@ import com.pahimar.ee3.configuration.ConfigurationSettings;
import com.pahimar.ee3.configuration.GeneralConfiguration;
import com.pahimar.ee3.helper.VersionHelper;
import com.pahimar.ee3.lib.Reference;
import com.pahimar.ee3.lib.Strings;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
@ -52,7 +51,7 @@ public class VersionCheckTickHandler implements ITickHandler
if (VersionHelper.getResult() == VersionHelper.OUTDATED)
{
FMLClientHandler.instance().getClient().ingameGUI.getChatGUI().printChatMessage(VersionHelper.getResultMessageForClient());
GeneralConfiguration.set(Configuration.CATEGORY_GENERAL, ConfigurationSettings.DISPLAY_VERSION_RESULT_CONFIGNAME, Strings.FALSE);
GeneralConfiguration.set(Configuration.CATEGORY_GENERAL, ConfigurationSettings.DISPLAY_VERSION_RESULT_CONFIGNAME, "false");
}
}
}

View file

@ -1,49 +0,0 @@
package com.pahimar.ee3.inventory;
import com.pahimar.ee3.helper.ItemStackNBTHelper;
import com.pahimar.ee3.lib.Strings;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
/**
* Equivalent-Exchange-3
* <p/>
* ContainerPortableTransmutation
*
* @author pahimar
*/
public class ContainerPortableTransmutation extends Container
{
@Override
public boolean canInteractWith(EntityPlayer var1)
{
// TODO Auto-generated method stub
return false;
}
@Override
public void onContainerClosed(EntityPlayer player)
{
super.onContainerClosed(player);
if (!player.worldObj.isRemote)
{
InventoryPlayer invPlayer = player.inventory;
for (ItemStack itemStack : invPlayer.mainInventory)
{
if (itemStack != null)
{
if (ItemStackNBTHelper.hasTag(itemStack, Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN))
{
ItemStackNBTHelper.removeTag(itemStack, Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN);
}
}
}
}
}
}

View file

@ -15,7 +15,5 @@ public interface ITransmutationStone
{
public abstract void openPortableCraftingGUI(EntityPlayer thePlayer, ItemStack itemStack);
public abstract void openPortableTransmutationGUI(EntityPlayer thePlayer, ItemStack itemStack);
public abstract void transmuteBlock(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int sideHit);
}

View file

@ -84,13 +84,6 @@ public class ItemMiniumStone extends ItemEE implements ITransmutationStone, IKey
thePlayer.openGui(EquivalentExchange3.instance, GuiIds.PORTABLE_CRAFTING, thePlayer.worldObj, (int) thePlayer.posX, (int) thePlayer.posY, (int) thePlayer.posZ);
}
@Override
public void openPortableTransmutationGUI(EntityPlayer thePlayer, ItemStack itemStack)
{
ItemStackNBTHelper.setBoolean(itemStack, Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN, true);
thePlayer.openGui(EquivalentExchange3.instance, GuiIds.PORTABLE_TRANSMUTATION, thePlayer.worldObj, (int) thePlayer.posX, (int) thePlayer.posY, (int) thePlayer.posZ);
}
@Override
public void transmuteBlock(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int sideHit)
{

View file

@ -91,13 +91,6 @@ public class ItemPhilosophersStone extends ItemEE implements ITransmutationStone
thePlayer.openGui(EquivalentExchange3.instance, GuiIds.PORTABLE_CRAFTING, thePlayer.worldObj, (int) thePlayer.posX, (int) thePlayer.posY, (int) thePlayer.posZ);
}
@Override
public void openPortableTransmutationGUI(EntityPlayer thePlayer, ItemStack itemStack)
{
ItemStackNBTHelper.setBoolean(itemStack, Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN, true);
thePlayer.openGui(EquivalentExchange3.instance, GuiIds.PORTABLE_TRANSMUTATION, thePlayer.worldObj, (int) thePlayer.posX, (int) thePlayer.posY, (int) thePlayer.posZ);
}
@Override
public void transmuteBlock(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int sideHit)
{

View file

@ -11,11 +11,9 @@ public class GuiIds
{
public static final int PORTABLE_CRAFTING = 0;
public static final int PORTABLE_TRANSMUTATION = 1;
public static final int CALCINATOR = 2;
public static final int ALUDEL = 3;
public static final int ALCHEMICAL_CHEST = 4;
public static final int ALCHEMICAL_BAG = 5;
public static final int SHARED_ALCHEMICAL_INVENTORY = 6;
public static final int GLASS_BELL = 7;
}

View file

@ -9,12 +9,6 @@ package com.pahimar.ee3.lib;
*/
public class Strings
{
/* General keys */
public static final String TRUE = "true";
public static final String FALSE = "false";
public static final String TOKEN_DELIMITER = ",";
/* Localization Prefixes */
public static final String RESOURCE_PREFIX = Reference.MOD_ID.toLowerCase() + ":";
@ -67,12 +61,6 @@ public class Strings
public static final String ALCHEMICAL_FUEL_NAME = "alchemicalFuel";
public static final String ALCHEMICAL_FUEL_BLOCK_NAME = "alchemicalFuelBlock";
/* TileEntity name constants */
public static final String TE_CALCINATOR_NAME = "tileCalcinator";
public static final String TE_ALUDEL_NAME = "tileAludel";
public static final String TE_ALCHEMICAL_CHEST_NAME = "tileAlchemicalChest";
public static final String TE_GLASS_BELL_NAME = "tileGlassBell";
/* Transmutation cost related constants */
public static final String TRANSMUTATION_COST = "_cost";
public static final String TRANSMUTATION_COST_ITEM = "item" + TRANSMUTATION_COST;

View file

@ -11,9 +11,9 @@ public abstract class CommonProxy implements IProxy
{
public void registerTileEntities()
{
GameRegistry.registerTileEntity(TileCalcinator.class, "tile." + Strings.TE_CALCINATOR_NAME);
GameRegistry.registerTileEntity(TileAludel.class, "tile." + Strings.TE_ALUDEL_NAME);
GameRegistry.registerTileEntity(TileAlchemicalChest.class, "tile." + Strings.TE_ALCHEMICAL_CHEST_NAME);
GameRegistry.registerTileEntity(TileGlassBell.class, "tile." + Strings.TE_GLASS_BELL_NAME);
GameRegistry.registerTileEntity(TileCalcinator.class, "tile." + Strings.CALCINATOR_NAME);
GameRegistry.registerTileEntity(TileAludel.class, "tile." + Strings.ALUDEL_NAME);
GameRegistry.registerTileEntity(TileAlchemicalChest.class, "tile." + Strings.ALCHEMICAL_CHEST_NAME);
GameRegistry.registerTileEntity(TileGlassBell.class, "tile." + Strings.GLASS_BELL_NAME);
}
}